commit d887aa16a12be0b6a073b931d5e083da7af18087
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/build.gradle b/build.gradle
index a1c8b493..70d39451 100644
--- a/build.gradle
+++ b/build.gradle
@@ -24,8 +24,6 @@ android {
 
 dependencies {
     api project(':distorted-library')
-    implementation 'com.google.firebase:firebase-crashlytics:18.2.3'
-    implementation 'androidx.appcompat:appcompat:1.3.1'
     implementation project(path: ':distorted-puzzle-dmesh')
     implementation project(path: ':distorted-puzzle-jsons')
 }
\ No newline at end of file
diff --git a/src/main/java/org/distorted/objectlib/helpers/BlockController.java b/src/main/java/org/distorted/objectlib/helpers/BlockController.java
index 8d0f8a7a..4de2faa8 100644
--- a/src/main/java/org/distorted/objectlib/helpers/BlockController.java
+++ b/src/main/java/org/distorted/objectlib/helpers/BlockController.java
@@ -19,21 +19,22 @@
 
 package org.distorted.objectlib.helpers;
 
-import android.app.Activity;
-
-import com.google.firebase.crashlytics.FirebaseCrashlytics;
-
 import java.util.Timer;
 import java.util.TimerTask;
 
+import android.app.Activity;
+
 import org.distorted.library.message.EffectMessageSender;
-import org.distorted.objectlib.BuildConfig;
 import org.distorted.objectlib.main.ObjectPreRender;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 public class BlockController
   {
+  public static final int TYPE_UI     = 0;
+  public static final int TYPE_TOUCH  = 1;
+  public static final int TYPE_THREAD = 2;
+
   public static final int PLACE_0 =0;
   public static final int PLACE_1 =1;
   public static final int PLACE_2 =2;
@@ -121,17 +122,17 @@ public class BlockController
     if( mTouchBlockTime>mPauseTime && touchBlocked>touchThreshhold )
       {
       boolean running = EffectMessageSender.isRunning();
+      ObjectLibInterface libInterface = mPre.getInterface();
 
       if( !running )
         {
-        reportThreadProblem();
+        libInterface.reportBlockProblem(TYPE_THREAD,0,mPauseTime,mResumeTime,0);
         EffectMessageSender.restartThread();
         }
       else
         {
-        boolean reallyBlocked = mPre.isTouchBlocked();
         mPre.unblockTouch();
-        reportTouchProblem(touchBlocked, reallyBlocked);
+        libInterface.reportBlockProblem(TYPE_TOUCH,mLastTouchPlace,mPauseTime,mResumeTime,mTouchBlockTime);
         }
       }
 
@@ -141,81 +142,21 @@ public class BlockController
     if( mUIBlockTime>mPauseTime && uiBlocked>uiThreshhold )
       {
       boolean running = EffectMessageSender.isRunning();
+      ObjectLibInterface libInterface = mPre.getInterface();
 
       if( !running )
         {
-        reportThreadProblem();
+        libInterface.reportBlockProblem(TYPE_THREAD,0,mPauseTime,mResumeTime,0);
         EffectMessageSender.restartThread();
         }
       else
         {
-        boolean reallyBlocked =  !mPre.isUINotBlocked();
         mPre.unblockUI();
-        reportUIProblem(uiBlocked, reallyBlocked);
+        libInterface.reportBlockProblem(TYPE_UI,mLastUIPlace,mPauseTime,mResumeTime,mUIBlockTime);
         }
       }
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void reportUIProblem(long time, boolean reallyBlocked)
-    {
-    String error = "UI BLOCK "+mLastUIPlace+" blocked for "+time+" milliseconds ("+reallyBlocked+")";
-
-    if( BuildConfig.DEBUG )
-       {
-       android.util.Log.e("D", error);
-       }
-    else
-      {
-      Exception ex = new Exception(error);
-      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
-      crashlytics.setCustomKey("pause" , mPauseTime );
-      crashlytics.setCustomKey("resume", mResumeTime );
-      crashlytics.recordException(ex);
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void reportTouchProblem(long time, boolean reallyBlocked)
-    {
-    String error = "TOUCH BLOCK "+mLastTouchPlace+" blocked for "+time+" milliseconds ("+reallyBlocked+")";
-
-    if( BuildConfig.DEBUG )
-       {
-       android.util.Log.e("D", error);
-       }
-    else
-      {
-      Exception ex = new Exception(error);
-      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
-      crashlytics.setCustomKey("pause" , mPauseTime );
-      crashlytics.setCustomKey("resume", mResumeTime );
-      crashlytics.recordException(ex);
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  private void reportThreadProblem()
-    {
-    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" , mPauseTime );
-      crashlytics.setCustomKey("resume", mResumeTime );
-      crashlytics.recordException(ex);
-      }
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public void touchBlocked(int place)
diff --git a/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java b/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
index 4505fd9f..fb06d04c 100644
--- a/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
+++ b/src/main/java/org/distorted/objectlib/helpers/ObjectLibInterface.java
@@ -33,6 +33,8 @@ public interface ObjectLibInterface
   void failedToDrag();
   void onSolved();
   void onObjectCreated(long time);
+  void reportBlockProblem(int type, int place, long pause, long resume, long time);
+  void reportProblem(String problem);
 
   // objectlib calls those to figure out app's state
   int getCurrentColor();
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index 6dc64068..c075ffad 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -128,6 +128,7 @@ public class ObjectPreRender implements EffectListener
 
     if( mNewObject!=null )
       {
+      mNewObject.setLibInterface(mInterface);
       TwistyObjectNode node = mController.getNode();
       if( node!=null ) mNewObject.setObjectRatioNow( 1.0f, node.getScaleFactor() );
       mController.setMovement(mNewObject.getMovement());
@@ -386,6 +387,13 @@ public class ObjectPreRender implements EffectListener
     return mMoveY;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public ObjectLibInterface getInterface()
+    {
+    return mInterface;
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/objectlib/main/TwistyObject.java b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
index b577a364..b54ee1d0 100644
--- a/src/main/java/org/distorted/objectlib/main/TwistyObject.java
+++ b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
@@ -24,8 +24,6 @@ import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Paint;
 
-import com.google.firebase.crashlytics.FirebaseCrashlytics;
-
 import org.distorted.library.effect.Effect;
 import org.distorted.library.effect.MatrixEffectMove;
 import org.distorted.library.effect.MatrixEffectQuaternion;
@@ -46,9 +44,9 @@ import org.distorted.library.type.Static1D;
 import org.distorted.library.type.Static3D;
 import org.distorted.library.type.Static4D;
 
-import org.distorted.objectlib.BuildConfig;
 import org.distorted.objectlib.helpers.FactoryCubit;
 import org.distorted.objectlib.helpers.FactorySticker;
+import org.distorted.objectlib.helpers.ObjectLibInterface;
 import org.distorted.objectlib.helpers.ObjectShape;
 import org.distorted.objectlib.helpers.ObjectSticker;
 import org.distorted.objectlib.helpers.ScrambleState;
@@ -135,6 +133,7 @@ public abstract class TwistyObject
   private boolean[][] mLayerRotatable;
   private int[][][] mEnabled;
   private DistortedNode mNode;
+  private ObjectLibInterface mInterface;
 
   //////////////////// SOLVED1 ////////////////////////
 
@@ -857,8 +856,7 @@ public abstract class TwistyObject
       }
     else
       {
-      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
-      crashlytics.log("points in RotationAngle: "+pointNum);
+      mInterface.reportProblem("points in RotationAngle: "+pointNum);
       return 0;
       }
     }
@@ -876,20 +874,14 @@ public abstract class TwistyObject
       }
 
     String name = intGetObjectType(mNumLayers).name();
+    mInterface.reportProblem("obj: "+name+" quats: "+quats.toString());
+    }
 
-    if( BuildConfig.DEBUG )
-      {
-      android.util.Log.e("quats" , quats.toString());
-      android.util.Log.e("object", name);
-      }
-    else
-      {
-      Exception ex = new Exception(message);
-      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
-      crashlytics.setCustomKey("quats" , quats.toString());
-      crashlytics.setCustomKey("object", name);
-      crashlytics.recordException(ex);
-      }
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  void setLibInterface(ObjectLibInterface inter)
+    {
+    mInterface = inter;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1132,8 +1124,7 @@ public abstract class TwistyObject
     if( !mTexture.setTexture(bitmap) )
       {
       int max = DistortedLibrary.getMaxTextureSize();
-      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
-      crashlytics.log("failed to set texture of size "+bitmap.getWidth()+"x"+bitmap.getHeight()+" max is "+max);
+      mInterface.reportProblem("failed to set texture of size "+bitmap.getWidth()+"x"+bitmap.getHeight()+" max is "+max);
       }
     }
 
