Skip to content

Commit c0031e1

Browse files
authored
Fix defineActions test. (#509)
Remove archiveData dead code
1 parent d446ea4 commit c0031e1

File tree

6 files changed

+14
-152
lines changed

6 files changed

+14
-152
lines changed

LeanplumSDK/LeanplumSDK.xcodeproj/project.pbxproj

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@
9292
075AAE6226847EC4007CA1BD /* LPHitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD7F26847EC3007CA1BD /* LPHitView.m */; };
9393
075AAE6426847EC4007CA1BD /* LPHitView.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8026847EC3007CA1BD /* LPHitView.h */; settings = {ATTRIBUTES = (Public, ); }; };
9494
075AAE6526847EC4007CA1BD /* LPMessageTemplateProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8126847EC3007CA1BD /* LPMessageTemplateProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
95-
075AAE6626847EC4007CA1BD /* LPMessageArchiveData.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD8326847EC3007CA1BD /* LPMessageArchiveData.m */; };
96-
075AAE6826847EC4007CA1BD /* LPMessageArchiveData.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8426847EC3007CA1BD /* LPMessageArchiveData.h */; settings = {ATTRIBUTES = (Public, ); }; };
9795
075AAE6A26847EC4007CA1BD /* LPLocalNotificationsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD8826847EC3007CA1BD /* LPLocalNotificationsManager.m */; };
9896
075AAE6F26847EC4007CA1BD /* LPLocalNotificationsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8B26847EC3007CA1BD /* LPLocalNotificationsManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
9997
075AAE7826847EC4007CA1BD /* LPNotificationsConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD9226847EC3007CA1BD /* LPNotificationsConstants.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -251,7 +249,6 @@
251249
6A714B2526F8B317004A34A9 /* LPRegisterForPushMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD6526847EC3007CA1BD /* LPRegisterForPushMessageTemplate.h */; settings = {ATTRIBUTES = (Public, ); }; };
252250
6A714B2626F8B317004A34A9 /* LPInterstitialMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD5F26847EC3007CA1BD /* LPInterstitialMessageTemplate.h */; settings = {ATTRIBUTES = (Public, ); }; };
253251
6A714B2726F8B317004A34A9 /* LPLogManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD5426847EC3007CA1BD /* LPLogManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
254-
6A714B2826F8B317004A34A9 /* LPMessageArchiveData.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8426847EC3007CA1BD /* LPMessageArchiveData.h */; settings = {ATTRIBUTES = (Public, ); }; };
255252
6A714B2926F8B317004A34A9 /* LPKeychainWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD9F26847EC3007CA1BD /* LPKeychainWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
256253
6A714B2A26F8B317004A34A9 /* LPSecuredVars.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AADC226847EC3007CA1BD /* LPSecuredVars.h */; settings = {ATTRIBUTES = (Public, ); }; };
257254
6A714B2B26F8B317004A34A9 /* LPCenterPopupMessageTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = 075AAD6A26847EC3007CA1BD /* LPCenterPopupMessageTemplate.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -308,7 +305,6 @@
308305
6A714B6826F8B317004A34A9 /* LPKeychainWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADBB26847EC3007CA1BD /* LPKeychainWrapper.m */; };
309306
6A714B6926F8B317004A34A9 /* LPHitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD7F26847EC3007CA1BD /* LPHitView.m */; };
310307
6A714B6A26F8B317004A34A9 /* Leanplum_WebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADAC26847EC3007CA1BD /* Leanplum_WebSocket.m */; };
311-
6A714B6B26F8B317004A34A9 /* LPMessageArchiveData.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD8326847EC3007CA1BD /* LPMessageArchiveData.m */; };
312308
6A714B6C26F8B317004A34A9 /* LPRichInterstitialMessageTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD7726847EC3007CA1BD /* LPRichInterstitialMessageTemplate.m */; };
313309
6A714B6D26F8B317004A34A9 /* LPInternalState.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AADD826847EC4007CA1BD /* LPInternalState.m */; };
314310
6A714B7026F8B317004A34A9 /* LPMessageTemplateUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 075AAD7226847EC3007CA1BD /* LPMessageTemplateUtilities.m */; };
@@ -418,7 +414,6 @@
418414
6A714BE626F8B505004A34A9 /* LPWebInterstitialViewController.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD7426847EC3007CA1BD /* LPWebInterstitialViewController.h */; };
419415
6A714BE726F8B505004A34A9 /* LPMessageTemplateUtilities.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD7626847EC3007CA1BD /* LPMessageTemplateUtilities.h */; };
420416
6A714BE826F8B505004A34A9 /* LPHitView.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8026847EC3007CA1BD /* LPHitView.h */; };
421-
6A714BE926F8B505004A34A9 /* LPMessageArchiveData.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8426847EC3007CA1BD /* LPMessageArchiveData.h */; };
422417
6A714BEA26F8B505004A34A9 /* LPNotificationsConstants.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD9226847EC3007CA1BD /* LPNotificationsConstants.h */; };
423418
6A714BED26F8B505004A34A9 /* LPLocalNotificationsManager.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AAD8B26847EC3007CA1BD /* LPLocalNotificationsManager.h */; };
424419
6A714BF026F8B505004A34A9 /* FileMD5Hash.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 075AADA226847EC3007CA1BD /* FileMD5Hash.h */; };
@@ -569,7 +564,6 @@
569564
6A714BE626F8B505004A34A9 /* LPWebInterstitialViewController.h in Copy Headers */,
570565
6A714BE726F8B505004A34A9 /* LPMessageTemplateUtilities.h in Copy Headers */,
571566
6A714BE826F8B505004A34A9 /* LPHitView.h in Copy Headers */,
572-
6A714BE926F8B505004A34A9 /* LPMessageArchiveData.h in Copy Headers */,
573567
6A714BEA26F8B505004A34A9 /* LPNotificationsConstants.h in Copy Headers */,
574568
6A714BED26F8B505004A34A9 /* LPLocalNotificationsManager.h in Copy Headers */,
575569
6A714BF026F8B505004A34A9 /* FileMD5Hash.h in Copy Headers */,
@@ -679,8 +673,6 @@
679673
075AAD7F26847EC3007CA1BD /* LPHitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPHitView.m; sourceTree = "<group>"; };
680674
075AAD8026847EC3007CA1BD /* LPHitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPHitView.h; sourceTree = "<group>"; };
681675
075AAD8126847EC3007CA1BD /* LPMessageTemplateProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPMessageTemplateProtocol.h; sourceTree = "<group>"; };
682-
075AAD8326847EC3007CA1BD /* LPMessageArchiveData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPMessageArchiveData.m; sourceTree = "<group>"; };
683-
075AAD8426847EC3007CA1BD /* LPMessageArchiveData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPMessageArchiveData.h; sourceTree = "<group>"; };
684676
075AAD8826847EC3007CA1BD /* LPLocalNotificationsManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LPLocalNotificationsManager.m; sourceTree = "<group>"; };
685677
075AAD8B26847EC3007CA1BD /* LPLocalNotificationsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPLocalNotificationsManager.h; sourceTree = "<group>"; };
686678
075AAD9226847EC3007CA1BD /* LPNotificationsConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LPNotificationsConstants.h; sourceTree = "<group>"; };
@@ -866,7 +858,6 @@
866858
075AADD626847EC4007CA1BD /* Internal */,
867859
075AAD2C26847EC3007CA1BD /* Managers */,
868860
075AAD5B26847EC3007CA1BD /* MessageTemplates */,
869-
075AAD8226847EC3007CA1BD /* Models */,
870861
075AAD8526847EC3007CA1BD /* Notifications */,
871862
075AAD9526847EC3007CA1BD /* Utilities */,
872863
);
@@ -994,15 +985,6 @@
994985
path = Views;
995986
sourceTree = "<group>";
996987
};
997-
075AAD8226847EC3007CA1BD /* Models */ = {
998-
isa = PBXGroup;
999-
children = (
1000-
075AAD8326847EC3007CA1BD /* LPMessageArchiveData.m */,
1001-
075AAD8426847EC3007CA1BD /* LPMessageArchiveData.h */,
1002-
);
1003-
path = Models;
1004-
sourceTree = "<group>";
1005-
};
1006988
075AAD8526847EC3007CA1BD /* Notifications */ = {
1007989
isa = PBXGroup;
1008990
children = (
@@ -1409,7 +1391,6 @@
14091391
075AAE3E26847EC4007CA1BD /* LPRegisterForPushMessageTemplate.h in Headers */,
14101392
075AAE3626847EC4007CA1BD /* LPInterstitialMessageTemplate.h in Headers */,
14111393
075AAE2626847EC4007CA1BD /* LPLogManager.h in Headers */,
1412-
075AAE6826847EC4007CA1BD /* LPMessageArchiveData.h in Headers */,
14131394
075AAE8926847EC4007CA1BD /* LPKeychainWrapper.h in Headers */,
14141395
075AAEAD26847EC4007CA1BD /* LPSecuredVars.h in Headers */,
14151396
075AAE4526847EC4007CA1BD /* LPCenterPopupMessageTemplate.h in Headers */,
@@ -1498,7 +1479,6 @@
14981479
6A714B2526F8B317004A34A9 /* LPRegisterForPushMessageTemplate.h in Headers */,
14991480
6A714B2626F8B317004A34A9 /* LPInterstitialMessageTemplate.h in Headers */,
15001481
6A714B2726F8B317004A34A9 /* LPLogManager.h in Headers */,
1501-
6A714B2826F8B317004A34A9 /* LPMessageArchiveData.h in Headers */,
15021482
6A714B2926F8B317004A34A9 /* LPKeychainWrapper.h in Headers */,
15031483
6A714B2A26F8B317004A34A9 /* LPSecuredVars.h in Headers */,
15041484
6A714B2B26F8B317004A34A9 /* LPCenterPopupMessageTemplate.h in Headers */,
@@ -1702,7 +1682,6 @@
17021682
075AAE6226847EC4007CA1BD /* LPHitView.m in Sources */,
17031683
39C081932781D31F00C1DBD6 /* ActionManager.swift in Sources */,
17041684
075AAE9526847EC4007CA1BD /* Leanplum_WebSocket.m in Sources */,
1705-
075AAE6626847EC4007CA1BD /* LPMessageArchiveData.m in Sources */,
17061685
075AAE5626847EC4007CA1BD /* LPRichInterstitialMessageTemplate.m in Sources */,
17071686
075AAEC926847EC4007CA1BD /* LPInternalState.m in Sources */,
17081687
6A96032D27C8DD1300F34BA0 /* User.swift in Sources */,
@@ -1827,7 +1806,6 @@
18271806
6A714B6826F8B317004A34A9 /* LPKeychainWrapper.m in Sources */,
18281807
6A714B6926F8B317004A34A9 /* LPHitView.m in Sources */,
18291808
6A714B6A26F8B317004A34A9 /* Leanplum_WebSocket.m in Sources */,
1830-
6A714B6B26F8B317004A34A9 /* LPMessageArchiveData.m in Sources */,
18311809
6A714B6C26F8B317004A34A9 /* LPRichInterstitialMessageTemplate.m in Sources */,
18321810
6A07FDA0280F27C700995BE3 /* NSRegularExpression+Matches.swift in Sources */,
18331811
6A714B6D26F8B317004A34A9 /* LPInternalState.m in Sources */,

LeanplumSDK/LeanplumSDK/Classes/Leanplum.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#import "LPInbox.h"
2828
#import "LPActionArg.h"
2929
#import "LPVar.h"
30-
#import "LPMessageArchiveData.h"
3130
#import "LPEnumConstants.h"
3231
#import "Leanplum_WebSocket.h"
3332
#import "LPNetworkOperation.h"

LeanplumSDK/LeanplumSDK/Classes/LeanplumSDK.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ FOUNDATION_EXPORT const unsigned char LeanplumSDKVersionString[];
9393
#import "LPPopupViewController.h"
9494
#import "LPWebInterstitialViewController.h"
9595
#import "LPHitView.h"
96-
#import "LPMessageArchiveData.h"
9796
#import "LPLocalNotificationsManager.h"
9897
#import "LPNotificationsConstants.h"
9998
#import "LPAES.h"

LeanplumSDK/LeanplumSDK/Classes/Models/LPMessageArchiveData.h

Lines changed: 0 additions & 43 deletions
This file was deleted.

LeanplumSDK/LeanplumSDK/Classes/Models/LPMessageArchiveData.m

Lines changed: 0 additions & 43 deletions
This file was deleted.

LeanplumSDKApp/LeanplumSDKTests/Classes/LeanplumTest.m

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,9 @@ - (void)test_define_actions
19971997
color_argument
19981998
];
19991999

2000+
2001+
XCTestExpectation *setVarsExpectation = [self expectationWithDescription:@"waiting_for_set_vars"];
2002+
20002003
// Validate request.
20012004
[LPRequestSender validate_request:^BOOL(NSString *method, NSString *apiMethod,
20022005
NSDictionary *params) {
@@ -2029,6 +2032,8 @@ - (void)test_define_actions
20292032
XCTAssertEqualObjects(values[number_argument_name], [number_argument defaultValue]);
20302033
XCTAssertEqualObjects(values[string_argument_name], [string_argument defaultValue]);
20312034

2035+
[setVarsExpectation fulfill];
2036+
20322037
return YES;
20332038
}];
20342039

@@ -2041,50 +2046,17 @@ - (void)test_define_actions
20412046
headers:@{@"Content-Type":@"application/json"}];
20422047
}];
20432048

