Migrate to API 31 for android (#14032)

This commit is contained in:
Audrius Molis 2022-09-20 13:50:16 +03:00 committed by GitHub
parent d97a7fb325
commit 8ba4f9ebae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 10 deletions

View File

@ -36,6 +36,7 @@
<meta-data android:name="commitHash" android:value="${commitHash}"/> <meta-data android:name="commitHash" android:value="${commitHash}"/>
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" android:windowSoftInputMode="adjustResize"

View File

@ -23,8 +23,8 @@
# Version requirements used throughout the Gradle scripts # Version requirements used throughout the Gradle scripts
kotlinVersion=1.3.50 kotlinVersion=1.3.50
minSdkVersion=23 minSdkVersion=23
compileSdkVersion=30 compileSdkVersion=31
targetSdkVersion=30 targetSdkVersion=31
buildToolsVersion=31.0.0 buildToolsVersion=31.0.0
supportLibVersion=28.0.0 supportLibVersion=28.0.0
# This should match version from nix/mobile/android/maven-and-npm-deps/maven/default.nix # This should match version from nix/mobile/android/maven-and-npm-deps/maven/default.nix

View File

@ -78,9 +78,10 @@ public class ForegroundService extends Service {
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_MUTABLE);
Intent stopIntent = new Intent(PushNotificationHelper.ACTION_TAP_STOP); Intent stopIntent = new Intent(PushNotificationHelper.ACTION_TAP_STOP);
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(context, 0, stopIntent, PendingIntent.FLAG_CANCEL_CURRENT); PendingIntent stopPendingIntent = PendingIntent.getBroadcast(context, 0, stopIntent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
Notification notification = new NotificationCompat.Builder(context, CHANNEL_ID) Notification notification = new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_stat_notify_status) .setSmallIcon(R.drawable.ic_stat_notify_status)

View File

@ -522,7 +522,7 @@ public class PushNotificationHelper {
actionIntent.setPackage(packageName); actionIntent.setPackage(packageName);
PendingIntent pendingActionIntent = PendingIntent.getBroadcast(context, notificationID, actionIntent, PendingIntent pendingActionIntent = PendingIntent.getBroadcast(context, notificationID, actionIntent,
PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
notification.addAction(new NotificationCompat.Action.Builder(icon, action, pendingActionIntent).build()); notification.addAction(new NotificationCompat.Action.Builder(icon, action, pendingActionIntent).build());
@ -708,26 +708,30 @@ public class PushNotificationHelper {
Intent intent = new Intent(ACTION_DELETE_NOTIFICATION); Intent intent = new Intent(ACTION_DELETE_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink); intent.putExtra("im.status.ethereum.deepLink", deepLink);
intent.putExtra("im.status.ethereum.groupId", groupId); intent.putExtra("im.status.ethereum.groupId", groupId);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT); return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
} }
private PendingIntent createGroupOnTapIntent(Context context, int notificationId, String groupId, String deepLink) { private PendingIntent createGroupOnTapIntent(Context context, int notificationId, String groupId, String deepLink) {
Intent intent = new Intent(ACTION_TAP_NOTIFICATION); Intent intent = new Intent(ACTION_TAP_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink); intent.putExtra("im.status.ethereum.deepLink", deepLink);
intent.putExtra("im.status.ethereum.groupId", groupId); intent.putExtra("im.status.ethereum.groupId", groupId);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT); return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
} }
private PendingIntent createOnTapIntent(Context context, int notificationId, String deepLink) { private PendingIntent createOnTapIntent(Context context, int notificationId, String deepLink) {
Intent intent = new Intent(ACTION_TAP_NOTIFICATION); Intent intent = new Intent(ACTION_TAP_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink); intent.putExtra("im.status.ethereum.deepLink", deepLink);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT); return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
} }
private PendingIntent createOnDismissedIntent(Context context, int notificationId, String deepLink) { private PendingIntent createOnDismissedIntent(Context context, int notificationId, String deepLink) {
Intent intent = new Intent(ACTION_DELETE_NOTIFICATION); Intent intent = new Intent(ACTION_DELETE_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink); intent.putExtra("im.status.ethereum.deepLink", deepLink);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, PendingIntent.FLAG_CANCEL_CURRENT); return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_MUTABLE);
} }
public void removeStatusMessage(Bundle bundle) { public void removeStatusMessage(Bundle bundle) {

View File

@ -11,7 +11,7 @@ androidenv.composeAndroidPackages {
toolsVersion = "26.1.1"; toolsVersion = "26.1.1";
platformToolsVersion = "33.0.1"; platformToolsVersion = "33.0.1";
buildToolsVersions = [ "31.0.0" ]; buildToolsVersions = [ "31.0.0" ];
platformVersions = [ "30" ]; platformVersions = [ "31" ];
cmakeVersions = [ "3.18.1" ]; cmakeVersions = [ "3.18.1" ];
ndkVersion = "22.1.7171670"; ndkVersion = "22.1.7171670";
includeNDK = true; includeNDK = true;