diff --git a/Reveil/Resources/Settings.bundle/Root.plist b/Reveil/Resources/Settings.bundle/Root.plist
index 1afabea..06af439 100644
--- a/Reveil/Resources/Settings.bundle/Root.plist
+++ b/Reveil/Resources/Settings.bundle/Root.plist
@@ -11,8 +11,6 @@
PSGroupSpecifier
Title
Performance
- FooterText
- Restart “Reveil” to make things happen.
Type
@@ -54,6 +52,24 @@
DefaultValue
+
+ Type
+ PSGroupSpecifier
+ Title
+ Dashboard
+ FooterText
+ Restart “Reveil” to make things happen.
+
+
+ Type
+ PSToggleSwitchSpecifier
+ Title
+ Reset Layouts
+ Key
+ ResetLayouts
+ DefaultValue
+
+
diff --git a/Reveil/Resources/Settings.bundle/en.lproj/Root.strings b/Reveil/Resources/Settings.bundle/en.lproj/Root.strings
index c4b4b57..e452d92 100644
--- a/Reveil/Resources/Settings.bundle/en.lproj/Root.strings
+++ b/Reveil/Resources/Settings.bundle/en.lproj/Root.strings
@@ -2,6 +2,8 @@
"Animated Text" = "Animated Text";
+"Dashboard" = "Dashboard";
+
"Enabled" = "Enabled";
"Group" = "Group";
@@ -16,4 +18,6 @@
"Performance" = "Performance";
+"Reset Layouts" = "Reset Layouts";
+
"Restart “Reveil” to make things happen." = "Restart “Reveil” to make things happen.";
diff --git a/Reveil/Resources/Settings.bundle/zh_Hans.lproj/Root.strings b/Reveil/Resources/Settings.bundle/zh_Hans.lproj/Root.strings
index 230d776..397d30c 100644
--- a/Reveil/Resources/Settings.bundle/zh_Hans.lproj/Root.strings
+++ b/Reveil/Resources/Settings.bundle/zh_Hans.lproj/Root.strings
@@ -2,6 +2,8 @@
"Animated Text" = "动态文字";
+"Dashboard" = "仪表盘";
+
"Enabled" = "启用";
"Group" = "组";
@@ -16,4 +18,6 @@
"Performance" = "性能";
+"Reset Layouts" = "还原布局";
+
"Restart “Reveil” to make things happen." = "重新打开 “Reveil” 以应用任何更改。";
diff --git a/Reveil/Storage/PinStorage.swift b/Reveil/Storage/PinStorage.swift
index 69b6fba..d7c5966 100644
--- a/Reveil/Storage/PinStorage.swift
+++ b/Reveil/Storage/PinStorage.swift
@@ -16,6 +16,10 @@ final class PinStorage: ObservableObject {
private init() {
pinnedEntryKeys = []
+ if StandardUserDefaults.shared.shouldResetLayouts {
+ resetDefaults()
+ StandardUserDefaults.shared.didResetLayouts()
+ }
reloadData()
registerNotifications()
try? registerDefaults()
diff --git a/Reveil/Storage/StandardUserDefaults.swift b/Reveil/Storage/StandardUserDefaults.swift
index 0e0dd51..f5e3765 100644
--- a/Reveil/Storage/StandardUserDefaults.swift
+++ b/Reveil/Storage/StandardUserDefaults.swift
@@ -11,15 +11,18 @@ private let gDefaultsKeyLegacyUI = "LegacyUI"
private let gDefaultsKeyAnimatedText = "AnimatedText"
private let gDefaultsKeyAnimatedBackground = "AnimatedBackground"
private let gDefaultsKeyLowFrameRate = "LowFrameRate"
+private let gDefaultsKeyResetLayouts = "ResetLayouts"
class StandardUserDefaults {
static let shared = StandardUserDefaults()
private init() {
UserDefaults.standard.register(defaults: [
+ gDefaultsKeyLegacyUI: false,
gDefaultsKeyAnimatedText: true,
gDefaultsKeyAnimatedBackground: true,
gDefaultsKeyLowFrameRate: false,
+ gDefaultsKeyResetLayouts: false,
])
}
@@ -38,4 +41,12 @@ class StandardUserDefaults {
lazy var isLowFrameRateEnabled: Bool = {
UserDefaults.standard.bool(forKey: gDefaultsKeyLowFrameRate)
}()
+
+ lazy var shouldResetLayouts: Bool = {
+ UserDefaults.standard.bool(forKey: gDefaultsKeyResetLayouts)
+ }()
+
+ func didResetLayouts() {
+ UserDefaults.standard.removeObject(forKey: gDefaultsKeyResetLayouts)
+ }
}