add a reset core data option in manage account menu

This commit is contained in:
Satindar Dhillon
2022-08-08 10:18:49 -07:00
parent b60fb42606
commit 8c1d012128
2 changed files with 7 additions and 1 deletions

View File

@ -37,6 +37,12 @@ struct ManageAccountView: View {
},
label: { Text("Delete Account") }
)
Button(
action: {
dataService.resetCoreData()
},
label: { Text("Reset Data Cache") }
)
.alert(isPresented: $showDeleteAccountConfirmation) {
Alert(
title: Text("Are you sure you want to delete your account? This action can't be undone."),

View File

@ -95,7 +95,7 @@ public final class DataService: ObservableObject {
}
}
func resetCoreData() {
public func resetCoreData() {
UserDefaults.standard.set(
DateFormatter.formatterISO8601.string(from: Date(timeIntervalSinceReferenceDate: 0)),
forKey: UserDefaultKey.lastItemSyncTime.rawValue