refactor: remove redundant semicolons
This commit is contained in:
parent
d6435cc5aa
commit
d6d25192c6
2 changed files with 8 additions and 7 deletions
|
|
@ -67,11 +67,12 @@ class FontsModule: PyonModule() {
|
||||||
if (!fontDefFile.exists()) return@with
|
if (!fontDefFile.exists()) return@with
|
||||||
|
|
||||||
val fontDef = try {
|
val fontDef = try {
|
||||||
Json { ignoreUnknownKeys = true }.decodeFromString<FontDefinition>(fontDefFile.readText())
|
val json = Json { ignoreUnknownKeys = true }
|
||||||
|
json.decodeFromString<FontDefinition>(fontDefFile.readText())
|
||||||
} catch (_: Throwable) { return@with }
|
} catch (_: Throwable) { return@with }
|
||||||
|
|
||||||
fontsDownloadsDir = File(appInfo.dataDir, "files/pyoncord/downloads/fonts").apply { mkdirs() }
|
fontsDownloadsDir = File(appInfo.dataDir, "files/pyoncord/downloads/fonts").apply { mkdirs() }
|
||||||
fontsDir = File(fontsDownloadsDir, fontDef.name).apply { mkdirs() }
|
fontsDir = File(fontsDownloadsDir, fontDef.name!!).apply { mkdirs() }
|
||||||
fontsAbsPath = fontsDir.absolutePath + "/"
|
fontsAbsPath = fontsDir.absolutePath + "/"
|
||||||
|
|
||||||
fontsDir.listFiles()?.forEach { file ->
|
fontsDir.listFiles()?.forEach { file ->
|
||||||
|
|
|
||||||
|
|
@ -59,19 +59,19 @@ class Main : IXposedHookLoadPackage {
|
||||||
lpparam.classLoader.loadClass("com.discord.react_activities.ReactActivity")
|
lpparam.classLoader.loadClass("com.discord.react_activities.ReactActivity")
|
||||||
}.getOrElse { return } // Package is not our the target app, return
|
}.getOrElse { return } // Package is not our the target app, return
|
||||||
|
|
||||||
var activity: Activity? = null;
|
var activity: Activity? = null
|
||||||
val onActivityCreateCallback = mutableSetOf<(activity: Activity) -> Unit>()
|
val onActivityCreateCallback = mutableSetOf<(activity: Activity) -> Unit>()
|
||||||
|
|
||||||
XposedBridge.hookMethod(reactActivity.getDeclaredMethod("onCreate", Bundle::class.java), object : XC_MethodHook() {
|
XposedBridge.hookMethod(reactActivity.getDeclaredMethod("onCreate", Bundle::class.java), object : XC_MethodHook() {
|
||||||
override fun beforeHookedMethod(param: MethodHookParam) {
|
override fun beforeHookedMethod(param: MethodHookParam) {
|
||||||
activity = param.thisObject as Activity;
|
activity = param.thisObject as Activity
|
||||||
onActivityCreateCallback.forEach { cb -> cb(activity!!) }
|
onActivityCreateCallback.forEach { cb -> cb(activity) }
|
||||||
onActivityCreateCallback.clear()
|
onActivityCreateCallback.clear()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
init(lpparam) { cb ->
|
init(lpparam) { cb ->
|
||||||
if (activity != null) cb(activity!!)
|
if (activity != null) cb(activity)
|
||||||
else onActivityCreateCallback.add(cb)
|
else onActivityCreateCallback.add(cb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +162,7 @@ class Main : IXposedHookLoadPackage {
|
||||||
|
|
||||||
return@async
|
return@async
|
||||||
} catch (e: RedirectResponseException) {
|
} catch (e: RedirectResponseException) {
|
||||||
if (e.response.status != HttpStatusCode.NotModified) throw e;
|
if (e.response.status != HttpStatusCode.NotModified) throw e
|
||||||
Log.e("Bunny", "Server responded with status code 304 - no changes to file")
|
Log.e("Bunny", "Server responded with status code 304 - no changes to file")
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
onActivityCreate { activity ->
|
onActivityCreate { activity ->
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue