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-12 17:41:21 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8ae20effb981143a14f03e26f616a8af5a8c5745
8ae20eff
1 parent
8a79a394
add trackers v1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
8 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
View file @
8ae20ef
...
...
@@ -107,6 +107,7 @@
-
(
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
;
-
(
void
)
sendEvent
:
(
NSString
*
)
eventName
priority
:
(
BOOL
)
priority
;
@end
#endif
/* MyApi_h */
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
8ae20ef
...
...
@@ -11,6 +11,10 @@
#import "WLUtils.h"
#import <SwiftWarplyFramework.h>
//#import "WLUserManager.h"
//#import "WLAnalyticsManager.h"
//#import <AdSupport/AdSupport.h>
@implementation
MyApi
NSString
*
WARP_PRODUCTION_BASE_URL
=
@"https://engage.warp.ly"
;
...
...
@@ -1659,4 +1663,14 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}];
}
-
(
void
)
sendEvent
:
(
NSString
*
)
eventName
priority
:
(
BOOL
)
priority
{
NSString
*
event_Name
=
eventName
;
NSNumber
*
time_submitted
=
[
NSNumber
numberWithDouble
:[[
NSDate
date
]
timeIntervalSince1970
]];
NSDictionary
*
inapp_event
=
[
NSDictionary
dictionaryWithObjectsAndKeys
:
event_Name
,
@"event_id"
,
nil
,
@"page_id"
,
time_submitted
,
@"time_submitted"
,
nil
,
@"action_metadata"
,
nil
];
NSDictionary
*
eventContext
=
[
NSDictionary
dictionaryWithObject
:
inapp_event
forKey
:
@"inapp_analytics"
];
WLEventSimple
*
simpleEvent
=
[[
WLEventSimple
alloc
]
initWithType
:
@"inapp_analytics"
andContext
:
eventContext
];
[[
Warply
sharedService
]
addEvent
:
simpleEvent
priority
:
priority
];
}
@end
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
8ae20ef
...
...
@@ -72,6 +72,14 @@ public class swiftApi {
UserDefaults
.
standard
.
set
(
newValue
,
forKey
:
"userNonTelco"
)
}
public
func
getTrackersEnabledUD
()
->
Bool
{
return
UserDefaults
.
standard
.
bool
(
forKey
:
"trackersEnabled"
)
}
public
func
setTrackersEnabledUD
(
_
newValue
:
Bool
)
->
Void
{
UserDefaults
.
standard
.
set
(
newValue
,
forKey
:
"trackersEnabled"
)
}
public
func
getStepsWebview
()
->
Int
{
return
GlobalVariables
.
stepsWebview
}
...
...
@@ -5788,18 +5796,31 @@ public class swiftApi {
public
func
setTrackersEnabled
(
_
isEnabled
:
Bool
)
->
Void
{
var
newProfileMetadata
:
[
String
:
Any
]
=
[
"trackers_enabled"
:
isEnabled
]
swiftApi
()
.
setTrackersEnabledUD
(
isEnabled
)
// var newProfileMetadata: [String: Any] = ["trackers_enabled": isEnabled]
swiftApi
()
.
editProfileAsync
(
firstname
:
""
,
lastname
:
""
,
email
:
""
,
salutation
:
""
,
msisdn
:
""
,
nickname
:
""
,
gender
:
""
,
birthday
:
""
,
nameday
:
""
,
taxid
:
""
,
profileMetadata
:
newProfileMetadata
,
optin
:
false
,
newsletter
:
false
,
sms
:
false
,
segmentation
:
false
,
smsSegmentation
:
false
,
editProfileCallback
)
//
swiftApi().editProfileAsync(firstname: "", lastname: "", email: "", salutation: "", msisdn: "", nickname: "", gender: "", birthday: "", nameday: "", taxid: "", profileMetadata: newProfileMetadata, optin: false, newsletter: false, sms: false, segmentation: false, smsSegmentation: false, editProfileCallback)
func
editProfileCallback
(
_
editProfileData
:
swiftApi
.
VerifyTicketResponseModel
?)
->
Void
{
if
(
editProfileData
!=
nil
)
{
//
func editProfileCallback (_ editProfileData: swiftApi.VerifyTicketResponseModel?) -> Void {
//
if (editProfileData != nil) {
DispatchQueue
.
main
.
async
{
}
}
else
{
}
// DispatchQueue.main.async {
// }
// } else {
// }
// }
}
public
func
logTrackersEvent
(
_
eventType
:
String
,
_
eventName
:
String
)
->
Void
{
if
(
swiftApi
()
.
getTrackersEnabledUD
()
==
true
)
{
let
instanceOfMyApi
=
MyApi
()
let
eventFullName
=
eventType
+
":"
+
eventName
instanceOfMyApi
.
sendEvent
(
eventFullName
,
priority
:
false
)
}
}
...
...
Please
register
or
login
to post a comment