Skip to content

Commit b242f88

Browse files
authored
Merge pull request #102 from smartmobilefactory/smartmobilefactory/STRATODRVE-4263
Don't start AppCenterSDK when no services should be enabled
2 parents 7d6e6e3 + e449dbb commit b242f88

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

AppCenter/AppCenterSDK+HiDrive.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,22 @@ class AppCenterSDK: NSObject {
5858

5959
self.delegate = AppCenterSDKDelegate(isLogUploadEnabled: configuration.isLogUploadEnabled)
6060

61+
var services = [AnyClass]()
62+
6163
#if !os(macOS)
62-
let services = (configuration.isDistributionEnabled == true) ? [MSCrashes.self, MSDistribute.self] : [MSCrashes.self]
63-
#else
64-
let services = [MSCrashes.self]
64+
if (configuration.isDistributionEnabled == true) {
65+
services.append(MSDistribute.self)
66+
}
6567
#endif
6668

69+
if (configuration.isCrashReportEnabled == true) {
70+
services.append(MSCrashes.self)
71+
}
72+
73+
guard (services.isEmpty == false) else {
74+
return
75+
}
76+
6777
MSAppCenter.start(configuration.appSecret, withServices: services)
6878
MSCrashes.setEnabled(configuration.isCrashReportEnabled)
6979
MSCrashes.setDelegate(self.delegate)

0 commit comments

Comments
 (0)