1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-17 02:44:04 +02:00

Make exception notification only visible in debug builds

This commit is contained in:
cpfeiffer 2020-02-26 21:31:04 +01:00
parent 136825fa9d
commit c766b1d1b7
2 changed files with 8 additions and 4 deletions

View File

@ -45,6 +45,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
@ -560,7 +561,13 @@ public class QHybridSupport extends QHybridBaseSupport {
notifiyException("", e);
}
public void notifiyException(String requestName, Exception e){
public void notifiyException(String requestName, Exception e) {
if (!BuildConfig.DEBUG) {
logger.error("Error: " + requestName, e);
return;
}
GB.toast("Please contact dakhnod@gmail.com\n", Toast.LENGTH_SHORT, GB.ERROR, e);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
@ -593,7 +600,6 @@ public class QHybridSupport extends QHybridBaseSupport {
}
((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify((int) System.currentTimeMillis(), notificationBuilder.build());
}
@Override
@ -623,7 +629,6 @@ public class QHybridSupport extends QHybridBaseSupport {
gbDevice.addDeviceInfo(new GenericItem(ITEM_HAS_ACTIVITY_HAND, String.valueOf(watchAdapter.supportsActivityHand())));
} catch (UnsupportedOperationException e) {
notifiyException(e);
GB.toast("Please contact dakhnod@gmail.com\n", Toast.LENGTH_SHORT, GB.INFO);
gbDevice.addDeviceInfo(new GenericItem(ITEM_EXTENDED_VIBRATION_SUPPORT, "false"));
}
break;

View File

@ -521,7 +521,6 @@ public class FossilWatchAdapter extends WatchAdapter {
}
} catch (UnsupportedOperationException e) {
getDeviceSupport().notifiyException(e);
GB.toast("Please contact dakhnod@gmail.com\n", Toast.LENGTH_SHORT, GB.INFO);
}
if (start && getDeviceSupport().searchDevice) return;