Skip to content

Commit

Permalink
Revert "Possible iOS fix?"
Browse files Browse the repository at this point in the history
This reverts commit 3c0686f.
  • Loading branch information
Wavesonics committed Aug 31, 2023
1 parent 3c0686f commit 1ab6a99
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ package com.darkrockstudios.apps.hammer.common.components.projectselection.proje
import com.arkivanov.decompose.value.Value
import com.arkivanov.essenty.parcelable.Parcelable
import com.arkivanov.essenty.parcelable.Parcelize
import com.arkivanov.essenty.parcelable.TypeParceler
import com.darkrockstudios.apps.hammer.common.components.projecteditor.metadata.ProjectMetadata
import com.darkrockstudios.apps.hammer.common.components.projectselection.ProjectData
import com.darkrockstudios.apps.hammer.common.data.ProjectDef
import com.darkrockstudios.apps.hammer.common.data.projectsync.SyncLogMessage
import com.darkrockstudios.apps.hammer.common.dependencyinjection.HammerComponent
import com.darkrockstudios.apps.hammer.common.fileio.HPath
import com.darkrockstudios.apps.hammer.common.parcelize.StringResourceParceler
import dev.icerock.moko.resources.StringResource

interface ProjectsList : HammerComponent {
val state: Value<State>
Expand All @@ -30,15 +27,14 @@ interface ProjectsList : HammerComponent {
fun onProjectNameUpdate(newProjectName: String)

@Parcelize
@TypeParceler<StringResource, StringResourceParceler>()
data class State(
val projects: List<ProjectData> = mutableListOf(),
val projectsPath: HPath,
val isServerSynced: Boolean = false,
val syncState: SyncState = SyncState(),
val showCreateDialog: Boolean = false,
val createDialogProjectName: String = "",
val toast: StringResource? = null
val toast: String? = null
) : Parcelable

@Parcelize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ProjectsListComponent(

private fun showToast(message: StringResource) {
_state.getAndUpdate {
it.copy(toast = message)
it.copy(toast = strRes.get(message))
}
}

Expand Down Expand Up @@ -183,7 +183,7 @@ class ProjectsListComponent(
(result.exceptionOrNull() as? ProjectCreationFailedException)?.errorMessage?.let { message ->
_state.getAndUpdate {
it.copy(
toast = message
toast = strRes.get(message)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@ package com.darkrockstudios.apps.hammer.common.parcelize
import com.arkivanov.essenty.parcelable.Parceler
import dev.icerock.moko.resources.StringResource
import kotlinx.datetime.Instant
import platform.Foundation.NSCoder

internal actual object InstantParceler : Parceler<Instant>

internal actual object StringResourceParceler : Parceler<StringResource> {
override fun create(coder: NSCoder): StringResource {
val id = coder.decodeStringForKey(key = "stringResource")
return StringResource(resourceId = id)
}


override fun StringResource.write(coder: NSCoder) {
coder.encodeString(value = resourceId, forKey = "stringResource")
}
}
internal actual object StringResourceParceler : Parceler<StringResource>

0 comments on commit 1ab6a99

Please sign in to comment.