Make AppCenter only included in debug builds.
Moves Flipper initialization to the same place as AppCenter.
This commit is contained in:
		| @@ -12,7 +12,12 @@ def appCenterLocalSecret = properties.getProperty('appCenter.localSecret') | |||||||
| def appCenterEnvSecret = System.getenv('APPCENTER_SECRET') | def appCenterEnvSecret = System.getenv('APPCENTER_SECRET') | ||||||
| def appCenterSecret = appCenterLocalSecret != null ? appCenterLocalSecret : appCenterEnvSecret != null ? appCenterEnvSecret : "" | def appCenterSecret = appCenterLocalSecret != null ? appCenterLocalSecret : appCenterEnvSecret != null ? appCenterEnvSecret : "" | ||||||
| def appCenterSdkVersion = '3.3.0' | def appCenterSdkVersion = '3.3.0' | ||||||
| def nav_version = "2.3.0" | def nav_version = '2.3.5' | ||||||
|  | def room_version = '2.3.0' | ||||||
|  | def rxjava_version = '3.0.0' | ||||||
|  | def flipper_version = '0.87.0' | ||||||
|  | def soloader_version = '0.10.1' | ||||||
|  | def gson_version = '2.8.6' | ||||||
|  |  | ||||||
| android { | android { | ||||||
|     compileSdkVersion 30 |     compileSdkVersion 30 | ||||||
| @@ -58,34 +63,40 @@ android { | |||||||
| } | } | ||||||
|  |  | ||||||
| dependencies { | dependencies { | ||||||
|     implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" |     // Included libs | ||||||
|     implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" |  | ||||||
|  |  | ||||||
|     implementation fileTree(dir: "libs", include: ["*.jar"]) |     implementation fileTree(dir: "libs", include: ["*.jar"]) | ||||||
|  |  | ||||||
|  |     // Google | ||||||
|     implementation 'androidx.appcompat:appcompat:1.2.0' |     implementation 'androidx.appcompat:appcompat:1.2.0' | ||||||
|     implementation 'com.google.android.material:material:1.3.0' |     implementation 'com.google.android.material:material:1.3.0' | ||||||
|     implementation 'androidx.constraintlayout:constraintlayout:2.0.1' |     implementation 'androidx.constraintlayout:constraintlayout:2.0.4' | ||||||
|     implementation "androidx.navigation:navigation-fragment:$nav_version" |     implementation "androidx.navigation:navigation-fragment:$nav_version" | ||||||
|     implementation "androidx.navigation:navigation-ui:$nav_version" |     implementation "androidx.navigation:navigation-ui:$nav_version" | ||||||
|     implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' |     implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' | ||||||
|     implementation 'com.atlassian.commonmark:commonmark:0.15.2' |  | ||||||
|     testImplementation 'junit:junit:4.12' |     // Testing | ||||||
|  |     testImplementation 'junit:junit:4.13.2' | ||||||
|     androidTestImplementation 'androidx.test.ext:junit:1.1.2' |     androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||||||
|     androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' |     androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||||||
|  |  | ||||||
|     def room_version = "2.3.0-rc01" |     // Room DB | ||||||
|     def rxjava_version = "3.0.0" |  | ||||||
|  |  | ||||||
|     implementation "io.reactivex.rxjava3:rxjava:$rxjava_version" |     implementation "io.reactivex.rxjava3:rxjava:$rxjava_version" | ||||||
|     implementation "io.reactivex.rxjava3:rxandroid:$rxjava_version" |     implementation "io.reactivex.rxjava3:rxandroid:$rxjava_version" | ||||||
|     implementation "androidx.room:room-runtime:$room_version" |     implementation "androidx.room:room-runtime:$room_version" | ||||||
|     annotationProcessor "androidx.room:room-compiler:$room_version" |     annotationProcessor "androidx.room:room-compiler:$room_version" | ||||||
|  |  | ||||||
|     // optional - RxJava3 support for Room |  | ||||||
|     implementation "androidx.room:room-rxjava3:$room_version" |     implementation "androidx.room:room-rxjava3:$room_version" | ||||||
|  |  | ||||||
|     // optional - Test helpers |  | ||||||
|     //testImplementation "androidx.room:room-testing:$room_version" |     //testImplementation "androidx.room:room-testing:$room_version" | ||||||
|  |  | ||||||
|     implementation 'com.google.code.gson:gson:2.8.6' |     // AppCenter | ||||||
|  |     debugImplementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" | ||||||
|  |     debugImplementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" | ||||||
|  |  | ||||||
|  |     // Flipper | ||||||
|  |     debugImplementation "com.facebook.flipper:flipper:$flipper_version" | ||||||
|  |     debugImplementation "com.facebook.soloader:soloader:$soloader_version" | ||||||
|  |     releaseImplementation "com.facebook.flipper:flipper-noop:$flipper_version" | ||||||
|  |  | ||||||
|  |     // Other 3rd Party | ||||||
|  |     implementation 'com.atlassian.commonmark:commonmark:0.15.2' | ||||||
|  |     implementation "com.google.code.gson:gson:$gson_version" | ||||||
| } | } | ||||||
| @@ -2,19 +2,28 @@ package com.majinnaibu.monstercards; | |||||||
|  |  | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
|  |  | ||||||
| import com.google.android.material.bottomnavigation.BottomNavigationView; |  | ||||||
|  |  | ||||||
| import androidx.appcompat.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; | ||||||
| import androidx.navigation.NavController; | import androidx.navigation.NavController; | ||||||
| import androidx.navigation.Navigation; | import androidx.navigation.Navigation; | ||||||
| import androidx.navigation.ui.AppBarConfiguration; | import androidx.navigation.ui.AppBarConfiguration; | ||||||
| import androidx.navigation.ui.NavigationUI; | import androidx.navigation.ui.NavigationUI; | ||||||
|  |  | ||||||
|  | import com.google.android.material.bottomnavigation.BottomNavigationView; | ||||||
|  | import com.majinnaibu.monstercards.init.AppCenterInitializer; | ||||||
|  |  | ||||||
| public class MainActivity extends AppCompatActivity { | public class MainActivity extends AppCompatActivity { | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public boolean onSupportNavigateUp() { | ||||||
|  |         NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); | ||||||
|  |         return navController.navigateUp() || super.onSupportNavigateUp(); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |     @SuppressWarnings("ConstantConditions") | ||||||
|     @Override |     @Override | ||||||
|     protected void onCreate(Bundle savedInstanceState) { |     protected void onCreate(Bundle savedInstanceState) { | ||||||
|         super.onCreate(savedInstanceState); |         super.onCreate(savedInstanceState); | ||||||
|  |         AppCenterInitializer.init(getApplication()); | ||||||
|         setContentView(R.layout.activity_main); |         setContentView(R.layout.activity_main); | ||||||
|         BottomNavigationView navView = findViewById(R.id.nav_view); |         BottomNavigationView navView = findViewById(R.id.nav_view); | ||||||
|         // Passing each menu ID as a set of Ids because each |         // Passing each menu ID as a set of Ids because each | ||||||
|   | |||||||
| @@ -9,15 +9,8 @@ import androidx.room.Room; | |||||||
| import androidx.room.migration.Migration; | import androidx.room.migration.Migration; | ||||||
| import androidx.sqlite.db.SupportSQLiteDatabase; | import androidx.sqlite.db.SupportSQLiteDatabase; | ||||||
|  |  | ||||||
| import com.facebook.flipper.android.AndroidFlipperClient; |  | ||||||
| import com.facebook.flipper.android.utils.FlipperUtils; |  | ||||||
| import com.facebook.flipper.core.FlipperClient; |  | ||||||
| import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; |  | ||||||
| import com.facebook.flipper.plugins.inspector.DescriptorMapping; |  | ||||||
| import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; |  | ||||||
| import com.facebook.flipper.plugins.navigation.NavigationFlipperPlugin; |  | ||||||
| import com.facebook.soloader.SoLoader; |  | ||||||
| import com.majinnaibu.monstercards.data.MonsterRepository; | import com.majinnaibu.monstercards.data.MonsterRepository; | ||||||
|  | import com.majinnaibu.monstercards.init.FlipperInitializer; | ||||||
|  |  | ||||||
| public class MonsterCardsApplication extends Application { | public class MonsterCardsApplication extends Application { | ||||||
|  |  | ||||||
| @@ -42,15 +35,8 @@ public class MonsterCardsApplication extends Application { | |||||||
|     public void onCreate() { |     public void onCreate() { | ||||||
|         super.onCreate(); |         super.onCreate(); | ||||||
|         // Required initialization logic here! |         // Required initialization logic here! | ||||||
|         SoLoader.init(this, false); |  | ||||||
|  |  | ||||||
|         if (BuildConfig.DEBUG && FlipperUtils.shouldEnableFlipper(this)) { |         FlipperInitializer.init(this); | ||||||
|             final FlipperClient client = AndroidFlipperClient.getInstance(this); |  | ||||||
|             client.addPlugin(new InspectorFlipperPlugin(this, DescriptorMapping.withDefaults())); |  | ||||||
|             client.addPlugin(new DatabasesFlipperPlugin(this)); |  | ||||||
|             client.addPlugin(NavigationFlipperPlugin.getInstance()); |  | ||||||
|             client.start(); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         m_db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "monsters") |         m_db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "monsters") | ||||||
|                 .addMigrations(MIGRATION_1_2) |                 .addMigrations(MIGRATION_1_2) | ||||||
|   | |||||||
| @@ -1,17 +1,9 @@ | |||||||
| package com.majinnaibu.monstercards.init; | package com.majinnaibu.monstercards.init; | ||||||
|  |  | ||||||
| import android.content.Context; | import android.content.Context; | ||||||
| import android.os.Bundle; |  | ||||||
|  |  | ||||||
| import androidx.navigation.NavController; |  | ||||||
| import androidx.navigation.NavDestination; |  | ||||||
|  |  | ||||||
| @SuppressWarnings("unused") |  | ||||||
| public class FlipperInitializer { | public class FlipperInitializer { | ||||||
|  |  | ||||||
|     public static void init(Context ctx) { |     public static void init(Context ctx) {} | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public static void sendNavigationEvent(NavController controller, NavDestination destination, Bundle arguments) { | } | ||||||
|     } |  | ||||||
| } |  | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| #Mon Aug 31 21:50:22 PDT 2020 | #Sat May 01 23:00:30 PDT 2021 | ||||||
| distributionBase=GRADLE_USER_HOME | distributionBase=GRADLE_USER_HOME | ||||||
| distributionPath=wrapper/dists | distributionPath=wrapper/dists | ||||||
| zipStoreBase=GRADLE_USER_HOME | zipStoreBase=GRADLE_USER_HOME | ||||||
| zipStorePath=wrapper/dists | zipStorePath=wrapper/dists | ||||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tom Hicks
						Tom Hicks