Skip to content

Commit

Permalink
Show / hide reset button in secrets recovery screen (#4546).
Browse files Browse the repository at this point in the history
  • Loading branch information
gileluard committed Jul 12, 2021
1 parent 3f15a44 commit a650e49
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Changes to be released in next version
* Directory List (pop-up one): Fix duplicate rooms being shown (#4537).
* Use different title for scan button for self verification (#4525).
* it's easy for the back button to trigger a leftpanel reveal (#4438).
* Show / hide reset button in secrets recovery screen (#4546).

⚠️ API Changes
*
Expand Down
5 changes: 4 additions & 1 deletion Config/BuildSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ final class BuildSettings: NSObject {
static let authScreenShowForgotPassword = true
static let authScreenShowCustomServerOptions = true

// Mark: - Unified Search
// MARK: - Unified Search
static let unifiedSearchScreenShowPublicDirectory = true

// MARK: - Secrets Recovery
static let secretsRecoveryAllowReset = true
}
16 changes: 15 additions & 1 deletion Riot/Managers/Settings/RiotSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ final class RiotSettings: NSObject {
static let roomMemberScreenShowIgnore = "roomMemberScreenShowIgnore"
static let unifiedSearchScreenShowPublicDirectory = "unifiedSearchScreenShowPublicDirectory"
static let hideSpaceBetaAnnounce = "hideSpaceBetaAnnounce"
static let secretsRecoveryAllowReset = "secretsRecoveryAllowReset"
}

static let shared = RiotSettings()
Expand Down Expand Up @@ -695,7 +696,7 @@ final class RiotSettings: NSObject {
}
}

// Mark: - Unified Search
// MARK: - Unified Search

var unifiedSearchScreenShowPublicDirectory: Bool {
get {
Expand All @@ -708,6 +709,19 @@ final class RiotSettings: NSObject {
}
}

// MARK: - Secrets Recovery

var secretsRecoveryAllowReset: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.secretsRecoveryAllowReset) != nil else {
return BuildSettings.secretsRecoveryAllowReset
}
return defaults.bool(forKey: UserDefaultsKeys.secretsRecoveryAllowReset)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.secretsRecoveryAllowReset)
}
}

// MARK: - Beta

var hideSpaceBetaAnnounce: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ final class SecretsRecoveryWithKeyViewController: UIViewController {
self.updateRecoverButton()

self.resetSecretsButton.vc_enableMultiLinesTitle()

self.resetSecretsButton.isHidden = !RiotSettings.shared.secretsRecoveryAllowReset
}

private func update(theme: Theme) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ final class SecretsRecoveryWithPassphraseViewController: UIViewController {
self.updateRecoverButton()

self.resetSecretsButton.vc_enableMultiLinesTitle()

self.resetSecretsButton.isHidden = !RiotSettings.shared.secretsRecoveryAllowReset
}

private func update(theme: Theme) {
Expand Down

0 comments on commit a650e49

Please sign in to comment.