Skip to content

Commit

Permalink
bump deps & add support for v5.0.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
Juby210 committed Feb 6, 2024
1 parent c4d137a commit 050290f
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SwiftBackupPrem
Swift Backup Premium LSPosed module (tested on v4.2.3 and v4.2.5, but should also work on newer versions - thanks to [DexKit](https://github.com/LuckyPray/DexKit)).
Swift Backup Premium LSPosed module (tested on v4.2.3, v4.2.5 and v5.0.4, but should also work on newer versions - thanks to [DexKit](https://github.com/LuckyPray/DexKit)).

Optionally also allows you to set your own firebase credentials, so only your firebase instance is used.

Expand Down
15 changes: 6 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
applicationId = "io.github.juby210.swiftbackupprem"
minSdk = 27
targetSdk = 34
versionCode = 203
versionName = "2.0.3"
versionCode = 204
versionName = "2.0.4"
}

buildTypes {
Expand All @@ -40,7 +40,7 @@ android {
compose = true
resValues = false
}
composeOptions.kotlinCompilerExtensionVersion = "1.5.3"
composeOptions.kotlinCompilerExtensionVersion = "1.5.8"
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
Expand All @@ -50,18 +50,15 @@ android {

dependencies {
compileOnly("de.robv.android.xposed:api:82")
implementation("org.luckypray:dexkit:2.0.0-rc7")
implementation("org.luckypray:dexkit:2.0.0")

// AndroidX
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.activity:activity-compose:1.8.0")
implementation("androidx.activity:activity-compose:1.8.2")

// Compose
val composeVersion = "1.5.4"
val composeVersion = "1.6.0"
implementation("androidx.compose.ui:ui:$composeVersion")
implementation("androidx.compose.ui:ui-tooling:$composeVersion")
implementation("androidx.compose.material3:material3:1.1.2")

// Accompanist
implementation("com.google.accompanist:accompanist-systemuicontroller:0.32.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import io.github.juby210.swiftbackupprem.util.PreferencesManager
import org.json.JSONArray
import org.json.JSONObject
import java.io.File
import java.lang.reflect.Modifier

fun hookBackupApk(cl: ClassLoader, ctx: Context, customFirebaseApp: Boolean, prefs: PreferencesManager) {
val pathsA = cl.loadClass("${paths!!.name}\$a")
XposedBridge.hookMethod(backupApk!!.getDeclaredMethod("c"), object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) {
val pathsClass = paths!!
val aInstance = pathsClass.getDeclaredField("y").get(null)
val aInstance = pathsClass.declaredFields.first { it.type == pathsA }.get(null)
val instance = pathsA.getDeclaredMethod("d").invoke(aInstance)
val basePath = pathsClass.getDeclaredMethod("m").invoke(instance) as String

Expand Down
17 changes: 8 additions & 9 deletions app/src/main/java/io/github/juby210/swiftbackupprem/DexKit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import android.content.Context
import android.util.Log
import android.widget.Toast
import org.luckypray.dexkit.DexKitBridge
import org.luckypray.dexkit.query.matchers.*
import java.lang.reflect.Modifier

private val classesClientId = mapOf(561 to "kf.s0", 569 to "rf.r0")
private val classesBackupApk = mapOf(561 to "org.swiftapps.swiftbackup.common.w1", 569 to "org.swiftapps.swiftbackup.common.n2")
private val classesPaths = mapOf(561 to "me.b", 569 to "te.c")
private val classesClientId = mapOf(561 to "kf.s0", 569 to "rf.r0", 590 to "eh.u")
private val classesBackupApk = mapOf(561 to "org.swiftapps.swiftbackup.common.w1", 569 to "org.swiftapps.swiftbackup.common.n2", 590 to "org.swiftapps.swiftbackup.common.c2")
private val classesPaths = mapOf(561 to "me.b", 569 to "te.c", 590 to "org.swiftapps.swiftbackup.a")

@JvmField
var clientId: Class<*>? = null
Expand All @@ -30,8 +29,8 @@ fun findObfuscatedClasses(ctx: Context, cl: ClassLoader, sourceDir: String) {
} else {
System.loadLibrary("dexkit")
val excludePackages = listOf("android", "androidx", "com", "iammert", "java", "javax", "kotlin", "kotlinx", "moe", "nz.mega",
"okhttp3", "okio", "org", "retrofit", "rikka")
DexKitBridge.create(sourceDir)?.use { bridge ->
"okhttp3", "okio", "retrofit", "rikka")
DexKitBridge.create(sourceDir).use { bridge ->
bridge.findClass {
excludePackages(excludePackages)
matcher {
Expand Down Expand Up @@ -63,7 +62,7 @@ fun findObfuscatedClasses(ctx: Context, cl: ClassLoader, sourceDir: String) {
addParamType("boolean")
}
}
}.firstOrNull()?.let {
}.singleOrNull()?.let {
clientId = it.getInstance(cl)
Log.d("SBP", "Found client id class: ${it.name}")
}
Expand All @@ -83,7 +82,7 @@ fun findObfuscatedClasses(ctx: Context, cl: ClassLoader, sourceDir: String) {
usingStrings("stable", "swift_backup_apks/", "SwiftBackupApkSaver")
}
}
}.firstOrNull()?.let {
}.singleOrNull()?.let {
backupApk = it.getInstance(cl)
Log.d("SBP", "Found backup apk class: ${it.name}")
}
Expand All @@ -107,7 +106,7 @@ fun findObfuscatedClasses(ctx: Context, cl: ClassLoader, sourceDir: String) {
}
}
}
}.firstOrNull()?.let {
}.singleOrNull()?.let {
paths = it.getInstance(cl)
Log.d("SBP", "Found paths class: ${it.name}")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
Expand All @@ -29,6 +30,7 @@ class MainActivity : ComponentActivity() {
@SuppressLint("WorldReadableFiles")
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)

val prefs: PreferencesManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.platform.LocalContext
import com.google.accompanist.systemuicontroller.rememberSystemUiController

@Composable
fun Theme(content: @Composable () -> Unit) {
Expand All @@ -19,15 +17,6 @@ fun Theme(content: @Composable () -> Unit) {
else -> lightColorScheme()
}

val systemUiController = rememberSystemUiController()

SideEffect {
systemUiController.setSystemBarsColor(
color = colorScheme.background,
darkIcons = !isDarkTheme
)
}

MaterialTheme(
colorScheme = colorScheme,
content = content
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:8.1.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
classpath("com.android.tools.build:gradle:8.2.2")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Oct 27 16:54:55 CEST 2023
#Tue Feb 06 16:02:37 CET 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 050290f

Please sign in to comment.