Skip to content

Commit e8274a7

Browse files
authored
Merge 67511af into e1fe640
2 parents e1fe640 + 67511af commit e8274a7

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

firebase-appdistribution/test-app/src/main/java/com/googletest/firebase/appdistribution/testapp/MainActivity.kt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ class MainActivity : AppCompatActivity() {
7070
feedbackTriggerMenu = findViewById(R.id.feedbackTriggerMenu)
7171
val items = listOf(
7272
FeedbackTrigger.NONE.label,
73-
FeedbackTrigger.SDK_NOTIFICATION.label,
7473
FeedbackTrigger.CUSTOM_NOTIFICATION.label,
7574
FeedbackTrigger.SHAKE.label,
7675
FeedbackTrigger.SCREENSHOT.label,
@@ -85,12 +84,6 @@ class MainActivity : AppCompatActivity() {
8584
FeedbackTrigger.NONE.label -> {
8685
disableAllFeedbackTriggers()
8786
}
88-
FeedbackTrigger.SDK_NOTIFICATION.label -> {
89-
disableAllFeedbackTriggers()
90-
Log.i(TAG, "Enabling notification trigger (SDK)")
91-
firebaseAppDistribution.showFeedbackNotification(
92-
R.string.feedbackInfoText, InterruptionLevel.HIGH)
93-
}
9487
FeedbackTrigger.CUSTOM_NOTIFICATION.label -> {
9588
disableAllFeedbackTriggers()
9689
startActivity(Intent(this, CustomNotificationActivity::class.java))
@@ -106,6 +99,9 @@ class MainActivity : AppCompatActivity() {
10699
}
107100
}
108101
}
102+
103+
firebaseAppDistribution.showFeedbackNotification(
104+
R.string.feedbackInfoText, InterruptionLevel.HIGH)
109105
}
110106

111107
override fun onDestroy() {
@@ -115,13 +111,15 @@ class MainActivity : AppCompatActivity() {
115111

116112
private fun disableAllFeedbackTriggers() {
117113
Log.i(TAG, "Disabling all feedback triggers")
118-
firebaseAppDistribution.cancelFeedbackNotification()
119114
ShakeDetectionFeedbackTrigger.disable(application)
120115
}
121116

122117
override fun onCreateOptionsMenu(menu: Menu): Boolean {
123118
val inflater: MenuInflater = menuInflater
124119
inflater.inflate(R.menu.action_menu, menu)
120+
if (BuildConfig.FLAVOR == "beta") {
121+
menu.findItem(R.id.startFeedbackMenuItem).isVisible = true
122+
}
125123
return true
126124
}
127125

@@ -261,10 +259,10 @@ class MainActivity : AppCompatActivity() {
261259

262260
private fun failureListener(exception: Exception) {
263261
val ex = exception as com.google.firebase.appdistribution.FirebaseAppDistributionException
264-
Log.d("FirebaseAppDistribution", "MAINACTIVITY:ERROR ERROR. CODE: " + exception.errorCode)
262+
Log.d("MainActivity", "Task failed with an error (${ex.errorCode}): ${ex.message}")
265263
AlertDialog.Builder(this)
266-
.setTitle("Error updating to new release")
267-
.setMessage("${ex.message}: ${ex.errorCode}")
264+
.setTitle("Task failed")
265+
.setMessage("${ex.message}\n\nCode: ${ex.errorCode}")
268266
.setNeutralButton("Okay") { dialog, _ -> dialog.dismiss() }
269267
.show()
270268
}
@@ -320,7 +318,6 @@ class MainActivity : AppCompatActivity() {
320318
NONE("None"),
321319
SHAKE("Shake the device"),
322320
SCREENSHOT("Take a screenshot"),
323-
SDK_NOTIFICATION("Tap a notification (SDK)"),
324321
CUSTOM_NOTIFICATION("Tap a notification (custom)")
325322
}
326323
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<menu xmlns:android="http://schemas.android.com/apk/res/android">
33
<item android:id="@+id/startFeedbackMenuItem"
4-
android:title="@string/startFeedbackLabel"/>
4+
android:title="@string/startFeedbackLabel"
5+
android:visible="false"/>
56
</menu>

firebase-appdistribution/test-app/test-app.gradle

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ android {
2525
applicationId "com.googletest.firebase.appdistribution.testapp"
2626
minSdkVersion 23
2727
targetSdkVersion 33
28-
versionName "2.1"
29-
versionCode 3
28+
versionName "3.1"
29+
versionCode 6
3030

3131
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3232
}
@@ -37,10 +37,22 @@ android {
3737
// needing to have the app signed.
3838
initWith debug
3939
}
40+
}
41+
42+
flavorDimensions.add("environment")
43+
44+
productFlavors {
45+
prod {
46+
dimension "environment"
47+
versionNameSuffix "-prod"
48+
}
49+
50+
beta {
51+
dimension "environment"
52+
versionNameSuffix "-beta"
4053

41-
debug {
4254
firebaseAppDistribution {
43-
releaseNotes "Debug variant of Android SDK test app"
55+
releaseNotes "Beta variant of Android SDK test app"
4456
// testers "your email here"
4557
}
4658
}
@@ -67,8 +79,8 @@ dependencies {
6779
implementation project(':firebase-common:ktx')
6880
implementation "com.google.android.gms:play-services-tasks:18.0.2"
6981

70-
// Debug uses the full implementation
71-
debugImplementation project(':firebase-appdistribution')
82+
// Beta flavor uses the full implementation
83+
betaImplementation project(':firebase-appdistribution')
7284

7385
// Other dependencies
7486
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

0 commit comments

Comments
 (0)