mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Endurain: Fixes following from PR review
This commit is contained in:
+3
-2
@@ -20,6 +20,7 @@ import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import nodomain.freeyourgadget.gadgetbridge.R
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.AbstractGBActivity
|
||||
import org.slf4j.LoggerFactory
|
||||
@@ -65,7 +66,7 @@ class EndurainOAuthCallbackActivity : AbstractGBActivity() {
|
||||
val resultIntent = Intent("nodomain.freeyourgadget.gadgetbridge.ENDURAIN_SSO_CALLBACK")
|
||||
resultIntent.putExtra("session_id", sessionId)
|
||||
resultIntent.putExtra("success", true)
|
||||
sendBroadcast(resultIntent)
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(resultIntent)
|
||||
|
||||
Toast.makeText(this,
|
||||
getString(R.string.endurain_oauth_completing_login), Toast.LENGTH_SHORT).show()
|
||||
@@ -76,7 +77,7 @@ class EndurainOAuthCallbackActivity : AbstractGBActivity() {
|
||||
// Broadcast failure
|
||||
val resultIntent = Intent("nodomain.freeyourgadget.gadgetbridge.ENDURAIN_SSO_CALLBACK")
|
||||
resultIntent.putExtra("success", false)
|
||||
sendBroadcast(resultIntent)
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(resultIntent)
|
||||
}
|
||||
|
||||
finish()
|
||||
|
||||
+3
-5
@@ -26,10 +26,10 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.button.MaterialButtonToggleGroup
|
||||
@@ -107,11 +107,9 @@ class EndurainSetupBottomSheet : BottomSheetDialogFragment() {
|
||||
serverInput.setText(prefs.getString("endurain_server", ""))
|
||||
|
||||
// Register broadcast receiver for SSO callbacks
|
||||
ContextCompat.registerReceiver(
|
||||
requireContext(),
|
||||
LocalBroadcastManager.getInstance(requireContext()).registerReceiver(
|
||||
ssoCallbackReceiver,
|
||||
IntentFilter("nodomain.freeyourgadget.gadgetbridge.ENDURAIN_SSO_CALLBACK"),
|
||||
ContextCompat.RECEIVER_EXPORTED
|
||||
IntentFilter("nodomain.freeyourgadget.gadgetbridge.ENDURAIN_SSO_CALLBACK")
|
||||
)
|
||||
|
||||
next.setOnClickListener {
|
||||
|
||||
+1
-2
@@ -44,8 +44,7 @@ class EndurainTokenManager(context: Context) {
|
||||
putString("access_token", accessToken)
|
||||
.putString("refresh_token", refreshToken)
|
||||
.putInt("access_token_expires_at", accessTokenExpiryTs)
|
||||
.putInt("refresh_token_expires_at", refreshTokenExpiryTs
|
||||
)
|
||||
.putInt("refresh_token_expires_at", refreshTokenExpiryTs)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<item
|
||||
android:id="@+id/activity_action_upload_to_wanderer"
|
||||
android:icon="@drawable/ic_file_upload"
|
||||
android:title="Upload GPX to Wanderer"
|
||||
android:title="@string/activity_detail_upload_to_wanderer"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
|
||||
@@ -4963,7 +4963,7 @@
|
||||
<string name="prefs_online_fitness_trackers_title">Online fitness trackers</string>
|
||||
<string name="prefs_online_fitness_trackers_summary">Configure how to reach and use online fitness trackers</string>
|
||||
<string name="warning_network_required_title">Network required</string>
|
||||
<string name="warning_network_required_summary">This integration requires network connectivity. Please install and enable the internet helper add-on app.</string>
|
||||
<string name="warning_network_required_summary">These integrations requires network connectivity. Please install and enable the internet helper add-on app.</string>
|
||||
<string name="pref_info_endurain_status_title">Endurain status</string>
|
||||
<string name="pref_endurain_log_in_title">Log in to Endurain</string>
|
||||
<string name="pref_endurain_log_in_summary">Tap here to enter the Endurain server and log in</string>
|
||||
@@ -4975,7 +4975,7 @@
|
||||
<string name="unable_to_share_gpx_track_toast">Unable to share GPX track: %1$s</string>
|
||||
<string name="endurain_successfully_uploaded_toast">Successfully uploaded to Endurain</string>
|
||||
<string name="endurain_error_while_uploading_toast">Error while uploading to Endurain</string>
|
||||
<string name="endurain_unable_to_upload_gpx_file_toast">Unable to upload GPX file to Endurain: %1$s</string>
|
||||
<string name="endurain_unable_to_upload_gpx_file_toast">Unable to upload activity file to Endurain: %1$s</string>
|
||||
<string name="endurain_setup_title">Endurain setup</string>
|
||||
<string name="endurain_setup_server">Endurain server</string>
|
||||
<string name="endurain_setup_login_type_local">Local</string>
|
||||
@@ -4993,4 +4993,7 @@
|
||||
<string name="pref_wanderer_enter_api_token_title">Enter Wanderer API token</string>
|
||||
<string name="pref_wanderer_enter_api_token_summary">Tap here to enter the Wanderer server and API token</string>
|
||||
<string name="pref_wanderer_log_out_title">Log out of Wanderer</string>
|
||||
<string name="pref_category_endurain" translatable="false">Endurain</string>
|
||||
<string name="pref_category_wanderer" translatable="false">Wanderer</string>
|
||||
<string name="activity_detail_upload_to_wanderer">Upload GPX to Wanderer</string>
|
||||
</resources>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
android:title="@string/warning_network_required_title"
|
||||
android:summary="@string/warning_network_required_summary" />
|
||||
<PreferenceCategory
|
||||
android:title="Endurain">
|
||||
android:title="@string/pref_category_endurain">
|
||||
<Preference
|
||||
android:icon="@drawable/ic_info"
|
||||
android:key="pref_key_endurain_status"
|
||||
@@ -25,7 +25,7 @@
|
||||
android:summary="@string/pref_endurain_log_out_summary" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:title="Wanderer">
|
||||
android:title="@string/pref_category_wanderer">
|
||||
<Preference
|
||||
android:icon="@drawable/ic_info"
|
||||
android:key="pref_key_wanderer_status"
|
||||
|
||||
Reference in New Issue
Block a user