Skip to content

Commit e4b705c

Browse files
committed
SDK-1440 enable android logging. Fix issue with iOS logging. Add note about early lifecycle events prior to JS runtime init
1 parent c4d67c1 commit e4b705c

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/android/io/branch/BranchSDK.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,19 @@ private void setCookieBasedMatching(String linkDomain, CallbackContext callbackC
527527
}
528528

529529
/**
530-
* <p>Sets the library to function in debug mode, enabling logging of all requests.</p>
531-
* <p>If you want to flag debug, call this <b>before</b> initUserSession</p>
530+
* <p>Enabling Branch SDK logging</p>
532531
*
533-
* @param isEnable A {@link Boolean} value to enable/disable debugging mode for the app.
532+
* @param isEnable A {@link Boolean} value to enable/disable logging
534533
* @param callbackContext A callback to execute at the end of this method
535534
*/
536-
private void setDebug(boolean isEnable, CallbackContext callbackContext) {
535+
private void setLogging(boolean isEnable, CallbackContext callbackContext) {
537536
this.activity = this.cordova.getActivity();
538-
Branch.enableDebugMode();
537+
if (isEnable == true) {
538+
Branch.enableLogging();
539+
} else {
540+
Branch.disableLogging();
541+
}
542+
539543
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, isEnable));
540544
}
541545

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Branch.prototype.setDebug = function setDebug(isEnabled) {
120120
});
121121
};
122122

123+
// For early lifecycle logging, we recommend you enable logging in the native iOS or Android code.
123124
Branch.prototype.setLogging = function setLogging(isEnabled) {
124125
var value = typeof isEnabled !== "boolean" ? false : isEnabled;
125126
this.enableLogging = value;

src/ios/BranchSDK.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ - (void)enableLogging:(CDVInvokedUrlCommand*)command
160160
[[Branch getInstance] enableLogging];
161161
}
162162

163-
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enableDebug];
163+
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enableLogging];
164164

165165
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
166166
}

0 commit comments

Comments
 (0)