Show a link to Clipboard notification settings near the One time password notification duration #122
This commit is contained in:
parent
a54f5085fa
commit
57c4151a2f
|
@ -0,0 +1,59 @@
|
|||
package com.artemchep.keyguard.feature.home.settings.component
|
||||
|
||||
import android.content.Intent
|
||||
import android.provider.Settings
|
||||
import androidx.compose.foundation.layout.RowScope
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.EditNotifications
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import com.artemchep.keyguard.common.R
|
||||
import com.artemchep.keyguard.res.Res
|
||||
import com.artemchep.keyguard.ui.FlatItem
|
||||
import com.artemchep.keyguard.ui.icons.ChevronIcon
|
||||
import com.artemchep.keyguard.ui.icons.icon
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import org.kodein.di.DirectDI
|
||||
|
||||
actual fun settingClipboardNotificationSettingsProvider(
|
||||
directDI: DirectDI,
|
||||
): SettingComponent = settingClipboardNotificationSettingsProvider()
|
||||
|
||||
fun settingClipboardNotificationSettingsProvider(
|
||||
): SettingComponent = run {
|
||||
|
||||
val item = SettingIi {
|
||||
SettingClipboardNotificationSettings()
|
||||
}
|
||||
flowOf(item)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun SettingClipboardNotificationSettings(
|
||||
) {
|
||||
val updatedContext by rememberUpdatedState(LocalContext.current)
|
||||
FlatItem(
|
||||
leading = icon<RowScope>(Icons.Outlined.EditNotifications),
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(Res.strings.pref_item_clipboard_notification_settings_title),
|
||||
)
|
||||
},
|
||||
trailing = {
|
||||
ChevronIcon()
|
||||
},
|
||||
onClick = {
|
||||
val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS).apply {
|
||||
val packageName = updatedContext.packageName
|
||||
val channelId = updatedContext.getString(R.string.notification_clipboard_channel_id)
|
||||
putExtra(Settings.EXTRA_APP_PACKAGE, packageName)
|
||||
putExtra(Settings.EXTRA_CHANNEL_ID, channelId)
|
||||
}
|
||||
updatedContext.startActivity(intent)
|
||||
},
|
||||
)
|
||||
}
|
|
@ -40,6 +40,7 @@ import com.artemchep.keyguard.feature.home.settings.component.settingCheckTwoFAP
|
|||
import com.artemchep.keyguard.feature.home.settings.component.settingClearCache
|
||||
import com.artemchep.keyguard.feature.home.settings.component.settingClipboardAutoClearProvider
|
||||
import com.artemchep.keyguard.feature.home.settings.component.settingClipboardAutoRefreshProvider
|
||||
import com.artemchep.keyguard.feature.home.settings.component.settingClipboardNotificationSettingsProvider
|
||||
import com.artemchep.keyguard.feature.home.settings.component.settingColorAccentProvider
|
||||
import com.artemchep.keyguard.feature.home.settings.component.settingColorSchemeProvider
|
||||
import com.artemchep.keyguard.feature.home.settings.component.settingConcealFieldsProvider
|
||||
|
@ -133,6 +134,7 @@ object Setting {
|
|||
const val ROTATE_DEVICE_ID = "rotate_device_id"
|
||||
const val CLIPBOARD_AUTO_CLEAR = "clipboard_auto_clear"
|
||||
const val CLIPBOARD_AUTO_REFRESH = "clipboard_auto_refresh"
|
||||
const val CLIPBOARD_NOTIFICATION_SETTINGS = "clipboard_notification_settings"
|
||||
const val CRASH = "test_crash_reports"
|
||||
const val CRASHLYTICS = "automatic_crash_reports"
|
||||
const val REQUIRE_MASTER_PASSWORD = "require_master_password"
|
||||
|
@ -211,6 +213,7 @@ val hub = mapOf<String, (DirectDI) -> SettingComponent>(
|
|||
Setting.ROTATE_DEVICE_ID to ::settingRotateDeviceId,
|
||||
Setting.CLIPBOARD_AUTO_CLEAR to ::settingClipboardAutoClearProvider,
|
||||
Setting.CLIPBOARD_AUTO_REFRESH to ::settingClipboardAutoRefreshProvider,
|
||||
Setting.CLIPBOARD_NOTIFICATION_SETTINGS to ::settingClipboardNotificationSettingsProvider,
|
||||
Setting.CRASH to ::settingCrashProvider,
|
||||
Setting.CRASHLYTICS to ::settingCrashlyticsProvider,
|
||||
Setting.REQUIRE_MASTER_PASSWORD to ::settingRequireMasterPasswordProvider,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.artemchep.keyguard.feature.home.settings.component
|
||||
|
||||
import org.kodein.di.DirectDI
|
||||
|
||||
expect fun settingClipboardNotificationSettingsProvider(
|
||||
directDI: DirectDI,
|
||||
): SettingComponent
|
|
@ -21,6 +21,7 @@ fun SecuritySettingsScreen() {
|
|||
key = "clipboard",
|
||||
list = listOf(
|
||||
SettingPaneItem.Item(Setting.CLIPBOARD_AUTO_REFRESH),
|
||||
SettingPaneItem.Item(Setting.CLIPBOARD_NOTIFICATION_SETTINGS),
|
||||
),
|
||||
),
|
||||
SettingPaneItem.Group(
|
||||
|
|
|
@ -937,6 +937,7 @@
|
|||
<string name="pref_item_clipboard_auto_refresh_otp_duration_title">One-time password notification duration</string>
|
||||
<string name="pref_item_clipboard_auto_refresh_otp_duration_note">When you autofill a login item that has a one-time password, the notification with verification code will popup for at least the defined duration</string>
|
||||
<string name="pref_item_clipboard_auto_refresh_otp_duration_never_text">Never</string>
|
||||
<string name="pref_item_clipboard_notification_settings_title">One-time password notification settings</string>
|
||||
<string name="pref_item_premium_membership_title">About Keyguard membership</string>
|
||||
<string name="pref_item_premium_membership_text">The Premium unlocks extra features and funds a development of the app. Thank you for supporting us! ❤️</string>
|
||||
<string name="pref_item_premium_membership_section_subscriptions_title">Subscriptions</string>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package com.artemchep.keyguard.feature.home.settings.component
|
||||
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import org.kodein.di.DirectDI
|
||||
|
||||
actual fun settingClipboardNotificationSettingsProvider(
|
||||
directDI: DirectDI,
|
||||
): SettingComponent = flowOf(null)
|
Loading…
Reference in New Issue