-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Background** This PR introduces fixes for design part of RemoteControls **Changes** - Title/Subtitle on remote screen - Connection API for infrareds - Progress loading on remote screen **Test plan** - Open setup screen, find remote - See the progress now is shown on remote screen
- Loading branch information
1 parent
45b8202
commit fcce80f
Showing
64 changed files
with
687 additions
and
328 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
12 changes: 12 additions & 0 deletions
12
...nts/infrared/api/src/main/kotlin/com/flipperdevices/infrared/api/InfraredConnectionApi.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,12 @@ | ||
package com.flipperdevices.infrared.api | ||
|
||
import com.flipperdevices.bridge.service.api.FlipperServiceApi | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
interface InfraredConnectionApi { | ||
fun getState(serviceApi: FlipperServiceApi): Flow<InfraredEmulateState> | ||
|
||
enum class InfraredEmulateState { | ||
NOT_CONNECTED, CONNECTING, SYNCING, UPDATE_FLIPPER, ALL_GOOD | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...ed/impl/src/main/kotlin/com/flipperdevices/infrared/impl/api/InfraredConnectionApiImpl.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,55 @@ | ||
package com.flipperdevices.infrared.impl.api | ||
|
||
import com.flipperdevices.bridge.api.manager.ktx.state.ConnectionState | ||
import com.flipperdevices.bridge.api.manager.ktx.state.FlipperSupportedState | ||
import com.flipperdevices.bridge.api.utils.Constants.API_SUPPORTED_INFRARED_EMULATE | ||
import com.flipperdevices.bridge.service.api.FlipperServiceApi | ||
import com.flipperdevices.bridge.synchronization.api.SynchronizationApi | ||
import com.flipperdevices.bridge.synchronization.api.SynchronizationState | ||
import com.flipperdevices.core.di.AppGraph | ||
import com.flipperdevices.core.log.info | ||
import com.flipperdevices.infrared.api.InfraredConnectionApi | ||
import com.squareup.anvil.annotations.ContributesBinding | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.combine | ||
import javax.inject.Inject | ||
|
||
@ContributesBinding(AppGraph::class, InfraredConnectionApi::class) | ||
class InfraredConnectionApiImpl @Inject constructor( | ||
private val synchronizationApi: SynchronizationApi | ||
) : InfraredConnectionApi { | ||
override fun getState( | ||
serviceApi: FlipperServiceApi | ||
): Flow<InfraredConnectionApi.InfraredEmulateState> { | ||
return combine( | ||
serviceApi.flipperVersionApi.getVersionInformationFlow(), | ||
serviceApi.connectionInformationApi.getConnectionStateFlow(), | ||
synchronizationApi.getSynchronizationState() | ||
) { versionInformation, connectionState, synchronizationState -> | ||
val infraredEmulateState = when { | ||
connectionState is ConnectionState.Disconnected -> { | ||
InfraredConnectionApi.InfraredEmulateState.NOT_CONNECTED | ||
} | ||
|
||
connectionState !is ConnectionState.Ready || | ||
connectionState.supportedState != FlipperSupportedState.READY -> { | ||
InfraredConnectionApi.InfraredEmulateState.CONNECTING | ||
} | ||
|
||
synchronizationState is SynchronizationState.InProgress -> { | ||
InfraredConnectionApi.InfraredEmulateState.SYNCING | ||
} | ||
|
||
versionInformation == null || versionInformation < API_SUPPORTED_INFRARED_EMULATE -> { | ||
InfraredConnectionApi.InfraredEmulateState.UPDATE_FLIPPER | ||
} | ||
|
||
else -> { | ||
InfraredConnectionApi.InfraredEmulateState.ALL_GOOD | ||
} | ||
} | ||
info { "#onServiceApiReady $infraredEmulateState" } | ||
infraredEmulateState | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.