Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
Firebase changes
Browse files Browse the repository at this point in the history
* Enable Firebase Analytics
* Allow user to opt out of Crashlytics
  • Loading branch information
pazaan committed Nov 15, 2020
1 parent c9cb616 commit aa12e6c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.gradle
build
fabric.properties
local.properties
.idea
/app/app.iml
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ android:
before_install:
- openssl aes-256-cbc -K $encrypted_c75769befc95_key -iv $encrypted_c75769befc95_iv
-in keystore.jks.enc -out keystore.jks -d
- openssl aes-256-cbc -K $encrypted_c75769befc95_key -iv $encrypted_c75769befc95_iv
-in fabric.properties.enc -out app/fabric.properties -d
- gpg --quiet --batch --yes --decrypt --passphrase="$GPG_ENCRYPTION_KEY" --output
app/google-services.json app/google-services.json.gpg
- chmod +x gradlew
Expand Down
10 changes: 3 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repositories {

// change dev to false for release version (release uses the generated version name and code)
def dev = false
def devName = "arecibo 0.7.1 (final)"
def devName = "arecibo 0.7.2 (final)"

def generateVersionCode() {
// We need to get the number of releases directly from GitHub, since Travis
Expand Down Expand Up @@ -96,11 +96,6 @@ android {
// Set to true once we set up proguard-rules without breaking anything
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
ext.enableCrashlytics = file("fabric.properties").exists()
}

debug {
ext.enableCrashlytics = file("fabric.properties").exists()
}
}

Expand All @@ -125,8 +120,9 @@ dependencies {

implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'

implementation 'com.bugfender.sdk:android:3.+'
implementation 'com.bugfender.sdk:android:3.0.7'

implementation files('libs/slf4j-api-1.7.2.jar')
implementation files('libs/lzo-core-1.0.5.jar')
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
android:supportsRtl="true"
android:theme="@style/AppTheme">

<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />

<activity
android:name=".medtronic.MainActivity"
android:icon="@drawable/ic_launcher"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package info.nightscout.android;

import android.app.Application;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
Expand All @@ -9,7 +8,7 @@
import android.util.Log;

import com.bugfender.sdk.Bugfender;
import com.google.firebase.crashlytics.internal.common.CrashlyticsCore;
import com.google.firebase.crashlytics.FirebaseCrashlytics;

import info.nightscout.android.model.medtronicNg.PumpHistoryMarker;
import info.nightscout.android.model.medtronicNg.PumpHistorySystem;
Expand Down Expand Up @@ -73,9 +72,9 @@ public void onCreate() {
try {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

// if (prefs.getBoolean(getString(R.string.key_dbgCrashlytics), getResources().getBoolean(R.bool.default_dbgCrashlytics))) {
// Fabric.with(this, new Crashlytics());
// }
if (prefs.getBoolean(getString(R.string.key_dbgCrashlytics), getResources().getBoolean(R.bool.default_dbgCrashlytics))) {
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
}

if (prefs.getBoolean(getString(R.string.key_dbgRemoteLogcat), getResources().getBoolean(R.bool.default_dbgRemoteLogcat))) {
Bugfender.init(this, BuildConfig.BUGFENDER_API_KEY, BuildConfig.DEBUG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

import com.github.javiersantos.appupdater.AppUpdater;
import com.github.javiersantos.appupdater.enums.UpdateFrom;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.jjoe64.graphview.DefaultLabelFormatter;
import com.jjoe64.graphview.series.DataPointInterface;
import com.jjoe64.graphview.series.OnDataPointTapListener;
Expand Down Expand Up @@ -123,6 +124,7 @@ public class MainActivity extends AppCompatActivity implements OnSharedPreferenc

private UserLogDisplay userLogDisplay;
private AppUpdater appUpdater;
private FirebaseAnalytics mFirebaseAnalytics;

@Override
public void onCreate(Bundle savedInstanceState) {
Expand All @@ -136,6 +138,10 @@ public void onCreate(Bundle savedInstanceState) {
mPrefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

if (mPrefs.getBoolean(getString(R.string.key_dbgAnswers), getResources().getBoolean(R.bool.default_dbgAnswers))) {
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
}

final boolean versionChanged = !mPrefs.getString("versionName", "n/a").equals(getString(R.string.versionName));
final long now = System.currentTimeMillis();

Expand Down
4 changes: 0 additions & 4 deletions fabric.properties.enc

This file was deleted.

0 comments on commit aa12e6c

Please sign in to comment.