1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-13 21:49:27 +01:00

Fossil/Skagen Hybrids: Remove useless and annoying debug message

This commit is contained in:
Arjan Schrijver 2023-02-11 21:02:24 +01:00
parent 11bcaeb7a8
commit cbf98b9308
2 changed files with 2 additions and 47 deletions

View File

@ -80,7 +80,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.mis
import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol; import nodomain.freeyourgadget.gadgetbridge.service.serial.GBDeviceProtocol;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils; import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.GB; import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.Version;
public class QHybridSupport extends QHybridBaseSupport { public class QHybridSupport extends QHybridBaseSupport {
public static final String QHYBRID_COMMAND_CONTROL = "qhybrid_command_control"; public static final String QHYBRID_COMMAND_CONTROL = "qhybrid_command_control";
@ -703,47 +702,6 @@ public class QHybridSupport extends QHybridBaseSupport {
super.handleGBDeviceEvent(deviceEvent); super.handleGBDeviceEvent(deviceEvent);
} }
public void notifiyException(Exception e){
notifiyException("", 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);
String sStackTrace = sw.toString();
Notification.Builder notificationBuilder = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationBuilder = new Notification.Builder(getContext(), GB.NOTIFICATION_CHANNEL_ID);
} else {
notificationBuilder = new Notification.Builder(getContext());
}
notificationBuilder
.setContentTitle("Q Error " + requestName)
.setSmallIcon(R.drawable.ic_notification_qhybrid)
.setContentText(sStackTrace)
.setStyle(new Notification.BigTextStyle())
.build();
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
"mailto","dakhnod@gmail.com", null));
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Exception Report");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Here's a crash from your stupid app: \n\n" + sStackTrace);
PendingIntent intent = PendingIntent.getActivity(getContext(), 0, emailIntent, PendingIntent.FLAG_UPDATE_CURRENT);
notificationBuilder.addAction(new Notification.Action(0, "report", intent));
GB.notify((int) System.currentTimeMillis(), notificationBuilder.build(), getContext());
}
@Override @Override
public boolean onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) { public boolean onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
watchAdapter.onCharacteristicWrite(gatt, characteristic, status); watchAdapter.onCharacteristicWrite(gatt, characteristic, status);
@ -777,7 +735,7 @@ public class QHybridSupport extends QHybridBaseSupport {
gbDevice.addDeviceInfo(new GenericItem(ITEM_EXTENDED_VIBRATION_SUPPORT, String.valueOf(watchAdapter.supportsExtendedVibration()))); gbDevice.addDeviceInfo(new GenericItem(ITEM_EXTENDED_VIBRATION_SUPPORT, String.valueOf(watchAdapter.supportsExtendedVibration())));
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); GB.log("error", GB.ERROR, e);
gbDevice.addDeviceInfo(new GenericItem(ITEM_EXTENDED_VIBRATION_SUPPORT, "false")); gbDevice.addDeviceInfo(new GenericItem(ITEM_EXTENDED_VIBRATION_SUPPORT, "false"));
} }
break; break;

View File

@ -21,7 +21,6 @@ import android.bluetooth.BluetoothGattCharacteristic;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.widget.Toast; import android.widget.Toast;
@ -580,7 +579,6 @@ public class FossilWatchAdapter extends WatchAdapter {
alarms = (ArrayList<? extends Alarm>) AlarmUtils.mergeOneshotToDeviceAlarms(getDeviceSupport().getDevice(), (nodomain.freeyourgadget.gadgetbridge.entities.Alarm) oneshot, 5); alarms = (ArrayList<? extends Alarm>) AlarmUtils.mergeOneshotToDeviceAlarms(getDeviceSupport().getDevice(), (nodomain.freeyourgadget.gadgetbridge.entities.Alarm) oneshot, 5);
} }
// throw new RuntimeException("noope");
ArrayList<nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.alarm.Alarm> activeAlarms = new ArrayList<>(); ArrayList<nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.alarm.Alarm> activeAlarms = new ArrayList<>();
for (Alarm alarm : alarms) { for (Alarm alarm : alarms) {
if (!alarm.getEnabled()) continue; if (!alarm.getEnabled()) continue;
@ -652,7 +650,6 @@ public class FossilWatchAdapter extends WatchAdapter {
// setDeviceState(GBDevice.State.AUTHENTICATION_REQUIRED); // setDeviceState(GBDevice.State.AUTHENTICATION_REQUIRED);
}else { }else {
GB.log("error", GB.ERROR, e); GB.log("error", GB.ERROR, e);
getDeviceSupport().notifiyException(fossilRequest.getName(), e);
GB.toast(fossilRequest.getName() + " failed", Toast.LENGTH_SHORT, GB.ERROR); GB.toast(fossilRequest.getName() + " failed", Toast.LENGTH_SHORT, GB.ERROR);
} }
@ -697,7 +694,7 @@ public class FossilWatchAdapter extends WatchAdapter {
} }
} }
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
getDeviceSupport().notifiyException(e); GB.log("error", GB.ERROR, e);
} }
if (start && getDeviceSupport().searchDevice) return; if (start && getDeviceSupport().searchDevice) return;