Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Add compiler directive that disables Crashlytics for development (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippzagar authored Jan 17, 2023
1 parent ca813ed commit edcc7cc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Campus-iOS/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ struct CampusApp: App {
@State var isLoginSheetPresented = false

init() {
#if !DEBUG
FirebaseApp.configure()
#endif
UITabBar.appearance().isOpaque = true
if #available(iOS 15.0, *) {
let appearance = UITabBarAppearance()
Expand Down
6 changes: 6 additions & 0 deletions Campus-iOS/Base/Entity/EntityImporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,21 @@ final class Importer<EntityType: Entity, EntityContainer: Decodable, DecoderType
let storage = try decoder.decode(EntityContainer.self, from: data)
handler?(.success(storage))
} catch let apiError as APIError {
#if !DEBUG
Crashlytics.crashlytics().record(error: apiError)
#endif
handler?(.failure(apiError))
return
} catch let decodingError as DecodingError {
#if !DEBUG
Crashlytics.crashlytics().record(error: decodingError)
#endif
handler?(.failure(decodingError))
return
} catch let error {
#if !DEBUG
Crashlytics.crashlytics().record(error: error)
#endif
handler?(.failure(error))
}
}
Expand Down
6 changes: 4 additions & 2 deletions Campus-iOS/Base/Networking/APIResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ struct TUMOnlineAPIResponse<T: Decodable>: Decodable {
return try $0.result.get()
}
catch {
Crashlytics.crashlytics().record(error: error)
return nil
#if !DEBUG
Crashlytics.crashlytics().record(error: error)
#endif
return nil
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Campus-iOS/LoginComponent/Service/AuthenticationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ final class AuthenticationHandler: RequestAdapter, RequestRetrier {
let encodedRequest = try URLEncoding.default.encode(urlRequest, with: ["pToken": pToken])
return completion(.success(encodedRequest))
} catch let error {
#if !DEBUG
Crashlytics.crashlytics().record(error: error)
#endif
return completion(.failure(error))
}
case urlString where TUMCabeAPI.requiresAuth.contains { urlString.contains($0)}:
Expand Down

0 comments on commit edcc7cc

Please sign in to comment.