Add option to disable image animation

Changelog-Added: Add option to disable image animation
Closes: #707
This commit is contained in:
OlegAba
2023-02-28 16:40:51 -05:00
committed by William Casarin
parent 3fec9dd209
commit 0aff41d384
3 changed files with 28 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
import Foundation
import Vault
import UIKit
func should_show_wallet_selector(_ pubkey: String) -> Bool {
return UserDefaults.standard.object(forKey: "show_wallet_selector") as? Bool ?? true
@@ -34,6 +35,10 @@ func get_default_zap_amount(pubkey: String) -> Int? {
return amt
}
func should_disable_image_animation() -> Bool {
return (UserDefaults.standard.object(forKey: "disable_animation") as? Bool)
?? UIAccessibility.isReduceMotionEnabled
}
func get_default_wallet(_ pubkey: String) -> Wallet {
if let defaultWalletName = UserDefaults.standard.string(forKey: "default_wallet"),
@@ -159,6 +164,12 @@ class UserSettingsStore: ObservableObject {
}
}
}
@Published var disable_animation: Bool {
didSet {
UserDefaults.standard.set(disable_animation, forKey: "disable_animation")
}
}
init() {
// TODO: pubkey-scoped settings
@@ -167,6 +178,7 @@ class UserSettingsStore: ObservableObject {
show_wallet_selector = should_show_wallet_selector(pubkey)
left_handed = UserDefaults.standard.object(forKey: "left_handed") as? Bool ?? false
disable_animation = should_disable_image_animation()
// Note from @tyiu:
// Default translation service is disabled by default for now until we gain some confidence that it is working well in production.