Merge pull request #11 from KELiON/master

Implement setUserProfileID method
This commit is contained in:
Aleksei Androsov
2018-07-25 16:02:55 +03:00
committed by GitHub
3 changed files with 17 additions and 0 deletions

View File

@@ -59,6 +59,11 @@ public class AppMetricaModule extends ReactContextBaseJavaModule {
}
}
@ReactMethod
public void setUserProfileID(String profileID) {
YandexMetrica.setUserProfileID(profileID);
}
private String convertReadableMapToJson(final ReadableMap readableMap) {
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
JSONObject json = new JSONObject();

View File

@@ -30,4 +30,12 @@ export default {
reportError(error: string, reason: Object) {
AppMetrica.reportError(error, reason);
},
/**
* Sets the ID of the user profile.
* @param {string} userProfileId
*/
setUserProfileID(userProfileId: string) {
AppMetrica.setUserProfileID(userProfileId);
},
};

View File

@@ -26,4 +26,8 @@ RCT_EXPORT_METHOD(reportError:(NSString *)message) {
NSException *exception = [[NSException alloc] initWithName:message reason:nil userInfo:nil];
[YMMYandexMetrica reportError:message exception:exception onFailure:NULL];
}
RCT_EXPORT_METHOD(setUserProfileID:(NSString *)userProfileID) {
[YMMYandexMetrica setUserProfileID:userProfileID];
}
@end