From 7ddd7cf6febde59368f3f652e460632a4c53ffd7 Mon Sep 17 00:00:00 2001
From: Dariusz Rybicki <dariusz@elixxir.io>
Date: Thu, 8 Sep 2022 00:51:06 +0200
Subject: [PATCH] Remove FactHelpers from AppCore library

---
 .../AppCore/XXClientHelpers/FactHelpers.swift | 55 -------------------
 1 file changed, 55 deletions(-)
 delete mode 100644 Examples/xx-messenger/Sources/AppCore/XXClientHelpers/FactHelpers.swift

diff --git a/Examples/xx-messenger/Sources/AppCore/XXClientHelpers/FactHelpers.swift b/Examples/xx-messenger/Sources/AppCore/XXClientHelpers/FactHelpers.swift
deleted file mode 100644
index 83f04032..00000000
--- a/Examples/xx-messenger/Sources/AppCore/XXClientHelpers/FactHelpers.swift
+++ /dev/null
@@ -1,55 +0,0 @@
-import XXClient
-
-// TODO: Move to XXClient library
-
-public enum FactType: Equatable {
-  case username
-  case email
-  case phone
-  case other(Int)
-
-  public static let knownTypes: [Self] = [.username, .email, .phone]
-
-  public init(rawValue: Int) {
-    if let known = FactType.knownTypes.first(where: { $0.rawValue == rawValue }) {
-      self = known
-    } else {
-      self = .other(rawValue)
-    }
-  }
-
-  public var rawValue: Int {
-    switch self {
-    case .username: return 0
-    case .email: return 1
-    case .phone: return 2
-    case .other(let rawValue): return rawValue
-    }
-  }
-}
-
-extension Array where Element == Fact {
-  public func get(_ type: FactType) -> Fact? {
-    first(where: { $0.type == type.rawValue })
-  }
-
-  public mutating func set(_ type: FactType, _ value: String?) {
-    removeAll(where: { $0.type == type.rawValue })
-    if let value = value {
-      append(Fact(fact: value, type: type.rawValue))
-      sort(by: { $0.type < $1.type })
-    }
-  }
-}
-
-extension Contact {
-  public func getFact(_ type: FactType) throws -> Fact? {
-    try getFacts().get(type)
-  }
-
-  public mutating func setFact(_ type: FactType, _ value: String?) throws {
-    var facts = try getFacts()
-    facts.set(type, value)
-    try setFacts(facts)
-  }
-}
-- 
GitLab