@@ -33,7 +33,6 @@ import androidx.core.widget.doOnTextChanged
33
33
import com.google.android.gms.tasks.Task
34
34
import com.google.android.material.textfield.TextInputLayout
35
35
import com.google.firebase.appdistribution.AppDistributionRelease
36
- import com.google.firebase.appdistribution.FirebaseAppDistributionException
37
36
import com.google.firebase.appdistribution.InterruptionLevel
38
37
import com.google.firebase.appdistribution.UpdateProgress
39
38
import com.google.firebase.appdistribution.ktx.appDistribution
@@ -87,7 +86,6 @@ class MainActivity : AppCompatActivity() {
87
86
feedbackTriggerMenu = findViewById(R .id.feedbackTriggerMenu)
88
87
val items = listOf (
89
88
FeedbackTrigger .NONE .label,
90
- FeedbackTrigger .SDK_NOTIFICATION .label,
91
89
FeedbackTrigger .CUSTOM_NOTIFICATION .label,
92
90
FeedbackTrigger .SHAKE .label,
93
91
FeedbackTrigger .SCREENSHOT .label,
@@ -102,12 +100,6 @@ class MainActivity : AppCompatActivity() {
102
100
FeedbackTrigger .NONE .label -> {
103
101
disableAllFeedbackTriggers()
104
102
}
105
- FeedbackTrigger .SDK_NOTIFICATION .label -> {
106
- disableAllFeedbackTriggers()
107
- Log .i(TAG , " Enabling notification trigger (SDK)" )
108
- firebaseAppDistribution.showFeedbackNotification(
109
- R .string.feedbackInfoText, InterruptionLevel .HIGH )
110
- }
111
103
FeedbackTrigger .CUSTOM_NOTIFICATION .label -> {
112
104
disableAllFeedbackTriggers()
113
105
startActivity(Intent (this , CustomNotificationActivity ::class .java))
@@ -123,6 +115,9 @@ class MainActivity : AppCompatActivity() {
123
115
}
124
116
}
125
117
}
118
+
119
+ firebaseAppDistribution.showFeedbackNotification(
120
+ R .string.feedbackInfoText, InterruptionLevel .HIGH )
126
121
}
127
122
128
123
override fun onDestroy () {
@@ -132,13 +127,15 @@ class MainActivity : AppCompatActivity() {
132
127
133
128
private fun disableAllFeedbackTriggers () {
134
129
Log .i(TAG , " Disabling all feedback triggers" )
135
- firebaseAppDistribution.cancelFeedbackNotification()
136
130
ShakeDetectionFeedbackTrigger .disable(application)
137
131
}
138
132
139
133
override fun onCreateOptionsMenu (menu : Menu ): Boolean {
140
134
val inflater: MenuInflater = menuInflater
141
135
inflater.inflate(R .menu.action_menu, menu)
136
+ if (BuildConfig .FLAVOR == " beta" ) {
137
+ menu.findItem(R .id.startFeedbackMenuItem).isVisible = true
138
+ }
142
139
return true
143
140
}
144
141
@@ -277,11 +274,11 @@ class MainActivity : AppCompatActivity() {
277
274
}
278
275
279
276
private fun failureListener (exception : Exception ) {
280
- val ex = exception as FirebaseAppDistributionException
281
- Log .d(" FirebaseAppDistribution " , " MAINACTIVITY:ERROR ERROR. CODE: " + exception .errorCode)
277
+ val ex = exception as com.google.firebase.appdistribution. FirebaseAppDistributionException
278
+ Log .d(" MainActivity " , " Task failed with an error ( ${ex .errorCode} ): ${ex.message} " )
282
279
AlertDialog .Builder (this )
283
- .setTitle(" Error updating to new release " )
284
- .setMessage(" ${ex.message} : ${ex.errorCode} " )
280
+ .setTitle(" Task failed " )
281
+ .setMessage(" ${ex.message} \n\n Code : ${ex.errorCode} " )
285
282
.setNeutralButton(" Okay" ) { dialog, _ -> dialog.dismiss() }
286
283
.show()
287
284
}
@@ -337,7 +334,6 @@ class MainActivity : AppCompatActivity() {
337
334
NONE (" None" ),
338
335
SHAKE (" Shake the device" ),
339
336
SCREENSHOT (" Take a screenshot" ),
340
- SDK_NOTIFICATION (" Tap a notification (SDK)" ),
341
337
CUSTOM_NOTIFICATION (" Tap a notification (custom)" )
342
338
}
343
339
}
0 commit comments