Skip to content

Commit 38dd0c8

Browse files
authored
Merge pull request #4 from anotherdev/pk/feature-detect-app-debug
Feature detect app debug
2 parents 177a07d + bb23d3b commit 38dd0c8

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

app/src/main/java/com/anotherdev/sample/firebase/auth/LoginActivity.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.anotherdev.sample.firebase.auth;
22

33
import android.content.Intent;
4+
import android.content.pm.ApplicationInfo;
45
import android.os.Bundle;
56
import android.util.Log;
67
import android.view.Menu;
@@ -83,9 +84,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
8384

8485
firebaseAuth = FirebaseAuthRest.getInstance(FirebaseApp.getInstance());
8586

86-
String libInfo = String.format("Library: %s %s",
87+
String libInfo = String.format("Library: %s %s\nBuildType: %s\nHash: %s",
8788
getString(com.anotherdev.firebase.auth.core.R.string.anotherdev_firebase_auth_rest_sdk_name),
88-
com.anotherdev.firebase.auth.core.BuildConfig.VERSION_NAME);
89+
com.anotherdev.firebase.auth.core.BuildConfig.VERSION_NAME,
90+
com.anotherdev.firebase.auth.core.BuildConfig.BUILD_TYPE,
91+
com.anotherdev.firebase.auth.core.BuildConfig.GIT_SHA);
8992
authLibraryTextView.setText(libInfo);
9093

9194
onDestroy.add(firebaseAuth.currentUser()
@@ -101,7 +104,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
101104
})
102105
.subscribe(Functions.emptyConsumer(), RxUtil.ON_ERROR_LOG_V3));
103106

104-
String appInfo = String.format("%s\n%s", getString(R.string.app_title), BuildConfig.VERSION_NAME);
107+
final boolean isDebugBuild = (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
108+
String appInfo = String.format("%s\n%s\nBuildType: %s",
109+
getString(R.string.app_title),
110+
BuildConfig.VERSION_NAME,
111+
isDebugBuild ? "debug" : "release");
105112
appInfoTextView.setText(appInfo);
106113

107114
googleSignInClient = GoogleSignIn.getClient(this,

buildsystem/dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ext {
22
// Manifest version information!
33
def versionMajor = 0
44
def versionMinor = 1
5-
def versionPatch = 3
5+
def versionPatch = 4
66
def versionBuild = 0 // bump for dogfood builds, public betas, etc.
77

88
// Eko SDK version

firebase-auth-rest/core/src/main/java/com/anotherdev/firebase/auth/rest/api/RestAuthApi.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.anotherdev.firebase.auth.rest.api;
22

3+
import android.content.Context;
4+
import android.content.pm.ApplicationInfo;
5+
36
import com.anotherdev.firebase.auth.init.AppContext;
47
import com.anotherdev.firebase.auth.util.FarGson;
58

@@ -9,7 +12,6 @@
912
import retrofit2.Retrofit;
1013
import retrofit2.converter.gson.GsonConverterFactory;
1114

12-
import static com.anotherdev.firebase.auth.core.BuildConfig.DEBUG;
1315
import static okhttp3.logging.HttpLoggingInterceptor.Level.BASIC;
1416
import static okhttp3.logging.HttpLoggingInterceptor.Level.BODY;
1517

@@ -20,9 +22,11 @@ public final class RestAuthApi {
2022

2123

2224
private RestAuthApi() {
25+
Context context = AppContext.get();
26+
boolean isDebugBuild = (context.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
2327
OkHttpClient okHttpClient = new OkHttpClient.Builder()
24-
.addInterceptor(new HttpLoggingInterceptor().setLevel(DEBUG ? BODY : BASIC))
25-
.addInterceptor(new RestAuthInterceptor(AppContext.get()))
28+
.addInterceptor(new HttpLoggingInterceptor().setLevel(isDebugBuild ? BODY : BASIC))
29+
.addInterceptor(new RestAuthInterceptor(context))
2630
.build();
2731

2832
auth = buildApi(okHttpClient, IdentityToolkitApi.BASE_URL, IdentityToolkitApi.class);

0 commit comments

Comments
 (0)