diff --git a/.github/workflows/build.gradle b/.github/workflows/build.gradle new file mode 100644 index 000000000..8fc3b00ba --- /dev/null +++ b/.github/workflows/build.gradle @@ -0,0 +1,11 @@ +plugins { + id "org.sonarqube" version "4.4.1.3373" +} + +sonar { + properties { + property "sonar.projectKey", "OmniaAlam_OpenTracks-Winter-SOEN-6431_2024" + property "sonar.organization", "omniaalam" + property "sonar.host.url", "https://sonarcloud.io" + } +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1 @@ + diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1 @@ + diff --git a/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java b/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java index 3136ae731..70da88275 100644 --- a/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java +++ b/src/main/java/de/dennisguse/opentracks/services/TrackDeleteService.java @@ -54,12 +54,13 @@ 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{ + throw new RuntimeException("Unknown resultCode."); + } + } - public interface Receiver { void onDeleteFinished(); } diff --git a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java index ad2e62722..7d4f826f2 100644 --- a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java +++ b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java @@ -213,10 +213,10 @@ private synchronized void startSensors() { wakeLock = SystemUtils.acquireWakeLock(this, wakeLock); trackPointCreator.start(this, handler); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { - if (!PermissionRequester.RECORDING.hasPermission(this)) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && !PermissionRequester.RECORDING.hasPermission(this)) { + throw new RuntimeException("Android14: Please grant permissions LOCATION and NEARBY DEVICES (manually)"); - } + } ServiceCompat.startForeground(this, TrackRecordingServiceNotificationManager.NOTIFICATION_ID, notificationManager.setGPSonlyStarted(this), ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION + ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE); @@ -285,7 +285,7 @@ public Marker.Id insertMarker(String name, String category, String description, return trackRecordingManager.insertMarker(name, category, description, photoUrl); } - @Deprecated + @Deprecated(since = "14.0.0", forRemoval = true) @VisibleForTesting public TrackPointCreator getTrackPointCreator() { return trackPointCreator; @@ -354,4 +354,4 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, @Null trackPointCreator.onSharedPreferenceChanged(sharedPreferences, key); notificationManager.onSharedPreferenceChanged(sharedPreferences, key); } -} \ No newline at end of file +}