diff --git a/app/.gitignore b/app/.gitignore
index 42afabf..956c004 100644
--- a/app/.gitignore
+++ b/app/.gitignore
@@ -1 +1,2 @@
-/build
\ No newline at end of file
+/build
+/release
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index d06bae8..4cb7ce9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -11,8 +11,8 @@ android {
applicationId "kongsang.swybot"
minSdk 24
targetSdk 33
- versionCode 1
- versionName "1.0"
+ versionCode 2
+ versionName "2.0"
python {
version "3.8"
pip {
diff --git a/app/release/app-release.apk b/app/release/app-release.apk
deleted file mode 100644
index 5e00adf..0000000
Binary files a/app/release/app-release.apk and /dev/null differ
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
deleted file mode 100644
index 1965f40..0000000
--- a/app/release/output-metadata.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "version": 3,
- "artifactType": {
- "type": "APK",
- "kind": "Directory"
- },
- "applicationId": "kongsang.swybot",
- "variantName": "release",
- "elements": [
- {
- "type": "SINGLE",
- "filters": [],
- "attributes": [],
- "versionCode": 1,
- "versionName": "1.0",
- "outputFile": "app-release.apk"
- }
- ],
- "elementType": "File"
-}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9e6e77c..29ea6a8 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,6 +7,7 @@
+
activityResultLauncher;
@Override
@@ -38,9 +40,20 @@ protected void onCreate(Bundle savedInstanceState) {
}
try {
- PackageInfo swyPackageInfo = getPackageManager().getPackageInfo(SWY_PACKAGE_NAME, 0);
- Log.i(TAG, "Found swy version: " + swyPackageInfo.versionName);
- } catch (PackageManager.NameNotFoundException e) {
+ PackageInfo swyPackageInfo = getPackageManager().getPackageInfo(SWY_BT_PACKAGE_NAME, 0);
+ gamePackageName = SWY_BT_PACKAGE_NAME;
+ Log.i(TAG, "Found swy (baitian) version: " + swyPackageInfo.versionName);
+ } catch (PackageManager.NameNotFoundException e1) {
+ e1.printStackTrace();
+ try {
+ PackageInfo swyPackageInfo = getPackageManager().getPackageInfo(SWY_PACKAGE_NAME, 0);
+ gamePackageName = SWY_PACKAGE_NAME;
+ Log.i(TAG, "Found swy (tencent) version: " + swyPackageInfo.versionName);
+ } catch (PackageManager.NameNotFoundException e2) {
+ gamePackageName = null;
+ }
+ }
+ if (gamePackageName == null) {
new AlertDialog.Builder(this)
.setMessage(R.string.exit_message)
.setPositiveButton(android.R.string.ok, (dialog, which) -> finish())
@@ -86,7 +99,7 @@ private void startGame() {
if (SystemUtil.isHarmonyOS() && SystemUtil.getHarmonyVersion() >= 3) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
- startActivity(getPackageManager().getLaunchIntentForPackage(SWY_PACKAGE_NAME));
+ startActivity(getPackageManager().getLaunchIntentForPackage(gamePackageName));
finish();
}
}
diff --git a/app/src/main/java/kongsang/swybot/SwyBotService.java b/app/src/main/java/kongsang/swybot/SwyBotService.java
index f27dcdb..af432c5 100644
--- a/app/src/main/java/kongsang/swybot/SwyBotService.java
+++ b/app/src/main/java/kongsang/swybot/SwyBotService.java
@@ -71,7 +71,7 @@ public void onCreate() {
protected void onServiceConnected() {
Log.i(TAG, "Accessibility service connected");
AccessibilityServiceInfo serviceInfo = getServiceInfo();
- serviceInfo.packageNames = new String[] { MainActivity.SWY_PACKAGE_NAME };
+ serviceInfo.packageNames = new String[] { MainActivity.SWY_PACKAGE_NAME, MainActivity.SWY_BT_PACKAGE_NAME };
setServiceInfo(serviceInfo);
}