diff --git a/mParticle-Apple-SDK/Utils/MPApplication.h b/mParticle-Apple-SDK/Utils/MPApplication.h index 57323d53..6b0185a4 100644 --- a/mParticle-Apple-SDK/Utils/MPApplication.h +++ b/mParticle-Apple-SDK/Utils/MPApplication.h @@ -24,16 +24,11 @@ extern NSString * _Nonnull const kMPApplicationInformationKey; @property (nonatomic, strong, readonly, nullable) NSString *version __attribute__((const)); @property (nonatomic, readonly) MPEnvironment environment __attribute__((const)); -#if TARGET_OS_IOS == 1 -@property (nonatomic, strong, readonly, nullable) NSNumber *badgeNumber; -#endif - + (nullable NSString *)appStoreReceipt; + (void)markInitialLaunchTime; + (void)updateLastUseDate:(nonnull NSDate *)date; + (void)updateLaunchCountsAndDates; + (void)updateStoredVersionAndBuildNumbers; -+ (void)updateBadgeNumber; + (nonnull NSDictionary *)appImageInfo; + (nullable UIApplication *)sharedUIApplication; - (nonnull NSDictionary *)dictionaryRepresentation; diff --git a/mParticle-Apple-SDK/Utils/MPApplication.m b/mParticle-Apple-SDK/Utils/MPApplication.m index 0820e7c4..5a3dc19f 100644 --- a/mParticle-Apple-SDK/Utils/MPApplication.m +++ b/mParticle-Apple-SDK/Utils/MPApplication.m @@ -28,7 +28,6 @@ NSString *const kMPAppStoredVersionKey = @"asv"; NSString *const kMPAppStoredBuildKey = @"asb"; NSString *const kMPAppEnvironmentKey = @"env"; -NSString *const kMPAppBadgeNumberKey = @"bn"; NSString *const kMPAppStoreReceiptKey = @"asr"; NSString *const kMPAppImageBaseAddressKey = @"iba"; NSString *const kMPAppImageSizeKey = @"is"; @@ -69,10 +68,6 @@ @interface MParticle () @property (nonatomic, strong, readonly) MPStateMachine *stateMachine; -#if TARGET_OS_IOS == 1 -@property (nonatomic, strong, readwrite, nullable) NSNumber *badgeNumber; -#endif - @end @interface MPApplication() { @@ -298,24 +293,6 @@ + (UIApplication *)sharedUIApplication { return nil; } -#if TARGET_OS_IOS == 1 -- (NSNumber *)badgeNumber { - if (![MPStateMachine isAppExtension]) { - MPIUserDefaults *userDefaults = [MPIUserDefaults standardUserDefaults]; - NSNumber *badgeNumber = userDefaults[kMPAppBadgeNumberKey]; - return badgeNumber.integerValue != 0 ? badgeNumber : nil; - } - return nil; -} - -- (void)setBadgeNumber:(NSNumber * _Nullable)badgeNumber { - if (![MPStateMachine isAppExtension]) { - MPIUserDefaults *userDefaults = [MPIUserDefaults standardUserDefaults]; - userDefaults[kMPAppBadgeNumberKey] = badgeNumber; - } -} -#endif - - (NSDictionary *)searchAdsAttribution { return MParticle.sharedInstance.stateMachine.searchAdsInfo; } @@ -386,20 +363,6 @@ + (void)updateStoredVersionAndBuildNumbers { application.storedBuild = application.build; } -+ (void)updateBadgeNumber { -#if TARGET_OS_IOS == 1 - if ([NSThread isMainThread]) { - MPApplication *application = [[MPApplication alloc] init]; - application.badgeNumber = @([MPApplication sharedUIApplication].applicationIconBadgeNumber); - } else { - dispatch_async(dispatch_get_main_queue(), ^{ - MPApplication *application = [[MPApplication alloc] init]; - application.badgeNumber = @([MPApplication sharedUIApplication].applicationIconBadgeNumber); - }); - } -#endif -} - + (NSDictionary *)appImageInfo { struct uuid_command uuid = {0}; uintptr_t baseaddr = 0; @@ -510,13 +473,6 @@ + (NSDictionary *)appImageInfo { applicationInfo[kMPAppStoreReceiptKey] = [MPApplication appStoreReceipt]; } -#if TARGET_OS_IOS == 1 - NSNumber *badgeNumber = self.badgeNumber; - if (badgeNumber != nil) { - applicationInfo[kMPAppBadgeNumberKey] = badgeNumber; - } -#endif - appInfo = (NSDictionary *)applicationInfo; return appInfo; diff --git a/mParticle-Apple-SDK/Utils/MPStateMachine.m b/mParticle-Apple-SDK/Utils/MPStateMachine.m index ed9f453f..1c2baf81 100644 --- a/mParticle-Apple-SDK/Utils/MPStateMachine.m +++ b/mParticle-Apple-SDK/Utils/MPStateMachine.m @@ -137,7 +137,6 @@ - (instancetype)init { [MPApplication markInitialLaunchTime]; [MPApplication updateLaunchCountsAndDates]; - [MPApplication updateBadgeNumber]; }); } @@ -260,12 +259,11 @@ - (void)resetTriggers { - (void)handleApplicationDidEnterBackground:(NSNotification *)notification { [MPApplication updateLastUseDate:_launchDate]; _backgrounded = YES; - + __weak MPStateMachine *weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ __strong MPStateMachine *strongSelf = weakSelf; strongSelf.launchInfo = nil; - [MPApplication updateBadgeNumber]; }); } @@ -275,7 +273,6 @@ - (void)handleApplicationWillEnterForeground:(NSNotification *)notification { dispatch_async(dispatch_get_main_queue(), ^{ __strong MPStateMachine *strongSelf = weakSelf; strongSelf->_backgrounded = NO; - [MPApplication updateBadgeNumber]; }); }