Skip to content

Commit

Permalink
Merge pull request #804 from mixpanel/enable-preprocessor-macro
Browse files Browse the repository at this point in the history
Fixes for compile error when set preprocessor macro `MIXPANEL_NO_NOTI…
  • Loading branch information
zihejia authored Oct 15, 2018
2 parents caa6445 + 9597bf0 commit 2a4da3a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Mixpanel/AutomaticEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
//

#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
#import "MixpanelPeople.h"


@protocol TrackDelegate <NSObject>
- (void)track:(NSString *)event properties:(NSDictionary *)properties;
@end

@interface AutomaticEvents: NSObject <SKPaymentTransactionObserver, SKProductsRequestDelegate>
@interface AutomaticEvents: NSObject
@property (atomic, weak) id<TrackDelegate> delegate;
@property (atomic, assign) UInt64 minimumSessionDuration;
@property (atomic, assign) UInt64 maximumSessionDuration;
Expand Down
5 changes: 5 additions & 0 deletions Mixpanel/AutomaticEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#import "AutomaticEvents.h"
#import "MPSwizzler.h"
#import <objc/runtime.h>
#import <StoreKit/StoreKit.h>

@interface AutomaticEvents() <SKPaymentTransactionObserver, SKProductsRequestDelegate>

@end

@implementation AutomaticEvents {
NSMutableDictionary *awaitingTransactions;
Expand Down
4 changes: 3 additions & 1 deletion Mixpanel/Mixpanel.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#import "MPLogger.h"
#import "MPNetworkPrivate.h"

#if !MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT
#import <UserNotifications/UserNotifications.h>
#if !MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT
#import "NSThread+MPHelpers.h"
#endif
#if defined(MIXPANEL_WATCHOS)
Expand Down Expand Up @@ -1729,6 +1729,7 @@ - (void)checkForDecideResponseWithCompletion:(void (^)(NSArray *notifications, N
return;
}

#if !MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT
NSDictionary *config = object[@"config"];
if (config && [config isKindOfClass:NSDictionary.class]) {
NSDictionary *validationConfig = config[@"ce"];
Expand All @@ -1743,6 +1744,7 @@ - (void)checkForDecideResponseWithCompletion:(void (^)(NSArray *notifications, N
}
}
}
#endif

id rawNotifications = object[@"notifications"];
NSMutableArray *parsedNotifications = [NSMutableArray array];
Expand Down
11 changes: 8 additions & 3 deletions Mixpanel/MixpanelPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@
#import "MPConnectIntegrations.h"
#endif

#if !MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT
@interface Mixpanel () <MPNotificationViewControllerDelegate, TrackDelegate>
#else
#if defined(MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT) && defined(MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT)
@interface Mixpanel ()
#elif defined(MIXPANEL_NO_NOTIFICATION_AB_TEST_SUPPORT)
@interface Mixpanel () <TrackDelegate>
#elif defined(MIXPANEL_NO_AUTOMATIC_EVENTS_SUPPORT)
@interface Mixpanel () <MPNotificationViewControllerDelegate>
#else
@interface Mixpanel () <MPNotificationViewControllerDelegate, TrackDelegate>
#endif

{
NSUInteger _flushInterval;
BOOL _enableVisualABTestAndCodeless;
Expand Down

0 comments on commit 2a4da3a

Please sign in to comment.