Skip to content

Commit be3e913

Browse files
committed
ndk 21
1 parent 2ec0ed7 commit be3e913

File tree

10 files changed

+92
-163
lines changed

10 files changed

+92
-163
lines changed

build.gradle

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ buildscript {
1919

2020
repositories {
2121
google()
22-
jcenter()
2322
}
2423

2524
/**
@@ -30,11 +29,7 @@ buildscript {
3029

3130
dependencies {
3231
classpath 'com.github.triplet.gradle:play-publisher:3.7.0'
33-
classpath 'com.android.tools.build:gradle:7.1.2'
34-
classpath 'com.google.gms:google-services:4.3.10'
35-
// Add the Crashlytics Gradle plugin (use v2.0.0+ if you built
36-
// your app with Android Studio 4.1).
37-
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
32+
classpath 'com.android.tools.build:gradle:7.1.3'
3833
}
3934
}
4035

@@ -54,6 +49,5 @@ plugins {
5449
allprojects {
5550
repositories {
5651
google()
57-
jcenter()
5852
}
5953
}

project/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
apply plugin: 'com.android.application'
2-
32
apply from: "deploy.gradle"
4-
apply from: "google-api.gradle" // for closed source software
53

64

75
project.ext.set("archivesBaseName", "reversatile")
@@ -44,7 +42,7 @@ android {
4442
}
4543
}
4644

47-
ndkVersion "24.0.8215888"
45+
ndkVersion "21.4.7075529"
4846

4947
externalNativeBuild {
5048
ndkBuild {
@@ -82,12 +80,13 @@ dependencies {
8280
implementation 'androidx.core:core:1.7.0'
8381
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
8482
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
83+
implementation 'com.github.matomo-org:matomo-sdk-android:4.1.4'
8584

8685
implementation 'com.github.Innovattic:range-seek-bar:v1.0.6'
8786

8887
// Required -- JUnit 4 framework
8988
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
90-
testImplementation 'junit:junit:4.12'
89+
testImplementation 'junit:junit:4.13.2'
9190
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
9291
// Optional -- Mockito framework
9392
testImplementation 'org.mockito:mockito-core:2.28.2'

project/google-api.gradle

Lines changed: 0 additions & 27 deletions
This file was deleted.

project/google-services.json

Lines changed: 0 additions & 77 deletions
This file was deleted.

project/signing.gradle

Lines changed: 0 additions & 26 deletions
This file was deleted.

project/src/androidTest/java/de/earthlingz/oerszebra/DroidZebraTest.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,59 @@ public void testIssue22() throws InterruptedException {
5959
assertSame(32, countSquares(ZebraEngine.PLAYER_BLACK));
6060
}
6161

62+
@Test
63+
public void testCrash1() throws InterruptedException {
64+
Intent intent = new Intent();
65+
intent.setAction(Intent.ACTION_SEND);
66+
intent.setType("message/rfc822");
67+
intent.putExtra(Intent.EXTRA_TEXT, "d3c5f6f5e6e3c4c3f4d6c6d7b5b4c7f7a3g5f8g6g3a6b6a5e8e7f2g4f3e2h3f1d8h5h7a7g2");
68+
69+
zebra.runOnUiThread(() -> zebra.onNewIntent(intent));
70+
71+
Thread.sleep(2000);
72+
zebra.runOnUiThread(() -> zebra.undoAll());
73+
Thread.sleep(10000);
74+
for(int i = 1; i < 20; i++) {
75+
zebra.runOnUiThread(() -> zebra.redo());
76+
Thread.sleep(200);
77+
}
78+
}
79+
80+
@Test
81+
public void testCrash2() throws InterruptedException {
82+
Intent intent = new Intent();
83+
intent.setAction(Intent.ACTION_SEND);
84+
intent.setType("message/rfc822");
85+
intent.putExtra(Intent.EXTRA_TEXT, "d3c5e6f5f6e3d6f7g6e7f4c4b4d2c3b5c2e2f3a4f1e1c1g1f2h6f8g5c6b3a6g4a5a3b6a7b2a1a2b1a8d1g3h4h3c7h5h2g7e8c8h7h8");
86+
87+
zebra.runOnUiThread(() -> zebra.onNewIntent(intent));
88+
89+
Thread.sleep(2000);
90+
zebra.runOnUiThread(() -> zebra.undoAll());
91+
Thread.sleep(10000);
92+
for(int i = 1; i < 50; i++) {
93+
zebra.runOnUiThread(() -> zebra.redo());
94+
Thread.sleep(200);
95+
}
96+
97+
98+
}
99+
100+
@Test
101+
public void testCrash3() throws InterruptedException {
102+
Intent intent = new Intent();
103+
intent.setAction(Intent.ACTION_SEND);
104+
intent.setType("message/rfc822");
105+
intent.putExtra(Intent.EXTRA_TEXT, "d3c5e6f5f6e3d6f7g6e7f4c4b4d2c3b5c2e2f3a4f1e1c1g1f2h6f8g5c6b3a6g4a5a3b6a7b2a1a2");
106+
107+
zebra.runOnUiThread(() -> zebra.onNewIntent(intent));
108+
109+
Thread.sleep(2000);
110+
zebra.runOnUiThread(() -> zebra.undoAll());
111+
Thread.sleep(10000);
112+
113+
}
114+
62115

63116

64117
}

project/src/main/java/de/earthlingz/oerszebra/Analytics.java

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,26 @@
55
import android.content.SharedPreferences;
66
import android.os.Bundle;
77
import android.util.Log;
8-
import com.google.firebase.analytics.FirebaseAnalytics;
98
import com.shurik.droidzebra.GameState;
10-
import com.google.firebase.crashlytics.FirebaseCrashlytics;
119

1210
import javax.annotation.Nullable;
11+
12+
import java.util.UUID;
1313
import java.util.concurrent.atomic.AtomicReference;
1414

1515
import static android.content.Context.MODE_PRIVATE;
1616
import static de.earthlingz.oerszebra.GlobalSettingsLoader.SHARED_PREFS_NAME;
1717

18+
import org.matomo.sdk.Matomo;
19+
import org.matomo.sdk.Tracker;
20+
import org.matomo.sdk.TrackerBuilder;
21+
import org.matomo.sdk.extra.TrackHelper;
22+
1823
public class Analytics {
1924

2025
static final String ANALYTICS_SETTING = "analytics_setting";
2126
private static final AtomicReference<DroidZebra> app = new AtomicReference<>();
22-
private static FirebaseAnalytics firebase = null;
27+
private static Tracker tracker = null;
2328

2429
public static void setApp(DroidZebra zebra) {
2530
app.set(zebra);
@@ -62,7 +67,7 @@ public static void log(String id, String message) {
6267
return;
6368
}
6469

65-
FirebaseCrashlytics.getInstance().log("E/LOG : " + id + " / " +message);
70+
TrackHelper.track().event(id, "E/Message: " + message).with(tracker);
6671
}
6772

6873
public static void build() {
@@ -73,10 +78,6 @@ public static void build() {
7378

7479
boolean consent = isConsent();
7580

76-
if (consent) { //one time only, needs reboot of the app to work
77-
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
78-
}
79-
8081
handleConsent(app.get(), consent);
8182
}
8283

@@ -91,31 +92,41 @@ private static boolean isConsent() {
9192
}
9293

9394
private static void handleConsent(Context app, boolean consent) {
95+
if(tracker != null) { //already initialised
96+
return;
97+
}
9498

95-
FirebaseAnalytics instance = getFirebaseAnalytics(app);
96-
instance.setAnalyticsCollectionEnabled(consent);
99+
getTracker(app);
100+
101+
tracker.setOptOut(!consent);
97102

98103
if (!consent) {
99-
instance.resetAnalyticsData();
104+
return;
100105
}
106+
107+
tracker.startNewSession();
108+
tracker.setUserId(UUID.randomUUID().toString());
109+
110+
TrackHelper.track().uncaughtExceptions().with(tracker);
111+
TrackHelper.track().download().with(tracker);
101112
}
102113

103-
private synchronized static FirebaseAnalytics getFirebaseAnalytics(Context app) {
104-
if(firebase == null) {
105-
firebase = FirebaseAnalytics.getInstance(app);
114+
private synchronized static Tracker getTracker(Context app) {
115+
if(tracker == null) {
116+
tracker = TrackerBuilder.createDefault("https://matomo.reversatile.online/matomo.php", 2).build(Matomo.getInstance(app));
106117
}
107-
return firebase;
118+
return tracker;
108119
}
109120

110121
public static void converse(String converse, @Nullable Bundle bundle) {
111122
if(!isConsent()) {
112123
Log.i("converse", converse);
113124
return;
114125
}
115-
FirebaseCrashlytics.getInstance().log("E/Converse: " + converse);
116126
if(app.get() != null) {
117-
FirebaseAnalytics fb = getFirebaseAnalytics(app.get());
118-
fb.logEvent(converse, bundle);
127+
Tracker fb = getTracker(app.get());
128+
TrackHelper.track().screen( converse).with(fb);
129+
119130
}
120131

121132
}
@@ -130,6 +141,6 @@ public static void error(String msg, GameState state) {
130141
if(app.get() == null) {
131142
return;
132143
}
133-
FirebaseCrashlytics.getInstance().log("E/Message: " + message);
144+
TrackHelper.track().event("error", "E/Message: " + message);
134145
}
135146
}

project/src/main/java/de/earthlingz/oerszebra/DroidZebra.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ public void onResume() {
887887
}
888888
}
889889

890-
private void undoAll() {
890+
void undoAll() {
891891
engine.undoAll(gameState);
892892
}
893893

whatsnew/whatsnew-de-DE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Bugfix beim Einlesen von Spieldaten
1+
Bugfix beim Einlesen von Spieldaten
2+
Keine Google Service Dependencies mehr

whatsnew/whatsnew-en-US

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Bugfix when showing game data
1+
Bugfix when showing game data
2+
No more dependencies on google services

0 commit comments

Comments
 (0)