1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2023 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Magic Cube. //
|
5
|
// //
|
6
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9
|
|
10
|
package org.distorted.config;
|
11
|
|
12
|
import com.google.firebase.crashlytics.FirebaseCrashlytics;
|
13
|
|
14
|
import org.distorted.library.message.EffectMessageSender;
|
15
|
import org.distorted.main.BuildConfig;
|
16
|
import org.distorted.objectlib.helpers.BlockController;
|
17
|
import org.distorted.objectlib.helpers.ObjectLibInterface;
|
18
|
import org.distorted.objectlib.main.ObjectControl;
|
19
|
import org.distorted.solvers.SolverMain;
|
20
|
import org.distorted.solverui.ScreenList;
|
21
|
import org.distorted.solverui.ScreenSolver;
|
22
|
import org.distorted.solverui.SolverActivity;
|
23
|
|
24
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
25
|
|
26
|
public class ConfigObjectLibInterface implements ObjectLibInterface
|
27
|
{
|
28
|
public void onWinEffectFinished(long startTime, long endTime, String debug, int scrambleNum) { }
|
29
|
public void onScrambleEffectFinished() { }
|
30
|
public void onBeginRotation() { }
|
31
|
public void onSolved() { }
|
32
|
public void onObjectCreated(long time) { }
|
33
|
public void onRemoveRotation(int axis, int row, int angle) { }
|
34
|
public void failedToDrag() { }
|
35
|
public void reportJSONError(String error, int ordinal) { }
|
36
|
|
37
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
38
|
|
39
|
public void reportProblem(String problem, boolean reportException)
|
40
|
{
|
41
|
if( BuildConfig.DEBUG )
|
42
|
{
|
43
|
android.util.Log.e("interface", problem);
|
44
|
}
|
45
|
else
|
46
|
{
|
47
|
if( reportException )
|
48
|
{
|
49
|
Exception ex = new Exception(problem);
|
50
|
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
51
|
crashlytics.setCustomKey("problem" , problem);
|
52
|
crashlytics.recordException(ex);
|
53
|
}
|
54
|
else
|
55
|
{
|
56
|
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
57
|
crashlytics.log(problem);
|
58
|
}
|
59
|
}
|
60
|
}
|
61
|
|
62
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
63
|
|
64
|
private void reportScramblingProblem(int place, long pause, long resume, long time)
|
65
|
{
|
66
|
String error = "SCRAMBLING BLOCK "+place+" blocked for "+time;
|
67
|
|
68
|
if( BuildConfig.DEBUG )
|
69
|
{
|
70
|
android.util.Log.e("D", error);
|
71
|
}
|
72
|
else
|
73
|
{
|
74
|
Exception ex = new Exception(error);
|
75
|
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
76
|
crashlytics.setCustomKey("pause" , pause );
|
77
|
crashlytics.setCustomKey("resume", resume );
|
78
|
crashlytics.recordException(ex);
|
79
|
}
|
80
|
}
|
81
|
|
82
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
83
|
|
84
|
private void reportRotationProblem(int place, long pause, long resume, long time)
|
85
|
{
|
86
|
String error = "ROTATION BLOCK "+place+" blocked for "+time;
|
87
|
|
88
|
if( BuildConfig.DEBUG )
|
89
|
{
|
90
|
android.util.Log.e("D", error);
|
91
|
}
|
92
|
else
|
93
|
{
|
94
|
Exception ex = new Exception(error);
|
95
|
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
96
|
crashlytics.setCustomKey("pause" , pause );
|
97
|
crashlytics.setCustomKey("resume", resume);
|
98
|
crashlytics.recordException(ex);
|
99
|
}
|
100
|
}
|
101
|
|
102
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
103
|
|
104
|
private void reportThreadProblem(int place, long pause, long resume, long time)
|
105
|
{
|
106
|
String error = EffectMessageSender.reportState();
|
107
|
|
108
|
if( BuildConfig.DEBUG )
|
109
|
{
|
110
|
android.util.Log.e("D", error);
|
111
|
}
|
112
|
else
|
113
|
{
|
114
|
Exception ex = new Exception(error);
|
115
|
FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
|
116
|
crashlytics.setCustomKey("pause" , pause );
|
117
|
crashlytics.setCustomKey("resume", resume );
|
118
|
crashlytics.recordException(ex);
|
119
|
}
|
120
|
}
|
121
|
|
122
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
123
|
|
124
|
public void reportBlockProblem(int type, int place, long pause, long resume, long time)
|
125
|
{
|
126
|
switch(type)
|
127
|
{
|
128
|
case BlockController.TYPE_SCRAMBLING: reportScramblingProblem(place,pause,resume,time); break;
|
129
|
case BlockController.TYPE_ROTATION : reportRotationProblem(place,pause,resume,time); break;
|
130
|
case BlockController.TYPE_THREAD : reportThreadProblem(place,pause,resume,time); break;
|
131
|
}
|
132
|
}
|
133
|
|
134
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
135
|
// TODO
|
136
|
|
137
|
public void onReplaceModeDown(int cubit, int face)
|
138
|
{
|
139
|
|
140
|
}
|
141
|
|
142
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
143
|
|
144
|
public void onReplaceModeUp()
|
145
|
{
|
146
|
|
147
|
}
|
148
|
}
|