Skip to content

Commit

Permalink
fix: opencage privacy links are clickable now, also tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
growse committed Jun 6, 2024
1 parent 82295a1 commit 45c6f01
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class PreferencesActivityTests :
clickOnAndWait(R.string.preferencesReverseGeocodeProvider)

clickOnAndWait("OpenCage")
clickOnAndWait(android.R.id.button1)

writeToPreference(R.string.preferencesOpencageGeocoderApiKey, "geocodeAPIKey")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.owntracks.android.ui.preferences

import android.Manifest.permission.ACCESS_BACKGROUND_LOCATION
import android.app.ProgressDialog.show
import android.content.Context
import android.os.Build
import android.os.Bundle
import android.widget.TextView
import androidx.core.content.PermissionChecker
import androidx.preference.ListPreference
import androidx.preference.Preference
Expand Down Expand Up @@ -72,7 +74,10 @@ class AdvancedFragment @Inject constructor() :
(preference as ListPreference).value = newValue.toString()
}
.setNegativeButton(R.string.preferencesAdvancedOpencagePrivacyDialogCancel, null)
.show()
.create()
.apply { show() }
.findViewById<TextView>(android.R.id.message)
?.movementMethod = android.text.method.LinkMovementMethod.getInstance()
false
} else {
true
Expand Down
2 changes: 1 addition & 1 deletion project/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ To allow this, please enable Location in the device settings."</string>
<string name="play_services_update_required">"Google Play Services update is required"</string>
<string name="preferencesAdvanced">"Advanced"</string>
<string name="preferencesAdvancedAutostartWarning">"This version of Android restricts OwnTracks from receiving locations when automatically started on device boot until the app is opened."</string>
<string name="preferencesAdvancedOpencagePrivacy"><a href="https://opencagedata.com/api#privacy">OpenCage Privacy Policy</a></string>
<string name="preferencesAdvancedOpencagePrivacy"><a href="%s">OpenCage Privacy Policy</a></string>
<string name="preferencesAdvancedOpencagePrivacyDialogMessage">To use the OpenCage geocoder, OwnTracks will send every location it processes to OpenCage over a TLS-encrypted connection.\n\nThe OpenCage privacy policy can be found <a href="https://opencagedata.com/api#privacy">on their website</a>.</string>
<string name="preferencesAdvancedOpencagePrivacyDialogTitle">OpenCage Privacy Policy</string>
<string name="preferencesAdvancedOpencagePrivacyDialogAccept">Accept</string>
Expand Down
1 change: 1 addition & 0 deletions project/app/src/main/res/values/urls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<string name="translationContributionUrl" translatable="false">https://poeditor.com/join/project?hash=xe6LPP0Jnx</string>
<string name="licenseUrl" translatable="false">https://opensource.org/licenses/EPL-1.0</string>
<string name="changelogUrl" translatable="false">https://raw.githubusercontent.com/owntracks/android/master/CHANGELOG.md</string>
<string name="opencagePrivacyPolicyUrl" translatable="false">https://opencagedata.com/api#privacy</string>
</resources>
6 changes: 5 additions & 1 deletion project/app/src/main/res/xml/preferences_advanced.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@
android:icon="@drawable/baseline_privacy_tip_24"
app:iconSpaceReserved="true"
app:key="opencagePrivacy"
app:summary="@string/preferencesAdvancedOpencagePrivacy" />
app:summary="@string/preferencesAdvancedOpencagePrivacy">
<intent
android:action="android.intent.action.VIEW"
android:data="@string/opencagePrivacyPolicyUrl" />
</Preference>
<androidx.preference.EditTextPreference
app:dialogMessage="@string/preferencesOpencageGeocoderApiKeyDialog"
app:iconSpaceReserved="false"
Expand Down

0 comments on commit 45c6f01

Please sign in to comment.