-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#97: First iteration of refactoring #90
Conversation
…ill be fixed later
private val _isCropMode = mutableStateOf(false) | ||
val isCropMode = _isCropMode | ||
|
||
var editionMode: EditionMode by mutableStateOf(EditionMode.IDLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EditingMode
sounds more correct. Could you create an issue for refactoring of operations as EditingMode
s?
import timber.log.Timber | ||
import java.util.Stack | ||
|
||
// FIXME: This class is overloaded, split into smaller classes/managers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as EditingMode
or separate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val editManager = EditManager() | ||
|
||
var strokeSliderExpanded by mutableStateOf(false) | ||
// TODO: Move each field into [EditionState] in next PRs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EditingState
sounds more correct. Same issue as EditingMode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is a diferent one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes in logic
Crash when opening edit screen
Crash
2023-10-31 14:18:55.757 15709-15709 [Koin] dev.arkbuilders.arkretouch2 E * Instance creation error : could not create instance for '[Factory:'dev.arkbuilders.arkretouch.edition.ui.main.EditViewModel']': org.koin.core.error.NoBeanDefFoundException: No definition found for class:'java.lang.String' q:''. Check your definitions!
org.koin.core.scope.Scope.throwDefinitionNotFound(Scope.kt:304)
org.koin.core.scope.Scope.resolveValue(Scope.kt:274)
org.koin.core.scope.Scope.resolveInstance(Scope.kt:231)
org.koin.core.scope.Scope.get(Scope.kt:210)
dev.arkbuilders.arkretouch.edition.EditionModule$create$1$invoke$$inlined$viewModelOf$default$1.invoke(ViewModelOf.kt:231)
dev.arkbuilders.arkretouch.edition.EditionModule$create$1$invoke$$inlined$viewModelOf$default$1.invoke(ViewModelOf.kt:96)
org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:51)
org.koin.core.instance.FactoryInstanceFactory.get(FactoryInstanceFactory.kt:38)
org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:116)
org.koin.core.scope.Scope.resolveValue(Scope.kt:246)
org.koin.core.scope.Scope.resolveInstance(Scope.kt:231)
org.koin.core.scope.Scope.get(Scope.kt:210)
org.koin.androidx.viewmodel.factory.KoinViewModelFactory.create(KoinViewModelFactory.kt:25)
androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:187)
androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:153)
org.koin.androidx.viewmodel.GetViewModelKt.resolveViewModel(GetViewModel.kt:44)
dev.arkbuilders.arkretouch.edition.ui.main.EditScreenKt.EditScreen(EditScreen.kt:1084)
dev.arkbuilders.arkretouch.main.MainScreenKt$MainScreen$2$5.invoke(MainScreen.kt:94)
dev.arkbuilders.arkretouch.main.MainScreenKt$MainScreen$2$5.invoke(MainScreen.kt:93)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
androidx.navigation.compose.NavHostKt$NavHost$4$2.invoke(NavHost.kt:163)
androidx.navigation.compose.NavHostKt$NavHost$4$2.invoke(NavHost.kt:162)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
androidx.navigation.compose.NavBackStackEntryProviderKt.SaveableStateProvider(NavBackStackEntryProvider.kt:60)
androidx.navigation.compose.NavBackStackEntryProviderKt.access$SaveableStateProvider(NavBackStackEntryProvider.kt:1)
androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:52)
androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:51)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
androidx.navigation.compose.NavBackStackEntryProviderKt.LocalOwnersProvider(NavBackStackEntryProvider.kt:47)
androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:162)
androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:141)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
androidx.compose.animation.CrossfadeKt$Crossfade$5$1.invoke(Crossfade.kt:133)
androidx.compose.animation.CrossfadeKt$Crossfade$5$1.invoke(Crossfade.kt:128)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:142)
androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade
2023-10-31 14:18:55.782 15709-15709 ACRA dev.arkbuilders.arkretouch2 E ACRA caught a InstanceCreationException for dev.arkbuilders.arkretouch2
org.koin.core.error.InstanceCreationException: Could not create instance for '[Factory:'dev.arkbuilders.arkretouch.edition.ui.main.EditViewModel']'
at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:58)
at org.koin.core.instance.FactoryInstanceFactory.get(FactoryInstanceFactory.kt:38)
at org.koin.core.registry.InstanceRegistry.resolveInstance$koin_core(InstanceRegistry.kt:116)
at org.koin.core.scope.Scope.resolveValue(Scope.kt:246)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:231)
at org.koin.core.scope.Scope.get(Scope.kt:210)
at org.koin.androidx.viewmodel.factory.KoinViewModelFactory.create(KoinViewModelFactory.kt:25)
at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:187)
at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.kt:153)
at org.koin.androidx.viewmodel.GetViewModelKt.resolveViewModel(GetViewModel.kt:44)
at dev.arkbuilders.arkretouch.edition.ui.main.EditScreenKt.EditScreen(EditScreen.kt:1084)
at dev.arkbuilders.arkretouch.main.MainScreenKt$MainScreen$2$5.invoke(MainScreen.kt:94)
at dev.arkbuilders.arkretouch.main.MainScreenKt$MainScreen$2$5.invoke(MainScreen.kt:93)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.navigation.compose.NavHostKt$NavHost$4$2.invoke(NavHost.kt:163)
at androidx.navigation.compose.NavHostKt$NavHost$4$2.invoke(NavHost.kt:162)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.runtime.saveable.SaveableStateHolderImpl.SaveableStateProvider(SaveableStateHolder.kt:84)
at androidx.navigation.compose.NavBackStackEntryProviderKt.SaveableStateProvider(NavBackStackEntryProvider.kt:60)
at androidx.navigation.compose.NavBackStackEntryProviderKt.access$SaveableStateProvider(NavBackStackEntryProvider.kt:1)
at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:52)
at androidx.navigation.compose.NavBackStackEntryProviderKt$LocalOwnersProvider$1.invoke(NavBackStackEntryProvider.kt:51)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.navigation.compose.NavBackStackEntryProviderKt.LocalOwnersProvider(NavBackStackEntryProvider.kt:47)
at androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:162)
at androidx.navigation.compose.NavHostKt$NavHost$4.invoke(NavHost.kt:141)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:116)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.animation.CrossfadeKt$Crossfade$5$1.invoke(Crossfade.kt:133)
at androidx.compose.animation.CrossfadeKt$Crossfade$5$1.invoke(Crossfade.kt:128)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:142)
at androidx.compose.animation.CrossfadeKt.Crossfade(Crossfade.kt:73)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:141)
at androidx.navigation.compose.NavHostKt$NavHost$5.invoke(Unknown Source:13)
at androidx.navigation.compose.NavHostKt$NavHost$5.invoke(Unknown Source:10)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:145)
2023-10-31 14:18:55.783 15709-15709 ACRA dev.arkbuilders.arkretouch2 E at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2375)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2643)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3260)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3238)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3238)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:3203)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:771)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:1031)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:125)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:534)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:503)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34)
at androidx.compose.ui.platform.AndroidUiDispatcher.performFrameDispatch(AndroidUiDispatcher.android.kt:109)
at androidx.compose.ui.platform.AndroidUiDispatcher.access$performFrameDispatch(AndroidUiDispatcher.android.kt:41)
at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.doFrame(AndroidUiDispatcher.android.kt:69)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1029)
at android.view.Choreographer.doCallbacks(Choreographer.java:854)
at android.view.Choreographer.doFrame(Choreographer.java:785)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1016)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.runtime.PausableMonotonicFrameClock@13285f4, androidx.compose.ui.platform.MotionDurationScaleImpl@60b911d, StandaloneCoroutine{Cancelling}@291cf92, AndroidUiDispatcher@2400d63]
Caused by: org.koin.core.error.NoBeanDefFoundException: No definition found for class:'java.lang.String' q:''. Check your definitions!
at org.koin.core.scope.Scope.throwDefinitionNotFound(Scope.kt:304)
at org.koin.core.scope.Scope.resolveValue(Scope.kt:274)
at org.koin.core.scope.Scope.resolveInstance(Scope.kt:231)
at org.koin.core.scope.Scope.get(Scope.kt:210)
at dev.arkbuilders.arkretouch.edition.EditionModule$create$1$invoke$$inlined$viewModelOf$default$1.invoke(ViewModelOf.kt:231)
at dev.arkbuilders.arkretouch.edition.EditionModule$create$1$invoke$$inlined$viewModelOf$default$1.invoke(ViewModelOf.kt:96)
at org.koin.core.instance.InstanceFactory.create(InstanceFactory.kt:51)
... 70 more
setupAcra() | ||
} | ||
|
||
// FIXME: Let's use Firebase crashlytics instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: String = "" | ||
) = getCachedImageUri(context, bitmap, name) | ||
|
||
// FIXME: Remove context or this function from here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -139,6 +144,7 @@ class EditViewModel( | |||
isSavingImage = false | |||
} | |||
|
|||
// FIXME: Remove context or this function from here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
|
||
// FIXME: Remove context or this function from here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -454,6 +428,7 @@ private fun loadImageWithPath( | |||
.loadInto(editManager) | |||
} | |||
|
|||
// FIXME: Remove context or this function from here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -464,12 +439,14 @@ private fun loadImageWithUri( | |||
.loadInto(editManager) | |||
} | |||
|
|||
// FIXME: Remove context or this function from here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private fun initGlideBuilder(context: Context) = Glide | ||
.with(context) | ||
.asBitmap() | ||
.skipMemoryCache(true) | ||
.diskCacheStrategy(DiskCacheStrategy.NONE) | ||
|
||
// FIXME: Remove context or this function from here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.unit.IntSize | ||
import kotlinx.serialization.Serializable | ||
|
||
// FIXME: Replace with Parcelable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth of creating follow-up issue for this? Or can be done in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need issue since it can lead to crashes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The crash and todos moved to these issues: |
Changes:
Future plans: