Showing
3 changed files
with
44 additions
and
8 deletions
... | @@ -107,6 +107,7 @@ | ... | @@ -107,6 +107,7 @@ |
107 | - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken; | 107 | - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken; |
108 | - (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; | 108 | - (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; |
109 | - (void)getSingleCampaignAsync:(NSString*)sessionUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 109 | - (void)getSingleCampaignAsync:(NSString*)sessionUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
110 | +- (void) sendEvent: (NSString *) eventName priority: (BOOL) priority; | ||
110 | 111 | ||
111 | @end | 112 | @end |
112 | #endif /* MyApi_h */ | 113 | #endif /* MyApi_h */ | ... | ... |
... | @@ -11,6 +11,10 @@ | ... | @@ -11,6 +11,10 @@ |
11 | #import "WLUtils.h" | 11 | #import "WLUtils.h" |
12 | #import <SwiftWarplyFramework.h> | 12 | #import <SwiftWarplyFramework.h> |
13 | 13 | ||
14 | +//#import "WLUserManager.h" | ||
15 | +//#import "WLAnalyticsManager.h" | ||
16 | +//#import <AdSupport/AdSupport.h> | ||
17 | + | ||
14 | 18 | ||
15 | @implementation MyApi | 19 | @implementation MyApi |
16 | NSString *WARP_PRODUCTION_BASE_URL = @"https://engage.warp.ly"; | 20 | NSString *WARP_PRODUCTION_BASE_URL = @"https://engage.warp.ly"; |
... | @@ -1659,4 +1663,14 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -1659,4 +1663,14 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
1659 | }]; | 1663 | }]; |
1660 | } | 1664 | } |
1661 | 1665 | ||
1666 | +- (void) sendEvent: (NSString *) eventName priority: (BOOL) priority { | ||
1667 | + NSString *event_Name = eventName; | ||
1668 | + NSNumber *time_submitted = [NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]]; | ||
1669 | + NSDictionary *inapp_event = [NSDictionary dictionaryWithObjectsAndKeys:event_Name, @"event_id", nil, @"page_id", time_submitted, @"time_submitted", nil, @"action_metadata", nil]; | ||
1670 | + NSDictionary *eventContext = [NSDictionary dictionaryWithObject:inapp_event forKey:@"inapp_analytics"]; | ||
1671 | + WLEventSimple *simpleEvent = [[WLEventSimple alloc] initWithType:@"inapp_analytics" andContext:eventContext]; | ||
1672 | + | ||
1673 | + [[Warply sharedService] addEvent:simpleEvent priority:priority]; | ||
1674 | +} | ||
1675 | + | ||
1662 | @end | 1676 | @end | ... | ... |
... | @@ -72,6 +72,14 @@ public class swiftApi { | ... | @@ -72,6 +72,14 @@ public class swiftApi { |
72 | UserDefaults.standard.set(newValue, forKey: "userNonTelco") | 72 | UserDefaults.standard.set(newValue, forKey: "userNonTelco") |
73 | } | 73 | } |
74 | 74 | ||
75 | + public func getTrackersEnabledUD() -> Bool { | ||
76 | + return UserDefaults.standard.bool(forKey: "trackersEnabled") | ||
77 | + } | ||
78 | + | ||
79 | + public func setTrackersEnabledUD(_ newValue: Bool) -> Void { | ||
80 | + UserDefaults.standard.set(newValue, forKey: "trackersEnabled") | ||
81 | + } | ||
82 | + | ||
75 | public func getStepsWebview() -> Int { | 83 | public func getStepsWebview() -> Int { |
76 | return GlobalVariables.stepsWebview | 84 | return GlobalVariables.stepsWebview |
77 | } | 85 | } |
... | @@ -5788,18 +5796,31 @@ public class swiftApi { | ... | @@ -5788,18 +5796,31 @@ public class swiftApi { |
5788 | 5796 | ||
5789 | public func setTrackersEnabled(_ isEnabled: Bool) -> Void { | 5797 | public func setTrackersEnabled(_ isEnabled: Bool) -> Void { |
5790 | 5798 | ||
5791 | - var newProfileMetadata: [String: Any] = ["trackers_enabled": isEnabled] | 5799 | + swiftApi().setTrackersEnabledUD(isEnabled) |
5800 | + | ||
5801 | + // var newProfileMetadata: [String: Any] = ["trackers_enabled": isEnabled] | ||
5792 | 5802 | ||
5793 | - 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) | 5803 | + // 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) |
5794 | 5804 | ||
5795 | - func editProfileCallback (_ editProfileData: swiftApi.VerifyTicketResponseModel?) -> Void { | 5805 | + // func editProfileCallback (_ editProfileData: swiftApi.VerifyTicketResponseModel?) -> Void { |
5796 | - if (editProfileData != nil) { | 5806 | + // if (editProfileData != nil) { |
5797 | 5807 | ||
5798 | - DispatchQueue.main.async { | 5808 | + // DispatchQueue.main.async { |
5799 | - } | 5809 | + // } |
5800 | - } else { | 5810 | + // } else { |
5801 | - } | 5811 | + // } |
5812 | + // } | ||
5813 | + } | ||
5814 | + | ||
5815 | + | ||
5816 | + public func logTrackersEvent(_ eventType: String, _ eventName: String) -> Void { | ||
5817 | + | ||
5818 | + if (swiftApi().getTrackersEnabledUD() == true) { | ||
5819 | + let instanceOfMyApi = MyApi() | ||
5820 | + let eventFullName = eventType + ":" + eventName | ||
5821 | + instanceOfMyApi.sendEvent(eventFullName, priority: false) | ||
5802 | } | 5822 | } |
5823 | + | ||
5803 | } | 5824 | } |
5804 | 5825 | ||
5805 | 5826 | ... | ... |
-
Please register or login to post a comment