Skip to content

Commit 30fa9d6

Browse files
committed
Addressing some review comments
1 parent a167b0f commit 30fa9d6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

android/src/main/java/io/branch/rnbranch/RNBranchModule.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static void reInitSession(Activity reactActivity) {
123123
if (intent != null) {
124124
intent.putExtra("branch_force_new_session", true);
125125
notifyJSOfInitSessionStart(reactActivity, intent.getData());
126-
branch.sessionBuilder(reactActivity).withCallback(referralInitListener).reInit();
126+
Branch.sessionBuilder(reactActivity).withCallback(referralInitListener).reInit();
127127
} else {
128128
Log.w(REACT_CLASS, "reInitSession was called but the Intent is null");
129129
}
@@ -208,9 +208,15 @@ private void generateLocalBroadcast(JSONObject referringParams,
208208
}.init(reactActivity);
209209

210210
notifyJSOfInitSessionStart(reactActivity, uri);
211-
branch.sessionBuilder(reactActivity).withCallback(referralInitListener).withData(uri).init();
211+
Branch.sessionBuilder(reactActivity).withCallback(referralInitListener).withData(uri).init();
212212
}
213213

214+
/**
215+
* Notify JavaScript of init session start. This generates an RNBranch.initSessionStart
216+
* event to JS via the RN native event emitter.
217+
* @param context a Context for the LocalBroadcastManager
218+
* @param uri the URI to include in the notification or null
219+
*/
214220
private static void notifyJSOfInitSessionStart(Context context, Uri uri) {
215221
Intent broadcastIntent = new Intent(NATIVE_INIT_SESSION_STARTED_EVENT);
216222
if (uri != null) {
@@ -243,7 +249,7 @@ public static void setRequestMetadata(String key, String val) {
243249

244250
public RNBranchModule(ReactApplicationContext reactContext) {
245251
super(reactContext);
246-
forwardInitSessionEventsToReactNative(reactContext);
252+
listenForInitSessionEventsToReactNative(reactContext);
247253
}
248254

249255
@javax.annotation.Nullable
@@ -296,7 +302,7 @@ public Map<String, Object> getConstants() {
296302
return constants;
297303
}
298304

299-
private void forwardInitSessionEventsToReactNative(ReactApplicationContext reactContext) {
305+
private void listenForInitSessionEventsToReactNative(ReactApplicationContext reactContext) {
300306
mInitSessionFinishedEventReceiver = new BroadcastReceiver() {
301307
RNBranchModule mBranchModule;
302308

0 commit comments

Comments
 (0)