From 9d3d86c8d2c685afee919113d08da1e2afe07325 Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Fri, 22 Jul 2022 13:26:49 +0100
Subject: [PATCH] Remove unused code

---
 Sources/ElixxirDAppsSDK/Legacy/Client.swift   | 48 -------------------
 .../Legacy/ClientCreator.swift                | 37 --------------
 .../ElixxirDAppsSDK/Legacy/ClientE2E.swift    | 24 ----------
 .../Legacy/ClientIdProvider.swift             | 23 ---------
 .../Legacy/ClientProcessStatusProvider.swift  | 23 ---------
 .../Legacy/NetworkFollower.swift              | 27 -----------
 .../NetworkFollowerStatusProvider.swift       | 26 ----------
 7 files changed, 208 deletions(-)
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/Client.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/ClientCreator.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/ClientE2E.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/ClientIdProvider.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/ClientProcessStatusProvider.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/NetworkFollower.swift
 delete mode 100644 Sources/ElixxirDAppsSDK/Legacy/NetworkFollowerStatusProvider.swift

diff --git a/Sources/ElixxirDAppsSDK/Legacy/Client.swift b/Sources/ElixxirDAppsSDK/Legacy/Client.swift
deleted file mode 100644
index 306517de..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/Client.swift
+++ /dev/null
@@ -1,48 +0,0 @@
-//import Bindings
-//
-//public struct Client {
-//  public var getId: ClientIdProvider
-//  public var hasRunningProcesses: ClientProcessStatusProvider
-//  public var networkFollower: NetworkFollower
-//  public var waitForNetwork: NetworkWaiter
-//  public var isNetworkHealthy: NetworkHealthProvider
-//  public var monitorNetworkHealth: NetworkHealthListener
-//  public var listenErrors: ClientErrorListener
-//  public var makeIdentity: IdentityMaker
-//  public var connect: ConnectionMaker
-//  public var waitForDelivery: MessageDeliveryWaiter
-//}
-//
-//extension Client {
-//  public static func live(bindingsClient: BindingsCmix) -> Client {
-//    Client(
-//      getId: .live(bindingsClient: bindingsClient),
-//      hasRunningProcesses: .live(bindingsClient: bindingsClient),
-//      networkFollower: .live(bindingsClient: bindingsClient),
-//      waitForNetwork: .live(bindingsClient: bindingsClient),
-//      isNetworkHealthy: .live(bindingsClient: bindingsClient),
-//      monitorNetworkHealth: .live(bindingsClient: bindingsClient),
-//      listenErrors: .live(bindingsClient: bindingsClient),
-//      makeIdentity: .live(bindingsClient: bindingsClient),
-//      connect: .live(bindingsClient: bindingsClient),
-//      waitForDelivery: .live(bindingsClient: bindingsClient)
-//    )
-//  }
-//}
-//
-//#if DEBUG
-//extension Client {
-//  public static let failing = Client(
-//    getId: .failing,
-//    hasRunningProcesses: .failing,
-//    networkFollower: .failing,
-//    waitForNetwork: .failing,
-//    isNetworkHealthy: .failing,
-//    monitorNetworkHealth: .failing,
-//    listenErrors: .failing,
-//    makeIdentity: .failing,
-//    connect: .failing,
-//    waitForDelivery: .failing
-//  )
-//}
-//#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/ClientCreator.swift b/Sources/ElixxirDAppsSDK/Legacy/ClientCreator.swift
deleted file mode 100644
index 8988e085..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/ClientCreator.swift
+++ /dev/null
@@ -1,37 +0,0 @@
-//import Bindings
-//
-//public struct ClientCreator {
-//  public var create: (URL, Data, Data, String?) throws -> Void
-//
-//  public func callAsFunction(
-//    directoryURL: URL,
-//    ndf: Data,
-//    password: Data,
-//    regCode: String? = nil
-//  ) throws {
-//    try create(directoryURL, ndf, password, regCode)
-//  }
-//}
-//
-//extension ClientCreator {
-//  public static let live = ClientCreator { directoryURL, ndf, password, regCode in
-//    var error: NSError?
-//    let network = String(data: ndf, encoding: .utf8)!
-//    let created = BindingsNewKeystore(network, directoryURL.path, password, regCode, &error)
-//    if let error = error {
-//      throw error
-//    }
-//    if !created {
-//      fatalError("BindingsNewClient returned `false` without providing error")
-//    }
-//  }
-//}
-//
-//#if DEBUG
-//extension ClientCreator {
-//  public static let failing = ClientCreator { _, _, _, _ in
-//    struct NotImplemented: Error {}
-//    throw NotImplemented()
-//  }
-//}
-//#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/ClientE2E.swift b/Sources/ElixxirDAppsSDK/Legacy/ClientE2E.swift
deleted file mode 100644
index b16c68a6..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/ClientE2E.swift
+++ /dev/null
@@ -1,24 +0,0 @@
-import Bindings
-
-public struct ClientE2E {
-    public var getId: ClientE2EIdProvider
-    public var getContactFromIdentity: ContactFromIdentityProvider
-}
-
-extension ClientE2E {
-    public static func live(bindingsClientE2E: BindingsE2e) -> ClientE2E {
-        ClientE2E(
-            getId: .live(bindingsClientE2E: bindingsClientE2E),
-            getContactFromIdentity: .live(bindingsClientE2E: bindingsClientE2E)
-        )
-    }
-}
-
-#if DEBUG
-extension ClientE2E {
-    public static let failing = ClientE2E(
-        getId: .failing,
-        getContactFromIdentity: .failing
-    )
-}
-#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/ClientIdProvider.swift b/Sources/ElixxirDAppsSDK/Legacy/ClientIdProvider.swift
deleted file mode 100644
index acdfadba..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/ClientIdProvider.swift
+++ /dev/null
@@ -1,23 +0,0 @@
-import Bindings
-
-public struct ClientIdProvider {
-  public var get: () -> Int
-
-  public func callAsFunction() -> Int {
-    get()
-  }
-}
-
-extension ClientIdProvider {
-  public static func live(bindingsClient: BindingsCmix) -> ClientIdProvider {
-    ClientIdProvider(get: bindingsClient.getID)
-  }
-}
-
-#if DEBUG
-extension ClientIdProvider {
-  public static let failing = ClientIdProvider {
-    fatalError("Not implemented")
-  }
-}
-#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/ClientProcessStatusProvider.swift b/Sources/ElixxirDAppsSDK/Legacy/ClientProcessStatusProvider.swift
deleted file mode 100644
index 4da57562..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/ClientProcessStatusProvider.swift
+++ /dev/null
@@ -1,23 +0,0 @@
-import Bindings
-
-public struct ClientProcessStatusProvider {
-  public var get: () -> Bool
-
-  public func callAsFunction() -> Bool {
-    get()
-  }
-}
-
-extension ClientProcessStatusProvider {
-  public static func live(bindingsClient: BindingsCmix) -> ClientProcessStatusProvider {
-    ClientProcessStatusProvider(get: bindingsClient.hasRunningProcessies)
-  }
-}
-
-#if DEBUG
-extension ClientProcessStatusProvider {
-  public static let failing = ClientProcessStatusProvider {
-    fatalError("Not implemented")
-  }
-}
-#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/NetworkFollower.swift b/Sources/ElixxirDAppsSDK/Legacy/NetworkFollower.swift
deleted file mode 100644
index f4b748fc..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/NetworkFollower.swift
+++ /dev/null
@@ -1,27 +0,0 @@
-//import Bindings
-//
-//public struct NetworkFollower {
-//  public var status: NetworkFollowerStatusProvider
-//  public var start: NetworkFollowerStarter
-//  public var stop: NetworkFollowerStopper
-//}
-//
-//extension NetworkFollower {
-//  public static func live(bindingsClient: BindingsCmix) -> NetworkFollower {
-//    NetworkFollower(
-//      status: .live(bindingsClient: bindingsClient),
-//      start: .live(bindingsClient: bindingsClient),
-//      stop: .live(bindingsClient: bindingsClient)
-//    )
-//  }
-//}
-//
-//#if DEBUG
-//extension NetworkFollower {
-//  public static let failing = NetworkFollower(
-//    status: .failing,
-//    start: .failing,
-//    stop: .failing
-//  )
-//}
-//#endif
diff --git a/Sources/ElixxirDAppsSDK/Legacy/NetworkFollowerStatusProvider.swift b/Sources/ElixxirDAppsSDK/Legacy/NetworkFollowerStatusProvider.swift
deleted file mode 100644
index 04ca4d2a..00000000
--- a/Sources/ElixxirDAppsSDK/Legacy/NetworkFollowerStatusProvider.swift
+++ /dev/null
@@ -1,26 +0,0 @@
-import Bindings
-
-public struct NetworkFollowerStatusProvider {
-  public var status: () -> NetworkFollowerStatus
-
-  public func callAsFunction() -> NetworkFollowerStatus {
-    status()
-  }
-}
-
-extension NetworkFollowerStatusProvider {
-  public static func live(bindingsClient: BindingsCmix) -> NetworkFollowerStatusProvider {
-    NetworkFollowerStatusProvider {
-      let rawValue = bindingsClient.networkFollowerStatus()
-      return NetworkFollowerStatus(rawValue: rawValue)
-    }
-  }
-}
-
-#if DEBUG
-extension NetworkFollowerStatusProvider {
-  public static let failing = NetworkFollowerStatusProvider {
-    fatalError("Not implemented")
-  }
-}
-#endif
-- 
GitLab