2044-
// // Define action and send it.
2045-
// [Leanplum defineAction:action_name ofKind:kLeanplumActionKindAction withArguments:arguments];
2046-
// [[LPVarCache sharedCache] sendActionsIfChanged];
2047-
//
2048-
// // Test whether notification parsing is working correctly.
2049-
// NSString *jsonString = [LeanplumHelper retrieve_string_from_file:@"sample_action_notification"
2050-
// ofType:@"json"];
2051-
// NSDictionary *userInfo = [LPJSON JSONFromString:jsonString];
2052-
//
2053-
// // Expectation for onAction block.
2054-
// XCTestExpectation *expects = [self expectationWithDescription:@"waiting_for_action"];
2055-
2056-
// Add responder.
2057-
// [Leanplum addResponder:self withSelector:@selector(on_action_named:)
2058-
// forActionNamed:action_name];
2059-
// Verify that responder is added.
2060-
// NSMutableSet *responders = [LPInternalState sharedState].actionResponders[action_name];
2061-
// XCTAssertTrue(responders.count == 1);
2062-
//
2063-
// // Test action received via notification.
2064-
// [Leanplum onAction:action_name invoke:^BOOL(LPActionContext *context) {
2065-
// XCTAssertEqualObjects(action_name, [context actionName]);
2066-
// XCTAssertEqualObjects([context stringNamed:string_argument_name], @"test_string_2");
2067-
// XCTAssertEqualObjects([context numberNamed:number_argument_name], @15);
2068-
// XCTAssertEqual([context boolNamed:bool_argument_name], YES);
2069-
// XCTAssertEqualObjects([context dictionaryNamed:dict_argument_name],
2070-
// @{@"test_value": @"test_value_2"});
2071-
// XCTAssertEqualObjects([context arrayNamed:array_argument_name], (@[@9, @8, @7, @6]));
2072-
// XCTAssertNotNil([context colorNamed:color_argument_name]);
2073-
//
2074-
// [expects fulfill];
2075-
// return YES;
2076-
// }];
2077-
// // Perform action with notification.
2078-
// [[Leanplum notificationsManager] notificationOpened:userInfo action:LP_VALUE_DEFAULT_PUSH_ACTION];
2049+
// Define action and send it.
2050+
[Leanplum defineAction:action_name ofKind:kLeanplumActionKindAction withArguments:arguments withOptions:@{} presentHandler:^BOOL(LPActionContext * _Nonnull context) {
2051+
return YES;
2052+
} dismissHandler:^BOOL(LPActionContext * _Nonnull context) {
2053+
return YES;
2054+
}];
2055+
2056+
[[LPVarCache sharedCache] sendActionsIfChanged];
20792057

20802058
// Wait for action to be received before finishing.
2081-
// [self waitForExpectationsWithTimeout:10 handler:nil];
2082-
2083-
// Remove responder.
2084-
// [Leanplum removeResponder:self withSelector:@selector(on_action_named:)
2085-
// forActionNamed:action_name];
2086-
// Verify that responder is removed.
2087-
// XCTAssertTrue(responders.count == 0);
2059+
[self waitForExpectationsWithTimeout:10 handler:nil];
20882060
}
20892061

20902062
- (void)test_device_registration

0 commit comments

Comments
 (0)