Fix moar ktlint issues
This commit is contained in:
parent
d3830af78b
commit
378692f743
528 changed files with 146 additions and 629 deletions
|
|
@ -37,7 +37,6 @@ class AnalyticsOptInNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: AnalyticsOptInPresenter,
|
private val presenter: AnalyticsOptInPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
private fun onClickTerms(activity: Activity, darkTheme: Boolean) {
|
private fun onClickTerms(activity: Activity, darkTheme: Boolean) {
|
||||||
activity.openUrlInChromeCustomTab(null, darkTheme, AnalyticsConfig.POLICY_LINK)
|
activity.openUrlInChromeCustomTab(null, darkTheme, AnalyticsConfig.POLICY_LINK)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ class AnalyticsOptInPresenter @Inject constructor(
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
private val analyticsService: AnalyticsService,
|
private val analyticsService: AnalyticsService,
|
||||||
) : Presenter<AnalyticsOptInState> {
|
) : Presenter<AnalyticsOptInState> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): AnalyticsOptInState {
|
override fun present(): AnalyticsOptInState {
|
||||||
val localCoroutineScope = rememberCoroutineScope()
|
val localCoroutineScope = rememberCoroutineScope()
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ class DefaultAnalyticsPreferencesPresenter @Inject constructor(
|
||||||
private val analyticsService: AnalyticsService,
|
private val analyticsService: AnalyticsService,
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
) : AnalyticsPreferencesPresenter {
|
) : AnalyticsPreferencesPresenter {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): AnalyticsPreferencesState {
|
override fun present(): AnalyticsPreferencesState {
|
||||||
val localCoroutineScope = rememberCoroutineScope()
|
val localCoroutineScope = rememberCoroutineScope()
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class AnalyticsOptInPresenterTest {
|
class AnalyticsOptInPresenterTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class AnalyticsPreferencesPresenterTest {
|
class AnalyticsPreferencesPresenterTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||||
import io.element.android.libraries.matrix.api.core.RoomId
|
import io.element.android.libraries.matrix.api.core.RoomId
|
||||||
|
|
||||||
interface CreateRoomEntryPoint : FeatureEntryPoint {
|
interface CreateRoomEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
||||||
interface NodeBuilder {
|
interface NodeBuilder {
|
||||||
fun callback(callback: Callback): NodeBuilder
|
fun callback(callback: Callback): NodeBuilder
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ class ConfigureRoomFlowNode @AssistedInject constructor(
|
||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
plugins = plugins
|
plugins = plugins
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val component by lazy {
|
private val component by lazy {
|
||||||
parent!!.bindings<CreateRoomComponent.ParentBindings>().createRoomComponentBuilder().build()
|
parent!!.bindings<CreateRoomComponent.ParentBindings>().createRoomComponentBuilder().build()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import javax.inject.Inject
|
||||||
class CreateRoomDataStore @Inject constructor(
|
class CreateRoomDataStore @Inject constructor(
|
||||||
val selectedUserListDataStore: UserListDataStore,
|
val selectedUserListDataStore: UserListDataStore,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val createRoomConfigFlow: MutableStateFlow<CreateRoomConfig> = MutableStateFlow(CreateRoomConfig())
|
private val createRoomConfigFlow: MutableStateFlow<CreateRoomConfig> = MutableStateFlow(CreateRoomConfig())
|
||||||
private var cachedAvatarUri: Uri? = null
|
private var cachedAvatarUri: Uri? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ class CreateRoomFlowNode @AssistedInject constructor(
|
||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
plugins = plugins
|
plugins = plugins
|
||||||
) {
|
) {
|
||||||
|
|
||||||
sealed interface NavTarget : Parcelable {
|
sealed interface NavTarget : Parcelable {
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object Root : NavTarget
|
data object Root : NavTarget
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,10 @@ import javax.inject.Inject
|
||||||
|
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultCreateRoomEntryPoint @Inject constructor() : CreateRoomEntryPoint {
|
class DefaultCreateRoomEntryPoint @Inject constructor() : CreateRoomEntryPoint {
|
||||||
|
|
||||||
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): CreateRoomEntryPoint.NodeBuilder {
|
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): CreateRoomEntryPoint.NodeBuilder {
|
||||||
val plugins = ArrayList<Plugin>()
|
val plugins = ArrayList<Plugin>()
|
||||||
|
|
||||||
return object : CreateRoomEntryPoint.NodeBuilder {
|
return object : CreateRoomEntryPoint.NodeBuilder {
|
||||||
|
|
||||||
override fun callback(callback: CreateRoomEntryPoint.Callback): CreateRoomEntryPoint.NodeBuilder {
|
override fun callback(callback: CreateRoomEntryPoint.Callback): CreateRoomEntryPoint.NodeBuilder {
|
||||||
plugins += callback
|
plugins += callback
|
||||||
return this
|
return this
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class DefaultStartDMAction @Inject constructor(
|
||||||
private val matrixClient: MatrixClient,
|
private val matrixClient: MatrixClient,
|
||||||
private val analyticsService: AnalyticsService,
|
private val analyticsService: AnalyticsService,
|
||||||
) : StartDMAction {
|
) : StartDMAction {
|
||||||
|
|
||||||
override suspend fun execute(userId: UserId, actionState: MutableState<AsyncAction<RoomId>>) {
|
override suspend fun execute(userId: UserId, actionState: MutableState<AsyncAction<RoomId>>) {
|
||||||
actionState.value = AsyncAction.Loading
|
actionState.value = AsyncAction.Loading
|
||||||
when (val result = matrixClient.startDM(userId)) {
|
when (val result = matrixClient.startDM(userId)) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ class AddPeopleNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: AddPeoplePresenter,
|
private val presenter: AddPeoplePresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onContinue()
|
fun onContinue()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ class AddPeoplePresenter @Inject constructor(
|
||||||
userRepository: UserRepository,
|
userRepository: UserRepository,
|
||||||
dataStore: CreateRoomDataStore,
|
dataStore: CreateRoomDataStore,
|
||||||
) : Presenter<UserListState> {
|
) : Presenter<UserListState> {
|
||||||
|
|
||||||
private val userListPresenter = userListPresenterFactory.create(
|
private val userListPresenter = userListPresenterFactory.create(
|
||||||
UserListPresenterArgs(
|
UserListPresenterArgs(
|
||||||
selectionMode = SelectionMode.Multiple,
|
selectionMode = SelectionMode.Multiple,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ class ConfigureRoomNode @AssistedInject constructor(
|
||||||
private val presenter: ConfigureRoomPresenter,
|
private val presenter: ConfigureRoomPresenter,
|
||||||
private val analyticsService: AnalyticsService,
|
private val analyticsService: AnalyticsService,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
lifecycle.subscribe(
|
lifecycle.subscribe(
|
||||||
onResume = {
|
onResume = {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ class ConfigureRoomPresenter @Inject constructor(
|
||||||
private val analyticsService: AnalyticsService,
|
private val analyticsService: AnalyticsService,
|
||||||
permissionsPresenterFactory: PermissionsPresenter.Factory,
|
permissionsPresenterFactory: PermissionsPresenter.Factory,
|
||||||
) : Presenter<ConfigureRoomState> {
|
) : Presenter<ConfigureRoomState> {
|
||||||
|
|
||||||
private val cameraPermissionPresenter: PermissionsPresenter = permissionsPresenterFactory.create(android.Manifest.permission.CAMERA)
|
private val cameraPermissionPresenter: PermissionsPresenter = permissionsPresenterFactory.create(android.Manifest.permission.CAMERA)
|
||||||
private var pendingPermissionRequest = false
|
private var pendingPermissionRequest = false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import io.element.android.libraries.di.SingleIn
|
||||||
@SingleIn(CreateRoomScope::class)
|
@SingleIn(CreateRoomScope::class)
|
||||||
@MergeSubcomponent(CreateRoomScope::class)
|
@MergeSubcomponent(CreateRoomScope::class)
|
||||||
interface CreateRoomComponent : NodeFactoriesBindings {
|
interface CreateRoomComponent : NodeFactoriesBindings {
|
||||||
|
|
||||||
@Subcomponent.Builder
|
@Subcomponent.Builder
|
||||||
interface Builder {
|
interface Builder {
|
||||||
fun build(): CreateRoomComponent
|
fun build(): CreateRoomComponent
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ class CreateRoomRootNode @AssistedInject constructor(
|
||||||
private val analyticsService: AnalyticsService,
|
private val analyticsService: AnalyticsService,
|
||||||
private val inviteFriendsUseCase: InviteFriendsUseCase,
|
private val inviteFriendsUseCase: InviteFriendsUseCase,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onCreateNewRoom()
|
fun onCreateNewRoom()
|
||||||
fun onStartChatSuccess(roomId: RoomId)
|
fun onStartChatSuccess(roomId: RoomId)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ class CreateRoomRootPresenter @Inject constructor(
|
||||||
private val startDMAction: StartDMAction,
|
private val startDMAction: StartDMAction,
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
) : Presenter<CreateRoomRootState> {
|
) : Presenter<CreateRoomRootState> {
|
||||||
|
|
||||||
private val presenter = presenterFactory.create(
|
private val presenter = presenterFactory.create(
|
||||||
UserListPresenterArgs(
|
UserListPresenterArgs(
|
||||||
selectionMode = SelectionMode.Single,
|
selectionMode = SelectionMode.Single,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ class DefaultUserListPresenter @AssistedInject constructor(
|
||||||
@Assisted val userRepository: UserRepository,
|
@Assisted val userRepository: UserRepository,
|
||||||
@Assisted val userListDataStore: UserListDataStore,
|
@Assisted val userListDataStore: UserListDataStore,
|
||||||
) : UserListPresenter {
|
) : UserListPresenter {
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
@ContributesBinding(SessionScope::class)
|
@ContributesBinding(SessionScope::class)
|
||||||
interface DefaultUserListFactory : UserListPresenter.Factory {
|
interface DefaultUserListFactory : UserListPresenter.Factory {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class UserListDataStore @Inject constructor() {
|
class UserListDataStore @Inject constructor() {
|
||||||
|
|
||||||
private val selectedUsers: MutableStateFlow<List<MatrixUser>> = MutableStateFlow(emptyList())
|
private val selectedUsers: MutableStateFlow<List<MatrixUser>> = MutableStateFlow(emptyList())
|
||||||
|
|
||||||
fun selectUser(user: MatrixUser) {
|
fun selectUser(user: MatrixUser) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import io.element.android.libraries.architecture.Presenter
|
||||||
import io.element.android.libraries.usersearch.api.UserRepository
|
import io.element.android.libraries.usersearch.api.UserRepository
|
||||||
|
|
||||||
interface UserListPresenter : Presenter<UserListState> {
|
interface UserListPresenter : Presenter<UserListState> {
|
||||||
|
|
||||||
interface Factory {
|
interface Factory {
|
||||||
fun create(
|
fun create(
|
||||||
args: UserListPresenterArgs,
|
args: UserListPresenterArgs,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultStartDMActionTests {
|
class DefaultStartDMActionTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `when dm is found, assert state is updated with given room id`() = runTest {
|
fun `when dm is found, assert state is updated with given room id`() = runTest {
|
||||||
val matrixClient = FakeMatrixClient().apply {
|
val matrixClient = FakeMatrixClient().apply {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class AddPeoplePresenterTests {
|
class AddPeoplePresenterTests {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ private const val AN_URI_FROM_GALLERY = "content://uri_from_gallery"
|
||||||
|
|
||||||
@RunWith(RobolectricTestRunner::class)
|
@RunWith(RobolectricTestRunner::class)
|
||||||
class ConfigureRoomPresenterTests {
|
class ConfigureRoomPresenterTests {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class CreateRoomRootPresenterTests {
|
class CreateRoomRootPresenterTests {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultUserListPresenterTests {
|
class DefaultUserListPresenterTests {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package io.element.android.features.createroom.impl.userlist
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
class FakeUserListPresenter : UserListPresenter {
|
class FakeUserListPresenter : UserListPresenter {
|
||||||
|
|
||||||
private var state = aUserListState()
|
private var state = aUserListState()
|
||||||
|
|
||||||
fun givenState(state: UserListState) {
|
fun givenState(state: UserListState) {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import io.element.android.libraries.usersearch.api.UserRepository
|
||||||
class FakeUserListPresenterFactory(
|
class FakeUserListPresenterFactory(
|
||||||
private val fakeUserListPresenter: FakeUserListPresenter = FakeUserListPresenter()
|
private val fakeUserListPresenter: FakeUserListPresenter = FakeUserListPresenter()
|
||||||
) : UserListPresenter.Factory {
|
) : UserListPresenter.Factory {
|
||||||
|
|
||||||
override fun create(
|
override fun create(
|
||||||
args: UserListPresenterArgs,
|
args: UserListPresenterArgs,
|
||||||
userRepository: UserRepository,
|
userRepository: UserRepository,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import io.element.android.libraries.matrix.test.A_ROOM_ID
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
|
||||||
class FakeStartDMAction : StartDMAction {
|
class FakeStartDMAction : StartDMAction {
|
||||||
|
|
||||||
private var executeResult: AsyncAction<RoomId> = AsyncAction.Success(A_ROOM_ID)
|
private var executeResult: AsyncAction<RoomId> = AsyncAction.Success(A_ROOM_ID)
|
||||||
|
|
||||||
fun givenExecuteResult(result: AsyncAction<RoomId>) {
|
fun givenExecuteResult(result: AsyncAction<RoomId>) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import com.bumble.appyx.core.plugin.Plugin
|
||||||
import io.element.android.libraries.architecture.FeatureEntryPoint
|
import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||||
|
|
||||||
interface FtueEntryPoint : FeatureEntryPoint {
|
interface FtueEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
||||||
|
|
||||||
interface NodeBuilder {
|
interface NodeBuilder {
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,10 @@ import javax.inject.Inject
|
||||||
|
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultFtueEntryPoint @Inject constructor() : FtueEntryPoint {
|
class DefaultFtueEntryPoint @Inject constructor() : FtueEntryPoint {
|
||||||
|
|
||||||
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): FtueEntryPoint.NodeBuilder {
|
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): FtueEntryPoint.NodeBuilder {
|
||||||
val plugins = ArrayList<Plugin>()
|
val plugins = ArrayList<Plugin>()
|
||||||
|
|
||||||
return object : FtueEntryPoint.NodeBuilder {
|
return object : FtueEntryPoint.NodeBuilder {
|
||||||
|
|
||||||
override fun callback(callback: FtueEntryPoint.Callback): FtueEntryPoint.NodeBuilder {
|
override fun callback(callback: FtueEntryPoint.Callback): FtueEntryPoint.NodeBuilder {
|
||||||
plugins += callback
|
plugins += callback
|
||||||
return this
|
return this
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,6 @@ class FtueFlowNode @AssistedInject constructor(
|
||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
plugins = plugins,
|
plugins = plugins,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
sealed interface NavTarget : Parcelable {
|
sealed interface NavTarget : Parcelable {
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object Placeholder : NavTarget
|
data object Placeholder : NavTarget
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ class MigrationScreenNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: MigrationScreenPresenter,
|
private val presenter: MigrationScreenPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onMigrationFinished()
|
fun onMigrationFinished()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import javax.inject.Inject
|
||||||
class SharedPrefsMigrationScreenStore @Inject constructor(
|
class SharedPrefsMigrationScreenStore @Inject constructor(
|
||||||
@DefaultPreferences private val sharedPreferences: SharedPreferences,
|
@DefaultPreferences private val sharedPreferences: SharedPreferences,
|
||||||
) : MigrationScreenStore {
|
) : MigrationScreenStore {
|
||||||
|
|
||||||
override fun isMigrationScreenNeeded(sessionId: SessionId): Boolean {
|
override fun isMigrationScreenNeeded(sessionId: SessionId): Boolean {
|
||||||
return sharedPreferences.getBoolean(sessionId.toKey(), false).not()
|
return sharedPreferences.getBoolean(sessionId.toKey(), false).not()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ class NotificationsOptInNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
presenterFactory: NotificationsOptInPresenter.Factory,
|
presenterFactory: NotificationsOptInPresenter.Factory,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : NodeInputs {
|
interface Callback : NodeInputs {
|
||||||
fun onNotificationsOptInFinished()
|
fun onNotificationsOptInFinished()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ class NotificationsOptInPresenter @AssistedInject constructor(
|
||||||
private val permissionStateProvider: PermissionStateProvider,
|
private val permissionStateProvider: PermissionStateProvider,
|
||||||
private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider,
|
private val buildVersionSdkIntProvider: BuildVersionSdkIntProvider,
|
||||||
) : Presenter<NotificationsOptInState> {
|
) : Presenter<NotificationsOptInState> {
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
interface Factory {
|
interface Factory {
|
||||||
fun create(callback: NotificationsOptInNode.Callback): NotificationsOptInPresenter
|
fun create(callback: NotificationsOptInNode.Callback): NotificationsOptInPresenter
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,6 @@ class DefaultFtueState @Inject constructor(
|
||||||
private val lockScreenService: LockScreenService,
|
private val lockScreenService: LockScreenService,
|
||||||
private val matrixClient: MatrixClient,
|
private val matrixClient: MatrixClient,
|
||||||
) : FtueState {
|
) : FtueState {
|
||||||
|
|
||||||
override val shouldDisplayFlow = MutableStateFlow(isAnyStepIncomplete())
|
override val shouldDisplayFlow = MutableStateFlow(isAnyStepIncomplete())
|
||||||
|
|
||||||
override suspend fun reset() {
|
override suspend fun reset() {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ class WelcomeNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onContinueClicked()
|
fun onContinueClicked()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import javax.inject.Inject
|
||||||
class AndroidWelcomeScreenState @Inject constructor(
|
class AndroidWelcomeScreenState @Inject constructor(
|
||||||
@DefaultPreferences private val sharedPreferences: SharedPreferences,
|
@DefaultPreferences private val sharedPreferences: SharedPreferences,
|
||||||
) : WelcomeScreenState {
|
) : WelcomeScreenState {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val IS_WELCOME_SCREEN_SHOWN = "is_welcome_screen_shown"
|
private const val IS_WELCOME_SCREEN_SHOWN = "is_welcome_screen_shown"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultFtueStateTests {
|
class DefaultFtueStateTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `given any check being false, should display flow is true`() = runTest {
|
fun `given any check being false, should display flow is true`() = runTest {
|
||||||
val coroutineScope = CoroutineScope(coroutineContext + SupervisorJob())
|
val coroutineScope = CoroutineScope(coroutineContext + SupervisorJob())
|
||||||
|
|
@ -130,7 +129,8 @@ class DefaultFtueStateTests {
|
||||||
FtueStep.NotificationsOptIn,
|
FtueStep.NotificationsOptIn,
|
||||||
FtueStep.LockscreenSetup,
|
FtueStep.LockscreenSetup,
|
||||||
FtueStep.AnalyticsOptIn,
|
FtueStep.AnalyticsOptIn,
|
||||||
null, // Final state
|
// Final state
|
||||||
|
null,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
|
@ -204,7 +204,8 @@ class DefaultFtueStateTests {
|
||||||
permissionStateProvider: FakePermissionStateProvider = FakePermissionStateProvider(permissionGranted = false),
|
permissionStateProvider: FakePermissionStateProvider = FakePermissionStateProvider(permissionGranted = false),
|
||||||
matrixClient: MatrixClient = FakeMatrixClient(),
|
matrixClient: MatrixClient = FakeMatrixClient(),
|
||||||
lockScreenService: LockScreenService = FakeLockScreenService(),
|
lockScreenService: LockScreenService = FakeLockScreenService(),
|
||||||
sdkIntVersion: Int = Build.VERSION_CODES.TIRAMISU, // First version where notification permission is required
|
// First version where notification permission is required
|
||||||
|
sdkIntVersion: Int = Build.VERSION_CODES.TIRAMISU,
|
||||||
) = DefaultFtueState(
|
) = DefaultFtueState(
|
||||||
sdkVersionProvider = FakeBuildVersionSdkIntProvider(sdkIntVersion),
|
sdkVersionProvider = FakeBuildVersionSdkIntProvider(sdkIntVersion),
|
||||||
coroutineScope = coroutineScope,
|
coroutineScope = coroutineScope,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class MigrationScreenPresenterTest {
|
class MigrationScreenPresenterTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class NotificationsOptInPresenterTests {
|
class NotificationsOptInPresenterTests {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package io.element.android.features.ftue.impl.welcome.state
|
package io.element.android.features.ftue.impl.welcome.state
|
||||||
|
|
||||||
class FakeWelcomeState : WelcomeScreenState {
|
class FakeWelcomeState : WelcomeScreenState {
|
||||||
|
|
||||||
private var isWelcomeScreenNeeded = true
|
private var isWelcomeScreenNeeded = true
|
||||||
|
|
||||||
override fun isWelcomeScreenNeeded(): Boolean {
|
override fun isWelcomeScreenNeeded(): Boolean {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||||
import io.element.android.libraries.matrix.api.core.RoomId
|
import io.element.android.libraries.matrix.api.core.RoomId
|
||||||
|
|
||||||
interface InviteListEntryPoint : FeatureEntryPoint {
|
interface InviteListEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
||||||
|
|
||||||
interface NodeBuilder {
|
interface NodeBuilder {
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,10 @@ import javax.inject.Inject
|
||||||
|
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultInviteListEntryPoint @Inject constructor() : InviteListEntryPoint {
|
class DefaultInviteListEntryPoint @Inject constructor() : InviteListEntryPoint {
|
||||||
|
|
||||||
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): InviteListEntryPoint.NodeBuilder {
|
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): InviteListEntryPoint.NodeBuilder {
|
||||||
val plugins = ArrayList<Plugin>()
|
val plugins = ArrayList<Plugin>()
|
||||||
|
|
||||||
return object : InviteListEntryPoint.NodeBuilder {
|
return object : InviteListEntryPoint.NodeBuilder {
|
||||||
|
|
||||||
override fun callback(callback: InviteListEntryPoint.Callback): InviteListEntryPoint.NodeBuilder {
|
override fun callback(callback: InviteListEntryPoint.Callback): InviteListEntryPoint.NodeBuilder {
|
||||||
plugins += callback
|
plugins += callback
|
||||||
return this
|
return this
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ private val seenInvitesKey = stringSetPreferencesKey("seenInvites")
|
||||||
class DefaultSeenInvitesStore @Inject constructor(
|
class DefaultSeenInvitesStore @Inject constructor(
|
||||||
@ApplicationContext context: Context
|
@ApplicationContext context: Context
|
||||||
) : SeenInvitesStore {
|
) : SeenInvitesStore {
|
||||||
|
|
||||||
private val store = context.dataStore
|
private val store = context.dataStore
|
||||||
|
|
||||||
override fun seenRoomIds(): Flow<Set<RoomId>> =
|
override fun seenRoomIds(): Flow<Set<RoomId>> =
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ class InviteListNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: InviteListPresenter,
|
private val presenter: InviteListPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
private fun onBackClicked() {
|
private fun onBackClicked() {
|
||||||
plugins<InviteListEntryPoint.Callback>().forEach { it.onBackClicked() }
|
plugins<InviteListEntryPoint.Callback>().forEach { it.onBackClicked() }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ class InviteListPresenter @Inject constructor(
|
||||||
private val analyticsService: AnalyticsService,
|
private val analyticsService: AnalyticsService,
|
||||||
private val notificationDrawerManager: NotificationDrawerManager,
|
private val notificationDrawerManager: NotificationDrawerManager,
|
||||||
) : Presenter<InviteListState> {
|
) : Presenter<InviteListState> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): InviteListState {
|
override fun present(): InviteListState {
|
||||||
val invites by client
|
val invites by client
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
|
||||||
class FakeSeenInvitesStore : SeenInvitesStore {
|
class FakeSeenInvitesStore : SeenInvitesStore {
|
||||||
|
|
||||||
private val existing = MutableStateFlow(emptySet<RoomId>())
|
private val existing = MutableStateFlow(emptySet<RoomId>())
|
||||||
private var provided: Set<RoomId>? = null
|
private var provided: Set<RoomId>? = null
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class LeaveRoomPresenterImplTest {
|
class LeaveRoomPresenterImplTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import io.element.android.features.leaveroom.api.LeaveRoomPresenter
|
||||||
import io.element.android.features.leaveroom.api.LeaveRoomState
|
import io.element.android.features.leaveroom.api.LeaveRoomState
|
||||||
|
|
||||||
class FakeLeaveRoomPresenter : LeaveRoomPresenter {
|
class FakeLeaveRoomPresenter : LeaveRoomPresenter {
|
||||||
|
|
||||||
val events = mutableListOf<LeaveRoomEvent>()
|
val events = mutableListOf<LeaveRoomEvent>()
|
||||||
|
|
||||||
private fun handleEvent(event: LeaveRoomEvent) {
|
private fun handleEvent(event: LeaveRoomEvent) {
|
||||||
|
|
|
||||||
|
|
@ -45,14 +45,16 @@ android {
|
||||||
name = "maptiler_light_map_id",
|
name = "maptiler_light_map_id",
|
||||||
value = System.getenv("ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID")
|
value = System.getenv("ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID")
|
||||||
?: readLocalProperty("services.maptiler.lightMapId")
|
?: readLocalProperty("services.maptiler.lightMapId")
|
||||||
?: "basic-v2" // fall back to maptiler's default light map.
|
// fall back to maptiler's default light map.
|
||||||
|
?: "basic-v2"
|
||||||
)
|
)
|
||||||
resValue(
|
resValue(
|
||||||
type = "string",
|
type = "string",
|
||||||
name = "maptiler_dark_map_id",
|
name = "maptiler_dark_map_id",
|
||||||
value = System.getenv("ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID")
|
value = System.getenv("ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID")
|
||||||
?: readLocalProperty("services.maptiler.darkMapId")
|
?: readLocalProperty("services.maptiler.darkMapId")
|
||||||
?: "basic-v2-dark" // fall back to maptiler's default dark map.
|
// fall back to maptiler's default dark map.
|
||||||
|
?: "basic-v2-dark"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||||
import io.element.android.libraries.architecture.NodeInputs
|
import io.element.android.libraries.architecture.NodeInputs
|
||||||
|
|
||||||
interface ShowLocationEntryPoint : FeatureEntryPoint {
|
interface ShowLocationEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
data class Inputs(val location: Location, val description: String?) : NodeInputs
|
data class Inputs(val location: Location, val description: String?) : NodeInputs
|
||||||
|
|
||||||
fun createNode(parentNode: Node, buildContext: BuildContext, inputs: Inputs): Node
|
fun createNode(parentNode: Node, buildContext: BuildContext, inputs: Inputs): Node
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ internal class MapTilerStaticMapUrlBuilder(
|
||||||
private val lightMapId: String,
|
private val lightMapId: String,
|
||||||
private val darkMapId: String,
|
private val darkMapId: String,
|
||||||
) : StaticMapUrlBuilder {
|
) : StaticMapUrlBuilder {
|
||||||
|
|
||||||
constructor(context: Context) : this(
|
constructor(context: Context) : this(
|
||||||
apiKey = context.apiKey,
|
apiKey = context.apiKey,
|
||||||
lightMapId = context.mapId(darkMode = false),
|
lightMapId = context.mapId(darkMode = false),
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ internal class MapTilerTileServerStyleUriBuilder(
|
||||||
private val lightMapId: String,
|
private val lightMapId: String,
|
||||||
private val darkMapId: String,
|
private val darkMapId: String,
|
||||||
) : TileServerStyleUriBuilder {
|
) : TileServerStyleUriBuilder {
|
||||||
|
|
||||||
constructor(context: Context) : this(
|
constructor(context: Context) : this(
|
||||||
apiKey = context.apiKey,
|
apiKey = context.apiKey,
|
||||||
lightMapId = context.mapId(darkMode = false),
|
lightMapId = context.mapId(darkMode = false),
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
internal class LocationKtTest {
|
internal class LocationKtTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `parseGeoUri - returns null for invalid urls`() {
|
fun `parseGeoUri - returns null for invalid urls`() {
|
||||||
assertThat(Location.fromGeoUri("")).isNull()
|
assertThat(Location.fromGeoUri("")).isNull()
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class MapTilerStaticMapUrlBuilderTest {
|
class MapTilerStaticMapUrlBuilderTest {
|
||||||
|
|
||||||
private val builder = MapTilerStaticMapUrlBuilder(
|
private val builder = MapTilerStaticMapUrlBuilder(
|
||||||
apiKey = "anApiKey",
|
apiKey = "anApiKey",
|
||||||
lightMapId = "aLightMapId",
|
lightMapId = "aLightMapId",
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class MapTilerTileServerStyleUriBuilderTest {
|
class MapTilerTileServerStyleUriBuilderTest {
|
||||||
|
|
||||||
private val builder = MapTilerTileServerStyleUriBuilder(
|
private val builder = MapTilerTileServerStyleUriBuilder(
|
||||||
apiKey = "anApiKey",
|
apiKey = "anApiKey",
|
||||||
lightMapId = "aLightMapId",
|
lightMapId = "aLightMapId",
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import io.element.android.libraries.di.AppScope
|
||||||
class PermissionsPresenterImpl @AssistedInject constructor(
|
class PermissionsPresenterImpl @AssistedInject constructor(
|
||||||
@Assisted private val permissions: List<String>
|
@Assisted private val permissions: List<String>
|
||||||
) : PermissionsPresenter {
|
) : PermissionsPresenter {
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
interface Factory : PermissionsPresenter.Factory {
|
interface Factory : PermissionsPresenter.Factory {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ class SendLocationNode @AssistedInject constructor(
|
||||||
private val presenter: SendLocationPresenter,
|
private val presenter: SendLocationPresenter,
|
||||||
analyticsService: AnalyticsService,
|
analyticsService: AnalyticsService,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
lifecycle.subscribe(
|
lifecycle.subscribe(
|
||||||
onResume = {
|
onResume = {
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ class SendLocationPresenter @Inject constructor(
|
||||||
private val locationActions: LocationActions,
|
private val locationActions: LocationActions,
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
) : Presenter<SendLocationState> {
|
) : Presenter<SendLocationState> {
|
||||||
|
|
||||||
private val permissionsPresenter = permissionsPresenterFactory.create(MapDefaults.permissions)
|
private val permissionsPresenter = permissionsPresenterFactory.create(MapDefaults.permissions)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,6 @@ class ShowLocationNode @AssistedInject constructor(
|
||||||
@Assisted buildContext: BuildContext,
|
@Assisted buildContext: BuildContext,
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
lifecycle.subscribe(
|
lifecycle.subscribe(
|
||||||
onResume = {
|
onResume = {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ class ShowLocationPresenter @AssistedInject constructor(
|
||||||
@Assisted private val location: Location,
|
@Assisted private val location: Location,
|
||||||
@Assisted private val description: String?
|
@Assisted private val description: String?
|
||||||
) : Presenter<ShowLocationState> {
|
) : Presenter<ShowLocationState> {
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
interface Factory {
|
interface Factory {
|
||||||
fun create(location: Location, description: String?): ShowLocationPresenter
|
fun create(location: Location, description: String?): ShowLocationPresenter
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import org.junit.Test
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
|
||||||
internal class AndroidLocationActionsTest {
|
internal class AndroidLocationActionsTest {
|
||||||
|
|
||||||
// We use an Android-native encoder in the actual app, switch to an equivalent JVM one for the tests
|
// We use an Android-native encoder in the actual app, switch to an equivalent JVM one for the tests
|
||||||
private fun urlEncoder(input: String) = URLEncoder.encode(input, "US-ASCII")
|
private fun urlEncoder(input: String) = URLEncoder.encode(input, "US-ASCII")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package io.element.android.features.location.impl.common.actions
|
||||||
import io.element.android.features.location.api.Location
|
import io.element.android.features.location.api.Location
|
||||||
|
|
||||||
class FakeLocationActions : LocationActions {
|
class FakeLocationActions : LocationActions {
|
||||||
|
|
||||||
var sharedLocation: Location? = null
|
var sharedLocation: Location? = null
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package io.element.android.features.location.impl.common.permissions
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
class PermissionsPresenterFake : PermissionsPresenter {
|
class PermissionsPresenterFake : PermissionsPresenter {
|
||||||
|
|
||||||
val events = mutableListOf<PermissionsEvents>()
|
val events = mutableListOf<PermissionsEvents>()
|
||||||
|
|
||||||
private fun handleEvent(event: PermissionsEvents) {
|
private fun handleEvent(event: PermissionsEvents) {
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class SendLocationPresenterTest {
|
class SendLocationPresenterTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class ShowLocationPresenterTest {
|
class ShowLocationPresenterTest {
|
||||||
|
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import com.bumble.appyx.core.plugin.Plugin
|
||||||
import io.element.android.libraries.architecture.FeatureEntryPoint
|
import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||||
|
|
||||||
interface LockScreenEntryPoint : FeatureEntryPoint {
|
interface LockScreenEntryPoint : FeatureEntryPoint {
|
||||||
|
|
||||||
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
||||||
|
|
||||||
interface NodeBuilder {
|
interface NodeBuilder {
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,11 @@ import javax.inject.Inject
|
||||||
|
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultLockScreenEntryPoint @Inject constructor() : LockScreenEntryPoint {
|
class DefaultLockScreenEntryPoint @Inject constructor() : LockScreenEntryPoint {
|
||||||
|
|
||||||
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): LockScreenEntryPoint.NodeBuilder {
|
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): LockScreenEntryPoint.NodeBuilder {
|
||||||
var innerTarget: LockScreenEntryPoint.Target = LockScreenEntryPoint.Target.Unlock
|
var innerTarget: LockScreenEntryPoint.Target = LockScreenEntryPoint.Target.Unlock
|
||||||
val callbacks = mutableListOf<LockScreenEntryPoint.Callback>()
|
val callbacks = mutableListOf<LockScreenEntryPoint.Callback>()
|
||||||
|
|
||||||
return object : LockScreenEntryPoint.NodeBuilder {
|
return object : LockScreenEntryPoint.NodeBuilder {
|
||||||
|
|
||||||
override fun callback(callback: LockScreenEntryPoint.Callback): LockScreenEntryPoint.NodeBuilder {
|
override fun callback(callback: LockScreenEntryPoint.Callback): LockScreenEntryPoint.NodeBuilder {
|
||||||
callbacks += callback
|
callbacks += callback
|
||||||
return this
|
return this
|
||||||
|
|
|
||||||
|
|
@ -57,25 +57,24 @@ class DefaultLockScreenService @Inject constructor(
|
||||||
private val appForegroundStateService: AppForegroundStateService,
|
private val appForegroundStateService: AppForegroundStateService,
|
||||||
private val biometricUnlockManager: BiometricUnlockManager,
|
private val biometricUnlockManager: BiometricUnlockManager,
|
||||||
) : LockScreenService {
|
) : LockScreenService {
|
||||||
|
private val _lockState = MutableStateFlow<LockScreenLockState>(LockScreenLockState.Unlocked)
|
||||||
private val _lockScreenState = MutableStateFlow<LockScreenLockState>(LockScreenLockState.Unlocked)
|
override val lockState: StateFlow<LockScreenLockState> = _lockState
|
||||||
override val lockState: StateFlow<LockScreenLockState> = _lockScreenState
|
|
||||||
|
|
||||||
private var lockJob: Job? = null
|
private var lockJob: Job? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
pinCodeManager.addCallback(object : DefaultPinCodeManagerCallback() {
|
pinCodeManager.addCallback(object : DefaultPinCodeManagerCallback() {
|
||||||
override fun onPinCodeVerified() {
|
override fun onPinCodeVerified() {
|
||||||
_lockScreenState.value = LockScreenLockState.Unlocked
|
_lockState.value = LockScreenLockState.Unlocked
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPinCodeRemoved() {
|
override fun onPinCodeRemoved() {
|
||||||
_lockScreenState.value = LockScreenLockState.Unlocked
|
_lockState.value = LockScreenLockState.Unlocked
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
biometricUnlockManager.addCallback(object : DefaultBiometricUnlockCallback() {
|
biometricUnlockManager.addCallback(object : DefaultBiometricUnlockCallback() {
|
||||||
override fun onBiometricUnlockSuccess() {
|
override fun onBiometricUnlockSuccess() {
|
||||||
_lockScreenState.value = LockScreenLockState.Unlocked
|
_lockState.value = LockScreenLockState.Unlocked
|
||||||
coroutineScope.launch {
|
coroutineScope.launch {
|
||||||
lockScreenStore.resetCounter()
|
lockScreenStore.resetCounter()
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +90,6 @@ class DefaultLockScreenService @Inject constructor(
|
||||||
*/
|
*/
|
||||||
private fun observeSessionsState() {
|
private fun observeSessionsState() {
|
||||||
sessionObserver.addListener(object : SessionListener {
|
sessionObserver.addListener(object : SessionListener {
|
||||||
|
|
||||||
override suspend fun onSessionCreated(userId: String) = Unit
|
override suspend fun onSessionCreated(userId: String) = Unit
|
||||||
|
|
||||||
override suspend fun onSessionDeleted(userId: String) {
|
override suspend fun onSessionDeleted(userId: String) {
|
||||||
|
|
@ -135,7 +133,7 @@ class DefaultLockScreenService @Inject constructor(
|
||||||
private fun CoroutineScope.lockIfNeeded(gracePeriod: Duration = Duration.ZERO) = launch {
|
private fun CoroutineScope.lockIfNeeded(gracePeriod: Duration = Duration.ZERO) = launch {
|
||||||
if (isPinSetup().first()) {
|
if (isPinSetup().first()) {
|
||||||
delay(gracePeriod)
|
delay(gracePeriod)
|
||||||
_lockScreenState.value = LockScreenLockState.Locked
|
_lockState.value = LockScreenLockState.Locked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ class LockScreenFlowNode @AssistedInject constructor(
|
||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
plugins = plugins,
|
plugins = plugins,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
data class Inputs(
|
data class Inputs(
|
||||||
val initialNavTarget: NavTarget = NavTarget.Unlock,
|
val initialNavTarget: NavTarget = NavTarget.Unlock,
|
||||||
) : NodeInputs
|
) : NodeInputs
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ import java.security.InvalidKeyException
|
||||||
import javax.crypto.Cipher
|
import javax.crypto.Cipher
|
||||||
|
|
||||||
interface BiometricUnlock {
|
interface BiometricUnlock {
|
||||||
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
fun onBiometricSetupError()
|
fun onBiometricSetupError()
|
||||||
fun onBiometricUnlockSuccess()
|
fun onBiometricUnlockSuccess()
|
||||||
|
|
@ -62,7 +61,6 @@ class DefaultBiometricUnlock(
|
||||||
private val keyAlias: String,
|
private val keyAlias: String,
|
||||||
private val callbacks: List<BiometricUnlock.Callback>
|
private val callbacks: List<BiometricUnlock.Callback>
|
||||||
) : BiometricUnlock {
|
) : BiometricUnlock {
|
||||||
|
|
||||||
override val isActive: Boolean = true
|
override val isActive: Boolean = true
|
||||||
|
|
||||||
private lateinit var cryptoObject: CryptoObject
|
private lateinit var cryptoObject: CryptoObject
|
||||||
|
|
@ -105,7 +103,6 @@ private class AuthenticationCallback(
|
||||||
private val callbacks: List<BiometricUnlock.Callback>,
|
private val callbacks: List<BiometricUnlock.Callback>,
|
||||||
private val deferredAuthenticationResult: CompletableDeferred<BiometricUnlock.AuthenticationResult>,
|
private val deferredAuthenticationResult: CompletableDeferred<BiometricUnlock.AuthenticationResult>,
|
||||||
) : BiometricPrompt.AuthenticationCallback() {
|
) : BiometricPrompt.AuthenticationCallback() {
|
||||||
|
|
||||||
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
|
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
|
||||||
super.onAuthenticationError(errorCode, errString)
|
super.onAuthenticationError(errorCode, errString)
|
||||||
val biometricUnlockError = BiometricUnlockError(errorCode, errString.toString())
|
val biometricUnlockError = BiometricUnlockError(errorCode, errString.toString())
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package io.element.android.features.lockscreen.impl.biometric
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
||||||
interface BiometricUnlockManager {
|
interface BiometricUnlockManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the device is secured for example with a pin, pattern or password.
|
* If the device is secured for example with a pin, pattern or password.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ class DefaultBiometricUnlockManager @Inject constructor(
|
||||||
private val secretKeyRepository: SecretKeyRepository,
|
private val secretKeyRepository: SecretKeyRepository,
|
||||||
private val coroutineScope: CoroutineScope,
|
private val coroutineScope: CoroutineScope,
|
||||||
) : BiometricUnlockManager {
|
) : BiometricUnlockManager {
|
||||||
|
|
||||||
private val callbacks = CopyOnWriteArrayList<BiometricUnlock.Callback>()
|
private val callbacks = CopyOnWriteArrayList<BiometricUnlock.Callback>()
|
||||||
private val biometricManager = BiometricManager.from(context)
|
private val biometricManager = BiometricManager.from(context)
|
||||||
private val keyguardManager: KeyguardManager = context.getSystemService()!!
|
private val keyguardManager: KeyguardManager = context.getSystemService()!!
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,6 @@ private fun PinDigitView(
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.then(appearanceModifier),
|
.then(appearanceModifier),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
if (digit is PinDigit.Filled) {
|
if (digit is PinDigit.Filled) {
|
||||||
val text = if (isSecured) {
|
val text = if (isSecured) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ class DefaultPinCodeManager @Inject constructor(
|
||||||
private val encryptionDecryptionService: EncryptionDecryptionService,
|
private val encryptionDecryptionService: EncryptionDecryptionService,
|
||||||
private val lockScreenStore: LockScreenStore,
|
private val lockScreenStore: LockScreenStore,
|
||||||
) : PinCodeManager {
|
) : PinCodeManager {
|
||||||
|
|
||||||
private val callbacks = CopyOnWriteArrayList<PinCodeManager.Callback>()
|
private val callbacks = CopyOnWriteArrayList<PinCodeManager.Callback>()
|
||||||
|
|
||||||
override fun addCallback(callback: PinCodeManager.Callback) {
|
override fun addCallback(callback: PinCodeManager.Callback) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import kotlinx.coroutines.flow.Flow
|
||||||
* Implementation should take care of encrypting the pin code and storing it.
|
* Implementation should take care of encrypting the pin code and storing it.
|
||||||
*/
|
*/
|
||||||
interface PinCodeManager {
|
interface PinCodeManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callbacks for pin code management events.
|
* Callbacks for pin code management events.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import kotlinx.collections.immutable.toPersistentList
|
||||||
data class PinEntry(
|
data class PinEntry(
|
||||||
val digits: ImmutableList<PinDigit>,
|
val digits: ImmutableList<PinDigit>,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun createEmpty(size: Int): PinEntry {
|
fun createEmpty(size: Int): PinEntry {
|
||||||
val digits = List(size) { PinDigit.Empty }
|
val digits = List(size) { PinDigit.Empty }
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ class LockScreenSettingsFlowNode @AssistedInject constructor(
|
||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
plugins = plugins,
|
plugins = plugins,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
sealed interface NavTarget : Parcelable {
|
sealed interface NavTarget : Parcelable {
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data object Unknown : NavTarget
|
data object Unknown : NavTarget
|
||||||
|
|
@ -72,7 +71,6 @@ class LockScreenSettingsFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private val pinCodeManagerCallback = object : DefaultPinCodeManagerCallback() {
|
private val pinCodeManagerCallback = object : DefaultPinCodeManagerCallback() {
|
||||||
|
|
||||||
override fun onPinCodeRemoved() {
|
override fun onPinCodeRemoved() {
|
||||||
navigateUp()
|
navigateUp()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ class LockScreenSettingsNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: LockScreenSettingsPresenter,
|
private val presenter: LockScreenSettingsPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onChangePinClicked()
|
fun onChangePinClicked()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ class LockScreenSettingsPresenter @Inject constructor(
|
||||||
private val biometricUnlockManager: BiometricUnlockManager,
|
private val biometricUnlockManager: BiometricUnlockManager,
|
||||||
private val coroutineScope: CoroutineScope,
|
private val coroutineScope: CoroutineScope,
|
||||||
) : Presenter<LockScreenSettingsState> {
|
) : Presenter<LockScreenSettingsState> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): LockScreenSettingsState {
|
override fun present(): LockScreenSettingsState {
|
||||||
val showRemovePinOption by produceState(initialValue = false) {
|
val showRemovePinOption by produceState(initialValue = false) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ class LockScreenSetupFlowNode @AssistedInject constructor(
|
||||||
buildContext = buildContext,
|
buildContext = buildContext,
|
||||||
plugins = plugins,
|
plugins = plugins,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onSetupDone()
|
fun onSetupDone()
|
||||||
}
|
}
|
||||||
|
|
@ -70,7 +69,6 @@ class LockScreenSetupFlowNode @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private val pinCodeManagerCallback = object : DefaultPinCodeManagerCallback() {
|
private val pinCodeManagerCallback = object : DefaultPinCodeManagerCallback() {
|
||||||
|
|
||||||
override fun onPinCodeCreated() {
|
override fun onPinCodeCreated() {
|
||||||
backstack.newRoot(NavTarget.Biometric)
|
backstack.newRoot(NavTarget.Biometric)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ class SetupBiometricNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: SetupBiometricPresenter,
|
private val presenter: SetupBiometricPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onBiometricSetupDone()
|
fun onBiometricSetupDone()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import javax.inject.Inject
|
||||||
class SetupBiometricPresenter @Inject constructor(
|
class SetupBiometricPresenter @Inject constructor(
|
||||||
private val lockScreenStore: LockScreenStore,
|
private val lockScreenStore: LockScreenStore,
|
||||||
) : Presenter<SetupBiometricState> {
|
) : Presenter<SetupBiometricState> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): SetupBiometricState {
|
override fun present(): SetupBiometricState {
|
||||||
var isBiometricSetupDone by remember {
|
var isBiometricSetupDone by remember {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ class SetupPinNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: SetupPinPresenter,
|
private val presenter: SetupPinPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,6 @@ class SetupPinPresenter @Inject constructor(
|
||||||
private val buildMeta: BuildMeta,
|
private val buildMeta: BuildMeta,
|
||||||
private val pinCodeManager: PinCodeManager,
|
private val pinCodeManager: PinCodeManager,
|
||||||
) : Presenter<SetupPinState> {
|
) : Presenter<SetupPinState> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): SetupPinState {
|
override fun present(): SetupPinState {
|
||||||
var choosePinEntry by remember {
|
var choosePinEntry by remember {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ open class SetupPinStateProvider : PreviewParameterProvider<SetupPinState> {
|
||||||
choosePinEntry = PinEntry.createEmpty(4).fillWith("1111"),
|
choosePinEntry = PinEntry.createEmpty(4).fillWith("1111"),
|
||||||
creationFailure = SetupPinFailure.PinBlacklisted
|
creationFailure = SetupPinFailure.PinBlacklisted
|
||||||
),
|
),
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ import io.element.android.features.lockscreen.impl.pin.model.PinEntry
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class PinValidator @Inject constructor(private val lockScreenConfig: LockScreenConfig) {
|
class PinValidator @Inject constructor(private val lockScreenConfig: LockScreenConfig) {
|
||||||
|
|
||||||
sealed interface Result {
|
sealed interface Result {
|
||||||
data object Valid : Result
|
data object Valid : Result
|
||||||
data class Invalid(val failure: SetupPinFailure) : Result
|
data class Invalid(val failure: SetupPinFailure) : Result
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package io.element.android.features.lockscreen.impl.storage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
interface LockScreenStore : EncryptedPinCodeStorage {
|
interface LockScreenStore : EncryptedPinCodeStorage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the remaining PIN code attempts. When this reaches 0 the PIN code access won't be available for some time.
|
* Returns the remaining PIN code attempts. When this reaches 0 the PIN code access won't be available for some time.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ class PreferencesLockScreenStore @Inject constructor(
|
||||||
@ApplicationContext private val context: Context,
|
@ApplicationContext private val context: Context,
|
||||||
private val lockScreenConfig: LockScreenConfig,
|
private val lockScreenConfig: LockScreenConfig,
|
||||||
) : LockScreenStore {
|
) : LockScreenStore {
|
||||||
|
|
||||||
private val pinCodeKey = stringPreferencesKey("encoded_pin_code")
|
private val pinCodeKey = stringPreferencesKey("encoded_pin_code")
|
||||||
private val remainingAttemptsKey = intPreferencesKey("remaining_pin_code_attempts")
|
private val remainingAttemptsKey = intPreferencesKey("remaining_pin_code_attempts")
|
||||||
private val biometricUnlockKey = booleanPreferencesKey("biometric_unlock_enabled")
|
private val biometricUnlockKey = booleanPreferencesKey("biometric_unlock_enabled")
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ class PinUnlockHelper @Inject constructor(
|
||||||
private val biometricUnlockManager: BiometricUnlockManager,
|
private val biometricUnlockManager: BiometricUnlockManager,
|
||||||
private val pinCodeManager: PinCodeManager
|
private val pinCodeManager: PinCodeManager
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun OnUnlockEffect(onUnlock: () -> Unit) {
|
fun OnUnlockEffect(onUnlock: () -> Unit) {
|
||||||
DisposableEffect(Unit) {
|
DisposableEffect(Unit) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ class PinUnlockNode @AssistedInject constructor(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: PinUnlockPresenter,
|
private val presenter: PinUnlockPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
|
||||||
interface Callback : Plugin {
|
interface Callback : Plugin {
|
||||||
fun onUnlock()
|
fun onUnlock()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ class PinUnlockPresenter @Inject constructor(
|
||||||
private val coroutineScope: CoroutineScope,
|
private val coroutineScope: CoroutineScope,
|
||||||
private val pinUnlockHelper: PinUnlockHelper,
|
private val pinUnlockHelper: PinUnlockHelper,
|
||||||
) : Presenter<PinUnlockState> {
|
) : Presenter<PinUnlockState> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun present(): PinUnlockState {
|
override fun present(): PinUnlockState {
|
||||||
val pinEntryState = remember {
|
val pinEntryState = remember {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
|
||||||
class FakeBiometricUnlockManager : BiometricUnlockManager {
|
class FakeBiometricUnlockManager : BiometricUnlockManager {
|
||||||
|
|
||||||
override var isDeviceSecured: Boolean = true
|
override var isDeviceSecured: Boolean = true
|
||||||
override var hasAvailableAuthenticator: Boolean = false
|
override var hasAvailableAuthenticator: Boolean = false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class DefaultPinCodeManagerTest {
|
class DefaultPinCodeManagerTest {
|
||||||
|
|
||||||
private val lockScreenStore = InMemoryLockScreenStore()
|
private val lockScreenStore = InMemoryLockScreenStore()
|
||||||
private val secretKeyRepository = SimpleSecretKeyRepository()
|
private val secretKeyRepository = SimpleSecretKeyRepository()
|
||||||
private val encryptionDecryptionService = AESEncryptionDecryptionService()
|
private val encryptionDecryptionService = AESEncryptionDecryptionService()
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class PinEntryTest {
|
class PinEntryTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `when using fillWith with empty string ensure pin is empty`() {
|
fun `when using fillWith with empty string ensure pin is empty`() {
|
||||||
val pinEntry = PinEntry.createEmpty(4)
|
val pinEntry = PinEntry.createEmpty(4)
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
private const val DEFAULT_REMAINING_ATTEMPTS = 3
|
private const val DEFAULT_REMAINING_ATTEMPTS = 3
|
||||||
|
|
||||||
class InMemoryLockScreenStore : LockScreenStore {
|
class InMemoryLockScreenStore : LockScreenStore {
|
||||||
|
|
||||||
private val hasPinCode = MutableStateFlow(false)
|
private val hasPinCode = MutableStateFlow(false)
|
||||||
private var pinCode: String? = null
|
private var pinCode: String? = null
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class LockScreenSettingsPresenterTest {
|
class LockScreenSettingsPresenterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `present - remove pin flow`() = runTest {
|
fun `present - remove pin flow`() = runTest {
|
||||||
val presenter = createLockScreenSettingsPresenter(this)
|
val presenter = createLockScreenSettingsPresenter(this)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
class SetupBiometricPresenterTest {
|
class SetupBiometricPresenterTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `present - allow flow`() = runTest {
|
fun `present - allow flow`() = runTest {
|
||||||
val lockScreenStore = InMemoryLockScreenStore()
|
val lockScreenStore = InMemoryLockScreenStore()
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue