@@ -19,7 +19,6 @@ import androidx.core.widget.doOnTextChanged
19
19
import com.google.android.gms.tasks.Task
20
20
import com.google.android.material.textfield.TextInputLayout
21
21
import com.google.firebase.appdistribution.AppDistributionRelease
22
- import com.google.firebase.appdistribution.FirebaseAppDistributionException
23
22
import com.google.firebase.appdistribution.InterruptionLevel
24
23
import com.google.firebase.appdistribution.UpdateProgress
25
24
import com.google.firebase.appdistribution.ktx.appDistribution
@@ -73,7 +72,6 @@ class MainActivity : AppCompatActivity() {
73
72
feedbackTriggerMenu = findViewById(R .id.feedbackTriggerMenu)
74
73
val items = listOf (
75
74
FeedbackTrigger .NONE .label,
76
- FeedbackTrigger .SDK_NOTIFICATION .label,
77
75
FeedbackTrigger .CUSTOM_NOTIFICATION .label,
78
76
FeedbackTrigger .SHAKE .label,
79
77
FeedbackTrigger .SCREENSHOT .label,
@@ -88,12 +86,6 @@ class MainActivity : AppCompatActivity() {
88
86
FeedbackTrigger .NONE .label -> {
89
87
disableAllFeedbackTriggers()
90
88
}
91
- FeedbackTrigger .SDK_NOTIFICATION .label -> {
92
- disableAllFeedbackTriggers()
93
- Log .i(TAG , " Enabling notification trigger (SDK)" )
94
- firebaseAppDistribution.showFeedbackNotification(
95
- R .string.feedbackInfoText, InterruptionLevel .HIGH )
96
- }
97
89
FeedbackTrigger .CUSTOM_NOTIFICATION .label -> {
98
90
disableAllFeedbackTriggers()
99
91
startActivity(Intent (this , CustomNotificationActivity ::class .java))
@@ -109,6 +101,9 @@ class MainActivity : AppCompatActivity() {
109
101
}
110
102
}
111
103
}
104
+
105
+ firebaseAppDistribution.showFeedbackNotification(
106
+ R .string.feedbackInfoText, InterruptionLevel .HIGH )
112
107
}
113
108
114
109
override fun onDestroy () {
@@ -118,13 +113,15 @@ class MainActivity : AppCompatActivity() {
118
113
119
114
private fun disableAllFeedbackTriggers () {
120
115
Log .i(TAG , " Disabling all feedback triggers" )
121
- firebaseAppDistribution.cancelFeedbackNotification()
122
116
ShakeDetectionFeedbackTrigger .disable(application)
123
117
}
124
118
125
119
override fun onCreateOptionsMenu (menu : Menu ): Boolean {
126
120
val inflater: MenuInflater = menuInflater
127
121
inflater.inflate(R .menu.action_menu, menu)
122
+ if (BuildConfig .FLAVOR == " beta" ) {
123
+ menu.findItem(R .id.startFeedbackMenuItem).isVisible = true
124
+ }
128
125
return true
129
126
}
130
127
@@ -263,11 +260,11 @@ class MainActivity : AppCompatActivity() {
263
260
}
264
261
265
262
private fun failureListener (exception : Exception ) {
266
- val ex = exception as FirebaseAppDistributionException
267
- Log .d(" FirebaseAppDistribution " , " MAINACTIVITY:ERROR ERROR. CODE: " + exception .errorCode)
263
+ val ex = exception as com.google.firebase.appdistribution. FirebaseAppDistributionException
264
+ Log .d(" MainActivity " , " Task failed with an error ( ${ex .errorCode} ): ${ex.message} " )
268
265
AlertDialog .Builder (this )
269
- .setTitle(" Error updating to new release " )
270
- .setMessage(" ${ex.message} : ${ex.errorCode} " )
266
+ .setTitle(" Task failed " )
267
+ .setMessage(" ${ex.message} \n\n Code : ${ex.errorCode} " )
271
268
.setNeutralButton(" Okay" ) { dialog, _ -> dialog.dismiss() }
272
269
.show()
273
270
}
@@ -323,7 +320,6 @@ class MainActivity : AppCompatActivity() {
323
320
NONE (" None" ),
324
321
SHAKE (" Shake the device" ),
325
322
SCREENSHOT (" Take a screenshot" ),
326
- SDK_NOTIFICATION (" Tap a notification (SDK)" ),
327
323
CUSTOM_NOTIFICATION (" Tap a notification (custom)" )
328
324
}
329
325
}
0 commit comments