Skip to content

Notifications: Ask permission upfront, show only one persistent notification #4179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public interface FirebaseAppDistribution {
* @param screenshot URI to a bitmap containing a screenshot that will be included with the
* report, or null to not include a screenshot
*/
void startFeedback(@NonNull CharSequence infoText, @Nullable Uri screenshotUri);
void startFeedback(@NonNull CharSequence infoText, @Nullable Uri screenshot);

/** Gets the singleton {@link FirebaseAppDistribution} instance. */
@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class MainActivity : AppCompatActivity() {
lateinit var feedbackTriggerMenu: TextInputLayout

var updateTask: Task<Void>? = null
var release: AppDistributionRelease? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -67,6 +66,10 @@ class MainActivity : AppCompatActivity() {
signInStatus = findViewById(R.id.sign_in_status)
progressBar = findViewById(R.id.progress_bar)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
NotificationFeedbackTrigger.requestPermission(this)
}

// Set up feedback trigger menu
feedbackTriggerMenu = findViewById(R.id.feedbackTriggerMenu)
val items = listOf(
Expand Down Expand Up @@ -181,10 +184,11 @@ class MainActivity : AppCompatActivity() {
firebaseAppDistribution
.checkForNewRelease()
.addOnSuccessListener {
setupUI(
isSignedIn = firebaseAppDistribution.isTesterSignedIn,
isUpdateAvailable = it != null,
release = it)
release ->
setupUI(
isSignedIn = firebaseAppDistribution.isTesterSignedIn,
isUpdateAvailable = release != null,
release = release)
}
.addOnFailureListener { failureListener(it) }
}
Expand All @@ -194,11 +198,11 @@ class MainActivity : AppCompatActivity() {
firebaseAppDistribution
.checkForNewRelease()
.addOnSuccessListener {
release = it
setupUI(
isSignedIn = firebaseAppDistribution.isTesterSignedIn,
isUpdateAvailable = release != null,
release = release)
release ->
setupUI(
isSignedIn = firebaseAppDistribution.isTesterSignedIn,
isUpdateAvailable = release != null,
release = release)
}
.addOnFailureListener { failureListener(it) }
}
Expand Down
Loading