Skip to content

Commit

Permalink
Implementing Kotlin and C++
Browse files Browse the repository at this point in the history
  • Loading branch information
s1204IT committed Feb 13, 2024
1 parent 2b3a2cc commit e2a710b
Show file tree
Hide file tree
Showing 24 changed files with 75 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:

- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Java
uses: actions/setup-java@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
37 changes: 35 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
Expand All @@ -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'
}
4 changes: 2 additions & 2 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-keep class de.robv.android.xposed.**
-ignorewarnings
-keep class org.soralis_0912.twifucker2.HookEntry
-keep class com.tencent.mmkv.MMKV { *; }
1 change: 1 addition & 0 deletions app/src/main/cpp/external/linux-syscall-support
Submodule linux-syscall-support added at 9719c1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/icu/nullptr/twifucker/hook/DownloadHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/icu/nullptr/twifucker/ui/DownloadItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/icu/nullptr/twifucker/ui/KeyValueView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/icu/nullptr/twifucker/ui/SettingsDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/me/swak/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/soralis_0912/twifucker2/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.useAndroidX=true
kotlin.code.style=official
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit e2a710b

Please sign in to comment.