Fix #5212: removing bug causing progress dialog to load forever (#5350)

* Fixes bug causing the progress dialog to load forever (#5212)

* Fixes bug causing the progress dialog to load forever (#5212)

* remove unnecessary new line (#5212)
This commit is contained in:
Tai Ha 2023-10-19 18:20:28 +11:00 committed by GitHub
parent 26eaa4650d
commit 988b83dc32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 13 deletions

View file

@ -5,6 +5,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import javax.inject.Inject;
@ -63,7 +64,15 @@ public class NotificationHelper {
.setOngoing(false)
.setPriority(PRIORITY_HIGH);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT);
int flags = PendingIntent.FLAG_UPDATE_CURRENT;
// Check if the API level is 31 or higher to modify the flag
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// For API level 31 or above, PendingIntent requires either FLAG_IMMUTABLE or FLAG_MUTABLE to be set
flags |= PendingIntent.FLAG_IMMUTABLE;
}
PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, flags);
notificationBuilder.setContentIntent(pendingIntent);
notificationManager.notify(notificationId, notificationBuilder.build());
}

View file

@ -226,7 +226,6 @@ class DepictsPresenter @Inject constructor(
)
}
)
}
} else {
repository.cleanup()