From b173c355960cd82dd7aee933336fd842093e702f Mon Sep 17 00:00:00 2001 From: Suhaas Gummalam Date: Fri, 13 Oct 2023 12:34:35 -0400 Subject: [PATCH 1/3] GH-118: object shadowing problem solved --- .../services/TrackRecordingServiceConnection.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingServiceConnection.java b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingServiceConnection.java index 15dc2bc28..e5903aace 100644 --- a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingServiceConnection.java +++ b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingServiceConnection.java @@ -176,12 +176,12 @@ public void binderDied() { @Nullable public Marker.Id addMarker(Context context, String name, String category, String description, String photoUrl) { - TrackRecordingService trackRecordingService = getServiceIfBound(); - if (trackRecordingService == null) { + TrackRecordingService newTrackRecordingService = getServiceIfBound(); + if (newTrackRecordingService == null) { Log.d(TAG, "Unable to add marker, no track recording service"); } else { try { - Marker.Id marker = trackRecordingService.insertMarker(name, category, description, photoUrl); + Marker.Id marker = newTrackRecordingService.insertMarker(name, category, description, photoUrl); if (marker != null) { Toast.makeText(context, R.string.marker_add_success, Toast.LENGTH_SHORT).show(); return marker; @@ -196,11 +196,11 @@ public Marker.Id addMarker(Context context, String name, String category, String } public void stopRecording(@NonNull Context context) { - TrackRecordingService trackRecordingService = getServiceIfBound(); - if (trackRecordingService == null) { + TrackRecordingService newTrackRecordingService = getServiceIfBound(); + if (newTrackRecordingService == null) { Log.e(TAG, "TrackRecordingService not connected."); } else { - trackRecordingService.endCurrentTrack(); + newTrackRecordingService.endCurrentTrack(); } unbindAndStop(context); } From d069bb68336fbf08f5d9d61d2c1640f8b5dbeceb Mon Sep 17 00:00:00 2001 From: abraredu11 Date: Fri, 13 Oct 2023 13:45:52 -0400 Subject: [PATCH 2/3] #84 Replaced SWITCH with IF-ELSE statement and added a custom exception class to counter generic usage of exceptions --- .../services/TrackDeleteService.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java b/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java index 3136ae731..b87362940 100644 --- a/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java +++ b/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java @@ -15,8 +15,16 @@ import de.dennisguse.opentracks.data.ContentProviderUtils; import de.dennisguse.opentracks.data.models.Track; + +class UnknownResultCodeException extends Exception { + public UnknownResultCodeException() { + super("Unknown resultCode."); + } +} + public class TrackDeleteService extends JobIntentService { + private static final int JOB_ID = 3; private static final String EXTRA_RECEIVER = "extra_receiver"; @@ -54,10 +62,18 @@ public TrackDeleteResultReceiver(Handler handler, @NonNull Receiver receiver) { @Override protected void onReceiveResult(int resultCode, Bundle resultData) { - switch (resultCode) { - case RESULT_CODE_SUCCESS -> receiver.onDeleteFinished(); - default -> throw new RuntimeException("Unknown resultCode."); + if (resultCode == RESULT_CODE_SUCCESS) { + receiver.onDeleteFinished(); + } else { + try { + throw new UnknownResultCodeException(); + } catch (UnknownResultCodeException e) { + + + } } + + } public interface Receiver { From a64723005ba9379466c735a2d94cc887eaec3f0f Mon Sep 17 00:00:00 2001 From: Suhaas Gummalam Date: Fri, 13 Oct 2023 14:14:43 -0400 Subject: [PATCH 3/3] GH-118: Fix variable shadow issue --- build.gradle | 13 +++++++------ my-release-key.keystore | Bin 0 -> 2696 bytes 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 my-release-key.keystore diff --git a/build.gradle b/build.gradle index 0e9d2bbef..9c485f165 100644 --- a/build.gradle +++ b/build.gradle @@ -77,13 +77,14 @@ android { } signingConfigs { nightly { - if (System.getProperty("nightly_store_file") != null) { - storeFile file(System.getProperty("nightly_store_file")) - storePassword System.getProperty("nightly_store_password") - keyAlias System.getProperty("nightly_key_alias") - keyPassword System.getProperty("nightly_key_password") - } + + storeFile file("my-release-key.keystore") + storePassword "Group5" + keyAlias "Group5" + keyPassword "Group5" + } + } namespace 'de.dennisguse.opentracks' diff --git a/my-release-key.keystore b/my-release-key.keystore new file mode 100644 index 0000000000000000000000000000000000000000..32258571380aef52a2f71bbf1423d22f122c63ef GIT binary patch literal 2696 zcma);S5y-U5{8qI0EvkZK#&fhNf8nVy#^Eo#Lz*SRHz>`?J^Qr#FlWwu|NQg#pFtC05g;HHng|o8hKfX8k2*jAX@CVp z7&n**WB-j=&_qb}e@T#hFcFgd8>j!SRO)m8alv6gPyrF5_8Tgp@BDE<5a?TIxqn7D zS`^Gg*476c)l8=7EYK<6Vi1&ze0OOT1QMbL0eR4HYTAEa1VJGHG$%FGCh9uSkqQhH z0n-l&D1CQx8newAU(8{Jrs#r+;8BhHqkhoHG-JwTdt`@%u{F9bwH_VlM3Tsz{~YO$ zZiyE-oc_Q!n^5Sd*N3eu&W7HN9>^fQHqR+p@G!VcJq~Kh^%Nkb5w{)Ku0oR^3XBSPwhU<&$u_fpm|&cs#4zaN1_W`D z7eT9w-Gx!>*sL@ew1L*_%UYffTpb~*V_19W_e}ci!?M;pgM^*5xvkeZAmnok#v+ue zrQ$tg472toeYNSX;6M_VlR-@L(Dg8CU0>G=0;D>Tp8NSG?dRLP2YImRgbMy@6KTYW z^CT^v_Sb=ni_TDw8;6piAFqfDtjn5#>lynVvUo3bVQ(2==Ne#`EF*0zPRpI^QO<1Y z`0^P-A|vNl$V%3BE{ia-#FnjO9onZ9!2sJ1%yri+eQ@`S&4JJAtd@CA%G|bfGd*YU zk39_Y-lgXD*f?j`*P-7uPwg(k+oi%vo#!Oz|YCm>&Wf?BfBp)Hl zvz@VL2|+J6DTBhTf_kz87#P#n2LpO))$>F(qXk*AUE zi@0sGsN!>J9E5odq{4#9hd||b+9m~Vk8gez(+{qcdWB9)pWh6UonSRY#e)34i6Wb# zK{~h+K(z{R_k`K~H5;D)uxqUKJA<+MFwcG<1YlLJm=IaUxa$rq8E+H)98Q$IeWz@u zsr_5pv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