fix(@refactoring/base_01): button `I have a Keycard` displayed when it's not enabled
This commit is contained in:
parent
cdecd82e3f
commit
f788242c95
|
@ -24,8 +24,6 @@ const LSS_KEY_EXPAND_USERS_LIST* = "expandUsersList"
|
|||
const DEFAULT_EXPAND_USERS_LIST = false
|
||||
const LSS_KEY_IS_GIF_WIDGET_ENABLED* = "isGifWidgetEnabled"
|
||||
const DEFAULT_IS_GIF_WIDGET_ENABLED = false
|
||||
const LSS_KEY_IS_KEYCARD_ENABLED* = "isKeycardEnabled"
|
||||
const DEFAULT_IS_KEYCARD_ENABLED = false
|
||||
const LSS_KEY_IS_TENOR_WARNING_ACCEPTED* = "isTenorWarningAccepted"
|
||||
const DEFAULT_IS_TENOR_WARNING_ACCEPTED = false
|
||||
const LSS_KEY_DISPLAY_CHAT_IMAGES* = "displayChatImages"
|
||||
|
@ -320,19 +318,6 @@ QtObject:
|
|||
notify = isGifWidgetEnabledChanged
|
||||
|
||||
|
||||
proc isKeycardEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
||||
proc getIsKeycardEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
|
||||
getSettingsProp[bool](self, LSS_KEY_IS_KEYCARD_ENABLED, newQVariant(DEFAULT_IS_KEYCARD_ENABLED))
|
||||
proc setIsKeycardEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
|
||||
setSettingsProp(self, LSS_KEY_IS_KEYCARD_ENABLED, newQVariant(value)):
|
||||
self.isKeycardEnabledChanged()
|
||||
|
||||
QtProperty[bool] isKeycardEnabled:
|
||||
read = getIsKeycardEnabled
|
||||
write = setIsKeycardEnabled
|
||||
notify = isKeycardEnabledChanged
|
||||
|
||||
|
||||
proc isTenorWarningAcceptedChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
||||
proc getIsTenorWarningAccepted*(self: LocalAccountSensitiveSettings): bool {.slot.} =
|
||||
getSettingsProp[bool](self, LSS_KEY_IS_TENOR_WARNING_ACCEPTED, newQVariant(DEFAULT_IS_TENOR_WARNING_ACCEPTED))
|
||||
|
@ -896,7 +881,6 @@ QtObject:
|
|||
of LSS_KEY_SHOW_ONLINE_USERS: self.showOnlineUsersChanged()
|
||||
of LSS_KEY_EXPAND_USERS_LIST: self.expandUsersListChanged()
|
||||
of LSS_KEY_IS_GIF_WIDGET_ENABLED: self.isGifWidgetEnabledChanged()
|
||||
of LSS_KEY_IS_KEYCARD_ENABLED: self.isKeycardEnabledChanged()
|
||||
of LSS_KEY_IS_TENOR_WARNING_ACCEPTED: self.isTenorWarningAcceptedChanged()
|
||||
of LSS_KEY_DISPLAY_CHAT_IMAGES: self.displayChatImagesChanged()
|
||||
of LSS_KEY_USE_COMPACT_MODE: self.useCompactModeChanged()
|
||||
|
|
|
@ -4,6 +4,9 @@ import ../../constants
|
|||
|
||||
# Local Account Settings keys:
|
||||
const LS_KEY_STORE_TO_KEYCHAIN* = "storeToKeychain"
|
||||
const DEFAULT_STORE_TO_KEYCHAIN = "notNow"
|
||||
const LS_KEY_IS_KEYCARD_ENABLED* = "isKeycardEnabled"
|
||||
const DEFAULT_IS_KEYCARD_ENABLED = false
|
||||
# Local Account Settings values:
|
||||
const LS_VALUE_STORE* = "store"
|
||||
const LS_VALUE_NOTNOW* = "notNow"
|
||||
|
@ -37,6 +40,7 @@ QtObject:
|
|||
self.settings = newQSettings(filePath, QSettingsFormat.IniFormat)
|
||||
|
||||
proc storeToKeychainValueChanged*(self: LocalAccountSettings) {.signal.}
|
||||
proc isKeycardEnabledChanged*(self: LocalAccountSettings) {.signal.}
|
||||
|
||||
proc removeKey*(self: LocalAccountSettings, key: string) =
|
||||
if(self.settings.isNil):
|
||||
|
@ -46,10 +50,12 @@ QtObject:
|
|||
|
||||
if(key == LS_KEY_STORE_TO_KEYCHAIN):
|
||||
self.storeToKeychainValueChanged()
|
||||
elif(key == LS_KEY_IS_KEYCARD_ENABLED):
|
||||
self.isKeycardEnabledChanged()
|
||||
|
||||
proc getStoreToKeychainValue*(self: LocalAccountSettings): string {.slot.} =
|
||||
if(self.settings.isNil):
|
||||
return ""
|
||||
return DEFAULT_STORE_TO_KEYCHAIN
|
||||
|
||||
self.settings.value(LS_KEY_STORE_TO_KEYCHAIN).stringVal
|
||||
|
||||
|
@ -64,3 +70,22 @@ QtObject:
|
|||
read = getStoreToKeychainValue
|
||||
write = setStoreToKeychainValue
|
||||
notify = storeToKeychainValueChanged
|
||||
|
||||
|
||||
proc getIsKeycardEnabled*(self: LocalAccountSettings): bool {.slot.} =
|
||||
if(self.settings.isNil):
|
||||
return DEFAULT_IS_KEYCARD_ENABLED
|
||||
|
||||
self.settings.value(LS_KEY_IS_KEYCARD_ENABLED).boolVal
|
||||
|
||||
proc setIsKeycardEnabled*(self: LocalAccountSettings, value: bool) {.slot.} =
|
||||
if(self.settings.isNil):
|
||||
return
|
||||
|
||||
self.settings.setValue(LS_KEY_IS_KEYCARD_ENABLED, newQVariant(value))
|
||||
self.isKeycardEnabledChanged()
|
||||
|
||||
QtProperty[bool] isKeycardEnabled:
|
||||
read = getIsKeycardEnabled
|
||||
write = setIsKeycardEnabled
|
||||
notify = isKeycardEnabledChanged
|
|
@ -109,7 +109,7 @@ Page {
|
|||
anchors.top: btnExistingKey.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: isExperimental === "1" || localAccountSensitiveSettings.isKeycardEnabled
|
||||
visible: isExperimental === "1" || localAccountSettings.isKeycardEnabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,9 +227,9 @@ ScrollView {
|
|||
//% "Keycard"
|
||||
text: qsTr("Keycard")
|
||||
isSwitch: true
|
||||
switchChecked: localAccountSensitiveSettings.isKeycardEnabled
|
||||
switchChecked: localAccountSettings.isKeycardEnabled
|
||||
onClicked: {
|
||||
localAccountSensitiveSettings.isKeycardEnabled = !localAccountSensitiveSettings.isKeycardEnabled
|
||||
localAccountSettings.isKeycardEnabled = !localAccountSettings.isKeycardEnabled
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue