Project

General

Profile

« Previous | Next » 

Revision 25445dcf

Added by Leszek Koltunski about 4 years ago

More error reporting - this time in Scores.

View differences:

src/main/java/org/distorted/objects/TwistyObject.java
46 46
import org.distorted.library.type.Static1D;
47 47
import org.distorted.library.type.Static3D;
48 48
import org.distorted.library.type.Static4D;
49
import org.distorted.main.BuildConfig;
49 50

  
50 51
import java.io.DataInputStream;
51 52
import java.io.IOException;
......
485 486
      quats.append(" ");
486 487
      }
487 488

  
488
    Exception ex = new Exception(message);
489
    FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
490
    crashlytics.setCustomKey("quats" , quats.toString());
491
    crashlytics.setCustomKey("object", mList.name()+"_"+mNumLayers );
492
    crashlytics.recordException(ex);
489
    if( BuildConfig.DEBUG )
490
      {
491
      android.util.Log.e("object", quats.toString());
492
      android.util.Log.e("object", mList.name()+"_"+mNumLayers);
493
      }
494
    else
495
      {
496
      Exception ex = new Exception(message);
497
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
498
      crashlytics.setCustomKey("quats" , quats.toString());
499
      crashlytics.setCustomKey("object", mList.name()+"_"+mNumLayers );
500
      crashlytics.recordException(ex);
501
      }
493 502
    }
494 503

  
495 504
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/scores/RubikScores.java
23 23
import android.content.SharedPreferences;
24 24
import android.telephony.TelephonyManager;
25 25

  
26
import com.google.firebase.crashlytics.FirebaseCrashlytics;
27

  
28
import org.distorted.main.BuildConfig;
26 29
import org.distorted.objects.ObjectList;
27 30

  
28 31
import java.util.UUID;
......
394 397

  
395 398
  public synchronized void restorePreferences(SharedPreferences preferences)
396 399
    {
397
    String recordStr, subStr, nameStr, sizeStr, timeStr, submStr;
400
    String recordStr, subStr, nameStr, sizeStr, timeStr, submStr, errorStr="";
398 401
    int start, end, equals, underscore, comma;
399 402
    int object, sizeIndex, subm;
400 403
    long time;
404
    boolean thereWasError = false;
401 405

  
402 406
    for(int level=0; level<MAX_LEVEL; level++)
403 407
      {
......
439 443
              }
440 444
            else
441 445
              {
442
              android.util.Log.e("scores", "error: size="+sizeIndex+" subm="+subm);
446
              errorStr += ("error1: size="+sizeIndex+" subm="+subm+" obj: "+nameStr+" size: "+sizeStr+"\n");
447
              thereWasError= true;
443 448
              }
444 449
            }
445 450
          else
446 451
            {
447
            android.util.Log.e("scores", "error: object="+object);
452
            errorStr += ("error2: object="+object+" obj: "+nameStr+" size: "+sizeStr+"\n");
453
            thereWasError = true;
448 454
            }
449 455
          }
450 456
        }
......
458 464
    mNumReviews     = preferences.getInt("scores_review"  ,-3);
459 465

  
460 466
    if( mDeviceID==-1 ) mDeviceID = privateGetDeviceID();
467

  
468
    if( thereWasError ) recordDBError(errorStr);
469
    }
470

  
471
///////////////////////////////////////////////////////////////////////////////////////////////////
472

  
473
  public void recordDBError(String message)
474
    {
475
    if( BuildConfig.DEBUG )
476
      {
477
      android.util.Log.e("scores", message);
478
      }
479
    else
480
      {
481
      Exception ex = new Exception(message);
482
      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
483
      crashlytics.setCustomKey("scores" , message);
484
      crashlytics.recordException(ex);
485
      }
461 486
    }
462 487

  
463 488
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff