Skip to content

Commit 2a4da3a

Browse files
authored
Merge pull request #804 from mixpanel/enable-preprocessor-macro
Fixes for compile error when set preprocessor macro `MIXPANEL_NO_NOTI…
2 parents caa6445 + 9597bf0 commit 2a4da3a

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

Mixpanel/AutomaticEvents.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
//
88

99
#import <UIKit/UIKit.h>
10-
#import <StoreKit/StoreKit.h>
1110
#import "MixpanelPeople.h"
1211

12+
1313
@protocol TrackDelegate <NSObject>
1414
- (void)track:(NSString *)event properties:(NSDictionary *)properties;
1515
@end
1616

17-
@interface AutomaticEvents: NSObject <SKPaymentTransactionObserver, SKProductsRequestDelegate>
17+
@interface AutomaticEvents: NSObject
1818
@property (atomic, weak) id<TrackDelegate> delegate;
1919
@property (atomic, assign) UInt64 minimumSessionDuration;
2020
@property (atomic, assign) UInt64 maximumSessionDuration;

Mixpanel/AutomaticEvents.m

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
#import "AutomaticEvents.h"
1010
#import "MPSwizzler.h"
1111
#import <objc/runtime.h>
12+
#import <StoreKit/StoreKit.h>
13+
14+
@interface AutomaticEvents() <SKPaymentTransactionObserver, SKProductsRequestDelegate>
15+
16+
@end
1217

1318
@implementation AutomaticEvents {
1419
NSMutableDictionary *awaitingTransactions;

Mixpanel/Mixpanel.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#import "MPLogger.h"
1414
#import "MPNetworkPrivate.h"
1515

16-
#if !MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT
1716
#import <UserNotifications/UserNotifications.h>
17+
#if !MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT
1818
#import "NSThread+MPHelpers.h"
1919
#endif
2020
#if defined(MIXPANEL_WATCHOS)
@@ -1729,6 +1729,7 @@ - (void)checkForDecideResponseWithCompletion:(void (^)(NSArray *notifications, N
17291729
return;
17301730
}
17311731

1732+
#if !MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT
17321733
NSDictionary *config = object[@"config"];
17331734
if (config && [config isKindOfClass:NSDictionary.class]) {
17341735
NSDictionary *validationConfig = config[@"ce"];
@@ -1743,6 +1744,7 @@ - (void)checkForDecideResponseWithCompletion:(void (^)(NSArray *notifications, N
17431744
}
17441745
}
17451746
}
1747+
#endif
17461748

17471749
id rawNotifications = object[@"notifications"];
17481750
NSMutableArray *parsedNotifications = [NSMutableArray array];

Mixpanel/MixpanelPrivate.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@
4848
#import "MPConnectIntegrations.h"
4949
#endif
5050

51-
#if !MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT
52-
@interface Mixpanel () <MPNotificationViewControllerDelegate, TrackDelegate>
53-
#else
51+
#if defined(MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT) && defined(MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT)
5452
@interface Mixpanel ()
53+
#elif defined(MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT)
54+
@interface Mixpanel () <TrackDelegate>
55+
#elif defined(MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT)
56+
@interface Mixpanel () <MPNotificationViewControllerDelegate>
57+
#else
58+
@interface Mixpanel () <MPNotificationViewControllerDelegate, TrackDelegate>
5559
#endif
60+
5661
{
5762
NSUInteger _flushInterval;
5863
BOOL _enableVisualABTestAndCodeless;

0 commit comments

Comments
 (0)