From 3397cdd95ff32d136513bc25e96323e9d1577582 Mon Sep 17 00:00:00 2001 From: kr328 Date: Sun, 14 Nov 2021 19:17:06 +0800 Subject: [PATCH] Chore: update dependencies --- build.gradle.kts | 2 +- .../com/github/kr328/clash/common/compat/Intents.kt | 10 +++++++--- gradle/wrapper/gradle-wrapper.properties | 4 ++-- gradlew | 10 +++++----- .../service/clash/module/DynamicNotificationModule.kt | 1 + .../service/clash/module/StaticNotificationModule.kt | 1 + settings.gradle.kts | 6 +++--- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0380f399..f3196b21 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,7 +35,7 @@ subprojects { extensions.configure { val minSdkVersion = 21 - val targetSdkVersion = 30 + val targetSdkVersion = 31 val buildVersionCode = 204014 val buildVersionName = "2.4.14" val defaultDimension = "feature" diff --git a/common/src/main/java/com/github/kr328/clash/common/compat/Intents.kt b/common/src/main/java/com/github/kr328/clash/common/compat/Intents.kt index df56b2fa..8319542f 100644 --- a/common/src/main/java/com/github/kr328/clash/common/compat/Intents.kt +++ b/common/src/main/java/com/github/kr328/clash/common/compat/Intents.kt @@ -3,9 +3,13 @@ package com.github.kr328.clash.common.compat import android.app.PendingIntent import android.os.Build -fun pendingIntentFlags(flags: Int, immutable: Boolean = false): Int { - return if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && immutable) { - flags or PendingIntent.FLAG_IMMUTABLE +fun pendingIntentFlags(flags: Int, mutable: Boolean = false): Int { + return if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { + if (Build.VERSION.SDK_INT > 30 && mutable) { + flags or PendingIntent.FLAG_MUTABLE + } else { + flags or PendingIntent.FLAG_IMMUTABLE + } } else { flags } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1664ca00..fc89a986 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionSha256Sum=a8da5b02437a60819cad23e10fc7e9cf32bcb57029d9cb277e26eeff76ce014b \ No newline at end of file +distributionSha256Sum=00b273629df4ce46e68df232161d5a7c4e495b9a029ce6e0420f071e21316867 \ No newline at end of file diff --git a/gradlew b/gradlew index 3da45c16..1b6c7873 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright ? 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?, -# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?; -# * compound commands having a testable exit status, especially ?case?; -# * various built-in commands including ?command?, ?set?, and ?ulimit?. +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt index 96d5bc11..7dfefd07 100644 --- a/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/DynamicNotificationModule.kt @@ -29,6 +29,7 @@ class DynamicNotificationModule(service: Service) : Module(service) { .setOnlyAlertOnce(true) .setShowWhen(false) .setContentTitle("Not Selected") + .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE) .setContentIntent( PendingIntent.getActivity( service, diff --git a/service/src/main/java/com/github/kr328/clash/service/clash/module/StaticNotificationModule.kt b/service/src/main/java/com/github/kr328/clash/service/clash/module/StaticNotificationModule.kt index ee78a779..01ec3be2 100644 --- a/service/src/main/java/com/github/kr328/clash/service/clash/module/StaticNotificationModule.kt +++ b/service/src/main/java/com/github/kr328/clash/service/clash/module/StaticNotificationModule.kt @@ -23,6 +23,7 @@ class StaticNotificationModule(service: Service) : Module(service) { .setColor(service.getColorCompat(R.color.color_clash)) .setOnlyAlertOnce(true) .setShowWhen(false) + .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE) .setContentIntent( PendingIntent.getActivity( service, diff --git a/settings.gradle.kts b/settings.gradle.kts index 0be20369..d9a95c5d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -19,8 +19,8 @@ dependencyResolutionManagement { val kotlin = "1.5.31" val golang = "1.0.4" val coroutine = "1.5.2" - val coreKtx = "1.6.0" - val activity = "1.3.1" + val coreKtx = "1.7.0" + val activity = "1.4.0" val fragment = "1.3.6" val appcompat = "1.3.1" val coordinator = "1.1.0" @@ -28,7 +28,7 @@ dependencyResolutionManagement { val viewpager = "1.0.0" val material = "1.4.0" val appcenter = "4.3.1" - val serialization = "1.3.0" + val serialization = "1.3.1" val kaidl = "1.15" val room = "2.3.0" val multiprocess = "1.0.0"