|
|
|
|
@ -19,20 +19,20 @@ enum Patch: String, CaseIterable { |
|
|
|
|
|
|
|
|
|
class Patcher { |
|
|
|
|
|
|
|
|
|
// static func applyIfNeeded() { |
|
|
|
|
// for patch in Patch.allCases { |
|
|
|
|
// if UserDefaults.standard.value(forKey: patch.id) == nil { |
|
|
|
|
// do { |
|
|
|
|
// try self.applyPatch(patch) |
|
|
|
|
// UserDefaults.standard.setValue(true, forKey: patch.id) |
|
|
|
|
// } catch { |
|
|
|
|
// Logger.error(error) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
static func applyAllWhenApplicable() { |
|
|
|
|
for patch in Patch.allCases { |
|
|
|
|
self.patchIfPossible(patch) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static func patchIfPossible(_ patch: Patch) { |
|
|
|
|
if UserDefaults.standard.value(forKey: patch.id) == nil { |
|
|
|
|
self._applyPatch(patch) |
|
|
|
|
UserDefaults.standard.setValue(true, forKey: patch.id) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static func applyPatch(_ patch: Patch) { |
|
|
|
|
fileprivate static func _applyPatch(_ patch: Patch) { |
|
|
|
|
switch patch { |
|
|
|
|
case .alexisLeDu: self._patchAlexisLeDu() |
|
|
|
|
case .importDataFromDev: self._importDataFromDev() |
|
|
|
|
|