Skip to content

Commit 8f1ccfc

Browse files
committed
Move SignedOut classes to their own module.
1 parent 8bbcb97 commit 8f1ccfc

File tree

13 files changed

+179
-12
lines changed

13 files changed

+179
-12
lines changed

appnav/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ dependencies {
6464
testImplementation(libs.test.turbine)
6565
testImplementation(projects.libraries.matrix.test)
6666
testImplementation(projects.features.networkmonitor.test)
67-
testImplementation(projects.libraries.sessionStorage.implMemory)
6867
testImplementation(projects.tests.testutils)
6968
testImplementation(projects.features.rageshake.test)
7069
testImplementation(projects.features.rageshake.impl)

appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ import io.element.android.appnav.intent.ResolvedIntent
4242
import io.element.android.appnav.root.RootNavStateFlowFactory
4343
import io.element.android.appnav.root.RootPresenter
4444
import io.element.android.appnav.root.RootView
45-
import io.element.android.appnav.signedout.SignedOutNode
4645
import io.element.android.features.login.api.oidc.OidcAction
4746
import io.element.android.features.login.api.oidc.OidcActionFlow
4847
import io.element.android.features.rageshake.api.bugreport.BugReportEntryPoint
48+
import io.element.android.features.signedout.api.SignedOutEntryPoint
4949
import io.element.android.libraries.architecture.BackstackNode
5050
import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler
5151
import io.element.android.libraries.architecture.createNode
@@ -71,6 +71,7 @@ class RootFlowNode @AssistedInject constructor(
7171
private val matrixClientsHolder: MatrixClientsHolder,
7272
private val presenter: RootPresenter,
7373
private val bugReportEntryPoint: BugReportEntryPoint,
74+
private val signedOutEntryPoint: SignedOutEntryPoint,
7475
private val intentResolver: IntentResolver,
7576
private val oidcActionFlow: OidcActionFlow,
7677
) : BackstackNode<RootFlowNode.NavTarget>(
@@ -217,8 +218,13 @@ class RootFlowNode @AssistedInject constructor(
217218
}
218219
NavTarget.NotLoggedInFlow -> createNode<NotLoggedInFlowNode>(buildContext)
219220
is NavTarget.SignedOutFlow -> {
220-
val inputs = SignedOutNode.Inputs(navTarget.sessionId)
221-
createNode<SignedOutNode>(buildContext, listOf(inputs))
221+
signedOutEntryPoint.nodeBuilder(this, buildContext)
222+
.params(
223+
SignedOutEntryPoint.Params(
224+
sessionId = navTarget.sessionId
225+
)
226+
)
227+
.build()
222228
}
223229
NavTarget.SplashScreen -> splashNode(buildContext)
224230
NavTarget.BugReport -> {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2023 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
id("io.element.android-library")
19+
}
20+
21+
android {
22+
namespace = "io.element.android.features.signedout.api"
23+
}
24+
25+
dependencies {
26+
implementation(projects.libraries.architecture)
27+
implementation(projects.libraries.matrix.api)
28+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2023 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.element.android.features.signedout.api
18+
19+
import com.bumble.appyx.core.modality.BuildContext
20+
import com.bumble.appyx.core.node.Node
21+
import io.element.android.libraries.architecture.FeatureEntryPoint
22+
import io.element.android.libraries.matrix.api.core.SessionId
23+
24+
interface SignedOutEntryPoint : FeatureEntryPoint {
25+
26+
data class Params(
27+
val sessionId: SessionId,
28+
)
29+
30+
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
31+
32+
interface NodeBuilder {
33+
fun params(params: Params): NodeBuilder
34+
fun build(): Node
35+
}
36+
}
37+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2023 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
plugins {
18+
id("io.element.android-compose-library")
19+
alias(libs.plugins.anvil)
20+
alias(libs.plugins.ksp)
21+
id("kotlin-parcelize")
22+
}
23+
24+
android {
25+
namespace = "io.element.android.features.signedout.impl"
26+
}
27+
28+
anvil {
29+
generateDaggerFactories.set(true)
30+
}
31+
32+
dependencies {
33+
implementation(projects.anvilannotations)
34+
anvil(projects.anvilcodegen)
35+
api(projects.features.signedout.api)
36+
implementation(projects.libraries.core)
37+
implementation(projects.libraries.architecture)
38+
implementation(projects.libraries.matrix.api)
39+
implementation(projects.libraries.matrixui)
40+
implementation(projects.libraries.designsystem)
41+
42+
testImplementation(libs.test.junit)
43+
testImplementation(libs.coroutines.test)
44+
testImplementation(libs.molecule.runtime)
45+
testImplementation(libs.test.truth)
46+
testImplementation(libs.test.turbine)
47+
testImplementation(projects.libraries.matrix.test)
48+
testImplementation(projects.libraries.sessionStorage.implMemory)
49+
testImplementation(projects.tests.testutils)
50+
51+
ksp(libs.showkase.processor)
52+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2023 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.element.android.features.signedout.impl
18+
19+
import com.bumble.appyx.core.modality.BuildContext
20+
import com.bumble.appyx.core.node.Node
21+
import com.bumble.appyx.core.plugin.Plugin
22+
import com.squareup.anvil.annotations.ContributesBinding
23+
import io.element.android.features.signedout.api.SignedOutEntryPoint
24+
import io.element.android.libraries.architecture.createNode
25+
import io.element.android.libraries.di.AppScope
26+
import javax.inject.Inject
27+
28+
@ContributesBinding(AppScope::class)
29+
class DefaultSignedOutEntryPoint @Inject constructor() : SignedOutEntryPoint {
30+
31+
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): SignedOutEntryPoint.NodeBuilder {
32+
val plugins = ArrayList<Plugin>()
33+
34+
return object : SignedOutEntryPoint.NodeBuilder {
35+
36+
override fun params(params: SignedOutEntryPoint.Params): SignedOutEntryPoint.NodeBuilder {
37+
plugins += SignedOutNode.Inputs(params.sessionId)
38+
return this
39+
}
40+
41+
override fun build(): Node {
42+
return parentNode.createNode<SignedOutNode>(buildContext, plugins)
43+
}
44+
}
45+
}
46+
}

appnav/src/main/kotlin/io/element/android/appnav/signedout/SignedOutEvents.kt renamed to features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutEvents.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.element.android.appnav.signedout
17+
package io.element.android.features.signedout.impl
1818

1919
sealed interface SignedOutEvents {
2020
data object SignInAgain : SignedOutEvents

appnav/src/main/kotlin/io/element/android/appnav/signedout/SignedOutNode.kt renamed to features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutNode.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.element.android.appnav.signedout
17+
package io.element.android.features.signedout.impl
1818

1919
import androidx.compose.runtime.Composable
2020
import androidx.compose.ui.Modifier

appnav/src/main/kotlin/io/element/android/appnav/signedout/SignedOutPresenter.kt renamed to features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutPresenter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.element.android.appnav.signedout
17+
package io.element.android.features.signedout.impl
1818

1919
import androidx.compose.runtime.Composable
2020
import androidx.compose.runtime.collectAsState

appnav/src/main/kotlin/io/element/android/appnav/signedout/SignedOutState.kt renamed to features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.element.android.appnav.signedout
17+
package io.element.android.features.signedout.impl
1818

1919
import io.element.android.libraries.sessionstorage.api.SessionData
2020

0 commit comments

Comments
 (0)