update files iOS
This commit is contained in:
@@ -23,7 +23,15 @@ RCT_EXPORT_METHOD(activate:(NSDictionary *)configDict)
|
||||
[YMMYandexMetrica activateWithConfiguration:[AppMetricaUtils configurationForDictionary:configDict]];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(initPush:(NSString *)deviceToken)
|
||||
RCT_EXPORT_METHOD(reportUserProfile:(NSDictionary *)configDict)
|
||||
{
|
||||
// [YMPYandexMetrica reportUserProfile:[AppMetricaUtils configurationForUserProfile:configDict]];
|
||||
[YMMYandexMetrica reportUserProfile:[AppMetricaUtils configurationForUserProfile:configDict] onFailure:^(NSError *error) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(initPush:(NSData *)deviceToken)
|
||||
{
|
||||
[YMPYandexMetricaPush setDeviceTokenFromData:deviceToken];
|
||||
}
|
||||
|
||||
@@ -52,6 +52,38 @@
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
+ (YMMMutableUserProfile *)configurationForUserProfile:(NSDictionary *)configDict
|
||||
{
|
||||
YMMMutableUserProfile *profile = [[YMMMutableUserProfile alloc] init];
|
||||
|
||||
id<YMMCustomCounterAttribute> timeLeftAttribute = [YMMProfileAttribute customCounter:@"time_left"];
|
||||
[profile apply:[timeLeftAttribute withDelta:-4.42]];
|
||||
|
||||
if (configDict[@"name"] != nil) {
|
||||
id<YMMNameAttribute> nameAttribute = [YMMProfileAttribute name];
|
||||
[profile apply:[nameAttribute withValue:configDict[@"name"]]];
|
||||
}
|
||||
if (configDict[@"floor"] != nil && [configDict[@"floor"] isEqualToString:@"male"]) {
|
||||
id<YMMGenderAttribute> genderAttribute = [YMMProfileAttribute gender];
|
||||
[profile apply:[genderAttribute withValue:YMMGenderTypeMale]];
|
||||
}
|
||||
if (configDict[@"floor"] != nil && [configDict[@"floor"] isEqualToString:@"female"]) {
|
||||
id<YMMGenderAttribute> genderAttribute = [YMMProfileAttribute gender];
|
||||
[profile apply:[genderAttribute withValue:YMMGenderTypeFemale]];
|
||||
}
|
||||
if (configDict[@"age"] != nil) {
|
||||
id<YMMBirthDateAttribute> birthDateAttribute = [YMMProfileAttribute birthDate];
|
||||
[profile apply:[birthDateAttribute withAge:[configDict[@"age"] unsignedIntegerValue]]];
|
||||
}
|
||||
if (configDict[@"isNotification"] != nil) {
|
||||
id<YMMNotificationsEnabledAttribute> isNotificationAttribute = [YMMProfileAttribute notificationsEnabled];
|
||||
[profile apply:[isNotificationAttribute withValue:configDict[@"isNotification"]]];
|
||||
}
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
+ (CLLocation *)locationForDictionary:(NSDictionary *)locationDict
|
||||
{
|
||||
if (locationDict == nil) {
|
||||
|
||||
Reference in New Issue
Block a user