From 9173d40faed95b7fa08177d9d691a09aa20792e5 Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Wed, 3 Jan 2024 13:34:43 +0530 Subject: [PATCH 1/7] NearbyParentFragment : added referer In file NearbyParentFragment.java, I added header property, i.e., the referer - http://maps.wikimedia.org/ and set tile source to wikimedia. --- .../commons/nearby/fragments/NearbyParentFragment.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java index 0389a7358b..470ac1a3ba 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java @@ -125,6 +125,7 @@ import org.osmdroid.events.MapListener; import org.osmdroid.events.ScrollEvent; import org.osmdroid.events.ZoomEvent; +import org.osmdroid.tileprovider.tilesource.TileSourceFactory; import org.osmdroid.util.GeoPoint; import org.osmdroid.util.constants.GeoConstants; import org.osmdroid.views.CustomZoomButtonsController; @@ -398,7 +399,14 @@ public void onViewCreated(@NonNull final View view, @Nullable final Bundle saved presenter.setActionListeners(applicationKvStore); org.osmdroid.config.Configuration.getInstance().load(this.getContext(), PreferenceManager.getDefaultSharedPreferences(this.getContext())); + + mapView.setTileSource(TileSourceFactory.WIKIMEDIA); // Added tileSource - WIKIMEDIA mapView.setTilesScaledToDpi(true); + + org.osmdroid.config.Configuration.getInstance().getAdditionalHttpRequestProperties().put( + "Referer", "http://maps.wikimedia.org/" + ); // Added referer in the header + if (applicationKvStore.getString("LastLocation") != null) { // Checking for last searched location String[] locationLatLng = applicationKvStore.getString("LastLocation").split(","); From 3083a55bf537d6e75c365e4d06d30632880a4623 Mon Sep 17 00:00:00 2001 From: Nicolas Raoul Date: Wed, 3 Jan 2024 22:01:22 +0900 Subject: [PATCH 2/7] Reworded comments --- .../commons/nearby/fragments/NearbyParentFragment.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java index 470ac1a3ba..b03d693f2d 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.java @@ -400,12 +400,16 @@ public void onViewCreated(@NonNull final View view, @Nullable final Bundle saved org.osmdroid.config.Configuration.getInstance().load(this.getContext(), PreferenceManager.getDefaultSharedPreferences(this.getContext())); - mapView.setTileSource(TileSourceFactory.WIKIMEDIA); // Added tileSource - WIKIMEDIA + // Use the Wikimedia tile server, rather than OpenStreetMap (Mapnik) which has various + // restrictions that we do not satisfy. + mapView.setTileSource(TileSourceFactory.WIKIMEDIA); mapView.setTilesScaledToDpi(true); + // Add referer HTTP header because the Wikimedia tile server requires it. + // This was suggested by Dmitry Brant within an email thread between us and WMF. org.osmdroid.config.Configuration.getInstance().getAdditionalHttpRequestProperties().put( "Referer", "http://maps.wikimedia.org/" - ); // Added referer in the header + ); if (applicationKvStore.getString("LastLocation") != null) { // Checking for last searched location From b3e5019e36e50d8e94f9f0970222988fe75ade3b Mon Sep 17 00:00:00 2001 From: Rohit Verma <101377978+rohit9625@users.noreply.github.com> Date: Sat, 13 Jan 2024 23:42:48 +0530 Subject: [PATCH 3/7] sdkmanager: added installation command for build-tools-30.0.3 --- .github/workflows/android.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 7a1e7c0305..e9553e015e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -54,6 +54,8 @@ jobs: emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: echo "Generated AVD snapshot for caching." + - name: Install Build Tools 30.0.3 + run: yes | sdkmanager "build-tools;30.0.3" - name: Run Instrumentation tests if: github.event_name != 'pull_request' From c13cc3f3e36583f7a4968f9271409c4c5be62474 Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Sun, 14 Jan 2024 00:02:41 +0530 Subject: [PATCH 4/7] Revert "sdkmanager: added installation command for build-tools-30.0.3" This reverts commit b3e5019e36e50d8e94f9f0970222988fe75ade3b. --- .github/workflows/android.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index e9553e015e..7a1e7c0305 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -54,8 +54,6 @@ jobs: emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none disable-animations: true script: echo "Generated AVD snapshot for caching." - - name: Install Build Tools 30.0.3 - run: yes | sdkmanager "build-tools;30.0.3" - name: Run Instrumentation tests if: github.event_name != 'pull_request' From e03651c5ab7be60edeca6b09f44c3658aaa49059 Mon Sep 17 00:00:00 2001 From: Rohit Verma <101377978+rohit9625@users.noreply.github.com> Date: Sun, 14 Jan 2024 01:11:10 +0530 Subject: [PATCH 5/7] Update android.yml --- .github/workflows/android.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 7a1e7c0305..198efcfadf 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -55,6 +55,18 @@ jobs: disable-animations: true script: echo "Generated AVD snapshot for caching." + - name: Print environment + run: | + echo "System Environment:" + printenv + + echo "Gradle Properties:" + ./gradlew properties + + - name: Print dependencies + run: ./gradlew dependencies + + - name: Run Instrumentation tests if: github.event_name != 'pull_request' uses: reactivecircus/android-emulator-runner@v2 @@ -69,14 +81,15 @@ jobs: adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0 adb emu geo fix 37.422131 -122.084801 ./gradlew connectedBetaDebugAndroidTest --stacktrace + cat app/build/reports/androidTests/connected/flavors/BetaDebug/index.html - name: Run Unit tests with unified coverage if: github.event_name != 'pull_request' - run: ./gradlew -Pcoverage testBetaDebugUnitTestUnifiedCoverage --stacktrace + run: ./gradlew -Pcoverage testBetaDebugUnitTestUnifiedCoverage --stacktrace --info - name: Run Unit tests without unified coverage if: github.event_name == 'pull_request' - run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace + run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace --info - name: Upload Test Report to Codecov if: github.event_name != 'pull_request' From a6cf6259bfc0bec1053bdff7b81e976735b94965 Mon Sep 17 00:00:00 2001 From: Rohit Verma Date: Sun, 14 Jan 2024 01:31:54 +0530 Subject: [PATCH 6/7] Update gradle.properties --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index f0646307c8..04832531cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -31,8 +31,8 @@ OKHTTP_VERSION=4.10.0 MAPLIBRE_VERSION=10.0.1 OSMDROID_VERSION=6.1.17 -systemProp.http.proxyPort=0 -systemProp.http.proxyHost= +#systemProp.http.proxyPort=0 +#systemProp.http.proxyHost= android.useAndroidX=true android.enableJetifier=true android.jetifier.ignorelist=bcprov-jdk15on From b5b03012b93444411bb233789c3f36cbc31d5d0e Mon Sep 17 00:00:00 2001 From: Rohit Verma <101377978+rohit9625@users.noreply.github.com> Date: Sun, 14 Jan 2024 16:42:46 +0530 Subject: [PATCH 7/7] android.yml: removed extra debug commands Removed some debug commands because they are no longer needed. --- .github/workflows/android.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 198efcfadf..7a1e7c0305 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -55,18 +55,6 @@ jobs: disable-animations: true script: echo "Generated AVD snapshot for caching." - - name: Print environment - run: | - echo "System Environment:" - printenv - - echo "Gradle Properties:" - ./gradlew properties - - - name: Print dependencies - run: ./gradlew dependencies - - - name: Run Instrumentation tests if: github.event_name != 'pull_request' uses: reactivecircus/android-emulator-runner@v2 @@ -81,15 +69,14 @@ jobs: adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0 adb emu geo fix 37.422131 -122.084801 ./gradlew connectedBetaDebugAndroidTest --stacktrace - cat app/build/reports/androidTests/connected/flavors/BetaDebug/index.html - name: Run Unit tests with unified coverage if: github.event_name != 'pull_request' - run: ./gradlew -Pcoverage testBetaDebugUnitTestUnifiedCoverage --stacktrace --info + run: ./gradlew -Pcoverage testBetaDebugUnitTestUnifiedCoverage --stacktrace - name: Run Unit tests without unified coverage if: github.event_name == 'pull_request' - run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace --info + run: ./gradlew -Pcoverage testBetaDebugUnitTestCoverage --stacktrace - name: Upload Test Report to Codecov if: github.event_name != 'pull_request'