Skip to content
Snippets Groups Projects
Commit a25859e9 authored by Bruno Muniz's avatar Bruno Muniz :apple:
Browse files

Merge branch 'fix/invitation-deep-link-handling' into 'dev'

Fix invitation deep link handling

See merge request elixxir/client-ios!98
parents c21a449b 0b14a376
No related branches found
No related tags found
1 merge request!98Fix invitation deep link handling
...@@ -63,31 +63,8 @@ final class SearchLeftViewModel { ...@@ -63,31 +63,8 @@ final class SearchLeftViewModel {
if let pendingInvitation = invitation { if let pendingInvitation = invitation {
invitation = nil invitation = nil
stateSubject.value.input = pendingInvitation stateSubject.value.input = pendingInvitation
hudManager.show(.init(
actionTitle: Localized.Ud.Search.cancel,
hasDotAnimation: true,
isAutoDismissable: false,
onTapClosure: { [weak self] in
guard let self else { return }
self.didTapCancelSearch()
}
))
networkCancellable.removeAll() networkCancellable.removeAll()
didStartSearching()
// networkMonitor
// .statusPublisher
// .first { $0 == .available }
// .eraseToAnyPublisher()
// .flatMap { _ in
// self.waitForNodes(timeout: 5)
// }.sink(receiveCompletion: {
// if case .failure(let error) = $0 {
// self.hudManager.show(.init(error: error))
// }
// }, receiveValue: {
// self.didStartSearching()
// }).store(in: &networkCancellable)
} }
} }
...@@ -112,60 +89,60 @@ final class SearchLeftViewModel { ...@@ -112,60 +89,60 @@ final class SearchLeftViewModel {
func didStartSearching() { func didStartSearching() {
guard stateSubject.value.input.isEmpty == false else { return } guard stateSubject.value.input.isEmpty == false else { return }
hudManager.show(.init( backgroundScheduler.schedule { [weak self] in
actionTitle: Localized.Ud.Search.cancel, guard let self else { return }
hasDotAnimation: true,
isAutoDismissable: false,
onTapClosure: { [weak self] in
guard let self else { return }
self.didTapCancelSearch()
}
))
var content = stateSubject.value.input
if stateSubject.value.item == .phone {
content += stateSubject.value.country.code
}
enum NodeRegistrationError: Error { self.hudManager.show(.init(
case unhealthyNet actionTitle: Localized.Ud.Search.cancel,
case belowMinimum hasDotAnimation: true,
} isAutoDismissable: false,
onTapClosure: { [weak self] in
guard let self else { return }
self.didTapCancelSearch()
}
))
retry(max: 5, retryStrategy: .delay(seconds: 2)) { [weak self] in var content = self.stateSubject.value.input
guard let self else { return }
do { if self.stateSubject.value.item == .phone {
let nrr = try self.messenger.cMix.get()!.getNodeRegistrationStatus() content += self.stateSubject.value.country.code
if nrr.ratio < 0.8 { throw NodeRegistrationError.belowMinimum }
} catch {
throw NodeRegistrationError.unhealthyNet
} }
}.finalCatch { [weak self] in
guard let self else { return }
if case .unhealthyNet = $0 as? NodeRegistrationError { enum NodeRegistrationError: Error {
self.hudManager.show(.init(content: "Network is not healthy yet, try again within the next minute or so.")) case unhealthyNet
} else if case .belowMinimum = $0 as? NodeRegistrationError { case belowMinimum
self.hudManager.show(.init(content:"Node registration ratio is still below 80%, try again within the next minute or so."))
} else {
self.hudManager.show(.init(error: $0))
} }
return retry(max: 5, retryStrategy: .delay(seconds: 2)) { [weak self] in
} guard let self else { return }
var factType: FactType = .username do {
let nrr = try self.messenger.cMix.get()!.getNodeRegistrationStatus()
if nrr.ratio < 0.8 { throw NodeRegistrationError.belowMinimum }
} catch {
throw NodeRegistrationError.unhealthyNet
}
}.finalCatch { [weak self] in
guard let self else { return }
if stateSubject.value.item == .phone { if case .unhealthyNet = $0 as? NodeRegistrationError {
factType = .phone self.hudManager.show(.init(content: "Network is not healthy yet, try again within the next minute or so."))
} else if stateSubject.value.item == .email { } else if case .belowMinimum = $0 as? NodeRegistrationError {
factType = .email self.hudManager.show(.init(content:"Node registration ratio is still below 80%, try again within the next minute or so."))
} } else {
self.hudManager.show(.init(error: $0))
}
backgroundScheduler.schedule { [weak self] in return
guard let self else { return } }
var factType: FactType = .username
if self.stateSubject.value.item == .phone {
factType = .phone
} else if self.stateSubject.value.item == .email {
factType = .email
}
do { do {
let report = try SearchUD.live( let report = try SearchUD.live(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment