Merge remote-tracking branch 'origin/rename-android-pkg'

This commit is contained in:
Aleksei Androsov 2017-09-30 17:51:38 +03:00
commit bff63b4f16
6 changed files with 19 additions and 9 deletions

View File

@ -5,8 +5,6 @@
# react-native-appmetrica
React Native bridge to the AppMetrica on both iOS and Android.
**NOTE: Only iOS support for now. Feel free to send PR with Android support.**
## Installation
1. Setup [AppMetrica](https://tech.yandex.com/appmetrica/).
@ -38,4 +36,7 @@ AppMetrica.activateWithApiKey('...KEY...');
// Sends a custom event message and additional parameters (optional).
AppMetrica.reportEvent('My event');
AppMetrica.reportEvent('My event', { foo: 'bar' });
// Send a custom error event
AppMetrica.reportError('My error');
```

View File

@ -1,3 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.aandrosov.AppMetrica">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.doochik.RNAppMetrica">
</manifest>
</manifest>

View File

@ -1,4 +1,4 @@
package com.aandrosov.AppMetrica;
package com.doochik.RNAppMetrica;
import android.app.Activity;
import android.app.Application;
@ -41,6 +41,15 @@ public class AppMetricaModule extends ReactContextBaseJavaModule {
}
}
@ReactMethod
public void reportError(String message) {
try {
Integer.valueOf("00xffWr0ng");
} catch (Throwable error) {
YandexMetrica.reportError(message, error);
}
}
@ReactMethod
public void reportEvent(String message, @Nullable ReadableMap params) {
if (params != null) {

View File

@ -1,4 +1,4 @@
package com.aandrosov.AppMetrica;
package com.doochik.RNAppMetrica;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;

View File

@ -3,7 +3,7 @@ package com.rnappmetrika;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.aandrosov.AppMetrica.AppMetricaPackage;
import com.doochik.RNAppMetrica.AppMetricaPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;

View File

@ -22,8 +22,8 @@ RCT_EXPORT_METHOD(reportEvent:(NSString *)message parameters:(nullable NSDiction
[YMMYandexMetrica reportEvent:message parameters:params onFailure:NULL];
}
RCT_EXPORT_METHOD(reportError:(NSString *)message reason:(NSString *)reason) {
NSException *exception = [[NSException alloc] initWithName:message reason:reason userInfo:nil];
RCT_EXPORT_METHOD(reportError:(NSString *)message) {
NSException *exception = [[NSException alloc] initWithName:message reason:nil userInfo:nil];
[YMMYandexMetrica reportError:message exception:exception onFailure:NULL];
}
@end