fix: rearrange some stuff
This commit is contained in:
parent
143eed8cb2
commit
4ccf6fa1c8
3 changed files with 28 additions and 41 deletions
|
@ -38,8 +38,8 @@ import logcat.AndroidLogcatLogger
|
|||
import logcat.LogPriority
|
||||
import logcat.LogcatLogger
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.addSingletonFactory
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.lang.IllegalStateException
|
||||
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
|
@ -64,13 +64,19 @@ class App : MultiDexApplication() {
|
|||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
PrefManager.init(this)
|
||||
|
||||
val crashlytics =
|
||||
ani.dantotsu.connections.crashlytics.CrashlyticsFactory.createCrashlytics()
|
||||
Injekt.addSingletonFactory<CrashlyticsInterface> { crashlytics }
|
||||
crashlytics.initialize(this)
|
||||
Logger.init(this)
|
||||
Thread.setDefaultUncaughtExceptionHandler(FinalExceptionHandler())
|
||||
Logger.log(Log.WARN, "App: Logging started")
|
||||
|
||||
Injekt.importModule(AppModule(this))
|
||||
Injekt.importModule(PreferenceModule(this))
|
||||
|
||||
val crashlytics = Injekt.get<CrashlyticsInterface>()
|
||||
crashlytics.initialize(this)
|
||||
|
||||
val useMaterialYou: Boolean = PrefManager.getVal(PrefName.UseMaterialYou)
|
||||
if (useMaterialYou) {
|
||||
|
@ -92,10 +98,6 @@ class App : MultiDexApplication() {
|
|||
}
|
||||
crashlytics.setCustomKey("device Info", SettingsActivity.getDeviceInfo())
|
||||
|
||||
Logger.init(this)
|
||||
Thread.setDefaultUncaughtExceptionHandler(FinalExceptionHandler())
|
||||
Logger.log(Log.WARN, "App: Logging started")
|
||||
|
||||
initializeNetwork()
|
||||
|
||||
setupNotificationChannels()
|
||||
|
@ -154,6 +156,7 @@ class App : MultiDexApplication() {
|
|||
override fun onActivityCreated(p0: Activity, p1: Bundle?) {
|
||||
lastActivity = p0.javaClass.simpleName
|
||||
}
|
||||
|
||||
override fun onActivityStarted(p0: Activity) {
|
||||
currentActivity = p0
|
||||
}
|
||||
|
|
|
@ -60,10 +60,6 @@ class AppModule(val app: Application) : InjektModule {
|
|||
|
||||
addSingletonFactory { StandaloneDatabaseProvider(app) }
|
||||
|
||||
addSingletonFactory<CrashlyticsInterface> {
|
||||
ani.dantotsu.connections.crashlytics.CrashlyticsFactory.createCrashlytics()
|
||||
}
|
||||
|
||||
addSingletonFactory { MangaCache() }
|
||||
|
||||
ContextCompat.getMainExecutor(app).execute {
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.content.pm.PackageInfo
|
|||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import androidx.core.content.pm.PackageInfoCompat
|
||||
import ani.dantotsu.connections.crashlytics.CrashlyticsInterface
|
||||
import ani.dantotsu.media.MediaType
|
||||
import ani.dantotsu.parsers.NovelInterface
|
||||
import ani.dantotsu.parsers.novel.NovelExtension
|
||||
|
@ -26,6 +27,8 @@ import eu.kanade.tachiyomi.util.lang.Hash
|
|||
import eu.kanade.tachiyomi.util.system.getApplicationIcon
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.Locale
|
||||
|
||||
|
@ -255,22 +258,6 @@ internal object ExtensionLoader {
|
|||
|
||||
val signatureHash = getSignatureHash(pkgInfo)
|
||||
|
||||
if (signatureHash == null) {
|
||||
Logger.log("Package $pkgName isn't signed")
|
||||
return AnimeLoadResult.Error
|
||||
} else if (signatureHash !in trustedSignaturesAnime) {
|
||||
val extension = AnimeExtension.Untrusted(
|
||||
extName,
|
||||
pkgName,
|
||||
versionName,
|
||||
versionCode,
|
||||
libVersion,
|
||||
signatureHash
|
||||
)
|
||||
Logger.log("Extension $pkgName isn't trusted")
|
||||
return AnimeLoadResult.Untrusted(extension)
|
||||
}
|
||||
|
||||
val isNsfw = appInfo.metaData.getInt("$ANIME_PACKAGE$XX_METADATA_NSFW") == 1
|
||||
if (!loadNsfwSource && isNsfw) {
|
||||
Logger.log("NSFW extension $pkgName not allowed")
|
||||
|
@ -281,7 +268,13 @@ internal object ExtensionLoader {
|
|||
val hasChangelog =
|
||||
appInfo.metaData.getInt("$ANIME_PACKAGE$XX_METADATA_HAS_CHANGELOG", 0) == 1
|
||||
|
||||
val classLoader = PathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
||||
val classLoader = try{
|
||||
PathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
||||
} catch (e: Throwable) {
|
||||
Logger.log("Extension load error: $extName")
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
return AnimeLoadResult.Error
|
||||
}
|
||||
|
||||
val sources = appInfo.metaData.getString("$ANIME_PACKAGE$XX_METADATA_SOURCE_CLASS")!!
|
||||
.split(";")
|
||||
|
@ -371,17 +364,6 @@ internal object ExtensionLoader {
|
|||
|
||||
val signatureHash = getSignatureHash(pkgInfo)
|
||||
|
||||
/* temporarily disabling signature check TODO: remove?
|
||||
if (signatureHash == null) {
|
||||
Logger.log("Package $pkgName isn't signed")
|
||||
return MangaLoadResult.Error
|
||||
} else if (signatureHash !in trustedSignatures) {
|
||||
val extension = MangaExtension.Untrusted(extName, pkgName, versionName, versionCode, libVersion, signatureHash)
|
||||
Logger.log("Extension $pkgName isn't trusted")
|
||||
return MangaLoadResult.Untrusted(extension)
|
||||
}
|
||||
*/
|
||||
|
||||
val isNsfw = appInfo.metaData.getInt("$MANGA_PACKAGE$XX_METADATA_NSFW") == 1
|
||||
if (!loadNsfwSource && isNsfw) {
|
||||
Logger.log("NSFW extension $pkgName not allowed")
|
||||
|
@ -392,7 +374,13 @@ internal object ExtensionLoader {
|
|||
val hasChangelog =
|
||||
appInfo.metaData.getInt("$MANGA_PACKAGE$XX_METADATA_HAS_CHANGELOG", 0) == 1
|
||||
|
||||
val classLoader = PathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
||||
val classLoader = try{
|
||||
PathClassLoader(appInfo.sourceDir, null, context.classLoader)
|
||||
} catch (e: Throwable) {
|
||||
Logger.log("Extension load error: $extName")
|
||||
Injekt.get<CrashlyticsInterface>().logException(e)
|
||||
return MangaLoadResult.Error
|
||||
}
|
||||
|
||||
val sources = appInfo.metaData.getString("$MANGA_PACKAGE$XX_METADATA_SOURCE_CLASS")!!
|
||||
.split(";")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue