Skip to content

Commit 33dec39

Browse files
committed
fix release
1 parent 1e15928 commit 33dec39

File tree

5 files changed

+230
-26
lines changed

5 files changed

+230
-26
lines changed

app/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ android {
3939
buildTypes {
4040
release {
4141
isMinifyEnabled = true
42+
isShrinkResources = false
4243
proguardFiles(
4344
getDefaultProguardFile("proguard-android-optimize.txt"),
4445
"proguard-rules.pro"

app/proguard-rules.pro

+198-21
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,206 @@
1-
# Add project specific ProGuard rules here.
2-
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
4-
#
5-
# For more details, see
6-
# http://developer.android.com/guide/developing/tools/proguard.html
7-
8-
# If your project uses WebView with JS, uncomment the following
9-
# and specify the fully qualified class name to the JavaScript interface
10-
# class:
11-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12-
# public *;
13-
#}
14-
15-
# Uncomment this to preserve the line number information for
16-
# debugging stack traces.
17-
#-keepattributes SourceFile,LineNumberTable
18-
19-
# If you keep the line number information, uncomment this to
20-
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
1+
# https://github.com/square/retrofit/issues/3751
2+
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
3+
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
4+
-keep,allowobfuscation,allowshrinking class retrofit2.Response
5+
# With R8 full mode generic signatures are stripped for classes that are not
6+
# kept. Suspend functions are wrapped in continuations where the type argument
7+
# is used.
8+
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
229

10+
-keep class tornaco.apps.shortx.ext** {*;}
11+
12+
# Proto
13+
-keep class tornaco.apps.shortx.core.proto** {*;}
14+
# Exclude protobuf classes
15+
-keep class com.google.protobuf.** { *; }
16+
17+
-keep class ** implements android.os.Parcelable { *; }
18+
-keep class ** implements android.os.IInterface { *; }
19+
20+
-keep class de.robv.android.xposed.**{*;}
21+
-keep class tornaco.apps.shortx.services.xposed.hooks.hook** {*;}
22+
23+
-keep,allowobfuscation @interface tornaco.apps.shortx.core.annotations.DoNotStrip
24+
25+
# Do not strip any method/class that is annotated with @DoNotStrip
26+
-keep,allowobfuscation @interface tornaco.apps.shortx.core.annotations.DoNotStrip
27+
-keep @tornaco.apps.shortx.core.annotations.DoNotStrip class * {*;}
28+
29+
-keepclasseswithmembers class * {
30+
@tornaco.apps.shortx.core.annotations.DoNotStrip <methods>;
31+
}
32+
33+
-keepclasseswithmembers class * {
34+
@tornaco.apps.shortx.core.annotations.DoNotStrip <fields>;
35+
}
36+
37+
-keepclasseswithmembers class * {
38+
@tornaco.apps.shortx.core.annotations.DoNotStrip <init>(...);
39+
}
40+
41+
42+
# This class implements IAccessibilityServiceClient.Stub from hidden api
43+
-keepclassmembers class tornaco.apps.shortx.services.wm.UiAutomationManager {
44+
public *;
45+
}
46+
47+
-keep class tornaco.apps.shortx.ui.addrule.action.model.** { *; }
48+
-keep class tornaco.apps.shortx.ui.addrule.condition.model.** { *; }
49+
-keep class tornaco.apps.shortx.ui.addrule.fact.model.** { *; }
50+
51+
52+
53+
# java.lang.VerifyError: Verifier rejected class t7.e0: void t7.e0.b(int, int[])
54+
# failed to verify: void t7.e0.b(int, int[]): [0x7] register v5 has type Precise Reference:
55+
# int[] but expected Integer (declaration of 't7.e0' appears in Anonymous-DexFile@3310950862)
56+
-keep class com.squareup.** { *; }
57+
58+
# Keep, just incase.
59+
-keep class com.topjohnwu.superuser.** { *; }
60+
61+
# Keep thanox core.
62+
-keep class github.tornaco.android.thanos.core** {*;}
63+
64+
# Used for mevl
65+
-keep class org.jsoup** {*;}
66+
67+
# Keep all for Rhino JS
68+
-keep class com.faendir.rhino_android** {*;}
69+
-keep class org.mozilla** {*;}
70+
71+
# Code Editor
72+
-keep class io.github.rosemoe** {*;}
73+
-keep class org.eclipse** {*;}
74+
-keep class org.joni** {*;}
75+
76+
-keep class tornaco.apps.shortx.services.util.http.persistentcookiejar** {*;}
77+
78+
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
79+
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
80+
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
81+
82+
-keepclassmembers class * implements java.io.Serializable {
83+
static final long serialVersionUID;
84+
private static final java.io.ObjectStreamField[] serialPersistentFields;
85+
!static !transient <fields>;
86+
private void writeObject(java.io.ObjectOutputStream);
87+
private void readObject(java.io.ObjectInputStream);
88+
java.lang.Object writeReplace();
89+
java.lang.Object readResolve();
90+
}
91+
92+
# https://github.com/thegrizzlylabs/sardine-android/issues/70
93+
-dontwarn org.xmlpull.v1.**
94+
-keep class org.xmlpull.v1.** { *; }
95+
-dontwarn android.content.res.XmlResourceParser
96+
97+
# Plugin
98+
-keep class shortx.plugin.** { *; }
99+
100+
# Please add these rules to your existing keep rules in order to suppress warnings.
101+
# This is generated automatically by the Android Gradle plugin.
102+
-dontwarn android.accessibilityservice.IAccessibilityServiceClient$Stub
103+
-dontwarn android.accessibilityservice.IAccessibilityServiceClient
104+
-dontwarn android.accessibilityservice.IAccessibilityServiceConnection
105+
-dontwarn android.app.ActivityThread
106+
-dontwarn android.app.UiAutomationConnection
107+
-dontwarn android.content.IOnPrimaryClipChangedListener$Stub
108+
-dontwarn android.content.IOnPrimaryClipChangedListener
109+
-dontwarn android.content.pm.IPackageManager$Stub
110+
-dontwarn android.content.pm.IPackageManager
111+
-dontwarn android.content.pm.PackageParser$PackageLite
112+
-dontwarn android.content.pm.PackageParser$PackageParserException
113+
-dontwarn android.content.pm.PackageParser
23114
-dontwarn android.content.pm.ParceledListSlice
115+
-dontwarn android.content.pm.SuspendDialogInfo
116+
-dontwarn android.content.pm.UserInfo
117+
-dontwarn android.net.TetheringManager$StartTetheringCallback
118+
-dontwarn android.net.TetheringManager$TetheringRequest$Builder
119+
-dontwarn android.net.TetheringManager$TetheringRequest
120+
-dontwarn android.net.TetheringManager
24121
-dontwarn android.os.ServiceManager
122+
-dontwarn android.util.Slog
123+
-dontwarn android.view.IRotationWatcher$Stub
124+
-dontwarn android.view.IRotationWatcher
125+
-dontwarn android.view.accessibility.AccessibilityInteractionClient
126+
-dontwarn com.android.internal.annotations.GuardedBy
127+
-dontwarn com.android.internal.annotations.VisibleForTesting
25128
-dontwarn com.android.internal.appwidget.IAppWidgetHost
26129
-dontwarn com.android.internal.appwidget.IAppWidgetService$Stub
27130
-dontwarn com.android.internal.appwidget.IAppWidgetService
131+
-dontwarn com.android.internal.inputmethod.InputConnectionCommandHeader
132+
-dontwarn com.android.internal.view.IInputContext
133+
-dontwarn de.robv.android.xposed.IXposedHookLoadPackage
134+
-dontwarn de.robv.android.xposed.IXposedHookZygoteInit$StartupParam
135+
-dontwarn de.robv.android.xposed.IXposedHookZygoteInit
136+
-dontwarn de.robv.android.xposed.XC_MethodHook$MethodHookParam
137+
-dontwarn de.robv.android.xposed.XC_MethodHook
138+
-dontwarn de.robv.android.xposed.XC_MethodHook$Unhook
139+
-dontwarn de.robv.android.xposed.XposedBridge
140+
-dontwarn de.robv.android.xposed.XposedHelpers
141+
-dontwarn de.robv.android.xposed.callbacks.XC_LoadPackage$LoadPackageParam
142+
-dontwarn javax.script.AbstractScriptEngine
143+
-dontwarn javax.script.Compilable
144+
-dontwarn javax.script.ScriptEngine
145+
-dontwarn javax.script.ScriptEngineFactory
146+
-dontwarn android.app.usage.IUsageStatsManager$Stub
147+
-dontwarn android.app.usage.IUsageStatsManager
148+
-dontwarn android.app.ActivityManagerInternal
149+
-dontwarn android.app.IActivityManager$Stub
150+
-dontwarn android.app.IActivityManager
151+
-dontwarn android.net.INetworkScoreCache
152+
-dontwarn android.net.NetworkKey
153+
-dontwarn android.net.NetworkScoreManager
154+
-dontwarn android.net.ScoredNetwork
155+
-dontwarn android.net.wifi.WifiNetworkScoreCache$CacheListener
156+
-dontwarn android.net.wifi.WifiNetworkScoreCache
157+
-dontwarn android.app.INotificationManager$Stub
158+
-dontwarn android.app.INotificationManager
159+
-dontwarn android.app.ActivityTaskManager
160+
-dontwarn android.app.IActivityTaskManager
161+
-dontwarn android.media.projection.IMediaProjection$Stub
162+
-dontwarn android.media.projection.IMediaProjection
163+
-dontwarn android.media.projection.IMediaProjectionManager$Stub
164+
-dontwarn android.media.projection.IMediaProjectionManager
165+
-dontwarn android.util.MathUtils
166+
-dontwarn android.bluetooth.BluetoothA2dpSink
167+
-dontwarn android.bluetooth.BluetoothHeadsetClient
168+
-dontwarn android.bluetooth.BluetoothHidHost
169+
-dontwarn android.bluetooth.BluetoothMap
170+
-dontwarn android.bluetooth.BluetoothMapClient
171+
-dontwarn android.bluetooth.BluetoothPan
172+
-dontwarn android.bluetooth.BluetoothPbapClient
173+
-dontwarn android.bluetooth.BluetoothUuid
174+
-dontwarn android.os.SystemProperties
175+
-dontwarn android.view.VelocityTracker$Estimator
176+
-dontwarn android.view.WindowManagerPolicyConstants$PointerEventListener
177+
-dontwarn android.provider.Settings$Config
178+
-dontwarn android.view.IInputFilter$Stub
179+
-dontwarn android.view.IInputFilterHost
180+
-dontwarn android.os.ShellCommand
181+
-dontwarn android.view.ISystemGestureExclusionListener$Stub
182+
-dontwarn android.view.ISystemGestureExclusionListener
183+
-dontwarn android.view.IWindowManager
184+
-dontwarn android.view.WindowManagerGlobal
185+
-dontwarn android.view.IWindowManager$Stub
186+
-dontwarn com.android.internal.inputmethod.IRemoteInputConnection
187+
-dontwarn android.net.wifi.WifiManager$SoftApCallback
188+
-dontwarn android.os.HandlerExecutor
189+
-dontwarn android.net.wifi.WifiManager$ActionListener
190+
-dontwarn org.jspecify.annotations.NullMarked
191+
-dontwarn android.app.IUidObserver$Stub
192+
-dontwarn android.app.IUidObserver
193+
194+
# Inroduced by a lib update, not sure if it 55d1baecdbfe02c40a147d696d8a805f43906890
195+
-dontwarn java.beans.BeanDescriptor
196+
-dontwarn java.beans.BeanInfo
197+
-dontwarn java.beans.IntrospectionException
198+
-dontwarn java.beans.Introspector
199+
-dontwarn java.beans.PropertyDescriptor
200+
-dontwarn javax.lang.model.SourceVersion
201+
-dontwarn java.beans.FeatureDescriptor
202+
203+
-dontwarn com.android.internal.telephony.ITelephony$Stub
204+
-dontwarn com.android.internal.telephony.ITelephony
28205
-dontwarn com.google.auto.value.AutoValue$Builder
29206
-dontwarn com.google.auto.value.AutoValue

app/src/main/java/tornaco/apps/shortx/ext/shortcut/ExportDAShortcut.kt

+29-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import android.graphics.Color
44
import android.os.Handler
55
import android.os.Looper
66
import android.widget.Toast
7+
import androidx.compose.material3.AlertDialog
8+
import androidx.compose.material3.Button
9+
import androidx.compose.material3.Text
710
import androidx.compose.runtime.Composable
11+
import androidx.compose.runtime.mutableStateOf
812
import androidx.compose.runtime.remember
913
import androidx.compose.runtime.rememberCoroutineScope
1014
import androidx.compose.ui.graphics.toArgb
@@ -20,6 +24,7 @@ import tornaco.apps.shortx.ext.ui.DASelectorDialog
2024
import tornaco.apps.shortx.ext.ui.rememberDADialogState
2125
import tornaco.apps.shortx.ui.base.ListItem
2226
import tornaco.apps.shortx.ui.base.ProgressDialog
27+
import tornaco.apps.shortx.ui.base.rememberCommonDialogState
2328
import tornaco.apps.shortx.ui.base.rememberProgressDialogState
2429
import tornaco.apps.shortx.ui.shortcut.ApkInstallState
2530
import tornaco.apps.shortx.ui.shortcut.ShortcutStubInstaller
@@ -35,6 +40,26 @@ fun ExportDAShortcut() {
3540
Handler(Looper.getMainLooper())
3641
}
3742

43+
val errorDialogState = rememberCommonDialogState()
44+
val errorMessage = remember {
45+
mutableStateOf("N/A")
46+
}
47+
if (errorDialogState.isShowing) {
48+
AlertDialog(
49+
onDismissRequest = { errorDialogState.dismiss() },
50+
confirmButton = {
51+
Button(onClick = { errorDialogState.dismiss() }) {
52+
Text(text = stringResource(id = android.R.string.ok))
53+
}
54+
},
55+
title = {
56+
Text(text = "ERROR")
57+
},
58+
text = {
59+
Text(text = errorMessage.value)
60+
})
61+
}
62+
3863
val daSelectorState = rememberDADialogState { da ->
3964
val pkgNameSuffix = Pinyin.toPinyin(da.title, "").lowercase().removeSpecialCharacters()
4065
val info = ShortcutStubInfo(
@@ -52,11 +77,10 @@ fun ExportDAShortcut() {
5277
when (it) {
5378
is ApkInstallState.InstallFailure -> {
5479
progressDialogState.dismiss()
55-
Toast.makeText(
56-
context,
57-
it.message.fallbackOnEmpty { "Failed." },
58-
Toast.LENGTH_LONG
59-
).show()
80+
81+
errorMessage.value =
82+
context.resources.getString(R.string.install_apk_error) + "\n" + it.message.fallbackOnEmpty { "Failed." }
83+
errorDialogState.show()
6084
}
6185

6286
ApkInstallState.InstallSuccess -> {

app/src/main/res/values-zh-rCN/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<string name="app_intro">这是ShortX的拓展包,有些功能因为一些原因无法上架到市场,故而放到这个拓展包内。\n\n本应用完全开源,你可以前往 Github 搜索ShortX-Repo查看源代码</string>
44
<string name="export_rule_as_apk">导出指令为快捷应用</string>
55
<string name="ext_features">拓展功能</string>
6+
<string name="install_apk_error">安装失败,请重试,或者尝试手动安装生成的apk</string>
67
</resources>

app/src/main/res/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<string name="app_intro">This is an extension package for ShortX, containing some features that, for various reasons, cannot be published on the market. \n\nThis application is fully open source, and you can visit GitHub and search for ShortX-Repo to view the source code.</string>
44
<string name="export_rule_as_apk">Export direct rule as apk</string>
55
<string name="ext_features">Ext features</string>
6+
<string name="install_apk_error">Install apk error, please try again, or install generated apk manually.</string>
67
</resources>

0 commit comments

Comments
 (0)