mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Merge pull request #2463 from vector-im/feature/ons/change_pin
Change PIN
This commit is contained in:
commit
396dd5e36e
7 changed files with 29 additions and 2 deletions
|
@ -5,7 +5,7 @@ Features ✨:
|
||||||
-
|
-
|
||||||
|
|
||||||
Improvements 🙌:
|
Improvements 🙌:
|
||||||
-
|
- Add Setting Item to Change PIN (#2462)
|
||||||
|
|
||||||
Bugfix 🐛:
|
Bugfix 🐛:
|
||||||
- Double bottomsheet effect after verify with passphrase
|
- Double bottomsheet effect after verify with passphrase
|
||||||
|
|
|
@ -56,6 +56,7 @@ class PinFragment @Inject constructor(
|
||||||
when (fragmentArgs.pinMode) {
|
when (fragmentArgs.pinMode) {
|
||||||
PinMode.CREATE -> showCreateFragment()
|
PinMode.CREATE -> showCreateFragment()
|
||||||
PinMode.AUTH -> showAuthFragment()
|
PinMode.AUTH -> showAuthFragment()
|
||||||
|
PinMode.MODIFY -> showCreateFragment() // No need to create another function for now because texts are generic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,5 +18,6 @@ package im.vector.app.features.pin
|
||||||
|
|
||||||
enum class PinMode {
|
enum class PinMode {
|
||||||
CREATE,
|
CREATE,
|
||||||
AUTH
|
AUTH,
|
||||||
|
MODIFY
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
||||||
// Security
|
// Security
|
||||||
const val SETTINGS_SECURITY_USE_FLAG_SECURE = "SETTINGS_SECURITY_USE_FLAG_SECURE"
|
const val SETTINGS_SECURITY_USE_FLAG_SECURE = "SETTINGS_SECURITY_USE_FLAG_SECURE"
|
||||||
const val SETTINGS_SECURITY_USE_PIN_CODE_FLAG = "SETTINGS_SECURITY_USE_PIN_CODE_FLAG"
|
const val SETTINGS_SECURITY_USE_PIN_CODE_FLAG = "SETTINGS_SECURITY_USE_PIN_CODE_FLAG"
|
||||||
|
const val SETTINGS_SECURITY_CHANGE_PIN_CODE_FLAG = "SETTINGS_SECURITY_CHANGE_PIN_CODE_FLAG"
|
||||||
private const val SETTINGS_SECURITY_USE_BIOMETRICS_FLAG = "SETTINGS_SECURITY_USE_BIOMETRICS_FLAG"
|
private const val SETTINGS_SECURITY_USE_BIOMETRICS_FLAG = "SETTINGS_SECURITY_USE_BIOMETRICS_FLAG"
|
||||||
private const val SETTINGS_SECURITY_USE_GRACE_PERIOD_FLAG = "SETTINGS_SECURITY_USE_GRACE_PERIOD_FLAG"
|
private const val SETTINGS_SECURITY_USE_GRACE_PERIOD_FLAG = "SETTINGS_SECURITY_USE_GRACE_PERIOD_FLAG"
|
||||||
const val SETTINGS_SECURITY_USE_COMPLETE_NOTIFICATIONS_FLAG = "SETTINGS_SECURITY_USE_COMPLETE_NOTIFICATIONS_FLAG"
|
const val SETTINGS_SECURITY_USE_COMPLETE_NOTIFICATIONS_FLAG = "SETTINGS_SECURITY_USE_COMPLETE_NOTIFICATIONS_FLAG"
|
||||||
|
|
|
@ -21,6 +21,7 @@ import androidx.preference.Preference
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.extensions.registerStartForActivityResult
|
import im.vector.app.core.extensions.registerStartForActivityResult
|
||||||
|
import im.vector.app.core.preference.VectorPreference
|
||||||
import im.vector.app.features.navigation.Navigator
|
import im.vector.app.features.navigation.Navigator
|
||||||
import im.vector.app.features.notifications.NotificationDrawerManager
|
import im.vector.app.features.notifications.NotificationDrawerManager
|
||||||
import im.vector.app.features.pin.PinCodeStore
|
import im.vector.app.features.pin.PinCodeStore
|
||||||
|
@ -41,6 +42,10 @@ class VectorSettingsPinFragment @Inject constructor(
|
||||||
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_SECURITY_USE_PIN_CODE_FLAG)!!
|
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_SECURITY_USE_PIN_CODE_FLAG)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val changePinCodePref by lazy {
|
||||||
|
findPreference<VectorPreference>(VectorPreferences.SETTINGS_SECURITY_CHANGE_PIN_CODE_FLAG)!!
|
||||||
|
}
|
||||||
|
|
||||||
private val useCompleteNotificationPref by lazy {
|
private val useCompleteNotificationPref by lazy {
|
||||||
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_SECURITY_USE_COMPLETE_NOTIFICATIONS_FLAG)!!
|
findPreference<SwitchPreference>(VectorPreferences.SETTINGS_SECURITY_USE_COMPLETE_NOTIFICATIONS_FLAG)!!
|
||||||
}
|
}
|
||||||
|
@ -74,6 +79,17 @@ class VectorSettingsPinFragment @Inject constructor(
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changePinCodePref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||||
|
if (hasPinCode) {
|
||||||
|
navigator.openPinCode(
|
||||||
|
requireContext(),
|
||||||
|
pinActivityResultLauncher,
|
||||||
|
PinMode.MODIFY
|
||||||
|
)
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2686,6 +2686,8 @@
|
||||||
<string name="settings_security_pin_code_grace_period_title">Require PIN after 2 minutes</string>
|
<string name="settings_security_pin_code_grace_period_title">Require PIN after 2 minutes</string>
|
||||||
<string name="settings_security_pin_code_grace_period_summary_on">PIN code is required after 2 minutes of not using Element.</string>
|
<string name="settings_security_pin_code_grace_period_summary_on">PIN code is required after 2 minutes of not using Element.</string>
|
||||||
<string name="settings_security_pin_code_grace_period_summary_off">PIN code is required every time you open Element.</string>
|
<string name="settings_security_pin_code_grace_period_summary_off">PIN code is required every time you open Element.</string>
|
||||||
|
<string name="settings_security_pin_code_change_pin_title">Change PIN</string>
|
||||||
|
<string name="settings_security_pin_code_change_pin_summary">Change your current PIN</string>
|
||||||
<string name="auth_pin_confirm_to_disable_title">Confirm PIN to disable PIN</string>
|
<string name="auth_pin_confirm_to_disable_title">Confirm PIN to disable PIN</string>
|
||||||
<string name="error_opening_banned_room">Can\'t open a room where you are banned from.</string>
|
<string name="error_opening_banned_room">Can\'t open a room where you are banned from.</string>
|
||||||
<string name="room_error_not_found">Can\'t find this room. Make sure it exists.</string>
|
<string name="room_error_not_found">Can\'t find this room. Make sure it exists.</string>
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
android:summary="@string/settings_security_pin_code_summary"
|
android:summary="@string/settings_security_pin_code_summary"
|
||||||
android:title="@string/settings_security_pin_code_title" />
|
android:title="@string/settings_security_pin_code_title" />
|
||||||
|
|
||||||
|
<im.vector.app.core.preference.VectorPreference
|
||||||
|
android:dependency="SETTINGS_SECURITY_USE_PIN_CODE_FLAG"
|
||||||
|
android:key="SETTINGS_SECURITY_CHANGE_PIN_CODE_FLAG"
|
||||||
|
android:summary="@string/settings_security_pin_code_change_pin_summary"
|
||||||
|
android:title="@string/settings_security_pin_code_change_pin_title" />
|
||||||
|
|
||||||
<im.vector.app.core.preference.VectorSwitchPreference
|
<im.vector.app.core.preference.VectorSwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:dependency="SETTINGS_SECURITY_USE_PIN_CODE_FLAG"
|
android:dependency="SETTINGS_SECURITY_USE_PIN_CODE_FLAG"
|
||||||
|
|
Loading…
Reference in a new issue