Skip to content

Commit

Permalink
Dismiss all notifications if user wants to sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
fynngodau committed Oct 4, 2023
1 parent 44f9b0c commit 643e387
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,14 @@ private void registerNotificationChannel() {

}

private static class Receiver extends BroadcastReceiver {
public static final class IgnoreReceiver extends BroadcastReceiver {

@Override
@CallSuper
public void onReceive(Context context, Intent intent) {
// Dismiss notification

// Dismiss ignored notification
NotificationManagerCompat.from(context)
.cancel(intent.getIntExtra(INTENT_KEY_NOTIFICATION_ID, -1));
}
}

public static final class IgnoreReceiver extends Receiver {

@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);

SharedPreferences preferences = context.getSharedPreferences(PREFERENCES_FILE_NAME, Context.MODE_PRIVATE);

Expand All @@ -143,10 +135,12 @@ public void onReceive(Context context, Intent intent) {
}
}

public static final class SignInReceiver extends Receiver {
public static final class SignInReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);

// Dismiss all notifications
NotificationManagerCompat.from(context).cancelAll();

Log.d(TAG, "Starting sign in activity");
Intent authIntent = new Intent(GMS_AUTH_INTENT_ACTION);
Expand Down

0 comments on commit 643e387

Please sign in to comment.