mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-21 20:39:22 +00:00
Update Gradle & Target sdk 32
This commit is contained in:
parent
04114dede1
commit
c849ee0bac
2
.gitignore
vendored
2
.gitignore
vendored
@ -74,3 +74,5 @@ lib/*private*.dart
|
|||||||
|
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
|
|
||||||
|
local.properties
|
||||||
|
.gradle
|
||||||
|
@ -33,7 +33,7 @@ if (keystorePropertiesFile.exists()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.communiquons.comunic"
|
applicationId "org.communiquons.comunic"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 31
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
@ -59,7 +59,8 @@
|
|||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
android:exported="true">
|
||||||
<!-- This keeps the window background of the activity showing
|
<!-- This keeps the window background of the activity showing
|
||||||
until Flutter renders its first frame. It can be removed if
|
until Flutter renders its first frame. It can be removed if
|
||||||
there is no splash screen (such as the default splash screen
|
there is no splash screen (such as the default splash screen
|
||||||
|
@ -100,7 +100,10 @@ public class NotificationsService extends Service implements Runnable {
|
|||||||
|
|
||||||
Intent notificationIntent = new Intent(this, MainActivity.class);
|
Intent notificationIntent = new Intent(this, MainActivity.class);
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(this,
|
PendingIntent pendingIntent = PendingIntent.getActivity(this,
|
||||||
0, notificationIntent, 0);
|
0,
|
||||||
|
notificationIntent,
|
||||||
|
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M ? PendingIntent.FLAG_IMMUTABLE : 0);
|
||||||
|
|
||||||
Notification notification = new NotificationCompat.Builder(this, SVC_CHANNEL_ID)
|
Notification notification = new NotificationCompat.Builder(this, SVC_CHANNEL_ID)
|
||||||
.setContentTitle("Comunic")
|
.setContentTitle("Comunic")
|
||||||
.setContentText(getText(R.string.independent_push_notification_notification_text))
|
.setContentText(getText(R.string.independent_push_notification_notification_text))
|
||||||
@ -197,12 +200,12 @@ public class NotificationsService extends Service implements Runnable {
|
|||||||
ws.setPingInterval(PING_INTERVAL);
|
ws.setPingInterval(PING_INTERVAL);
|
||||||
ws.addListener(new WebSocketAdapter() {
|
ws.addListener(new WebSocketAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception {
|
public void onConnected(WebSocket websocket, Map<String, List<String>> headers) {
|
||||||
Log.v(TAG, "Connected to independent push notifications service!");
|
Log.v(TAG, "Connected to independent push notifications service!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) throws Exception {
|
public void onDisconnected(WebSocket websocket, WebSocketFrame serverCloseFrame, WebSocketFrame clientCloseFrame, boolean closedByServer) {
|
||||||
Log.v(TAG, "Disconnected from independent push notifications websocket!");
|
Log.v(TAG, "Disconnected from independent push notifications websocket!");
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
lock.notify();
|
lock.notify();
|
||||||
@ -210,12 +213,12 @@ public class NotificationsService extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextFrame(WebSocket websocket, WebSocketFrame frame) throws Exception {
|
public void onTextFrame(WebSocket websocket, WebSocketFrame frame) {
|
||||||
handleTextFrame(frame);
|
handleTextFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(WebSocket websocket, WebSocketException cause) throws Exception {
|
public void onError(WebSocket websocket, WebSocketException cause) {
|
||||||
Log.e(TAG, "An error occured, closing WebSocket!");
|
Log.e(TAG, "An error occured, closing WebSocket!");
|
||||||
cause.printStackTrace();
|
cause.printStackTrace();
|
||||||
websocket.disconnect();
|
websocket.disconnect();
|
||||||
@ -254,17 +257,14 @@ public class NotificationsService extends Service implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropNotification(String id) throws Exception {
|
private void dropNotification(String id) {
|
||||||
new Handler(Looper.getMainLooper()).post(new Runnable() {
|
new Handler(Looper.getMainLooper()).post(() -> {
|
||||||
@Override
|
NotificationManagerCompat notifManager = NotificationManagerCompat.from(NotificationsService.this);
|
||||||
public void run() {
|
notifManager.cancel(id, NOTIFS_ID);
|
||||||
NotificationManagerCompat notifManager = NotificationManagerCompat.from(NotificationsService.this);
|
|
||||||
notifManager.cancel(id, NOTIFS_ID);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendNotification(PushNotification n) throws Exception {
|
private void sendNotification(PushNotification n) {
|
||||||
new Handler(Looper.getMainLooper()).post(() -> postNotification(n));
|
new Handler(Looper.getMainLooper()).post(() -> postNotification(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +273,12 @@ public class NotificationsService extends Service implements Runnable {
|
|||||||
createPushNotificationChannel();
|
createPushNotificationChannel();
|
||||||
|
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
|
PendingIntent pendingIntent = PendingIntent.getActivity(
|
||||||
|
this,
|
||||||
|
0,
|
||||||
|
intent,
|
||||||
|
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M ? PendingIntent.FLAG_IMMUTABLE : 0
|
||||||
|
);
|
||||||
|
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFS_CHANNEL_ID)
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NOTIFS_CHANNEL_ID)
|
||||||
.setSmallIcon(R.drawable.ic_notifications)
|
.setSmallIcon(R.drawable.ic_notifications)
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.4'
|
classpath 'com.android.tools.build:gradle:4.1.3'
|
||||||
|
|
||||||
// Firebase
|
// Firebase
|
||||||
classpath 'com.google.gms:google-services:4.3.5'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user