mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Provide dark theme parameter.
This commit is contained in:
+3
-1
@@ -28,6 +28,7 @@ import com.bumble.appyx.core.plugin.plugins
|
|||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import io.element.android.anvilannotations.ContributesNode
|
import io.element.android.anvilannotations.ContributesNode
|
||||||
|
import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.features.logout.api.util.onSuccessLogout
|
import io.element.android.features.logout.api.util.onSuccessLogout
|
||||||
import io.element.android.libraries.di.SessionScope
|
import io.element.android.libraries.di.SessionScope
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ class PinUnlockNode @AssistedInject constructor(
|
|||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
val activity = LocalContext.current as Activity
|
val activity = LocalContext.current as Activity
|
||||||
|
val isDark = ElementTheme.isLightTheme.not()
|
||||||
LaunchedEffect(state.isUnlocked) {
|
LaunchedEffect(state.isUnlocked) {
|
||||||
if (state.isUnlocked) {
|
if (state.isUnlocked) {
|
||||||
onUnlock()
|
onUnlock()
|
||||||
@@ -61,7 +63,7 @@ class PinUnlockNode @AssistedInject constructor(
|
|||||||
// UnlockNode is only used for in-app unlock, so we can safely set isInAppUnlock to true.
|
// UnlockNode is only used for in-app unlock, so we can safely set isInAppUnlock to true.
|
||||||
// It's set to false in PinUnlockActivity.
|
// It's set to false in PinUnlockActivity.
|
||||||
isInAppUnlock = true,
|
isInAppUnlock = true,
|
||||||
onSuccessLogout = { onSuccessLogout(activity, it) },
|
onSuccessLogout = { onSuccessLogout(activity, isDark, it) },
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -24,6 +24,7 @@ import androidx.activity.compose.setContent
|
|||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.features.lockscreen.api.LockScreenLockState
|
import io.element.android.features.lockscreen.api.LockScreenLockState
|
||||||
import io.element.android.features.lockscreen.api.LockScreenService
|
import io.element.android.features.lockscreen.api.LockScreenService
|
||||||
import io.element.android.features.lockscreen.impl.unlock.PinUnlockPresenter
|
import io.element.android.features.lockscreen.impl.unlock.PinUnlockPresenter
|
||||||
@@ -54,10 +55,11 @@ class PinUnlockActivity : AppCompatActivity() {
|
|||||||
setContent {
|
setContent {
|
||||||
ElementThemeApp(appPreferencesStore) {
|
ElementThemeApp(appPreferencesStore) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
|
val isDark = ElementTheme.isLightTheme.not()
|
||||||
PinUnlockView(
|
PinUnlockView(
|
||||||
state = state,
|
state = state,
|
||||||
isInAppUnlock = false,
|
isInAppUnlock = false,
|
||||||
onSuccessLogout = { onSuccessLogout(this, it) },
|
onSuccessLogout = { onSuccessLogout(this, isDark, it) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -22,10 +22,11 @@ import timber.log.Timber
|
|||||||
|
|
||||||
fun onSuccessLogout(
|
fun onSuccessLogout(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
|
darkTheme: Boolean,
|
||||||
url: String?,
|
url: String?,
|
||||||
) {
|
) {
|
||||||
Timber.d("Success logout with result url: $url")
|
Timber.d("Success logout with result url: $url")
|
||||||
url?.let {
|
url?.let {
|
||||||
activity.openUrlInChromeCustomTab(null, false, it)
|
activity.openUrlInChromeCustomTab(null, darkTheme, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -27,6 +27,7 @@ import com.bumble.appyx.core.plugin.plugins
|
|||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
import io.element.android.anvilannotations.ContributesNode
|
import io.element.android.anvilannotations.ContributesNode
|
||||||
|
import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.features.logout.api.LogoutEntryPoint
|
import io.element.android.features.logout.api.LogoutEntryPoint
|
||||||
import io.element.android.features.logout.api.util.onSuccessLogout
|
import io.element.android.features.logout.api.util.onSuccessLogout
|
||||||
import io.element.android.libraries.di.SessionScope
|
import io.element.android.libraries.di.SessionScope
|
||||||
@@ -45,10 +46,11 @@ class LogoutNode @AssistedInject constructor(
|
|||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
val activity = LocalContext.current as Activity
|
val activity = LocalContext.current as Activity
|
||||||
|
val isDark = ElementTheme.isLightTheme.not()
|
||||||
LogoutView(
|
LogoutView(
|
||||||
state = state,
|
state = state,
|
||||||
onChangeRecoveryKeyClick = ::onChangeRecoveryKeyClick,
|
onChangeRecoveryKeyClick = ::onChangeRecoveryKeyClick,
|
||||||
onSuccessLogout = { onSuccessLogout(activity, it) },
|
onSuccessLogout = { onSuccessLogout(activity, isDark, it) },
|
||||||
onBackClick = ::navigateUp,
|
onBackClick = ::navigateUp,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ class PreferencesRootNode @AssistedInject constructor(
|
|||||||
directLogoutView.Render(
|
directLogoutView.Render(
|
||||||
state = state.directLogoutState,
|
state = state.directLogoutState,
|
||||||
onSuccessLogout = {
|
onSuccessLogout = {
|
||||||
onSuccessLogout(activity, it)
|
onSuccessLogout(activity, isDark, it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user