update files iOS

This commit is contained in:
Andrey Bondarenko 2021-01-21 18:23:32 +10:00
parent 8a0af3388d
commit 79c045577c
5 changed files with 45 additions and 3 deletions

View File

@ -84,6 +84,8 @@ dependencies {
implementation 'com.yandex.android:mobmetricalib:3.18.0' implementation 'com.yandex.android:mobmetricalib:3.18.0'
implementation "com.yandex.android:mobmetricapushlib:1.10.0" implementation "com.yandex.android:mobmetricapushlib:1.10.0"
implementation 'com.android.installreferrer:installreferrer:1.1.2' implementation 'com.android.installreferrer:installreferrer:1.1.2'
implementation "com.google.firebase:firebase-messaging:21.0.0"
implementation "com.google.android.gms:play-services-base:17.5.0"
} }
def configureReactNativePom(def pom) { def configureReactNativePom(def pom) {

View File

@ -68,7 +68,7 @@ export default {
} else { } else {
AppMetrica.initPush(token); AppMetrica.initPush(token);
} }
} },
reportUserProfile(config: UserProfileConfig){ reportUserProfile(config: UserProfileConfig){
AppMetrica.reportUserProfile(config); AppMetrica.reportUserProfile(config);

View File

@ -23,7 +23,15 @@ RCT_EXPORT_METHOD(activate:(NSDictionary *)configDict)
[YMMYandexMetrica activateWithConfiguration:[AppMetricaUtils configurationForDictionary: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]; [YMPYandexMetricaPush setDeviceTokenFromData:deviceToken];
} }

View File

@ -52,6 +52,38 @@
return configuration; 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 + (CLLocation *)locationForDictionary:(NSDictionary *)locationDict
{ {
if (locationDict == nil) { if (locationDict == nil) {

View File

@ -1,7 +1,7 @@
{ {
"name": "react-native-appmetrica-next", "name": "react-native-appmetrica-next",
"title": "Yandex AppMetrica React Native Plugin && AppMetricaPushSDK (fireBase CloudMessage)", "title": "Yandex AppMetrica React Native Plugin && AppMetricaPushSDK (fireBase CloudMessage)",
"version": "1.0.3", "version": "1.0.4",
"description": "React Native plugin for AppMetrica analytics tool", "description": "React Native plugin for AppMetrica analytics tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {