From 4cfe3394b11f85be571dc820a523fb0282383ee1 Mon Sep 17 00:00:00 2001 From: solokot Date: Wed, 29 Mar 2023 09:35:28 +0300 Subject: [PATCH 1/9] Updated Russian translation --- V2rayNG/app/src/main/res/values-ru/strings.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/V2rayNG/app/src/main/res/values-ru/strings.xml b/V2rayNG/app/src/main/res/values-ru/strings.xml index ef852674..995d5573 100644 --- a/V2rayNG/app/src/main/res/values-ru/strings.xml +++ b/V2rayNG/app/src/main/res/values-ru/strings.xml @@ -49,6 +49,8 @@ Запрос узла (WS/H2) / Шифрование QUIC Путь (WS/H2) / Ключ QUIC / Сид KCP / Сервис gRPC TLS + Fingerprint + Alpn Разрешать небезопасные SNI Адрес @@ -59,6 +61,9 @@ Пользователь (необязательно) Шифрование Поток + PublicKey + ShortId + SpiderX Успешно Ошибка Ничего нет @@ -165,7 +170,7 @@ Очистить Перезапуск службы Удалить все профили - Delete duplicate config + Удалить дубликаты профилей Удалить сбойные профили (после проверки) Экспорт всех профилей в буфер обмена Группы @@ -179,7 +184,7 @@ Сортировка по результатам теста Фильтр профилей Все группы - Delete %d duplicate configurations + Удалено дубликатов профилей: %d Запуск службы Подтвердить From 68553d38071ca122c1bd14b8cfb9032cf987f974 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:25:54 +0800 Subject: [PATCH 2/9] update kotlin version to 1.7.20 --- .../kotlin/com/v2ray/ang/ui/ServerActivity.kt | 28 +++++++++++-------- V2rayNG/build.gradle | 2 +- V2rayNG/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt index 535c862a..6ab4f3e1 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ServerActivity.kt @@ -116,6 +116,7 @@ class ServerActivity : BaseActivity() { EConfigType.SOCKS -> setContentView(R.layout.activity_server_socks) EConfigType.VLESS -> setContentView(R.layout.activity_server_vless) EConfigType.TROJAN -> setContentView(R.layout.activity_server_trojan) + else -> setContentView(R.layout.activity_server_vmess) } sp_network?.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { @@ -382,8 +383,8 @@ class ServerActivity : BaseActivity() { val sniField = et_sni?.text?.toString()?.trim() ?: return val allowInsecureField = sp_allow_insecure?.selectedItemPosition ?: return val streamSecurity = sp_stream_security?.selectedItemPosition ?: return - var utlsIndex = sp_stream_fingerprint?.selectedItemPosition ?: return - var alpnIndex = sp_stream_alpn?.selectedItemPosition ?: return + val utlsIndex = sp_stream_fingerprint?.selectedItemPosition ?: return + val alpnIndex = sp_stream_alpn?.selectedItemPosition ?: return val publicKey = et_public_key?.text?.toString()?.trim() ?: return val shortId = et_short_id?.text?.toString()?.trim() ?: return val spiderX = et_spider_x?.text?.toString()?.trim() ?: return @@ -421,14 +422,19 @@ class ServerActivity : BaseActivity() { } private fun transportTypes(network: String?): Array { - return if (network == "tcp") { - tcpTypes - } else if (network == "kcp" || network == "quic") { - kcpAndQuicTypes - } else if (network == "grpc") { - grpcModes - } else { - arrayOf("---") + return when (network) { + "tcp" -> { + tcpTypes + } + "kcp", "quic" -> { + kcpAndQuicTypes + } + "grpc" -> { + grpcModes + } + else -> { + arrayOf("---") + } } } @@ -437,7 +443,7 @@ class ServerActivity : BaseActivity() { */ private fun deleteServer(): Boolean { if (editGuid.isNotEmpty()) { - if (editGuid != mainStorage?.decodeString(MmkvManager.KEY_SELECTED_SERVER)) { + if (editGuid != mainStorage?.decodeString(KEY_SELECTED_SERVER)) { if (settingsStorage?.decodeBool(AppConfig.PREF_CONFIRM_REMOVE) == true) { AlertDialog.Builder(this).setMessage(R.string.del_config_comfirm) .setPositiveButton(android.R.string.ok) { _, _ -> diff --git a/V2rayNG/build.gradle b/V2rayNG/build.gradle index 96c7a55a..4a1d7cc9 100644 --- a/V2rayNG/build.gradle +++ b/V2rayNG/build.gradle @@ -8,7 +8,7 @@ buildscript { maven { url 'https://jitpack.io' } } dependencies { - classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.android.tools.build:gradle:7.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // NOTE: Do not place your application dependencies here; they belong diff --git a/V2rayNG/gradle.properties b/V2rayNG/gradle.properties index 1fa9a591..116ba44e 100644 --- a/V2rayNG/gradle.properties +++ b/V2rayNG/gradle.properties @@ -13,7 +13,7 @@ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true #Fri Jun 02 14:08:42 CST 2017 -kotlinVersion=1.6.21 +kotlinVersion=1.7.20 buildToolsVer=31.0.0 compileSdkVer=31 targetSdkVer=31 diff --git a/V2rayNG/gradle/wrapper/gradle-wrapper.properties b/V2rayNG/gradle/wrapper/gradle-wrapper.properties index 047ecba2..4d1d8f01 100644 --- a/V2rayNG/gradle/wrapper/gradle-wrapper.properties +++ b/V2rayNG/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip From de83302c8ac2ac0171197b0274c9c56462dd0b6b Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 29 Mar 2023 15:54:35 +0800 Subject: [PATCH 3/9] update buildtoolsversion & targetSdkversion to 33 --- V2rayNG/app/build.gradle | 8 ++++---- V2rayNG/gradle.properties | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index 1775db0f..9a8e9351 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -107,12 +107,12 @@ dependencies { // Androidx implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'com.google.android.material:material:1.8.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.preference:preference-ktx:1.2.0' - implementation 'androidx.recyclerview:recyclerview:1.2.1' - implementation 'androidx.fragment:fragment-ktx:1.5.2' + implementation 'androidx.recyclerview:recyclerview:1.3.0' + implementation 'androidx.fragment:fragment-ktx:1.5.6' implementation 'androidx.multidex:multidex:2.0.1' implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01' diff --git a/V2rayNG/gradle.properties b/V2rayNG/gradle.properties index 116ba44e..02049d84 100644 --- a/V2rayNG/gradle.properties +++ b/V2rayNG/gradle.properties @@ -14,9 +14,9 @@ # org.gradle.parallel=true #Fri Jun 02 14:08:42 CST 2017 kotlinVersion=1.7.20 -buildToolsVer=31.0.0 -compileSdkVer=31 -targetSdkVer=31 +buildToolsVer=33.0.2 +compileSdkVer=33 +targetSdkVer=33 kotlin.incremental=true android.useAndroidX=true android.enableJetifier=true From 6a6415753747c0536b111a89eea910abafc4c37b Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 29 Mar 2023 16:15:43 +0800 Subject: [PATCH 4/9] update kotlinx-coroutines to 1.6.4 --- V2rayNG/app/build.gradle | 4 ++-- V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index 9a8e9351..72f3ea57 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -124,8 +124,8 @@ dependencies { //kotlin implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" implementation 'com.tencent:mmkv-static:1.2.12' implementation 'com.google.code.gson:gson:2.8.9' diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt index 703bac40..0a978670 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt @@ -631,7 +631,9 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) { binding.drawerLayout.closeDrawer(GravityCompat.START) } else { - super.onBackPressed() + //super.onBackPressed() + onBackPressedDispatcher.onBackPressed() + } } From ce61f177dcbb286121aa467b0fd445f6a1f0688d Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 30 Mar 2023 11:54:15 +0800 Subject: [PATCH 5/9] Adjust build gradle --- V2rayNG/app/build.gradle | 21 ++++------- .../kotlin/com/v2ray/ang/ui/MainActivity.kt | 1 - V2rayNG/build.gradle | 35 +++---------------- V2rayNG/gradle.properties | 20 +++-------- V2rayNG/settings.gradle | 16 +++++++++ 5 files changed, 32 insertions(+), 61 deletions(-) diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index 72f3ea57..f80927c6 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -1,5 +1,7 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' +plugins { + id 'com.android.application' + id 'org.jetbrains.kotlin.android' +} Properties props = new Properties() props.load(new FileInputStream(new File('local.properties'))) @@ -18,7 +20,7 @@ android { minSdkVersion 21 targetSdkVersion Integer.parseInt("$targetSdkVer") multiDexEnabled true - versionCode 506 + versionCode 507 versionName "1.8.1" } @@ -123,7 +125,7 @@ dependencies { implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1' //kotlin - implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-reflect:1.7.20" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" @@ -139,13 +141,4 @@ dependencies { implementation 'com.blacksquircle.ui:editorkit:2.1.1' implementation 'com.blacksquircle.ui:language-base:2.1.1' implementation 'com.blacksquircle.ui:language-json:2.1.1' -} - -//buildscript { -// repositories { -// google() -// mavenCentral() -// maven { url 'https://maven.google.com' } -// maven { url 'https://jitpack.io' } -// } -//} +} \ No newline at end of file diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt index 0a978670..0286c1d7 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt @@ -633,7 +633,6 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList } else { //super.onBackPressed() onBackPressedDispatcher.onBackPressed() - } } diff --git a/V2rayNG/build.gradle b/V2rayNG/build.gradle index 4a1d7cc9..25369742 100644 --- a/V2rayNG/build.gradle +++ b/V2rayNG/build.gradle @@ -1,31 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - google() - mavenCentral() - maven { url 'https://maven.google.com' } - maven { url 'https://jitpack.io' } - } - dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - mavenCentral() - maven { url 'https://maven.google.com' } - maven { url 'https://jitpack.io' } - jcenter() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} +plugins { + id 'com.android.application' version '7.3.1' apply false + id 'com.android.library' version '7.3.1' apply false + id 'org.jetbrains.kotlin.android' version '1.7.20' apply false +} \ No newline at end of file diff --git a/V2rayNG/gradle.properties b/V2rayNG/gradle.properties index 02049d84..2fbe9156 100644 --- a/V2rayNG/gradle.properties +++ b/V2rayNG/gradle.properties @@ -1,22 +1,10 @@ -## Project-wide Gradle settings. -# -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx1024m -XX:MaxPermSize=256m - org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -# -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -#Fri Jun 02 14:08:42 CST 2017 -kotlinVersion=1.7.20 + buildToolsVer=33.0.2 compileSdkVer=33 targetSdkVer=33 kotlin.incremental=true android.useAndroidX=true android.enableJetifier=true +kotlin.code.style=official +android.nonTransitiveRClass=true +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 diff --git a/V2rayNG/settings.gradle b/V2rayNG/settings.gradle index e7b4def4..2b0e1603 100644 --- a/V2rayNG/settings.gradle +++ b/V2rayNG/settings.gradle @@ -1 +1,17 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + jcenter() + } +} +rootProject.name = "V2rayNG" include ':app' From 383f55f8098bc235936873c3da5d5f1b011ab80e Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 30 Mar 2023 13:21:36 +0800 Subject: [PATCH 6/9] update org.jetbrains.kotlin.android to 1.8.0 --- V2rayNG/app/build.gradle | 16 ++++++++-------- .../main/kotlin/com/v2ray/ang/ui/MainActivity.kt | 1 + V2rayNG/build.gradle | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index f80927c6..3c5979fa 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -119,19 +119,19 @@ dependencies { implementation 'androidx.viewpager2:viewpager2:1.1.0-beta01' // Androidx ktx - implementation 'androidx.activity:activity-ktx:1.5.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1' - implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1' + implementation 'androidx.activity:activity-ktx:1.7.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1' + implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1' //kotlin - implementation "org.jetbrains.kotlin:kotlin-reflect:1.7.20" + implementation "org.jetbrains.kotlin:kotlin-reflect:1.8.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4" - implementation 'com.tencent:mmkv-static:1.2.12' - implementation 'com.google.code.gson:gson:2.8.9' - implementation 'io.reactivex:rxjava:1.3.4' + implementation 'com.tencent:mmkv-static:1.2.15' + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'io.reactivex:rxjava:1.3.8' implementation 'io.reactivex:rxandroid:1.2.1' implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar' implementation 'me.dm7.barcodescanner:core:1.9.8' diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt index 0286c1d7..5e71b76d 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainActivity.kt @@ -627,6 +627,7 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList } } + @Deprecated("Deprecated in Java") override fun onBackPressed() { if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) { binding.drawerLayout.closeDrawer(GravityCompat.START) diff --git a/V2rayNG/build.gradle b/V2rayNG/build.gradle index 25369742..eb5c5d7e 100644 --- a/V2rayNG/build.gradle +++ b/V2rayNG/build.gradle @@ -2,5 +2,5 @@ plugins { id 'com.android.application' version '7.3.1' apply false id 'com.android.library' version '7.3.1' apply false - id 'org.jetbrains.kotlin.android' version '1.7.20' apply false + id 'org.jetbrains.kotlin.android' version '1.8.0' apply false } \ No newline at end of file From ea979f02b54240814b5df64dc64c2ab1a91c6957 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 30 Mar 2023 20:45:37 +0800 Subject: [PATCH 7/9] update gradle --- V2rayNG/app/build.gradle | 28 +------------------ V2rayNG/app/src/main/AndroidManifest.xml | 3 +- V2rayNG/build.gradle | 4 +-- .../gradle/wrapper/gradle-wrapper.properties | 2 +- 4 files changed, 5 insertions(+), 32 deletions(-) diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index 3c5979fa..7f2a4323 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -3,9 +3,6 @@ plugins { id 'org.jetbrains.kotlin.android' } -Properties props = new Properties() -props.load(new FileInputStream(new File('local.properties'))) - android { compileSdkVersion Integer.parseInt("$compileSdkVer") buildToolsVersion "$buildToolsVer" @@ -24,41 +21,17 @@ android { versionName "1.8.1" } - if (props["sign"]) { - signingConfigs { - release { - storeFile file("../key.jks") - keyAlias 'ang' - keyPassword '123456' - storePassword '123456' - } - debug { - storeFile file("../key.jks") - keyAlias 'ang' - keyPassword '123456' - storePassword '123456' - } - } - } - buildTypes { release { minifyEnabled false zipAlignEnabled false shrinkResources false - if (props["sign"]) { - signingConfig signingConfigs.release - } ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' -// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } debug { minifyEnabled false zipAlignEnabled false shrinkResources false - if (props["sign"]) { - signingConfig signingConfigs.release - } ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' } } @@ -100,6 +73,7 @@ android { buildFeatures { viewBinding true } + namespace 'com.v2ray.ang' } dependencies { diff --git a/V2rayNG/app/src/main/AndroidManifest.xml b/V2rayNG/app/src/main/AndroidManifest.xml index 29f9b3a9..74ff1945 100644 --- a/V2rayNG/app/src/main/AndroidManifest.xml +++ b/V2rayNG/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> Date: Fri, 31 Mar 2023 13:48:40 +0800 Subject: [PATCH 8/9] Add permission POST_NOTIFICATIONS and READ_MEDIA_IMAGES --- V2rayNG/app/build.gradle | 1 + V2rayNG/app/src/main/AndroidManifest.xml | 3 ++ .../kotlin/com/v2ray/ang/ui/MainActivity.kt | 10 +++++++ .../com/v2ray/ang/ui/ScannerActivity.kt | 28 +++++++++++-------- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index 7f2a4323..4a707a8d 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -74,6 +74,7 @@ android { viewBinding true } namespace 'com.v2ray.ang' + testNamespace 'com.v2ray.angTest' } dependencies { diff --git a/V2rayNG/app/src/main/AndroidManifest.xml b/V2rayNG/app/src/main/AndroidManifest.xml index 74ff1945..799fc968 100644 --- a/V2rayNG/app/src/main/AndroidManifest.xml +++ b/V2rayNG/app/src/main/AndroidManifest.xml @@ -23,6 +23,9 @@ + + + = Build.VERSION_CODES.TIRAMISU) { + RxPermissions(this) + .request(Manifest.permission.POST_NOTIFICATIONS) + .subscribe { + if (!it) + toast(R.string.toast_permission_denied) + } + } } private fun setupViewModel() { diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ScannerActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ScannerActivity.kt index bc3785ec..883f51b5 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ScannerActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/ScannerActivity.kt @@ -7,6 +7,7 @@ import com.google.zxing.Result import me.dm7.barcodescanner.zxing.ZXingScannerView import android.content.Intent import android.graphics.BitmapFactory +import android.os.Build import android.view.Menu import android.view.MenuItem import androidx.activity.result.contract.ActivityResultContracts @@ -70,18 +71,23 @@ class ScannerActivity : BaseActivity(), ZXingScannerView.ResultHandler { override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) { R.id.select_photo -> { + val permission = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + Manifest.permission.READ_MEDIA_IMAGES + } else { + Manifest.permission.READ_EXTERNAL_STORAGE + } RxPermissions(this) - .request(Manifest.permission.READ_EXTERNAL_STORAGE) - .subscribe { - if (it) { - try { - showFileChooser() - } catch (e: Exception) { - e.printStackTrace() - } - } else - toast(R.string.toast_permission_denied) - } + .request(permission) + .subscribe { + if (it) { + try { + showFileChooser() + } catch (e: Exception) { + e.printStackTrace() + } + } else + toast(R.string.toast_permission_denied) + } true } else -> super.onOptionsItemSelected(item) From 26f1f7099bfa688d2807be328b0fb6611394b50d Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sat, 1 Apr 2023 18:08:11 +0800 Subject: [PATCH 9/9] up 1.8.2 --- V2rayNG/app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index 4a707a8d..92d7a52c 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -17,8 +17,8 @@ android { minSdkVersion 21 targetSdkVersion Integer.parseInt("$targetSdkVer") multiDexEnabled true - versionCode 507 - versionName "1.8.1" + versionCode 510 + versionName "1.8.2" } buildTypes {