Project

General

Profile

« Previous | Next » 

Revision e4854e54

Added by Leszek Koltunski almost 3 years ago

FigureOutVersion before calling debugs.cgi !

View differences:

src/main/java/org/distorted/external/RubikNetwork.java
29 29
import java.security.MessageDigest;
30 30
import java.security.NoSuchAlgorithmException;
31 31

  
32
import android.app.Activity;
32 33
import android.content.Context;
33 34
import android.content.pm.PackageInfo;
34 35
import android.content.pm.PackageManager;
35 36
import android.graphics.Bitmap;
36 37
import android.graphics.BitmapFactory;
37 38

  
38
import androidx.fragment.app.FragmentActivity;
39

  
40 39
import org.distorted.library.main.DistortedLibrary;
41 40
import org.distorted.objectlib.json.JsonWriter;
42 41
import org.distorted.objects.RubikObjectList;
......
529 528

  
530 529
///////////////////////////////////////////////////////////////////////////////////////////////////
531 530

  
532
  private void figureOutVersion(FragmentActivity act)
531
  private void figureOutVersion(Activity act)
533 532
    {
534
    try
535
      {
536
      PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
537
      mVersion = pInfo.versionName;
538
      }
539
    catch (PackageManager.NameNotFoundException e)
533
    if( mVersion==null )
540 534
      {
541
      mVersion = "0.9.2";
535
      try
536
        {
537
        PackageInfo pInfo = act.getPackageManager().getPackageInfo( act.getPackageName(), 0);
538
        mVersion = pInfo.versionName;
539
        }
540
      catch (PackageManager.NameNotFoundException e)
541
        {
542
        mVersion = "0.9.2";
543
        }
542 544
      }
543 545
    }
544 546

  
......
829 831

  
830 832
///////////////////////////////////////////////////////////////////////////////////////////////////
831 833

  
832
  public void download(final ScoresReceiver receiver, final FragmentActivity act)
834
  public void download(final ScoresReceiver receiver, final Activity act)
833 835
    {
834 836
    initializeStatics();
835 837
    figureOutVersion(act);
......
847 849

  
848 850
///////////////////////////////////////////////////////////////////////////////////////////////////
849 851

  
850
  public void submit(ScoresReceiver receiver, final FragmentActivity act)
852
  public void submit(ScoresReceiver receiver, final Activity act)
851 853
    {
852 854
    initializeStatics();
853 855
    figureOutVersion(act);
......
865 867

  
866 868
///////////////////////////////////////////////////////////////////////////////////////////////////
867 869

  
868
  public void debug()
870
  public void debug(final Activity act)
869 871
    {
870 872
    initializeStatics();
873
    figureOutVersion(act);
871 874
    mDebugState = DEBUG_RUNNING;
872 875

  
873 876
    Thread thread = new Thread()
......
883 886

  
884 887
///////////////////////////////////////////////////////////////////////////////////////////////////
885 888

  
886
  public void suspicious(final String suspicious)
889
  public void suspicious(final String suspicious, final Activity act)
887 890
    {
888 891
    initializeStatics();
892
    figureOutVersion(act);
889 893

  
890 894
    Thread thread = new Thread()
891 895
      {
src/main/java/org/distorted/main/RubikObjectLibInterface.java
123 123
        long elapsed = timeNow - startTime;
124 124
        String suspicious ="start"+startTime+"end"+endTime+"elapsed"+elapsed+"obj"+objName+"level"+level+"record"+mNewRecord+"scrambles"+scrambleNum+debug;
125 125
        RubikNetwork network = RubikNetwork.getInstance();
126
        network.suspicious(suspicious);
126
        network.suspicious(suspicious,act);
127 127
        }
128 128

  
129 129
      FirebaseAnalytics analytics = act.getAnalytics();
src/main/java/org/distorted/main/RubikRenderer.java
19 19

  
20 20
package org.distorted.main;
21 21

  
22
import android.app.Activity;
22 23
import android.opengl.GLES30;
23 24
import android.opengl.GLSurfaceView;
24 25

  
......
136 137

  
137 138
      DistortedLibrary.onSurfaceCreated(mView.getContext(),this,1);
138 139

  
139
      if( /*!BuildConfig.DEBUG &&*/ !mDebugSent )
140
      if( !mDebugSent )
140 141
        {
141 142
        mDebugSent= true;
143
        Activity act = (Activity)mView.getContext();
142 144
        RubikNetwork network = RubikNetwork.getInstance();
143
        network.debug();
145
        network.debug(act);
144 146
        }
145 147
      }
146 148

  

Also available in: Unified diff