Skip to content
Snippets Groups Projects
Select Git revision
  • 5881ccd2d03327586a84b3af5ec38f2edb512642
  • main default protected
  • dev protected
  • hotfixes-oct-2022
  • refactor/avatar-cell
  • 1.1.5
  • 1.1.4
  • 1.1.3
  • 1.1
  • 1.0.8
  • 1.0.7
  • 1.0.6
12 results

ChatListRecentContactCell.swift

Blame
  • ClientCreator.swift 910 B
    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 = BindingsNewClient(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