mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-21 05:38:49 +03:00
Developer mode: hide show (decrypted) source actions
This commit is contained in:
parent
7d744f7d7f
commit
703a1a034d
4 changed files with 24 additions and 12 deletions
|
@ -8,6 +8,8 @@ Improvements 🙌:
|
||||||
- The initial sync is now handled by a foreground service
|
- The initial sync is now handled by a foreground service
|
||||||
- Render aliases and canonical alias change in the timeline
|
- Render aliases and canonical alias change in the timeline
|
||||||
- Fix autocompletion issues and add support for rooms and groups
|
- Fix autocompletion issues and add support for rooms and groups
|
||||||
|
- Introduce developer mode in the settings (#796)
|
||||||
|
- Improve devices list screen
|
||||||
|
|
||||||
Other changes:
|
Other changes:
|
||||||
-
|
-
|
||||||
|
|
|
@ -42,6 +42,7 @@ import im.vector.riotx.features.home.room.detail.timeline.format.NoticeEventForm
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.item.MessageInformationData
|
import im.vector.riotx.features.home.room.detail.timeline.item.MessageInformationData
|
||||||
import im.vector.riotx.features.html.EventHtmlRenderer
|
import im.vector.riotx.features.html.EventHtmlRenderer
|
||||||
import im.vector.riotx.features.html.VectorHtmlCompressor
|
import im.vector.riotx.features.html.VectorHtmlCompressor
|
||||||
|
import im.vector.riotx.features.settings.VectorPreferences
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
@ -86,7 +87,8 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
||||||
private val htmlCompressor: VectorHtmlCompressor,
|
private val htmlCompressor: VectorHtmlCompressor,
|
||||||
private val session: Session,
|
private val session: Session,
|
||||||
private val noticeEventFormatter: NoticeEventFormatter,
|
private val noticeEventFormatter: NoticeEventFormatter,
|
||||||
private val stringProvider: StringProvider
|
private val stringProvider: StringProvider,
|
||||||
|
private val vectorPreferences: VectorPreferences
|
||||||
) : VectorViewModel<MessageActionState, MessageActionsAction>(initialState) {
|
) : VectorViewModel<MessageActionState, MessageActionsAction>(initialState) {
|
||||||
|
|
||||||
private val eventId = initialState.eventId
|
private val eventId = initialState.eventId
|
||||||
|
@ -268,12 +270,15 @@ class MessageActionsViewModel @AssistedInject constructor(@Assisted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add(EventSharedAction.ViewSource(event.root.toContentStringWithIndent()))
|
if (vectorPreferences.developerMode()) {
|
||||||
if (event.isEncrypted()) {
|
add(EventSharedAction.ViewSource(event.root.toContentStringWithIndent()))
|
||||||
val decryptedContent = event.root.toClearContentStringWithIndent()
|
if (event.isEncrypted()) {
|
||||||
?: stringProvider.getString(R.string.encryption_information_decryption_error)
|
val decryptedContent = event.root.toClearContentStringWithIndent()
|
||||||
add(EventSharedAction.ViewDecryptedSource(decryptedContent))
|
?: stringProvider.getString(R.string.encryption_information_decryption_error)
|
||||||
|
add(EventSharedAction.ViewDecryptedSource(decryptedContent))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add(EventSharedAction.CopyPermalink(eventId))
|
add(EventSharedAction.CopyPermalink(eventId))
|
||||||
|
|
||||||
if (session.myUserId != event.root.senderId) {
|
if (session.myUserId != event.root.senderId) {
|
||||||
|
|
|
@ -147,6 +147,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
||||||
|
|
||||||
const val SETTINGS_LABS_ALLOW_EXTENDED_LOGS = "SETTINGS_LABS_ALLOW_EXTENDED_LOGS"
|
const val SETTINGS_LABS_ALLOW_EXTENDED_LOGS = "SETTINGS_LABS_ALLOW_EXTENDED_LOGS"
|
||||||
|
|
||||||
|
private const val SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY = "SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY"
|
||||||
private const val SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY = "SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY"
|
private const val SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY = "SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY"
|
||||||
private const val SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY = "SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY"
|
private const val SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY = "SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY"
|
||||||
|
|
||||||
|
@ -245,8 +246,12 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun developerMode(): Boolean {
|
||||||
|
return defaultPrefs.getBoolean(SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY, false)
|
||||||
|
}
|
||||||
|
|
||||||
fun shouldShowHiddenEvents(): Boolean {
|
fun shouldShowHiddenEvents(): Boolean {
|
||||||
return defaultPrefs.getBoolean(SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY, false)
|
return developerMode() && defaultPrefs.getBoolean(SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun swipeToReplyIsEnabled(): Boolean {
|
fun swipeToReplyIsEnabled(): Boolean {
|
||||||
|
@ -254,7 +259,7 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun labAllowedExtendedLogging(): Boolean {
|
fun labAllowedExtendedLogging(): Boolean {
|
||||||
return defaultPrefs.getBoolean(SETTINGS_LABS_ALLOW_EXTENDED_LOGS, false)
|
return developerMode() && defaultPrefs.getBoolean(SETTINGS_LABS_ALLOW_EXTENDED_LOGS, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,19 +4,19 @@
|
||||||
|
|
||||||
<im.vector.riotx.core.preference.VectorSwitchPreference
|
<im.vector.riotx.core.preference.VectorSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="SETTINGS_DEVELOPER_MODE_KEY"
|
android:key="SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY"
|
||||||
android:summary="@string/settings_developer_mode_summary"
|
android:summary="@string/settings_developer_mode_summary"
|
||||||
android:title="@string/settings_developer_mode" />
|
android:title="@string/settings_developer_mode" />
|
||||||
|
|
||||||
<im.vector.riotx.core.preference.VectorSwitchPreference
|
<im.vector.riotx.core.preference.VectorSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:dependency="SETTINGS_DEVELOPER_MODE_KEY"
|
android:dependency="SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY"
|
||||||
android:key="SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY"
|
android:key="SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY"
|
||||||
android:title="@string/settings_labs_show_hidden_events_in_timeline" />
|
android:title="@string/settings_labs_show_hidden_events_in_timeline" />
|
||||||
|
|
||||||
<im.vector.riotx.core.preference.VectorSwitchPreference
|
<im.vector.riotx.core.preference.VectorSwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:dependency="SETTINGS_DEVELOPER_MODE_KEY"
|
android:dependency="SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY"
|
||||||
android:key="SETTINGS_LABS_ALLOW_EXTENDED_LOGS"
|
android:key="SETTINGS_LABS_ALLOW_EXTENDED_LOGS"
|
||||||
android:summary="@string/labs_allow_extended_logging_summary"
|
android:summary="@string/labs_allow_extended_logging_summary"
|
||||||
android:title="@string/labs_allow_extended_logging" />
|
android:title="@string/labs_allow_extended_logging" />
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<!-- TODO Display unsupported events -->
|
<!-- TODO Display unsupported events -->
|
||||||
|
|
||||||
<im.vector.riotx.core.preference.VectorPreferenceCategory
|
<im.vector.riotx.core.preference.VectorPreferenceCategory
|
||||||
android:dependency="SETTINGS_DEVELOPER_MODE_KEY"
|
android:dependency="SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY"
|
||||||
android:title="@string/settings_notifications">
|
android:title="@string/settings_notifications">
|
||||||
|
|
||||||
<im.vector.riotx.core.preference.VectorPreference
|
<im.vector.riotx.core.preference.VectorPreference
|
||||||
|
|
Loading…
Add table
Reference in a new issue