WarplyReactMethods.m 1.19 KB
//
//  WarplyEvents.m
//  App
//
//  Created by Fotios Kalaitzidis on 23/10/2018.
//  Copyright © 2018 Facebook. All rights reserved.
//

#import "WarplyReactMethods.h"
#import "WLUserManager.h"
#import "WLAnalyticsManager.h"
#import "Warply.h"
#import <AdSupport/AdSupport.h>

@implementation WarplyReactMethods
- (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];
}

- (NSString *) getUniqueId {
    return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
}


- (NSString *) getAdvertisementId {
    return [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString];
}


@end