-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add better information during sync (#961)
**Background** Current synchronization screen doesn't show us any details about current synchronization **Changes** - Edit ProgressTracker to add details into it - Add more details to current syncrhonization **Test plan** - Open app - See there's now more steps and you can see what now is actually syncing
- Loading branch information
1 parent
f312064
commit abce7be
Showing
26 changed files
with
443 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ts/archive/impl/src/main/java/com/flipperdevices/archive/impl/viewmodel/SpeedViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.flipperdevices.archive.impl.viewmodel | ||
|
||
import com.flipperdevices.bridge.service.api.provider.FlipperServiceProvider | ||
import com.flipperdevices.core.ui.lifecycle.DecomposeViewModel | ||
import kotlinx.coroutines.flow.SharingStarted | ||
import kotlinx.coroutines.flow.collect | ||
import kotlinx.coroutines.flow.flow | ||
import kotlinx.coroutines.flow.onEach | ||
import kotlinx.coroutines.flow.shareIn | ||
import javax.inject.Inject | ||
|
||
class SpeedViewModel @Inject constructor( | ||
private val serviceProvider: FlipperServiceProvider, | ||
) : DecomposeViewModel() { | ||
val speedFlow = flow { | ||
serviceProvider.getServiceApi() | ||
.requestApi | ||
.getSpeed() | ||
.onEach { emit(it) } | ||
.collect() | ||
}.shareIn(viewModelScope, SharingStarted.Eagerly, 1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 25 additions & 4 deletions
29
...c/commonMain/kotlin/com/flipperdevices/bridge/synchronization/api/SynchronizationState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
package com.flipperdevices.bridge.synchronization.api | ||
|
||
import androidx.compose.runtime.Immutable | ||
import com.flipperdevices.bridge.dao.api.model.FlipperKeyType | ||
|
||
@Immutable | ||
sealed class SynchronizationState { | ||
data object NotStarted : SynchronizationState() | ||
data class InProgress(val progress: Float) : SynchronizationState() | ||
data object Finished : SynchronizationState() | ||
sealed interface SynchronizationState { | ||
data object NotStarted : SynchronizationState | ||
|
||
sealed interface InProgress : SynchronizationState { | ||
val progress: Float | ||
|
||
data class FileInProgress( | ||
override val progress: Float, | ||
val fileName: String | ||
) : InProgress | ||
|
||
data class Default(override val progress: Float) : InProgress | ||
|
||
data class Prepare(override val progress: Float) : InProgress | ||
|
||
data class PrepareHashes( | ||
override val progress: Float, | ||
val keyType: FlipperKeyType | ||
) : InProgress | ||
|
||
data class Favorites(override val progress: Float) : InProgress | ||
} | ||
|
||
data object Finished : SynchronizationState | ||
} |
Oops, something went wrong.