diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4491dda..2d2caedd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: - main env: - LATEST_VERSION: "1.4.4" + LATEST_VERSION: "1.4.5" jobs: build-and-deploy: diff --git a/apk/SKIP-v1.4.5.apk b/apk/SKIP-v1.4.5.apk new file mode 100644 index 00000000..d6dd389b Binary files /dev/null and b/apk/SKIP-v1.4.5.apk differ diff --git a/app/build.gradle b/app/build.gradle index e65ab358..b2a43646 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,7 +11,7 @@ android { minSdk 24 targetSdk 32 versionCode 1 - versionName "1.4.4" + versionName "1.4.5" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/java/com/android/skip/MainActivity.kt b/app/src/main/java/com/android/skip/MainActivity.kt index 07b10308..42ec207e 100644 --- a/app/src/main/java/com/android/skip/MainActivity.kt +++ b/app/src/main/java/com/android/skip/MainActivity.kt @@ -254,26 +254,12 @@ class MainActivity : ComponentActivity() { apkFile ) - // 创建并注册 BroadcastReceiver - val receiver = object : BroadcastReceiver() { - override fun onReceive(context: Context, intent: Intent) { - if (intent.action == Intent.ACTION_PACKAGE_ADDED) { - // 删除 APK 文件 - apkFile.delete() - } - } - } - registerReceiver(receiver, IntentFilter(Intent.ACTION_PACKAGE_ADDED)) - val intent = Intent(Intent.ACTION_VIEW) intent.setDataAndType(apkUri, "application/vnd.android.package-archive") intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION this.startActivity(intent) - // 取消注册 BroadcastReceiver - unregisterReceiver(receiver) - isUpdateAPKClicked = false } } @@ -285,6 +271,14 @@ class MainActivity : ComponentActivity() { val yaml = Yaml().load>(assets.open("skip_config.yaml")) SkipConfigManager.setConfig(yaml) + + // 清理临时文件 + val directory = this.getExternalFilesDir(null) + directory?.let { + it.listFiles()?.forEach { file -> + file.delete() + } + } } override fun onResume() {