Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2022-10-18 17:53:50 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
11da5bfc3bcec9508b44ecfa9b0e2c04f1834897
11da5bfc
1 parent
94db010e
added test code for push notifications
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.h
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.m
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
View file @
11da5bf
...
...
@@ -103,6 +103,8 @@
-
(
void
)
didReceiveNotification
:(
NSDictionary
*
)
payload
;
-
(
BOOL
)
checkforLoyaltySDKNotification
:(
NSDictionary
*
)
payload
;
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload whileAppWasInState:(UIApplicationState)appState;
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure;
-
(
void
)
sendDeviceInfoIfNecessary
:(
NSString
*
)
newDeviceToken
;
-
(
void
)
editProfileAsync
:(
NSString
*
)
firstname
andLastname
:(
NSString
*
)
lastname
andEmail
:(
NSString
*
)
email
andSalutation
:(
NSString
*
)
salutation
andMsisdn
:(
NSString
*
)
msisdn
andNickname
:(
NSString
*
)
nickname
andGender
:(
NSString
*
)
gender
andBirthday
:(
NSString
*
)
birthday
andNameDay
:(
NSString
*
)
nameday
andTaxID
:(
NSString
*
)
taxid
andProfileMetadata
:(
NSDictionary
*
)
profileMetadata
optin
:(
NSNumber
*
)
optin
newsLetter
:(
NSNumber
*
)
newsletter
andSMS
:(
NSNumber
*
)
sms
andSegmentation
:(
NSNumber
*
)
segmentation
andSMSSegmentation
:(
NSNumber
*
)
smsSegmentation
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
11da5bf
...
...
@@ -1621,6 +1621,12 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload whileAppWasInState:(UIApplicationState)appState {
// return [[Warply sharedService].pushManager checkforLoyaltySDKNotificationPM:payload whileAppWasInState:appState];
// }
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure {
// return [[Warply sharedService].pushManager checkforLoyaltySDKNotificationPM:payload :^(NSNumber *successResponse) {
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.h
View file @
11da5bf
...
...
@@ -163,6 +163,8 @@ typedef enum WLApplicationState : unsigned int{
-
(
BOOL
)
checkforLoyaltySDKNotificationPM
:(
NSDictionary
*
)
userInfo
;
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo whileAppWasInState:(UIApplicationState)appState;
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure;
/*!
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.m
View file @
11da5bf
...
...
@@ -387,6 +387,104 @@ static const char* jailbreak_apps[] =
}
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo whileAppWasInState:(UIApplicationState)appState
// {
// // TODO: Check if this guard should be commented
// if ([userInfo valueForKey:@"_a"] == nil) {
// // The push was sent from another push service
// return NO;
// }
// // TODO: Check if states are correct, especially from didFinishLaunchingWithOptions
// WLApplicationState state;
// if (appState == UIApplicationStateActive)
// state = WLApplicationStateActive;
// else if (appState == UIApplicationStateInactive)
// state = WLApplicationStateClosed;
// else
// state = WLApplicationStateBackground;
// // if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive)
// // state = WLApplicationStateActive;
// // else if ([UIApplication sharedApplication].applicationState == UIApplicationStateInactive)
// // state = WLApplicationStateClosed;
// // else
// // state = WLApplicationStateBackground;
// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:NSJSONWritingPrettyPrinted error:nil];
// NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
// WLLOG(@"Did receive push: %@", jsonString);
// WLInboxItem *inboxItem = [[WLInboxItem alloc] initWithAttributes:userInfo] ;
// // [WLAnalyticsManager logUserReceivedPush:inboxItem];
// if (state != WLApplicationStateActive) {
// [WLAnalyticsManager logUserEngagedPush:inboxItem];
// }
// if (inboxItem.action != 0) {
// [self.customPushHanlder didReceiveRemoteNotification:userInfo whileAppWasInState:state];
// return YES;
// }
// switch (state) {
// case WLApplicationStateActive:
// {
// NSLog(@"=== WLApplicationStateActive: %u", state);
// NSLog(@"=== userInfo: %@", userInfo);
// NSLog(@"=== userInfo aps: %@", [userInfo objectForKey:@"aps"]);
// NSLog(@"=== userInfo aps alert: %@", [[userInfo objectForKey:@"aps"] objectForKey:@"alert"]);
// UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
// UIAlertAction* yesButton = [UIAlertAction
// actionWithTitle:NSLocalizedString(@"Close", @"Warply")
// style:UIAlertActionStyleDefault
// handler:^(UIAlertAction * action) {
// //Handle your yes please button action here
// }];
// UIAlertAction* noButton = [UIAlertAction
// actionWithTitle:NSLocalizedString(@"View", @"Warply")
// style:UIAlertActionStyleDefault
// handler:^(UIAlertAction * action) {
// //Handle no, thanks button
// }];
// [alert addAction:yesButton];
// [alert addAction:noButton];
// UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
// alertWindow.rootViewController = [[UIViewController alloc] init];
// alertWindow.windowLevel = UIWindowLevelAlert + 1;
// [alertWindow makeKeyAndVisible];
// [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil];
// // UIAlertView *alert = [[UIAlertView alloc] init];
// // [alert setTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]];
// // [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")];
// // [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")];
// // [alert setDelegate:self];
// // [alert show];
// self.pendingItem = inboxItem;
// break;
// }
// case WLApplicationStateBackground:
// {
// WLLOG(@"=== WLApplicationStateBackground: %u", state);
// [self showItem:inboxItem];
// break;
// }
// case WLApplicationStateClosed:
// WLLOG(@"=== WLApplicationStateClosed: %u", state);
// self.pendingItem = inboxItem;
// break;
// }
// return YES;
// }
// TEST CODE FOR PUSH
// - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure
// {
// // TODO: Check if this guard should be commented
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
11da5bf
...
...
@@ -5769,6 +5769,14 @@ public class swiftApi {
// TEST CODE FOR PUSH
// public func checkForLoyaltySDKNotification(_ payload: [String : Any], _ appState: UIApplication.State) -> Bool {
// let instanceOfMyApi = MyApi()
// return instanceOfMyApi.checkforLoyaltySDKNotification(payload, whileAppWasIn: appState)
// }
// TEST CODE FOR PUSH
// public func checkForLoyaltySDKNotification(_ payload: [String : Any]) -> Bool {
// let instanceOfMyApi = MyApi()
...
...
Please
register
or
login
to post a comment