Skip to content

Commit

Permalink
[PWN-9032] Handle internet connection error on 2 striga screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Elizaveta Semenova committed Jul 10, 2023
1 parent ea60e2d commit db869b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion p2p_wallet/Common/Extensions/NSError+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Foundation

extension NSError {
var isNetworkConnectionError: Bool {
self.code == NSURLErrorNetworkConnectionLost || self.code == NSURLErrorNotConnectedToInternet || self.code == NSURLErrorDataNotAllowed
self.code == NSURLErrorNetworkConnectionLost || self.code == NSURLErrorNotConnectedToInternet || self.code == NSURLErrorDataNotAllowed || self.code == NSURLErrorTimedOut
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ private extension StrigaRegistrationSecondStepViewModel {
self.openHardError.send(())
}
await logAlertMessage(error: BankTransferError.mobileAlreadyExists)
} catch let error as NSError where error.isNetworkConnectionError {
notificationService.showConnectionErrorNotification()
await MainActor.run {
self.isLoading = false
}
} catch {
self.notificationService.showDefaultErrorNotification()
await MainActor.run {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ final class EnterSMSCodeViewModel: BaseOTPViewModel {
default:
self.showError(error: error)
}
} else if (error as? NSError)?.isNetworkConnectionError == true {
self?.notificationService.showConnectionErrorNotification()
} else if error is UndefinedAPIGatewayError {
self?.notificationService.showDefaultErrorNotification()
} else {
Expand Down

0 comments on commit db869b2

Please sign in to comment.