1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-27 10:07:32 +01: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.Iterator;
import java.util.UUID; import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.BuildConfig;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo; import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
@ -560,7 +561,13 @@ public class QHybridSupport extends QHybridBaseSupport {
notifiyException("", e); 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(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw); e.printStackTrace(pw);
@ -593,7 +600,6 @@ public class QHybridSupport extends QHybridBaseSupport {
} }
((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify((int) System.currentTimeMillis(), notificationBuilder.build()); ((NotificationManager) getContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify((int) System.currentTimeMillis(), notificationBuilder.build());
} }
@Override @Override
@ -623,7 +629,6 @@ public class QHybridSupport extends QHybridBaseSupport {
gbDevice.addDeviceInfo(new GenericItem(ITEM_HAS_ACTIVITY_HAND, String.valueOf(watchAdapter.supportsActivityHand()))); gbDevice.addDeviceInfo(new GenericItem(ITEM_HAS_ACTIVITY_HAND, String.valueOf(watchAdapter.supportsActivityHand())));
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
notifiyException(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")); gbDevice.addDeviceInfo(new GenericItem(ITEM_EXTENDED_VIBRATION_SUPPORT, "false"));
} }
break; break;

View File

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