Skip to content

Commit 808b883

Browse files
committed
style
1 parent 4bd93a6 commit 808b883

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

crashlytics/Shared/ReachabililtyHelper.swift

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

17-
import Foundation
1817
import FirebaseCrashlytics
18+
import Foundation
1919
import Network
2020

2121
class ReachabililtyHelper: NSObject {
22-
private let monitor: NWPathMonitor
22+
private let monitor: NWPathMonitor
2323

24-
override init() {
25-
monitor = NWPathMonitor()
26-
super.init()
27-
}
24+
override init() {
25+
monitor = NWPathMonitor()
26+
super.init()
27+
}
2828

29-
/**
30-
* Retrieve the locale information for the app.
31-
*/
32-
func getLocale() -> String {
33-
return Locale.preferredLanguages[0]
34-
}
29+
/**
30+
* Retrieve the locale information for the app.
31+
*/
32+
func getLocale() -> String {
33+
return Locale.preferredLanguages[0]
34+
}
3535

36-
/**
37-
* Retrieve the network status for the app.
38-
*/
39-
func getNetworkStatus() -> String {
40-
return networkStatus(from: monitor.currentPath)
41-
}
36+
/**
37+
* Retrieve the network status for the app.
38+
*/
39+
func getNetworkStatus() -> String {
40+
return networkStatus(from: monitor.currentPath)
41+
}
4242

43-
private func networkStatus(from path: NWPath) -> String {
44-
if path.status == .satisfied {
45-
if path.usesInterfaceType(.wifi) {
46-
return "wifi"
47-
} else if path.usesInterfaceType(.cellular) {
48-
return "cellular"
49-
} else if path.usesInterfaceType(.wiredEthernet) {
50-
return "wired"
51-
} else {
52-
return "other"
53-
}
54-
} else {
55-
return "unavailable"
43+
private func networkStatus(from path: NWPath) -> String {
44+
if path.status == .satisfied {
45+
if path.usesInterfaceType(.wifi) {
46+
return "wifi"
47+
} else if path.usesInterfaceType(.cellular) {
48+
return "cellular"
49+
} else if path.usesInterfaceType(.wiredEthernet) {
50+
return "wired"
51+
} else {
52+
return "other"
53+
}
54+
} else {
55+
return "unavailable"
56+
}
5657
}
57-
}
5858

59-
/**
60-
* Add a hook to update network status going forward.
61-
*/
62-
func updateAndTrackNetworkStatus() {
63-
monitor.pathUpdateHandler = { path in
64-
let status = self.networkStatus(from: path)
65-
Crashlytics.crashlytics().setCustomValue(status, forKey: "network_connection")
59+
/**
60+
* Add a hook to update network status going forward.
61+
*/
62+
func updateAndTrackNetworkStatus() {
63+
monitor.pathUpdateHandler = { path in
64+
let status = self.networkStatus(from: path)
65+
Crashlytics.crashlytics().setCustomValue(status, forKey: "network_connection")
66+
}
67+
let queue = DispatchQueue(label: "NetworkMonitor")
68+
monitor.start(queue: queue)
6669
}
67-
let queue = DispatchQueue(label: "NetworkMonitor")
68-
monitor.start(queue: queue)
69-
}
70-
}
70+
}

0 commit comments

Comments
 (0)