Automatic Lint

This commit is contained in:
Syer10
2023-07-04 02:22:36 +00:00
parent c4fc80510c
commit ed7c99a1ab
278 changed files with 6866 additions and 5684 deletions

View File

@@ -21,7 +21,6 @@ abstract class AppComponent(
@get:Provides
val context: ContextWrapper,
) : ViewModelComponent, DataComponent, DomainComponent, UiComponent {
abstract val appMigrations: AppMigrations
@get:AppScope
@@ -35,7 +34,8 @@ abstract class AppComponent(
companion object {
private var appComponentInstance: AppComponent? = null
fun getInstance(context: ContextWrapper) = appComponentInstance ?: create(context)
.also { appComponentInstance = it }
fun getInstance(context: ContextWrapper) =
appComponentInstance ?: create(context)
.also { appComponentInstance = it }
}
}

View File

@@ -11,22 +11,23 @@ import ca.gosyer.jui.ios.build.BuildKonfig
import ca.gosyer.jui.uicore.vm.ContextWrapper
import me.tatarka.inject.annotations.Inject
class AppMigrations @Inject constructor(
private val migrationPreferences: MigrationPreferences,
private val contextWrapper: ContextWrapper,
) {
class AppMigrations
@Inject
constructor(
private val migrationPreferences: MigrationPreferences,
private val contextWrapper: ContextWrapper,
) {
fun runMigrations(): Boolean {
val oldVersion = migrationPreferences.appVersion().get()
if (oldVersion < BuildKonfig.MIGRATION_CODE) {
migrationPreferences.appVersion().set(BuildKonfig.MIGRATION_CODE)
fun runMigrations(): Boolean {
val oldVersion = migrationPreferences.appVersion().get()
if (oldVersion < BuildKonfig.MIGRATION_CODE) {
migrationPreferences.appVersion().set(BuildKonfig.MIGRATION_CODE)
// Fresh install
if (oldVersion == 0) {
return false
// Fresh install
if (oldVersion == 0) {
return false
}
return true
}
return true
return false
}
return false
}
}

View File

@@ -61,58 +61,66 @@ fun main() {
}
}
class SkikoAppDelegate @OverrideInit constructor() : UIResponder(), UIApplicationDelegateProtocol {
companion object : UIResponderMeta(), UIApplicationDelegateProtocolMeta
class SkikoAppDelegate
@OverrideInit
constructor() : UIResponder(), UIApplicationDelegateProtocol {
companion object : UIResponderMeta(), UIApplicationDelegateProtocolMeta
private var _window: UIWindow? = null
override fun window() = _window
override fun setWindow(window: UIWindow?) {
_window = window
}
private var _window: UIWindow? = null
override fun window() = _window
override fun setWindow(window: UIWindow?) {
_window = window
}
private val context = ContextWrapper()
private val context = ContextWrapper()
private val appComponent = AppComponent.getInstance(context)
private val appComponent = AppComponent.getInstance(context)
init {
appComponent.migrations.runMigrations()
appComponent.appMigrations.runMigrations()
init {
appComponent.migrations.runMigrations()
appComponent.appMigrations.runMigrations()
appComponent.downloadService.init()
appComponent.libraryUpdateService.init()
}
appComponent.downloadService.init()
appComponent.libraryUpdateService.init()
}
val uiHooks = appComponent.hooks
val uiHooks = appComponent.hooks
override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map<Any?, *>?): Boolean {
window = UIWindow(frame = UIScreen.mainScreen.bounds).apply {
val insets = safeAreaInsets.useContents {
WindowInsets(left.dp, top.dp, right.dp, bottom.dp)
}
override fun application(
application: UIApplication,
didFinishLaunchingWithOptions: Map<Any?, *>?,
): Boolean {
window = UIWindow(frame = UIScreen.mainScreen.bounds).apply {
val insets = safeAreaInsets.useContents {
WindowInsets(left.dp, top.dp, right.dp, bottom.dp)
}
rootViewController = Application("Tachidesk-JUI") {
CompositionLocalProvider(*uiHooks) {
AppTheme {
Box(Modifier.fillMaxSize().windowInsetsPadding(insets)) {
MainMenu()
ToastOverlay(
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = 64.dp),
context = context,
)
rootViewController = Application("Tachidesk-JUI") {
CompositionLocalProvider(*uiHooks) {
AppTheme {
Box(Modifier.fillMaxSize().windowInsetsPadding(insets)) {
MainMenu()
ToastOverlay(
modifier = Modifier
.align(Alignment.BottomCenter)
.padding(bottom = 64.dp),
context = context,
)
}
}
}
}
makeKeyAndVisible()
}
makeKeyAndVisible()
return true
}
return true
}
}
@Composable
fun ToastOverlay(modifier: Modifier, context: ContextWrapper) {
fun ToastOverlay(
modifier: Modifier,
context: ContextWrapper,
) {
var toast by remember { mutableStateOf<Pair<String, Length>?>(null) }
LaunchedEffect(Unit) {
context.toasts