Skip to content

Commit

Permalink
Merge pull request #2 from nimblehq/chore/disable-debugging-logs-rele…
Browse files Browse the repository at this point in the history
…ase-build

Chore: Disable debugging log on release build
  • Loading branch information
hoangnguyen92dn authored Feb 19, 2021
2 parents eaf27ae + 257770d commit df8f9f7
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public void setOnHardwareKeysPressedListenerListener(OnHardwareKeysPressedListen

public void startWatch() {
if (mReceiver != null) {
Log.d(TAG, "startWatch on " + mContext);
logForDebugging("startWatch on " + mContext);
mContext.registerReceiver(mReceiver, mFilter);
}
}

public void stopWatch() {
if (mReceiver != null) {
Log.d(TAG, "stopWatch on " + mContext);
logForDebugging("stopWatch on " + mContext);
mContext.unregisterReceiver(mReceiver);
}
}
Expand All @@ -66,15 +66,15 @@ public void onReceive(Context context, Intent intent) {
if (mListener != null) {
switch (reason) {
case SYSTEM_DIALOG_REASON_HOME_KEY:
Log.d(TAG, "onHomePressed (homekey)");
logForDebugging("onHomePressed (homekey)");
mListener.onHomePressed();
break;
case SYSTEM_DIALOG_REASON_RECENT_APPS:
Log.d(TAG, "onRecentAppsPressed (recentapps)");
logForDebugging("onRecentAppsPressed (recentapps)");
mListener.onRecentAppsPressed();
break;
case SYSTEM_DIALOG_REASON_RECENT_APPS_XIAOMI:
Log.d(TAG, "onRecentAppsPressed (fs_gesture)");
logForDebugging("onRecentAppsPressed (fs_gesture)");
mListener.onRecentAppsPressed();
break;
}
Expand All @@ -83,4 +83,10 @@ public void onReceive(Context context, Intent intent) {
}
}
}

private void logForDebugging(String message) {
if (BuildConfig.DEBUG) {
Log.d(TAG, message);
}
}
}

0 comments on commit df8f9f7

Please sign in to comment.