Skip to content

Commit

Permalink
fix: migration compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
andrej-jasso committed Apr 12, 2024
1 parent 7691e7f commit a471c89
Show file tree
Hide file tree
Showing 19 changed files with 383 additions and 147 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EACEC4592995B363008242AA"
BuildableName = "GoodPersistence-Sample.app"
BlueprintName = "GoodPersistence-Sample"
ReferencedContainer = "container:GoodPersistence-Sample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EACEC4592995B363008242AA"
BuildableName = "GoodPersistence-Sample.app"
BlueprintName = "GoodPersistence-Sample"
ReferencedContainer = "container:GoodPersistence-Sample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EACEC4592995B363008242AA"
BuildableName = "GoodPersistence-Sample.app"
BlueprintName = "GoodPersistence-Sample"
ReferencedContainer = "container:GoodPersistence-Sample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5D0F029B2BC6A06C0052980E"
BuildableName = "GoodPersistenceKeychainTests.xctest"
BlueprintName = "GoodPersistenceKeychainTests"
ReferencedContainer = "container:GoodPersistence-Sample.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit
import GoodPersistence

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand All @@ -20,6 +21,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

UINavigationBar.configureAppearance()

GoodPersistence.Configuration.configure(monitors: [LoggingPersistenceMonitor(logger: OSLogLogger())])
AppCoordinator(window: window, di: DI()).start()

return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protocol CacheManagerType: AnyObject {

var savedTimeKeychain: String { get }

var savedTimeKeychainPublisher: AnyPublisher<String, KeychainError> { get }
var savedTimeKeychainPublisher: AnyPublisher<String, Never> { get }

var savedNumberKeychain: Int { get set }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Combine
import UIKit
import GoodPersistence

final class HomeViewModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ import GoodPersistence

typealias VoidClosure = (() -> ())

class PersistenceMonitorClass: PersistenceMonitor {

func didReceive(_ monitor: PersistenceMonitor, error: any Error) {
print("error from gRPer", error)
}

}

final class KeychainMajorMigrationV1Tests: XCTestCase {

enum C {
Expand All @@ -34,7 +26,6 @@ final class KeychainMajorMigrationV1Tests: XCTestCase {
var testString2: String?

func testMigrationFromv1tov2() {
GoodPersistence.Configuration.configure(monitors: [PersistenceMonitorClass()])
testString = nil

XCTAssert(self.testString == nil)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
//
// Configuration.swift
//
// GoodPersistence.swift
//
// Created by Dominik Pethö on 05/04/2024.
//

public final class GoodPersistence {

/// Used for configuring the GoodPoersistance monitors
/// Used for configuring the GoodPersistence monitors
public final class Configuration {

public static private(set) var monitors: [PersistenceMonitor] = []
Expand All @@ -19,4 +18,16 @@ public final class GoodPersistence {

}

static func log(error: Error) {
GoodPersistence.Configuration.monitors.forEach {
$0.didReceive($0, error: error)
}
}

static func log(message: String) {
GoodPersistence.Configuration.monitors.forEach {
$0.didReceive($0, message: message)
}
}

}
Loading

0 comments on commit a471c89

Please sign in to comment.