Provide dark theme parameter.
This commit is contained in:
parent
fae47143f1
commit
6657ebf42a
5 changed files with 12 additions and 5 deletions
|
|
@ -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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue