Skip to content

Commit 6e65f0c

Browse files
authored
Refactor Interstitial Into its file (#336)
* refactor hitview into its own file * changes * more progress * add open url * fix
1 parent e76da37 commit 6e65f0c

18 files changed

+1008
-122
lines changed

Leanplum-SDK.xcodeproj/project.pbxproj

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@
185185
5B23412D21ED970600206ACB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B23412C21ED970600206ACB /* UIKit.framework */; };
186186
5B23414721ED995500206ACB /* LeanplumSDK_iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B233C3321ED902900206ACB /* LeanplumSDK_iOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
187187
61B186A824E44665ED526E8F /* Pods_Leanplum_iOS_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 090C8E91DAFDE753EF49E13C /* Pods_Leanplum_iOS_Example.framework */; };
188+
A80A31DD23ECD51500F90E95 /* LPInterstitialMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = A80A31DB23ECD51500F90E95 /* LPInterstitialMessageTemplate.h */; };
189+
A80A31DE23ECD51500F90E95 /* LPInterstitialMessageTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = A80A31DC23ECD51500F90E95 /* LPInterstitialMessageTemplate.m */; };
190+
A80A31E123ECD5A000F90E95 /* LPHitView.h in Headers */ = {isa = PBXBuildFile; fileRef = A80A31DF23ECD5A000F90E95 /* LPHitView.h */; };
191+
A80A31E223ECD5A000F90E95 /* LPHitView.m in Sources */ = {isa = PBXBuildFile; fileRef = A80A31E023ECD5A000F90E95 /* LPHitView.m */; };
192+
A80A31E523ECD79D00F90E95 /* LPBaseAlertMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = A80A31E323ECD79D00F90E95 /* LPBaseAlertMessageTemplate.h */; };
193+
A80A31E623ECD79D00F90E95 /* LPBaseAlertMessageTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = A80A31E423ECD79D00F90E95 /* LPBaseAlertMessageTemplate.m */; };
194+
A80A31E923ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = A80A31E723ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.h */; };
195+
A80A31EA23ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = A80A31E823ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.m */; };
196+
A80A31ED23ECDC6600F90E95 /* LPWebInterstitialMessageTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = A80A31EB23ECDC6500F90E95 /* LPWebInterstitialMessageTemplate.m */; };
197+
A80A31EE23ECDC6600F90E95 /* LPWebInterstitialMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = A80A31EC23ECDC6500F90E95 /* LPWebInterstitialMessageTemplate.h */; };
188198
A8D39E7B23DFA00F00B0C51E /* LPBaseMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = A8D39E7923DFA00F00B0C51E /* LPBaseMessageTemplate.h */; };
189199
A8D39E7C23DFA00F00B0C51E /* LPBaseMessageTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = A8D39E7A23DFA00F00B0C51E /* LPBaseMessageTemplate.m */; };
190200
A8D39E8523DFA0D500B0C51E /* LPAlertMessageTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = A8D39E7F23DFA0D500B0C51E /* LPAlertMessageTemplate.m */; };
@@ -426,6 +436,16 @@
426436
8B6F288A14D3DC03AE34508A /* Pods-Leanplum-iOS-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Leanplum-iOS-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Leanplum-iOS-Example/Pods-Leanplum-iOS-Example.release.xcconfig"; sourceTree = "<group>"; };
427437
9A9A6BD32DCA7415FAF3B6A7 /* Pods_Leanplum_tvOS_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Leanplum_tvOS_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
428438
A4A6ABC6920A431C861DC0C7 /* Pods-LeanplumSDKTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LeanplumSDKTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LeanplumSDKTests/Pods-LeanplumSDKTests.debug.xcconfig"; sourceTree = "<group>"; };
439+
A80A31DB23ECD51500F90E95 /* LPInterstitialMessageTemplate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LPInterstitialMessageTemplate.h; sourceTree = "<group>"; };
440+
A80A31DC23ECD51500F90E95 /* LPInterstitialMessageTemplate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LPInterstitialMessageTemplate.m; sourceTree = "<group>"; };
441+
A80A31DF23ECD5A000F90E95 /* LPHitView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LPHitView.h; sourceTree = "<group>"; };
442+
A80A31E023ECD5A000F90E95 /* LPHitView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LPHitView.m; sourceTree = "<group>"; };
443+
A80A31E323ECD79D00F90E95 /* LPBaseAlertMessageTemplate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LPBaseAlertMessageTemplate.h; sourceTree = "<group>"; };
444+
A80A31E423ECD79D00F90E95 /* LPBaseAlertMessageTemplate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LPBaseAlertMessageTemplate.m; sourceTree = "<group>"; };
445+
A80A31E723ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LPBaseInterstitialMessageTemplate.h; sourceTree = "<group>"; };
446+
A80A31E823ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LPBaseInterstitialMessageTemplate.m; sourceTree = "<group>"; };
447+
A80A31EB23ECDC6500F90E95 /* LPWebInterstitialMessageTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPWebInterstitialMessageTemplate.m; sourceTree = "<group>"; };
448+
A80A31EC23ECDC6500F90E95 /* LPWebInterstitialMessageTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPWebInterstitialMessageTemplate.h; sourceTree = "<group>"; };
429449
A8D39E7923DFA00F00B0C51E /* LPBaseMessageTemplate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LPBaseMessageTemplate.h; sourceTree = "<group>"; };
430450
A8D39E7A23DFA00F00B0C51E /* LPBaseMessageTemplate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LPBaseMessageTemplate.m; sourceTree = "<group>"; };
431451
A8D39E7F23DFA0D500B0C51E /* LPAlertMessageTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPAlertMessageTemplate.m; sourceTree = "<group>"; };
@@ -673,6 +693,8 @@
673693
5B233FA021ED964F00206ACB /* Leanplum.h */,
674694
A8D39E9823E23FBE00B0C51E /* LPMessageTemplates.h */,
675695
A8D39E9723E23FBE00B0C51E /* LPMessageTemplates.m */,
696+
A80A31DF23ECD5A000F90E95 /* LPHitView.h */,
697+
A80A31E023ECD5A000F90E95 /* LPHitView.m */,
676698
A8D39E7E23DFA0D500B0C51E /* MessageTemplates */,
677699
5B233FA221ED964F00206ACB /* Managers */,
678700
5B233FC421ED964F00206ACB /* Features */,
@@ -1030,10 +1052,18 @@
10301052
A8D39E8023DFA0D500B0C51E /* LPMessageTemplateConstants.h */,
10311053
A8D39E7923DFA00F00B0C51E /* LPBaseMessageTemplate.h */,
10321054
A8D39E7A23DFA00F00B0C51E /* LPBaseMessageTemplate.m */,
1055+
A80A31E323ECD79D00F90E95 /* LPBaseAlertMessageTemplate.h */,
1056+
A80A31E423ECD79D00F90E95 /* LPBaseAlertMessageTemplate.m */,
1057+
A80A31E723ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.h */,
1058+
A80A31E823ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.m */,
10331059
A8D39E8223DFA0D500B0C51E /* LPAlertMessageTemplate.h */,
10341060
A8D39E7F23DFA0D500B0C51E /* LPAlertMessageTemplate.m */,
10351061
A8D39E8B23DFA21A00B0C51E /* LPConfirmMessageTemplate.h */,
10361062
A8D39E8C23DFA21A00B0C51E /* LPConfirmMessageTemplate.m */,
1063+
A80A31DB23ECD51500F90E95 /* LPInterstitialMessageTemplate.h */,
1064+
A80A31DC23ECD51500F90E95 /* LPInterstitialMessageTemplate.m */,
1065+
A80A31EC23ECDC6500F90E95 /* LPWebInterstitialMessageTemplate.h */,
1066+
A80A31EB23ECDC6500F90E95 /* LPWebInterstitialMessageTemplate.m */,
10371067
);
10381068
path = MessageTemplates;
10391069
sourceTree = "<group>";
@@ -1053,12 +1083,14 @@
10531083
A8D39E7B23DFA00F00B0C51E /* LPBaseMessageTemplate.h in Headers */,
10541084
5B23409721ED964F00206ACB /* LPEventDataManager.h in Headers */,
10551085
5B2340D321ED965000206ACB /* LPSwizzle.h in Headers */,
1086+
A80A31E923ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.h in Headers */,
10561087
5B2340C321ED964F00206ACB /* LPInbox.h in Headers */,
10571088
5B23405F21ED964F00206ACB /* LPNetworkProtocol.h in Headers */,
10581089
5B23410521ED965000206ACB /* MKNetworkKit.h in Headers */,
10591090
5B23414721ED995500206ACB /* LeanplumSDK_iOS.h in Headers */,
10601091
5B2340E721ED965000206ACB /* Leanplum_AsyncSocket.h in Headers */,
10611092
5B2340A521ED964F00206ACB /* LeanplumInternal.h in Headers */,
1093+
A80A31E523ECD79D00F90E95 /* LPBaseAlertMessageTemplate.h in Headers */,
10621094
5B23403D21ED964F00206ACB /* LPRegisterDevice.h in Headers */,
10631095
5B2340BB21ED964F00206ACB /* LPEnumConstants.h in Headers */,
10641096
5B23403F21ED964F00206ACB /* LPRevenueManager.h in Headers */,
@@ -1067,6 +1099,7 @@
10671099
5B23412321ED965000206ACB /* Leanplum_MKNKEngineWrapper.h in Headers */,
10681100
5B2340F321ED965000206ACB /* Leanplum_Reachability.h in Headers */,
10691101
5B23404721ED964F00206ACB /* LeanplumSocket.h in Headers */,
1102+
A80A31E123ECD5A000F90E95 /* LPHitView.h in Headers */,
10701103
5B23403721ED964F00206ACB /* Leanplum.h in Headers */,
10711104
5B23409921ED964F00206ACB /* LPEventCallbackManager.h in Headers */,
10721105
5B23408521ED964F00206ACB /* LPVarCache.h in Headers */,
@@ -1091,6 +1124,7 @@
10911124
5B23404121ED964F00206ACB /* LPNetworkOperation.h in Headers */,
10921125
5B2340DF21ED965000206ACB /* FileMD5Hash.h in Headers */,
10931126
5B2340C921ED964F00206ACB /* LPMessageArchiveData.h in Headers */,
1127+
A80A31DD23ECD51500F90E95 /* LPInterstitialMessageTemplate.h in Headers */,
10941128
A8D39E8823DFA0D500B0C51E /* LPAlertMessageTemplate.h in Headers */,
10951129
5B23405D21ED964F00206ACB /* LPAPIConfig.h in Headers */,
10961130
5B2340F721ED965000206ACB /* NSTimer+Blocks.h in Headers */,
@@ -1118,6 +1152,7 @@
11181152
5B2340C521ED964F00206ACB /* LPActionArg.h in Headers */,
11191153
5B23406121ED964F00206ACB /* LPRequestFactory.h in Headers */,
11201154
5B2340AD21ED964F00206ACB /* LPFeatureFlagManager.h in Headers */,
1155+
A80A31EE23ECDC6600F90E95 /* LPWebInterstitialMessageTemplate.h in Headers */,
11211156
);
11221157
runOnlyForDeploymentPostprocessing = 0;
11231158
};
@@ -1367,16 +1402,20 @@
13671402
5B2340D521ED965000206ACB /* LPJSON.m in Sources */,
13681403
5B23404321ED964F00206ACB /* LPAPIConfig.m in Sources */,
13691404
5B2340B121ED964F00206ACB /* LPFeatureFlagManager.m in Sources */,
1405+
A80A31DE23ECD51500F90E95 /* LPInterstitialMessageTemplate.m in Sources */,
1406+
A80A31ED23ECDC6600F90E95 /* LPWebInterstitialMessageTemplate.m in Sources */,
13701407
5B2340DD21ED965000206ACB /* LPUtils.m in Sources */,
13711408
A8D39E7C23DFA00F00B0C51E /* LPBaseMessageTemplate.m in Sources */,
13721409
5B23407921ED964F00206ACB /* LPCountAggregator.m in Sources */,
13731410
5B23408721ED964F00206ACB /* LPVar.m in Sources */,
13741411
5B23408D21ED964F00206ACB /* LPUIAlert.m in Sources */,
13751412
5B2340B321ED964F00206ACB /* LeanplumCompatibility.m in Sources */,
13761413
5B23409B21ED964F00206ACB /* LPEventCallback.m in Sources */,
1414+
A80A31EA23ECD82B00F90E95 /* LPBaseInterstitialMessageTemplate.m in Sources */,
13771415
5B23409121ED964F00206ACB /* LPActionContext.m in Sources */,
13781416
5B2340E921ED965000206ACB /* Leanplum_AsyncSocket.m in Sources */,
13791417
5B23405121ED964F00206ACB /* LPNetworkEngine.m in Sources */,
1418+
A80A31E223ECD5A000F90E95 /* LPHitView.m in Sources */,
13801419
5B2340D721ED965000206ACB /* FileMD5Hash.c in Sources */,
13811420
5B23406521ED964F00206ACB /* LPRequest.m in Sources */,
13821421
5B2340F521ED965000206ACB /* NSTimer+Blocks.m in Sources */,
@@ -1395,6 +1434,7 @@
13951434
5B23408121ED964F00206ACB /* LPVarCache.m in Sources */,
13961435
5B2340BF21ED964F00206ACB /* LPExceptionHandler.m in Sources */,
13971436
A8D39E8523DFA0D500B0C51E /* LPAlertMessageTemplate.m in Sources */,
1437+
A80A31E623ECD79D00F90E95 /* LPBaseAlertMessageTemplate.m in Sources */,
13981438
5B2340E321ED965000206ACB /* LPSwizzle.m in Sources */,
13991439
5B23407321ED964F00206ACB /* LPRevenueManager.m in Sources */,
14001440
5B23405B21ED964F00206ACB /* LPNetworkOperation.m in Sources */,

Leanplum-SDK/Classes/LPHitView.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//
2+
// LPHitView.h
3+
// LeanplumSDK-iOS
4+
//
5+
// Created by Mayank Sanganeria on 2/6/20.
6+
// Copyright © 2020 Leanplum. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface LPHitView : UIView
14+
15+
@property (strong, nonatomic) void (^callback)(void);
16+
17+
- (id)initWithCallback:(void (^)(void))callback;
18+
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
19+
20+
@end
21+
22+
NS_ASSUME_NONNULL_END

Leanplum-SDK/Classes/LPHitView.m

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// LPHitView.m
3+
// LeanplumSDK-iOS
4+
//
5+
// Created by Mayank Sanganeria on 2/6/20.
6+
// Copyright © 2020 Leanplum. All rights reserved.
7+
//
8+
9+
#import "LPHitView.h"
10+
11+
@implementation LPHitView
12+
13+
- (id)initWithCallback:(void (^)(void))callback
14+
{
15+
if (self = [super init]) {
16+
self.callback = [callback copy];
17+
}
18+
return self;
19+
}
20+
21+
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
22+
{
23+
UIView *hitView = [super hitTest:point withEvent:event];
24+
if (hitView == self) {
25+
if (self.callback) {
26+
self.callback();
27+
}
28+
return nil;
29+
}
30+
return hitView;
31+
}
32+
33+
@end

Leanplum-SDK/Classes/LPMessageTemplates.m

Lines changed: 7 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
#import "LPCountAggregator.h"
3333
#import "LPAlertMessageTemplate.h"
3434
#import "LPConfirmMessageTemplate.h"
35+
#import "LPInterstitialMessageTemplate.h"
36+
#import "LPWebInterstitialMessageTemplate.h"
37+
#import "LPOpenUrlMessageTemplate.h"
38+
#import "LPHitView.h"
3539

3640
#define APP_NAME (([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]) ?: \
3741
([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]))
@@ -40,33 +44,6 @@
4044
static NSString *DEFAULTS_ASKED_TO_PUSH = @"__Leanplum_asked_to_push";
4145
static NSString *DEFAULTS_LEANPLUM_ENABLED_PUSH = @"__Leanplum_enabled_push";
4246

43-
#pragma mark Helper View Class
44-
@interface LPHitView : UIView
45-
@property (strong, nonatomic) void (^callback)(void);
46-
@end
47-
48-
@implementation LPHitView
49-
- (id)initWithCallback:(void (^)(void))callback
50-
{
51-
if (self = [super init]) {
52-
self.callback = [callback copy];
53-
}
54-
return self;
55-
}
56-
57-
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
58-
{
59-
UIView *hitView = [super hitTest:point withEvent:event];
60-
if (hitView == self) {
61-
if (self.callback) {
62-
self.callback();
63-
}
64-
return nil;
65-
}
66-
return hitView;
67-
}
68-
@end
69-
7047
@implementation LPMessageTemplatesClass {
7148
NSMutableArray *_contexts;
7249
UIView *_popupView;
@@ -134,33 +111,10 @@ - (void)defineActions
134111

135112
[[[LPAlertMessageTemplate alloc] init] defineActionWithContexts:_contexts];
136113
[[[LPConfirmMessageTemplate alloc] init] defineActionWithContexts:_contexts];
114+
[[[LPInterstitialMessageTemplate alloc] init] defineActionWithContexts:_contexts];
115+
[[[LPWebInterstitialMessageTemplate alloc] init] defineActionWithContexts:_contexts];
116+
[[[LPOpenUrlMessageTemplate alloc] init] defineActionWithContexts:_contexts];
137117

138-
[Leanplum defineAction:LPMT_OPEN_URL_NAME
139-
ofKind:kLeanplumActionKindAction
140-
withArguments:@[[LPActionArg argNamed:LPMT_ARG_URL withString:LPMT_DEFAULT_URL]]
141-
withResponder:^BOOL(LPActionContext *context) {
142-
@try {
143-
dispatch_async(dispatch_get_main_queue(), ^{
144-
NSString *encodedURLString = [[self class] urlEncodedStringFromString:[context stringNamed:LPMT_ARG_URL]];
145-
NSURL *url = [NSURL URLWithString: encodedURLString];
146-
if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) {
147-
if (@available(iOS 10.0, *)) {
148-
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
149-
} else {
150-
// Fallback on earlier versions
151-
}
152-
} else {
153-
[[UIApplication sharedApplication] openURL:url];
154-
}
155-
});
156-
return YES;
157-
}
158-
@catch (NSException *exception) {
159-
LOG_LP_MESSAGE_EXCEPTION;
160-
return NO;
161-
}
162-
}];
163-
164118
UIColor *defaultButtonTextColor = [UIColor colorWithRed:0 green:0.478431 blue:1 alpha:1];
165119

