From c3a79cd2f370d887755e57d420e7c528a73ad88d Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Tue, 4 Oct 2022 22:46:49 +0200
Subject: [PATCH] Add ResetAuthFeature library

---
 .../xcschemes/ResetAuthFeature.xcscheme       | 78 +++++++++++++++++++
 Examples/xx-messenger/Package.swift           | 16 ++++
 .../xcschemes/XXMessenger.xcscheme            | 10 +++
 .../ResetAuthFeature/ResetAuthFeature.swift   | 27 +++++++
 .../ResetAuthFeature/ResetAuthView.swift      | 39 ++++++++++
 .../ResetAuthFeatureTests.swift               |  8 ++
 6 files changed, 178 insertions(+)
 create mode 100644 Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/ResetAuthFeature.xcscheme
 create mode 100644 Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthFeature.swift
 create mode 100644 Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthView.swift
 create mode 100644 Examples/xx-messenger/Tests/ResetAuthFeatureTests/ResetAuthFeatureTests.swift

diff --git a/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/ResetAuthFeature.xcscheme b/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/ResetAuthFeature.xcscheme
new file mode 100644
index 00000000..dded8f8d
--- /dev/null
+++ b/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/ResetAuthFeature.xcscheme
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "1400"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "ResetAuthFeature"
+               BuildableName = "ResetAuthFeature"
+               BlueprintName = "ResetAuthFeature"
+               ReferencedContainer = "container:">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      buildConfiguration = "Debug"
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      codeCoverageEnabled = "YES">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "ResetAuthFeatureTests"
+               BuildableName = "ResetAuthFeatureTests"
+               BlueprintName = "ResetAuthFeatureTests"
+               ReferencedContainer = "container:">
+            </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">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "ResetAuthFeature"
+            BuildableName = "ResetAuthFeature"
+            BlueprintName = "ResetAuthFeature"
+            ReferencedContainer = "container:">
+         </BuildableReference>
+      </MacroExpansion>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>
diff --git a/Examples/xx-messenger/Package.swift b/Examples/xx-messenger/Package.swift
index d863e016..118b4b14 100644
--- a/Examples/xx-messenger/Package.swift
+++ b/Examples/xx-messenger/Package.swift
@@ -25,6 +25,7 @@ let package = Package(
     .library(name: "HomeFeature", targets: ["HomeFeature"]),
     .library(name: "MyContactFeature", targets: ["MyContactFeature"]),
     .library(name: "RegisterFeature", targets: ["RegisterFeature"]),
+    .library(name: "ResetAuthFeature", targets: ["ResetAuthFeature"]),
     .library(name: "RestoreFeature", targets: ["RestoreFeature"]),
     .library(name: "SendRequestFeature", targets: ["SendRequestFeature"]),
     .library(name: "UserSearchFeature", targets: ["UserSearchFeature"]),
@@ -310,6 +311,21 @@ let package = Package(
       ],
       swiftSettings: swiftSettings
     ),
+    .target(
+      name: "ResetAuthFeature",
+      dependencies: [
+        .product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
+        .product(name: "XXClient", package: "elixxir-dapps-sdk-swift"),
+      ],
+      swiftSettings: swiftSettings
+    ),
+    .testTarget(
+      name: "ResetAuthFeatureTests",
+      dependencies: [
+        .target(name: "ResetAuthFeature"),
+      ],
+      swiftSettings: swiftSettings
+    ),
     .target(
       name: "RestoreFeature",
       dependencies: [
diff --git a/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme b/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme
index 42a3cede..09928db4 100644
--- a/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme
+++ b/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme
@@ -149,6 +149,16 @@
                ReferencedContainer = "container:..">
             </BuildableReference>
          </TestableReference>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "ResetAuthFeatureTests"
+               BuildableName = "ResetAuthFeatureTests"
+               BlueprintName = "ResetAuthFeatureTests"
+               ReferencedContainer = "container:..">
+            </BuildableReference>
+         </TestableReference>
          <TestableReference
             skipped = "NO">
             <BuildableReference
diff --git a/Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthFeature.swift b/Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthFeature.swift
new file mode 100644
index 00000000..b1408662
--- /dev/null
+++ b/Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthFeature.swift
@@ -0,0 +1,27 @@
+import ComposableArchitecture
+import XCTestDynamicOverlay
+import XXClient
+
+public struct ResetAuthState: Equatable {
+  public init(
+    partner: Contact
+  ) {
+    self.partner = partner
+  }
+
+  var partner: Contact
+}
+
+public enum ResetAuthAction: Equatable {}
+
+public struct ResetAuthEnvironment {
+  public init() {}
+}
+
+#if DEBUG
+extension ResetAuthEnvironment {
+  public static let unimplemented = ResetAuthEnvironment()
+}
+#endif
+
+public let resetAuthReducer = Reducer<ResetAuthState, ResetAuthAction, ResetAuthEnvironment>.empty
diff --git a/Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthView.swift b/Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthView.swift
new file mode 100644
index 00000000..76677a1c
--- /dev/null
+++ b/Examples/xx-messenger/Sources/ResetAuthFeature/ResetAuthView.swift
@@ -0,0 +1,39 @@
+import ComposableArchitecture
+import SwiftUI
+
+public struct ResetAuthView: View {
+  public init(store: Store<ResetAuthState, ResetAuthAction>) {
+    self.store = store
+  }
+
+  let store: Store<ResetAuthState, ResetAuthAction>
+
+  struct ViewState: Equatable {
+    init(state: ResetAuthState) {}
+  }
+
+  public var body: some View {
+    WithViewStore(store, observe: ViewState.init) { viewStore in
+      Form {
+        Text("Unimplemented")
+      }
+      .navigationTitle("Reset auth")
+    }
+  }
+}
+
+#if DEBUG
+public struct ResetAuthView_Previews: PreviewProvider {
+  public static var previews: some View {
+    NavigationView {
+      ResetAuthView(store: Store(
+        initialState: ResetAuthState(
+          partner: .unimplemented(Data())
+        ),
+        reducer: .empty,
+        environment: ()
+      ))
+    }
+  }
+}
+#endif
diff --git a/Examples/xx-messenger/Tests/ResetAuthFeatureTests/ResetAuthFeatureTests.swift b/Examples/xx-messenger/Tests/ResetAuthFeatureTests/ResetAuthFeatureTests.swift
new file mode 100644
index 00000000..3721b662
--- /dev/null
+++ b/Examples/xx-messenger/Tests/ResetAuthFeatureTests/ResetAuthFeatureTests.swift
@@ -0,0 +1,8 @@
+import XCTest
+@testable import ResetAuthFeature
+
+final class ResetAuthFeatureTests: XCTestCase {
+  func testExample() {
+    XCTAssert(true)
+  }
+}
-- 
GitLab