Update AppDelegate.mm

This commit is contained in:
Marcos Rodriguez Velez 2024-04-08 20:34:24 -04:00
parent cdb754ea32
commit d5dcae61e3
No known key found for this signature in database
GPG Key ID: 6030B2F48CCE86D7

View File

@ -30,18 +30,12 @@ NSUserDefaults *group = [[NSUserDefaults alloc] initWithSuiteName:@"group.io.blu
config.appType = @"macOS";
// Start Bugsnag with the configuration
[Bugsnag startWithConfiguration:config];
[self copyDeviceUID];
#else
[Bugsnag start];
[self copyDeviceUID];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"deviceUID"
options:NSKeyValueObservingOptionNew
context:NULL];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"deviceUIDCopy"
options:NSKeyValueObservingOptionNew
context:NULL];
[self copyDeviceUID];
#endif
}
@ -94,6 +88,14 @@ NSUserDefaults *group = [[NSUserDefaults alloc] initWithSuiteName:@"group.io.blu
}
- (void)copyDeviceUID {
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"deviceUID"
options:NSKeyValueObservingOptionNew
context:NULL];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"deviceUIDCopy"
options:NSKeyValueObservingOptionNew
context:NULL];
NSString *deviceUID = [[NSUserDefaults standardUserDefaults] stringForKey:@"deviceUID"];
if (deviceUID && deviceUID.length > 0) {
[NSUserDefaults.standardUserDefaults setValue:deviceUID forKey:@"deviceUIDCopy"];