Add AuthenticationService and RegistrationWizard. (#6056)

This commit is contained in:
Doug
2022-04-27 16:02:54 +01:00
committed by GitHub
parent 987eb7d5c0
commit abb8186a0a
16 changed files with 1373 additions and 5 deletions
@@ -36,12 +36,20 @@ struct AlertInfo<T: Hashable>: Identifiable {
var secondaryButton: (title: String, action: (() -> Void)?)? = nil
}
extension AlertInfo where T == Int {
extension AlertInfo {
/// Initialises the type with the title and message from an `NSError` along with the default Ok button.
init?(error: NSError? = nil) {
init?(error: NSError? = nil) where T == Int {
self.init(id: error?.code ?? -1, error: error)
}
/// Initialises the type with the title and message from an `NSError` along with the default Ok button.
/// - Parameters:
/// - id: An ID that identifies the error.
/// - error: The Error that occurred.
init?(id: T, error: NSError? = nil) {
guard error?.domain != NSURLErrorDomain && error?.code != NSURLErrorCancelled else { return nil }
id = error?.code ?? -1
self.id = id
title = error?.userInfo[NSLocalizedFailureReasonErrorKey] as? String ?? VectorL10n.error
message = error?.userInfo[NSLocalizedDescriptionKey] as? String ?? VectorL10n.errorCommonMessage
}