Skip to content

Commit

Permalink
fix: Display no connection error
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeWeidmann committed Sep 13, 2023
1 parent c71e857 commit 7d77f66
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
4 changes: 4 additions & 0 deletions MailCore/API/MailApiFetcher/MailApiFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ public final class MailApiFetcher: ApiFetcher, MailApiFetchable {
"Decoded type": String(describing: T.self),
"Raw JSON": rawJson])
}
} else if case .sessionTaskFailed(let error) = afError,
(error as NSError).code == NSURLErrorNotConnectedToInternet {
throw MailError.noConnection
}

throw AFErrorWithContext(request: request, afError: afError)
} else {
throw error
Expand Down
4 changes: 4 additions & 0 deletions MailCore/API/MailError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public class MailError: LocalizedError {
shouldDisplay: true)
public static let incoherentThreadDate = MailError(code: "incoherentThreadDate")

public static let noConnection = MailError(code: "noConnection",
localizedDescription: MailResourcesStrings.Localizable.noConnection,
shouldDisplay: true)

/// After an update from the server we are still without a default signature
public static let defaultSignatureMissing = MailError(code: "defaultSignatureMissing")

Expand Down
7 changes: 5 additions & 2 deletions MailResources/Localizable/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Release: Working copy
* Locale: de, German
* Tagged: ios
* Exported by: elena willen
* Exported at: Thu, 31 Aug 2023 13:09:24 +0200
* Exported by: Philippe Weidmann
* Exported at: Wed, 13 Sep 2023 10:20:38 +0200
*/

/* loco:6256793050618f7416758a32 */
Expand Down Expand Up @@ -1276,3 +1276,6 @@

/* loco:64edf250cb0c86ab3001d1b2 */
"buttonStart" = "Anfangen";

/* loco:65016e82bd99726dde081533 */
"noConnection" = "Keine Verbindung";
7 changes: 5 additions & 2 deletions MailResources/Localizable/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Release: Working copy
* Locale: en, English
* Tagged: ios
* Exported by: elena willen
* Exported at: Thu, 31 Aug 2023 13:09:24 +0200
* Exported by: Philippe Weidmann
* Exported at: Wed, 13 Sep 2023 10:20:38 +0200
*/

/* loco:6256793050618f7416758a32 */
Expand Down Expand Up @@ -1276,3 +1276,6 @@

/* loco:64edf250cb0c86ab3001d1b2 */
"buttonStart" = "Start";

/* loco:65016e82bd99726dde081533 */
"noConnection" = "No connection";
7 changes: 5 additions & 2 deletions MailResources/Localizable/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Release: Working copy
* Locale: es, Spanish
* Tagged: ios
* Exported by: elena willen
* Exported at: Thu, 31 Aug 2023 13:09:24 +0200
* Exported by: Philippe Weidmann
* Exported at: Wed, 13 Sep 2023 10:20:38 +0200
*/

/* loco:6256793050618f7416758a32 */
Expand Down Expand Up @@ -1276,3 +1276,6 @@

/* loco:64edf250cb0c86ab3001d1b2 */
"buttonStart" = "Empezar";

/* loco:65016e82bd99726dde081533 */
"noConnection" = "Sin conexión";
7 changes: 5 additions & 2 deletions MailResources/Localizable/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Release: Working copy
* Locale: fr, French
* Tagged: ios
* Exported by: elena willen
* Exported at: Thu, 31 Aug 2023 13:09:24 +0200
* Exported by: Philippe Weidmann
* Exported at: Wed, 13 Sep 2023 10:20:38 +0200
*/

/* loco:6256793050618f7416758a32 */
Expand Down Expand Up @@ -1276,3 +1276,6 @@

/* loco:64edf250cb0c86ab3001d1b2 */
"buttonStart" = "Commencer";

/* loco:65016e82bd99726dde081533 */
"noConnection" = "Pas de connexion";
7 changes: 5 additions & 2 deletions MailResources/Localizable/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Release: Working copy
* Locale: it, Italian
* Tagged: ios
* Exported by: elena willen
* Exported at: Thu, 31 Aug 2023 13:09:24 +0200
* Exported by: Philippe Weidmann
* Exported at: Wed, 13 Sep 2023 10:20:38 +0200
*/

/* loco:6256793050618f7416758a32 */
Expand Down Expand Up @@ -1276,3 +1276,6 @@

/* loco:64edf250cb0c86ab3001d1b2 */
"buttonStart" = "Inizia";

/* loco:65016e82bd99726dde081533 */
"noConnection" = "Nessuna connessione";

0 comments on commit 7d77f66

Please sign in to comment.