Adds patch to reset logs

online_reg^2
Laurent 11 months ago
parent acacfe1de2
commit c27a524fc5
  1. 9
      PadelClub/Utils/Patcher.swift

@ -16,6 +16,7 @@ enum Patch: String, CaseIterable {
case alexisLeDu case alexisLeDu
case importDataFromDevToProd case importDataFromDevToProd
case fixMissingMatches case fixMissingMatches
case cleanLogs
var id: String { var id: String {
return "padelclub.app.patch.\(self.rawValue)" return "padelclub.app.patch.\(self.rawValue)"
@ -31,7 +32,7 @@ class Patcher {
} }
static func patchIfPossible(_ patch: Patch) { static func patchIfPossible(_ patch: Patch) {
if UserDefaults.standard.value(forKey: patch.id) == nil { // if UserDefaults.standard.value(forKey: patch.id) == nil {
do { do {
Logger.log(">>> Patches \(patch.rawValue)...") Logger.log(">>> Patches \(patch.rawValue)...")
try self._applyPatch(patch) try self._applyPatch(patch)
@ -39,7 +40,7 @@ class Patcher {
} catch { } catch {
Logger.error(error) Logger.error(error)
} }
} // }
} }
fileprivate static func _applyPatch(_ patch: Patch) throws { fileprivate static func _applyPatch(_ patch: Patch) throws {
@ -47,6 +48,7 @@ class Patcher {
case .alexisLeDu: self._patchAlexisLeDu() case .alexisLeDu: self._patchAlexisLeDu()
case .importDataFromDevToProd: try self._importDataFromDev() case .importDataFromDevToProd: try self._importDataFromDev()
case .fixMissingMatches: self._patchMissingMatches() case .fixMissingMatches: self._patchMissingMatches()
case .cleanLogs: self._cleanLogs()
} }
} }
@ -161,4 +163,7 @@ class Patcher {
} }
fileprivate static func _cleanLogs() {
StoreCenter.main.resetLoggingCollections()
}
} }

Loading…
Cancel
Save