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-09-28 13:47:07 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b83a71650da0b4aff5c442af68e269200010bcd6
b83a7165
1 parent
132a9c46
add checkForLoyaltySDKNotification
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 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 @
b83a716
...
...
@@ -101,6 +101,7 @@
-
(
void
)
getMultilingualMerchantsAsync
:(
NSArray
*
)
categories
andDefaultShown
:(
NSNumber
*
)
defaultShown
andCenter
:(
NSNumber
*
)
center
andTags
:(
NSArray
*
)
tags
andUuid
:(
NSString
*
)
uuid
andDistance
:(
NSNumber
*
)
distance
parent_uuids
:(
NSArray
*
)
parent_uuids
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
// - (void)didReceiveNotification:(NSDictionary *)userInfo whileAppWasInState:(WLApplicationState)state;
-
(
void
)
didReceiveNotification
:(
NSDictionary
*
)
payload
;
-
(
BOOL
)
checkforLoyaltySDKNotification
:(
NSDictionary
*
)
payload
;
-
(
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
;
-
(
void
)
getSingleCampaignAsync
:(
NSString
*
)
sessionUuid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
b83a716
...
...
@@ -1610,6 +1610,12 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
[[
Warply
sharedService
].
pushManager
didReceiveRemoteNotification
:
payload
whileAppWasInState
:
WLApplicationStateClosed
];
}
// - (BOOL)checkForLoyaltySDKNotification:(NSDictionary *)userInfo whileAppWasInState:(WLApplicationState)state {
-
(
BOOL
)
checkforLoyaltySDKNotification
:
(
NSDictionary
*
)
payload
{
return
[[
Warply
sharedService
].
pushManager
checkforLoyaltySDKNotificationPM
:
payload
];
}
-
(
void
)
sendDeviceInfoIfNecessary
:
(
NSString
*
)
newDeviceToken
{
[[
Warply
sharedService
].
pushManager
sendDeviceInfoIfNecessary
:
newDeviceToken
];
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.h
View file @
b83a716
...
...
@@ -161,6 +161,8 @@ typedef enum WLApplicationState : unsigned int{
*/
-
(
void
)
didReceiveRemoteNotification
:(
NSDictionary
*
)
userInfo
whileAppWasInState
:(
WLApplicationState
)
state
;
-
(
BOOL
)
checkforLoyaltySDKNotificationPM
:(
NSDictionary
*
)
userInfo
;
/*!
@abstract Application received a Remote Notification.
@discussion This method notifies the WLPushManager that a remote notification was received and passes the data to the didReceiveRemoteNotification:whileAppWasInState: method
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.m
View file @
b83a716
...
...
@@ -278,6 +278,65 @@ static const char* jailbreak_apps[] =
}
///////////////////////////////////////////////////////////////////////////////
//- (BOOL)checkForLoyaltySDKNotification:(NSDictionary *)userInfo whileAppWasInState:(WLApplicationState)state
-
(
BOOL
)
checkforLoyaltySDKNotificationPM
:
(
NSDictionary
*
)
userInfo
{
// 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
([
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
:
{
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
:
{
[
self
showItem
:
inboxItem
];
break
;
}
case
WLApplicationStateClosed
:
self
.
pendingItem
=
inboxItem
;
break
;
}
return
YES
;
}
///////////////////////////////////////////////////////////////////////////////
-
(
void
)
application
:
(
UIApplication
*
)
application
didReceiveRemoteNotification
:
(
NSDictionary
*
)
userInfo
{
WLApplicationState
warplyAppState
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
b83a716
...
...
@@ -5619,6 +5619,13 @@ public class swiftApi {
}
public
func
checkForLoyaltySDKNotification
(
_
payload
:
[
String
:
Any
])
->
Bool
{
let
instanceOfMyApi
=
MyApi
()
return
instanceOfMyApi
.
checkforLoyaltySDKNotification
(
payload
)
}
public
func
sendDeviceInfoIfNecessary
(
_
newDeviceToken
:
String
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
...
...
Please
register
or
login
to post a comment