Skip to content

Commit

Permalink
Add a way to get the access token from the advances settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Jan 2, 2023
1 parent 5ee3ae5 commit 56986c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3501,4 +3501,7 @@
<string name="message_reply_to_sender_sent_video">sent a video.</string>
<string name="message_reply_to_sender_sent_sticker">sent a sticker.</string>
<string name="message_reply_to_sender_created_poll">created a poll.</string>

<string name="settings_access_token">Access Token</string>
<string name="settings_access_token_summary">Your access token gives full access to your account. Do not share it with anyone.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.core.preference.VectorPreference
import im.vector.app.core.preference.VectorPreferenceCategory
import im.vector.app.core.preference.VectorSwitchPreference
import im.vector.app.core.utils.copyToClipboard
import im.vector.app.features.analytics.plan.MobileScreen
import im.vector.app.features.home.NightlyProxy
import im.vector.app.features.rageshake.RageShake
Expand Down Expand Up @@ -64,6 +65,14 @@ class VectorSettingsAdvancedSettingsFragment :
override fun bindPref() {
setupRageShakeSection()
setupNightlySection()
setupDevToolsSection()
}

private fun setupDevToolsSection() {
findPreference<VectorPreference>("SETTINGS_ACCESS_TOKEN")?.setOnPreferenceClickListener {
copyToClipboard(requireActivity(), session.sessionParams.credentials.accessToken)
true
}
}

private fun setupRageShakeSection() {
Expand Down
6 changes: 6 additions & 0 deletions vector/src/main/res/xml/vector_settings_advanced_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
android:title="@string/settings_key_requests"
app:fragment="im.vector.app.features.settings.devtools.KeyRequestsFragment" />

<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_ACCESS_TOKEN"
android:persistent="false"
android:summary="@string/settings_access_token_summary"
android:title="@string/settings_access_token" />

</im.vector.app.core.preference.VectorPreferenceCategory>

<im.vector.app.core.preference.VectorPreferenceCategory
Expand Down

0 comments on commit 56986c3

Please sign in to comment.