Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardizes log tags and refactors log messages #1795

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public class RNOneSignal extends ReactContextBaseJavaModule implements
IPermissionObserver,
IUserStateObserver,
LifecycleEventListener,
INotificationLifecycleListener{
INotificationLifecycleListener {
private static final String TAG = "OneSignal";

private ReactApplicationContext mReactApplicationContext;
private ReactContext mReactContext;

Expand Down Expand Up @@ -171,8 +173,8 @@ private void removeObservers() {
}

private void removeHandlers() {
if(!oneSignalInitDone) {
Log.i("OneSignal", "OneSignal React-Native SDK not initialized yet. Could not remove handlers.");
if (!oneSignalInitDone) {
Log.i(TAG, "OneSignal React-Native SDK not initialized yet. Could not remove handlers.");
return;
}

Expand Down Expand Up @@ -232,7 +234,7 @@ public void initialize(String appId) {
OneSignalWrapper.setSdkVersion("050209");

if (oneSignalInitDone) {
Log.e("OneSignal", "Already initialized the OneSignal React-Native SDK");
Log.e(TAG, "Already initialized the OneSignal React-Native SDK");
return;
}

Expand Down Expand Up @@ -383,8 +385,8 @@ public void onWillDisplay(INotificationWillDisplayEvent event) {
event.wait();
}
}
} catch(InterruptedException e){
Log.e("InterruptedException" + e.toString(), null);
} catch (InterruptedException e) {
Log.e(TAG, "InterruptedException " + e.toString());
}
} catch (JSONException e) {
e.printStackTrace();
Expand All @@ -395,7 +397,7 @@ public void onWillDisplay(INotificationWillDisplayEvent event) {
private void displayNotification(String notificationId){
INotificationWillDisplayEvent event = notificationWillDisplayCache.get(notificationId);
if (event == null) {
Log.e("Could not find onWillDisplayNotification event for notification with id: " + notificationId, null);
Log.e(TAG, "Could not find onWillDisplayNotification event for notification with id: " + notificationId);
return;
}
event.getNotification().display();
Expand All @@ -405,7 +407,7 @@ private void displayNotification(String notificationId){
private void preventDefault(String notificationId) {
INotificationWillDisplayEvent event = notificationWillDisplayCache.get(notificationId);
if (event == null) {
Log.e("Could not find onWillDisplayNotification event for notification with id: " + notificationId, null);
Log.e(TAG, "Could not find onWillDisplayNotification event for notification with id: " + notificationId);
return;
}
event.preventDefault();
Expand All @@ -432,7 +434,7 @@ public void removePermissionObserver() {
public void onNotificationPermissionChange(boolean permission) {
try {
sendEvent("OneSignal-permissionChanged", RNUtils.convertHashMapToWritableMap(RNUtils.convertPermissionToMap(permission)));
Log.i("OneSignal", "sending permission change event");
Log.i(TAG, "sending permission change event");
} catch (JSONException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -546,7 +548,7 @@ public void onPushSubscriptionChange(PushSubscriptionChangedState pushSubscripti
sendEvent("OneSignal-subscriptionChanged",
RNUtils.convertHashMapToWritableMap(
RNUtils.convertPushSubscriptionChangedStateToMap(pushSubscriptionChangedState)));
Log.i("OneSignal", "sending subscription change event");
Log.i(TAG, "sending subscription change event");
} catch (JSONException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -715,7 +717,7 @@ public void onUserStateChange(UserChangedState state) {
sendEvent("OneSignal-userStateChanged",
RNUtils.convertHashMapToWritableMap(
RNUtils.convertUserChangedStateToMap(state)));
Log.i("OneSignal", "sending user state change event");
Log.i(TAG, "sending user state change event");
} catch (JSONException e) {
e.printStackTrace();
}
Expand Down