setCurrentScreen tweaks

This commit is contained in:
Akinwale Ariwodola 2019-08-25 16:36:25 +01:00
parent e47a1e0bf2
commit 660adb4a6f
2 changed files with 12 additions and 4 deletions

2
app

@ -1 +1 @@
Subproject commit 430fc1a66106efc99513eeae8043910bc40c0b82 Subproject commit 68d99ac639b908f6011325140c3a37428d039ad9

View file

@ -1,9 +1,11 @@
package io.lbry.browser.reactmodules; package io.lbry.browser.reactmodules;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import android.widget.Toast; import android.widget.Toast;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule; import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod; import com.facebook.react.bridge.ReactMethod;
@ -37,10 +39,16 @@ public class FirebaseModule extends ReactContextBaseJavaModule {
} }
@ReactMethod @ReactMethod
public void setCurrentScreen(String name) { public void setCurrentScreen(String name, final Promise promise) {
if (firebaseAnalytics != null) { final Activity activity = getCurrentActivity();
firebaseAnalytics.setCurrentScreen(MainActivity.getActivity(), name, Utils.capitalizeAndStrip(name)); if (activity != null && firebaseAnalytics != null) {
activity.runOnUiThread(new Runnable() {
public void run() {
firebaseAnalytics.setCurrentScreen(activity, name, Utils.capitalizeAndStrip(name));
}
});
} }
promise.resolve(true);
} }
@ReactMethod @ReactMethod