diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9446453..0772df4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,6 +26,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + submodules: recursive - name: Setup Java uses: actions/setup-java@v4 diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..93ca49b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "app/src/main/cpp/external/linux-syscall-support"] + path = app/src/main/cpp/external/linux-syscall-support + url = https://chromium.googlesource.com/linux-syscall-support diff --git a/app/build.gradle b/app/build.gradle index f53ff40..fce8b1d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,16 @@ plugins { id 'com.android.application' + id 'org.jetbrains.kotlin.android' } android { namespace 'org.soralis_0912.twifucker2' compileSdk 33 - ndkVersion = "25.2.9519653" + ndkVersion "25.2.9519653" defaultConfig { minSdk 26 + //noinspection OldTargetApi targetSdk 33 versionCode 1 versionName "1.1" @@ -28,14 +30,34 @@ android { keyPassword System.getenv('KEY_PASSWORD') } } + buildFeatures { + buildConfig true + prefab true + } + androidResources { + additionalParameters "--allow-reserved-package-id", "--package-id", "0x64" + } + externalNativeBuild{ + ndkBuild { + path "src/main/cpp/Android.mk" + } + } + packagingOptions { + jniLibs { + useLegacyPackaging = true + } + } buildTypes { debug { minifyEnabled false + multiDexEnabled false proguardFiles += 'proguard-rules.pro' signingConfig signingConfigs.android } release { - minifyEnabled false + minifyEnabled true + shrinkResources true + multiDexEnabled false proguardFiles += 'proguard-rules.pro' if (file('release.jks').exists()) { signingConfig signingConfigs.release @@ -46,10 +68,21 @@ android { sourceCompatibility JavaVersion.VERSION_17 targetCompatibility JavaVersion.VERSION_17 } + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17 + } } dependencies { compileOnly 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82:sources' compileOnly files('libs/twitter.jar') + implementation 'androidx.documentfile:documentfile:1.0.1' + implementation 'androidx.recyclerview:recyclerview:1.3.2' + //noinspection GradleDependency + implementation 'org.luckypray:DexKit:1.1.8' + implementation 'com.github.kyuubiran:EzXHelper:2.0.8' + implementation 'com.tencent:mmkv:1.3.3' + implementation 'dev.rikka.ndk.thirdparty:cxx:1.2.0' + implementation 'dev.rikka.ndk.thirdparty:nativehelper:1.0.1' } \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index c97a7d9..dfdb88d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,2 +1,2 @@ --keep class de.robv.android.xposed.** --ignorewarnings \ No newline at end of file +-keep class org.soralis_0912.twifucker2.HookEntry +-keep class com.tencent.mmkv.MMKV { *; } \ No newline at end of file diff --git a/app/src/main/cpp/external/linux-syscall-support b/app/src/main/cpp/external/linux-syscall-support new file mode 160000 index 0000000..9719c1e --- /dev/null +++ b/app/src/main/cpp/external/linux-syscall-support @@ -0,0 +1 @@ +Subproject commit 9719c1e1e676814c456b55f5f070eabad6709d31 diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/ActivityHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/ActivityHook.kt index 8e7b37d..e9cf5d0 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/ActivityHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/ActivityHook.kt @@ -5,6 +5,7 @@ import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.finders.MethodFinder import icu.nullptr.twifucker.afterMeasure import java.lang.ref.WeakReference +import org.soralis_0912.twifucker2.HookEntry object ActivityHook : BaseHook() { override val name: String diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/CustomTabsHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/CustomTabsHook.kt index 2e07fde..2926c1f 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/CustomTabsHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/CustomTabsHook.kt @@ -12,8 +12,8 @@ import com.github.kyuubiran.ezxhelper.finders.MethodFinder import de.robv.android.xposed.XposedHelpers import icu.nullptr.twifucker.beforeMeasure import icu.nullptr.twifucker.exceptions.CachedHookNotFound -import icu.nullptr.twifucker.hook.HookEntry.Companion.dexKit -import icu.nullptr.twifucker.hook.HookEntry.Companion.loadDexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.dexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.loadDexKit import icu.nullptr.twifucker.hostAppLastUpdate import icu.nullptr.twifucker.hostPrefs import icu.nullptr.twifucker.moduleLastModify diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/DownloadHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/DownloadHook.kt index 843f815..8e82874 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/DownloadHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/DownloadHook.kt @@ -17,15 +17,15 @@ import com.github.kyuubiran.ezxhelper.finders.FieldFinder import com.github.kyuubiran.ezxhelper.finders.MethodFinder import dalvik.bytecode.Opcodes import de.robv.android.xposed.XposedHelpers -import icu.nullptr.twifucker.R +import org.soralis_0912.twifucker2.R import icu.nullptr.twifucker.beforeMeasure import icu.nullptr.twifucker.clearUrlQueries import icu.nullptr.twifucker.exceptions.CachedHookNotFound import icu.nullptr.twifucker.genOrigUrl import icu.nullptr.twifucker.getId -import icu.nullptr.twifucker.hook.HookEntry.Companion.currentActivity -import icu.nullptr.twifucker.hook.HookEntry.Companion.dexKit -import icu.nullptr.twifucker.hook.HookEntry.Companion.loadDexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.currentActivity +import org.soralis_0912.twifucker2.HookEntry.Companion.dexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.loadDexKit import icu.nullptr.twifucker.hostAppLastUpdate import icu.nullptr.twifucker.moduleLastModify import icu.nullptr.twifucker.modulePrefs diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/DrawerNavbarHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/DrawerNavbarHook.kt index 2da2631..0bafab9 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/DrawerNavbarHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/DrawerNavbarHook.kt @@ -8,8 +8,8 @@ import dalvik.bytecode.Opcodes import icu.nullptr.twifucker.afterMeasure import icu.nullptr.twifucker.data.TwitterItem import icu.nullptr.twifucker.exceptions.CachedHookNotFound -import icu.nullptr.twifucker.hook.HookEntry.Companion.dexKit -import icu.nullptr.twifucker.hook.HookEntry.Companion.loadDexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.dexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.loadDexKit import icu.nullptr.twifucker.hostAppLastUpdate import icu.nullptr.twifucker.moduleLastModify import icu.nullptr.twifucker.modulePrefs diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/FeatureSwitchHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/FeatureSwitchHook.kt index 2cc03c4..2926ba4 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/FeatureSwitchHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/FeatureSwitchHook.kt @@ -9,8 +9,8 @@ import de.robv.android.xposed.XC_MethodHook import icu.nullptr.twifucker.afterMeasure import icu.nullptr.twifucker.exceptions.CachedHookNotFound import icu.nullptr.twifucker.forEach -import icu.nullptr.twifucker.hook.HookEntry.Companion.dexKit -import icu.nullptr.twifucker.hook.HookEntry.Companion.loadDexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.dexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.loadDexKit import icu.nullptr.twifucker.hostAppLastUpdate import icu.nullptr.twifucker.moduleLastModify import icu.nullptr.twifucker.modulePrefs diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/HomeTimelineHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/HomeTimelineHook.kt index 6c891f3..f7a55bd 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/HomeTimelineHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/HomeTimelineHook.kt @@ -8,8 +8,8 @@ import dalvik.bytecode.Opcodes import de.robv.android.xposed.XC_MethodHook import icu.nullptr.twifucker.beforeMeasure import icu.nullptr.twifucker.exceptions.CachedHookNotFound -import icu.nullptr.twifucker.hook.HookEntry.Companion.dexKit -import icu.nullptr.twifucker.hook.HookEntry.Companion.loadDexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.dexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.loadDexKit import icu.nullptr.twifucker.hostAppLastUpdate import icu.nullptr.twifucker.moduleLastModify import icu.nullptr.twifucker.modulePrefs @@ -43,7 +43,6 @@ object HomeTimelineHook : BaseHook() { MethodFinder.fromClass(homeTimelineTabClassName).filterByName("apply").first().createHook { beforeMeasure(name) { param -> if (param.args[0] !is List<*>) return@beforeMeasure - val c = FieldFinder.fromClass(homeTimelineTabClassName).filterByType(Int::class.java) .first().getInt(param.thisObject) unhook = MethodFinder.fromClass(homeTimelineListClassName).filterByName( diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/activity/MainActivityHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/activity/MainActivityHook.kt index 52bd0d9..7198e85 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/activity/MainActivityHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/activity/MainActivityHook.kt @@ -7,7 +7,7 @@ import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook import com.github.kyuubiran.ezxhelper.Log import com.github.kyuubiran.ezxhelper.finders.MethodFinder import de.robv.android.xposed.XC_MethodHook.Unhook -import icu.nullptr.twifucker.BuildConfig +import org.soralis_0912.twifucker2.BuildConfig import icu.nullptr.twifucker.afterMeasure import icu.nullptr.twifucker.hook.BaseHook import icu.nullptr.twifucker.modulePrefs diff --git a/app/src/main/java/icu/nullptr/twifucker/hook/activity/SettingsHook.kt b/app/src/main/java/icu/nullptr/twifucker/hook/activity/SettingsHook.kt index e2f1d26..bbbd5aa 100644 --- a/app/src/main/java/icu/nullptr/twifucker/hook/activity/SettingsHook.kt +++ b/app/src/main/java/icu/nullptr/twifucker/hook/activity/SettingsHook.kt @@ -12,8 +12,8 @@ import com.github.kyuubiran.ezxhelper.finders.MethodFinder import icu.nullptr.twifucker.exceptions.CachedHookNotFound import icu.nullptr.twifucker.getId import icu.nullptr.twifucker.hook.BaseHook -import icu.nullptr.twifucker.hook.HookEntry.Companion.dexKit -import icu.nullptr.twifucker.hook.HookEntry.Companion.loadDexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.dexKit +import org.soralis_0912.twifucker2.HookEntry.Companion.loadDexKit import icu.nullptr.twifucker.hostAppLastUpdate import icu.nullptr.twifucker.moduleLastModify import icu.nullptr.twifucker.modulePrefs diff --git a/app/src/main/java/icu/nullptr/twifucker/ui/DownloadDialog.kt b/app/src/main/java/icu/nullptr/twifucker/ui/DownloadDialog.kt index 12aea3f..6de32ca 100644 --- a/app/src/main/java/icu/nullptr/twifucker/ui/DownloadDialog.kt +++ b/app/src/main/java/icu/nullptr/twifucker/ui/DownloadDialog.kt @@ -19,7 +19,7 @@ import com.github.kyuubiran.ezxhelper.AndroidLogger import com.github.kyuubiran.ezxhelper.EzXHelper.addModuleAssetPath import com.github.kyuubiran.ezxhelper.EzXHelper.appContext import com.github.kyuubiran.ezxhelper.Log -import icu.nullptr.twifucker.R +import org.soralis_0912.twifucker2.R import icu.nullptr.twifucker.modulePrefs import java.io.File import java.io.FileOutputStream diff --git a/app/src/main/java/icu/nullptr/twifucker/ui/DownloadItem.kt b/app/src/main/java/icu/nullptr/twifucker/ui/DownloadItem.kt index ba47408..1cb9a34 100644 --- a/app/src/main/java/icu/nullptr/twifucker/ui/DownloadItem.kt +++ b/app/src/main/java/icu/nullptr/twifucker/ui/DownloadItem.kt @@ -6,7 +6,7 @@ import android.util.TypedValue import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.widget.ImageButton import android.widget.TextView -import icu.nullptr.twifucker.R +import org.soralis_0912.twifucker2.R class DownloadItem(context: Context) : CustomLayout(context) { diff --git a/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchDialog.kt b/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchDialog.kt index ee30589..50be5b2 100644 --- a/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchDialog.kt +++ b/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchDialog.kt @@ -8,7 +8,7 @@ import android.view.ViewGroup.LayoutParams.MATCH_PARENT import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import androidx.recyclerview.widget.RecyclerView import com.github.kyuubiran.ezxhelper.EzXHelper.addModuleAssetPath -import icu.nullptr.twifucker.R +import org.soralis_0912.twifucker2.R import icu.nullptr.twifucker.modulePrefs import org.json.JSONArray diff --git a/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchView.kt b/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchView.kt index f76a5cc..c5a9edf 100644 --- a/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchView.kt +++ b/app/src/main/java/icu/nullptr/twifucker/ui/FeatureSwitchView.kt @@ -8,7 +8,7 @@ import android.widget.Button import android.widget.TextView import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView -import icu.nullptr.twifucker.R +import org.soralis_0912.twifucker2.R class FeatureSwitchView(context: Context) : CustomLayout(context) { diff --git a/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueDialog.kt b/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueDialog.kt index a737a7d..cbdba0b 100644 --- a/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueDialog.kt +++ b/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueDialog.kt @@ -3,7 +3,7 @@ package icu.nullptr.twifucker.ui import android.app.AlertDialog import android.content.Context import com.github.kyuubiran.ezxhelper.EzXHelper.addModuleAssetPath -import icu.nullptr.twifucker.R +import org.soralis_0912.twifucker2.R import icu.nullptr.twifucker.modulePrefs import org.json.JSONArray import org.json.JSONObject diff --git a/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueView.kt b/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueView.kt index d60810d..51be966 100644 --- a/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueView.kt +++ b/app/src/main/java/icu/nullptr/twifucker/ui/KeyValueView.kt @@ -7,7 +7,7 @@ import android.view.ViewGroup.LayoutParams.WRAP_CONTENT import android.view.inputmethod.InputMethodManager import android.widget.EditText import android.widget.Switch -import icu.nullptr.twifucker.R +import org.soralis_0912.twifucker2.R class KeyValueView(context: Context) : CustomLayout(context) { var isBoolean: Boolean = true diff --git a/app/src/main/java/icu/nullptr/twifucker/ui/SettingsDialog.kt b/app/src/main/java/icu/nullptr/twifucker/ui/SettingsDialog.kt index 560fded..7f1d5d4 100644 --- a/app/src/main/java/icu/nullptr/twifucker/ui/SettingsDialog.kt +++ b/app/src/main/java/icu/nullptr/twifucker/ui/SettingsDialog.kt @@ -22,8 +22,10 @@ import com.github.kyuubiran.ezxhelper.misc.Utils.restartHostApp import icu.nullptr.twifucker.* import icu.nullptr.twifucker.hook.DrawerNavbarHook.bottomNavbarItems import icu.nullptr.twifucker.hook.DrawerNavbarHook.drawerItems -import icu.nullptr.twifucker.hook.HookEntry.Companion.isLogcatProcessInitialized -import icu.nullptr.twifucker.hook.HookEntry.Companion.logcatProcess +import org.soralis_0912.twifucker2.BuildConfig +import org.soralis_0912.twifucker2.HookEntry.Companion.isLogcatProcessInitialized +import org.soralis_0912.twifucker2.HookEntry.Companion.logcatProcess +import org.soralis_0912.twifucker2.R class SettingsDialog(context: Context) : AlertDialog.Builder(context) { diff --git a/app/src/main/java/me/swak/Utils.java b/app/src/main/java/me/swak/Utils.java index 63cc1bc..c2c99dc 100644 --- a/app/src/main/java/me/swak/Utils.java +++ b/app/src/main/java/me/swak/Utils.java @@ -15,7 +15,7 @@ public static Uri changeHost(Uri uri) { public static String getPref(String str, String str2) { try { return PreferenceManager.getDefaultSharedPreferences(StartApp.ctx).getString(str, str2); - } catch (Exception e) { + } catch (ClassCastException e) { logger(e.toString()); return str2; } @@ -25,7 +25,7 @@ public static String getPref(String str, String str2) { public static boolean getPref(String str, boolean z) { try { return PreferenceManager.getDefaultSharedPreferences(StartApp.ctx).getBoolean(str, z); - } catch (Exception e) { + } catch (ClassCastException e) { logger(e.toString()); return z; } diff --git a/app/src/main/java/org/soralis_0912/twifucker2/Main.kt b/app/src/main/java/org/soralis_0912/twifucker2/Main.kt index d6efb02..2acfa03 100644 --- a/app/src/main/java/org/soralis_0912/twifucker2/Main.kt +++ b/app/src/main/java/org/soralis_0912/twifucker2/Main.kt @@ -12,7 +12,7 @@ import com.github.kyuubiran.ezxhelper.finders.MethodFinder import de.robv.android.xposed.IXposedHookLoadPackage import de.robv.android.xposed.IXposedHookZygoteInit import de.robv.android.xposed.callbacks.XC_LoadPackage -import icu.nullptr.twifucker.BuildConfig +import icu.nullptr.twifucker.hook.* import icu.nullptr.twifucker.hook.activity.MainActivityHook import icu.nullptr.twifucker.hook.activity.SettingsHook import icu.nullptr.twifucker.hostVersionCode diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..743ad03 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +android.useAndroidX=true +kotlin.code.style=official diff --git a/settings.gradle b/settings.gradle index 8319878..97252f6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,11 +1,11 @@ pluginManagement { repositories { - gradlePluginPortal() google() mavenCentral() } plugins { id 'com.android.application' version '8.2.2' apply false + id 'org.jetbrains.kotlin.android' version '1.9.22' apply false } } dependencyResolutionManagement {