166120
[Leanplum defineAction:LPMT_PUSH_ASK_TO_ASK
@@ -267,41 +221,6 @@ - (void)defineActions
267221
]
268222
withResponder:messageResponder];
269223

270-
[Leanplum defineAction:LPMT_INTERSTITIAL_NAME
271-
ofKind:kLeanplumActionKindMessage | kLeanplumActionKindAction
272-
withArguments:@[
273-
[LPActionArg argNamed:LPMT_ARG_TITLE_TEXT withString:APP_NAME],
274-
[LPActionArg argNamed:LPMT_ARG_TITLE_COLOR withColor:[UIColor blackColor]],
275-
[LPActionArg argNamed:LPMT_ARG_MESSAGE_TEXT withString:LPMT_DEFAULT_INTERSTITIAL_MESSAGE],
276-
[LPActionArg argNamed:LPMT_ARG_MESSAGE_COLOR withColor:[UIColor blackColor]],
277-
[LPActionArg argNamed:LPMT_ARG_BACKGROUND_IMAGE withFile:nil],
278-
[LPActionArg argNamed:LPMT_ARG_BACKGROUND_COLOR withColor:[UIColor whiteColor]],
279-
[LPActionArg argNamed:LPMT_ARG_ACCEPT_BUTTON_TEXT withString:LPMT_DEFAULT_OK_BUTTON_TEXT],
280-
[LPActionArg argNamed:LPMT_ARG_ACCEPT_BUTTON_BACKGROUND_COLOR withColor:[UIColor whiteColor]],
281-
[LPActionArg argNamed:LPMT_ARG_ACCEPT_BUTTON_TEXT_COLOR withColor:defaultButtonTextColor],
282-
[LPActionArg argNamed:LPMT_ARG_ACCEPT_ACTION withAction:nil]
283-
]
284-
withResponder:messageResponder];
285-
286-
[Leanplum defineAction:LPMT_WEB_INTERSTITIAL_NAME
287-
ofKind:kLeanplumActionKindMessage | kLeanplumActionKindAction
288-
withArguments:@[
289-
[LPActionArg argNamed:LPMT_ARG_URL withString:LPMT_DEFAULT_URL],
290-
[LPActionArg argNamed:LPMT_ARG_URL_CLOSE withString:LPMT_DEFAULT_CLOSE_URL],
291-
[LPActionArg argNamed:LPMT_HAS_DISMISS_BUTTON
292-
withBool:LPMT_DEFAULT_HAS_DISMISS_BUTTON]]
293-
withResponder:^BOOL(LPActionContext *context) {
294-
@try {
295-
[self closePopupWithAnimation:NO];
296-
[self->_contexts addObject:context];
297-
[self showPopup];
298-
return YES;
299-
}
300-
@catch (NSException *exception) {
301-
LOG_LP_MESSAGE_EXCEPTION;
302-
return NO;
303-
}
304-
}];
305224

306225
[Leanplum defineAction:LPMT_HTML_NAME
307226
ofKind:kLeanplumActionKindMessage | kLeanplumActionKindAction

Leanplum-SDK/Classes/MessageTemplates/LPAlertMessageTemplate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
//
88

99
#import <Foundation/Foundation.h>
10-
#import "LPBaseMessageTemplate.h"
10+
#import "LPBaseAlertMessageTemplate.h"
1111

1212
NS_ASSUME_NONNULL_BEGIN
1313

14-
@interface LPAlertMessageTemplate : LPBaseMessageTemplate
14+
@interface LPAlertMessageTemplate : LPBaseAlertMessageTemplate
1515

1616
@end
1717

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// LPAlertBaseMessageTemplate.h
3+
// LeanplumSDK-iOS
4+
//
5+
// Created by Mayank Sanganeria on 2/6/20.
6+
// Copyright © 2020 Leanplum. All rights reserved.
7+
//
8+
9+
#import "LPBaseMessageTemplate.h"
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface LPBaseAlertMessageTemplate : LPBaseMessageTemplate
14+
15+
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex;
16+
- (void)alertDismissedWithButtonIndex:(NSInteger)buttonIndex;
17+
18+
@end
19+
20+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)