commit 95472acaad52a733298d0a189dc2dd3c7cdbb928
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu Oct 28 01:59:09 2021 +0200

    Remove dependancies on Firebase from objectlib.
    Report such errors to the application via the Interface.

diff --git a/src/main/java/org/distorted/main/RubikObjectLibInterface.java b/src/main/java/org/distorted/main/RubikObjectLibInterface.java
index fc2cff34..9ecb6d35 100644
--- a/src/main/java/org/distorted/main/RubikObjectLibInterface.java
+++ b/src/main/java/org/distorted/main/RubikObjectLibInterface.java
@@ -30,7 +30,11 @@ import com.google.android.play.core.tasks.OnCompleteListener;
 import com.google.android.play.core.tasks.OnFailureListener;
 import com.google.android.play.core.tasks.Task;
 import com.google.firebase.analytics.FirebaseAnalytics;
+import com.google.firebase.crashlytics.FirebaseCrashlytics;
 
+import org.distorted.library.message.EffectMessageSender;
+import org.distorted.objectlib.BuildConfig;
+import org.distorted.objectlib.helpers.BlockController;
 import org.distorted.objectlib.helpers.ObjectLibInterface;
 import org.distorted.objectlib.main.ObjectType;
 
@@ -314,6 +318,95 @@ public class RubikObjectLibInterface implements ObjectLibInterface
 
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void reportProblem(String problem)
+    {
+    if( BuildConfig.DEBUG )
+      {
+      android.util.Log.e("interface", problem);
+      }
+    else
+      {
+      Exception ex = new Exception(problem);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("problem" , problem);
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void reportUIProblem(int place, long pause, long resume, long time)
+    {
+    String error = "UI BLOCK "+place+" blocked for "+time;
+
+    if( BuildConfig.DEBUG )
+       {
+       android.util.Log.e("D", error);
+       }
+    else
+      {
+      Exception ex = new Exception(error);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("pause" , pause );
+      crashlytics.setCustomKey("resume", resume );
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void reportTouchProblem(int place, long pause, long resume, long time)
+    {
+    String error = "TOUCH BLOCK "+place+" blocked for "+time;
+
+    if( BuildConfig.DEBUG )
+       {
+       android.util.Log.e("D", error);
+       }
+    else
+      {
+      Exception ex = new Exception(error);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("pause" , pause );
+      crashlytics.setCustomKey("resume", resume);
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void reportThreadProblem(int place, long pause, long resume, long time)
+    {
+    String error = EffectMessageSender.reportState();
+
+    if( BuildConfig.DEBUG )
+       {
+       android.util.Log.e("D", error);
+       }
+    else
+      {
+      Exception ex = new Exception(error);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("pause" , pause  );
+      crashlytics.setCustomKey("resume", resume );
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
+    {
+    switch(type)
+      {
+      case BlockController.TYPE_UI    : reportUIProblem(place,pause,resume,time); break;
+      case BlockController.TYPE_TOUCH : reportTouchProblem(place,pause,resume,time); break;
+      case BlockController.TYPE_THREAD: reportThreadProblem(place,pause,resume,time); break;
+      }
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public int getCurrentColor()
diff --git a/src/main/java/org/distorted/tutorials/TutorialObjectLibInterface.java b/src/main/java/org/distorted/tutorials/TutorialObjectLibInterface.java
index 4f420d07..b6032cdd 100644
--- a/src/main/java/org/distorted/tutorials/TutorialObjectLibInterface.java
+++ b/src/main/java/org/distorted/tutorials/TutorialObjectLibInterface.java
@@ -19,6 +19,11 @@
 
 package org.distorted.tutorials;
 
+import com.google.firebase.crashlytics.FirebaseCrashlytics;
+
+import org.distorted.library.message.EffectMessageSender;
+import org.distorted.objectlib.BuildConfig;
+import org.distorted.objectlib.helpers.BlockController;
 import org.distorted.objectlib.helpers.ObjectLibInterface;
 import org.distorted.objectlib.main.ObjectType;
 
@@ -37,13 +42,102 @@ public class TutorialObjectLibInterface implements ObjectLibInterface
     mAct = new WeakReference<>(act);
     }
 
-   public void onWinEffectFinished(String debug, int scrambleNum) { }
-   public void onScrambleEffectFinished() { }
-   public void onBeginRotation() { }
-   public void onSolved() { }
-   public void onObjectCreated(long time) { }
-   public int getCurrentColor() { return 0; }
-   public int cubitIsLocked(ObjectType type, int cubit) { return 0; }
+  public void onWinEffectFinished(String debug, int scrambleNum) { }
+  public void onScrambleEffectFinished() { }
+  public void onBeginRotation() { }
+  public void onSolved() { }
+  public void onObjectCreated(long time) { }
+  public int getCurrentColor() { return 0; }
+  public int cubitIsLocked(ObjectType type, int cubit) { return 0; }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void reportProblem(String problem)
+    {
+    if( BuildConfig.DEBUG )
+      {
+      android.util.Log.e("interface", problem);
+      }
+    else
+      {
+      Exception ex = new Exception(problem);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("problem" , problem);
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void reportUIProblem(int place, long pause, long resume, long time)
+    {
+    String error = "UI BLOCK "+place+" blocked for "+time;
+
+    if( BuildConfig.DEBUG )
+       {
+       android.util.Log.e("D", error);
+       }
+    else
+      {
+      Exception ex = new Exception(error);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("pause" , pause );
+      crashlytics.setCustomKey("resume", resume );
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void reportTouchProblem(int place, long pause, long resume, long time)
+    {
+    String error = "TOUCH BLOCK "+place+" blocked for "+time;
+
+    if( BuildConfig.DEBUG )
+       {
+       android.util.Log.e("D", error);
+       }
+    else
+      {
+      Exception ex = new Exception(error);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("pause" , pause );
+      crashlytics.setCustomKey("resume", resume);
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  private void reportThreadProblem(int place, long pause, long resume, long time)
+    {
+    String error = EffectMessageSender.reportState();
+
+    if( BuildConfig.DEBUG )
+       {
+       android.util.Log.e("D", error);
+       }
+    else
+      {
+      Exception ex = new Exception(error);
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("pause" , pause  );
+      crashlytics.setCustomKey("resume", resume );
+      crashlytics.recordException(ex);
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void reportBlockProblem(int type, int place, long pause, long resume, long time)
+    {
+    switch(type)
+      {
+      case BlockController.TYPE_UI    : reportUIProblem(place,pause,resume,time); break;
+      case BlockController.TYPE_TOUCH : reportTouchProblem(place,pause,resume,time); break;
+      case BlockController.TYPE_THREAD: reportThreadProblem(place,pause,resume,time); break;
+      }
+    }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
