-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide buttons on balance tab (from appearance)
- Loading branch information
Showing
10 changed files
with
75 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
UnstoppableWallet/UnstoppableWallet/Core/Managers/WalletButtonHiddenManager.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import RxRelay | ||
import RxSwift | ||
|
||
class WalletButtonHiddenManager { | ||
private let keyButtonHidden = "wallet-button-hidden" | ||
|
||
private let userDefaultsStorage: UserDefaultsStorage | ||
|
||
private let buttonHiddenRelay = PublishRelay<Bool>() | ||
var buttonHidden: Bool { | ||
get { | ||
userDefaultsStorage.value(for: keyButtonHidden) ?? false | ||
} | ||
set { | ||
guard buttonHidden != newValue else { return } | ||
userDefaultsStorage.set(value: newValue, for: keyButtonHidden) | ||
buttonHiddenRelay.accept(newValue) | ||
} | ||
} | ||
|
||
init(userDefaultsStorage: UserDefaultsStorage) { | ||
self.userDefaultsStorage = userDefaultsStorage | ||
} | ||
} | ||
|
||
extension WalletButtonHiddenManager { | ||
var buttonHiddenObservable: Observable<Bool> { | ||
buttonHiddenRelay.asObservable() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters