Skip to content

Commit dfa7c35

Browse files
committed
Style
1 parent d7a5c50 commit dfa7c35

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

crashlytics/Shared/CrashlyticsSwiftUIExampleApp.swift

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,55 @@
1414
// limitations under the License.
1515
//
1616

17-
import SwiftUI
1817
import FirebaseCore
1918
import FirebaseCrashlytics
19+
import SwiftUI
2020

2121
@main
2222
struct CrashlyticsSwiftUIExampleApp: App {
23-
private var crashlyticsReference = Crashlytics.crashlytics()
24-
let reachabilityHelper = ReachabililtyHelper()
23+
private var crashlyticsReference = Crashlytics.crashlytics()
24+
let reachabilityHelper = ReachabililtyHelper()
2525

26-
func setUserInfo() {
27-
let userInfo = [
28-
NSLocalizedDescriptionKey: NSLocalizedString("The request failed.", comment: ""),
29-
NSLocalizedFailureReasonErrorKey: NSLocalizedString(
30-
"The response returned a 404.",
31-
comment: ""
32-
),
33-
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(
34-
"Does this page exist?",
35-
comment: ""
36-
),
37-
"ProductID": "123456",
38-
"UserID": "Jane Smith",
39-
]
40-
let error = NSError(domain: NSURLErrorDomain, code: -1001, userInfo: userInfo)
41-
Crashlytics.crashlytics().record(error: error)
42-
}
26+
func setUserInfo() {
27+
let userInfo = [
28+
NSLocalizedDescriptionKey: NSLocalizedString("The request failed.", comment: ""),
29+
NSLocalizedFailureReasonErrorKey: NSLocalizedString(
30+
"The response returned a 404.",
31+
comment: ""
32+
),
33+
NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(
34+
"Does this page exist?",
35+
comment: ""
36+
),
37+
"ProductID": "123456",
38+
"UserID": "Jane Smith",
39+
]
40+
let error = NSError(domain: NSURLErrorDomain, code: -1001, userInfo: userInfo)
41+
Crashlytics.crashlytics().record(error: error)
42+
}
4343

44-
func setCustomValues() {
45-
crashlyticsReference.setCustomValue(42, forKey: "MeaningOfLife")
46-
crashlyticsReference.setCustomValue("Test value", forKey: "last_UI_action")
47-
let customKeysObject = [
48-
"locale": reachabilityHelper.getLocale(),
49-
"network_connection": reachabilityHelper.getNetworkStatus(),
50-
] as [String: Any]
51-
crashlyticsReference.setCustomKeysAndValues(customKeysObject)
52-
reachabilityHelper.updateAndTrackNetworkStatus()
53-
Crashlytics.crashlytics().setUserID("123456789")
54-
}
44+
func setCustomValues() {
45+
crashlyticsReference.setCustomValue(42, forKey: "MeaningOfLife")
46+
crashlyticsReference.setCustomValue("Test value", forKey: "last_UI_action")
47+
let customKeysObject = [
48+
"locale": reachabilityHelper.getLocale(),
49+
"network_connection": reachabilityHelper.getNetworkStatus(),
50+
] as [String: Any]
51+
crashlyticsReference.setCustomKeysAndValues(customKeysObject)
52+
reachabilityHelper.updateAndTrackNetworkStatus()
53+
Crashlytics.crashlytics().setUserID("123456789")
54+
}
5555

56-
init() {
57-
FirebaseApp.configure()
58-
Crashlytics.crashlytics().log("App loaded")
59-
setCustomValues()
60-
setUserInfo()
61-
}
56+
init() {
57+
FirebaseApp.configure()
58+
Crashlytics.crashlytics().log("App loaded")
59+
setCustomValues()
60+
setUserInfo()
61+
}
6262

63-
var body: some Scene {
64-
WindowGroup {
65-
ContentView()
63+
var body: some Scene {
64+
WindowGroup {
65+
ContentView()
66+
}
6667
}
67-
}
6868
}

crashlytics/Shared/ReachabililtyHelper.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ class ReachabililtyHelper: NSObject {
6060
* Add a hook to update network status going forward.
6161
*/
6262
func updateAndTrackNetworkStatus() {
63-
monitor.pathUpdateHandler = { [weak self] path in
64-
guard let self = self else { return }
65-
let status = self.networkStatus(from: path)
66-
Crashlytics.crashlytics().setCustomValue(status, forKey: "network_connection")
67-
}
63+
monitor.pathUpdateHandler = { [weak self] path in
64+
guard let self = self else { return }
65+
let status = self.networkStatus(from: path)
66+
Crashlytics.crashlytics().setCustomValue(status, forKey: "network_connection")
67+
}
6868
let queue = DispatchQueue(label: "NetworkMonitor")
6969
monitor.start(queue: queue)
7070
}

0 commit comments

Comments
 (0)