mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Updated DisappearingMessages.kt and HelpSettingsActivity.kt
This commit is contained in:
parent
5bd55ea993
commit
e7dd1c582d
@ -1,7 +1,6 @@
|
||||
package org.thoughtcrime.securesms.conversation.disappearingmessages
|
||||
|
||||
import android.content.Context
|
||||
import com.squareup.phrase.Phrase
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
@ -21,6 +20,7 @@ import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.session.libsession.utilities.getExpirationTypeDisplayValue
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||
import org.thoughtcrime.securesms.showSessionDialog
|
||||
import org.thoughtcrime.securesms.ui.getSubbedString
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
|
||||
class DisappearingMessages @Inject constructor(
|
||||
@ -50,10 +50,9 @@ class DisappearingMessages @Inject constructor(
|
||||
text(if (message.expiresIn == 0L) {
|
||||
context.getString(R.string.disappearingMessagesFollowSettingOff)
|
||||
} else {
|
||||
Phrase.from(context, R.string.disappearingMessagesFollowSettingOn)
|
||||
.put(TIME_LARGE_KEY, ExpirationUtil.getExpirationDisplayValue(context, message.expiresIn.milliseconds))
|
||||
.put(DISAPPEARING_MESSAGES_TYPE_KEY, context.getExpirationTypeDisplayValue(message.isNotDisappearAfterRead))
|
||||
.format().toString()
|
||||
context.getSubbedString(R.string.disappearingMessagesFollowSettingOn,
|
||||
TIME_LARGE_KEY to ExpirationUtil.getExpirationDisplayValue(context, message.expiresIn.milliseconds),
|
||||
DISAPPEARING_MESSAGES_TYPE_KEY to context.getExpirationTypeDisplayValue(message.isNotDisappearAfterRead))
|
||||
})
|
||||
|
||||
dangerButton(
|
||||
|
@ -10,12 +10,13 @@ import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.preference.Preference
|
||||
import com.squareup.phrase.Phrase
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.StringSubstitutionConstants.APP_NAME_KEY
|
||||
import org.session.libsignal.utilities.Log
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.permissions.Permissions
|
||||
import org.thoughtcrime.securesms.ui.getSubbedCharSequence
|
||||
import org.thoughtcrime.securesms.ui.getSubbedString
|
||||
|
||||
class HelpSettingsActivity: PassphraseRequiredActionBarActivity() {
|
||||
|
||||
@ -47,15 +48,11 @@ class HelpSettingsFragment: CorrectedPreferenceFragment() {
|
||||
|
||||
// String sub the summary text of the `export_logs` element in preferences_help.xml
|
||||
val exportPref = preferenceScreen.findPreference<Preference>(EXPORT_LOGS)
|
||||
exportPref?.summary = Phrase.from(context, R.string.helpReportABugExportLogsDescription)
|
||||
.put(APP_NAME_KEY, getString(R.string.app_name))
|
||||
.format()
|
||||
exportPref?.summary = context?.getSubbedCharSequence(R.string.helpReportABugExportLogsDescription, APP_NAME_KEY to getString(R.string.app_name))
|
||||
|
||||
// String sub the summary text of the `translate_session` element in preferences_help.xml
|
||||
val translatePref = preferenceScreen.findPreference<Preference>(TRANSLATE)
|
||||
translatePref?.title = Phrase.from(context, R.string.helpHelpUsTranslateSession)
|
||||
.put(APP_NAME_KEY, getString(R.string.app_name))
|
||||
.format()
|
||||
translatePref?.title = context?.getSubbedCharSequence(R.string.helpHelpUsTranslateSession, APP_NAME_KEY to getString(R.string.app_name))
|
||||
}
|
||||
|
||||
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||
@ -101,14 +98,11 @@ class HelpSettingsFragment: CorrectedPreferenceFragment() {
|
||||
Permissions.with(this)
|
||||
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
.maxSdkVersion(Build.VERSION_CODES.P)
|
||||
.withPermanentDenialDialog(Phrase.from(context, R.string.permissionsStorageSaveDenied)
|
||||
.put(APP_NAME_KEY, getString(R.string.app_name))
|
||||
.format().toString())
|
||||
.withPermanentDenialDialog(requireContext().getSubbedString(R.string.permissionsStorageSaveDenied, APP_NAME_KEY to getString(R.string.app_name)))
|
||||
.onAnyDenied {
|
||||
val txt = Phrase.from(context, R.string.permissionsStorageSaveDenied)
|
||||
.put(APP_NAME_KEY, getString(R.string.app_name))
|
||||
.format().toString()
|
||||
Toast.makeText(requireActivity(), txt, Toast.LENGTH_LONG).show()
|
||||
val c = requireContext()
|
||||
val txt = c.getSubbedString(R.string.permissionsStorageSaveDenied, APP_NAME_KEY to getString(R.string.app_name))
|
||||
Toast.makeText(c, txt, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
.onAllGranted {
|
||||
ShareLogsDialog(::updateExportButtonAndProgressBarUI).show(parentFragmentManager,"Share Logs Dialog")
|
||||
@ -121,6 +115,7 @@ class HelpSettingsFragment: CorrectedPreferenceFragment() {
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
// TODO: Have asked Rebecca about a new string for this to replace the hard-coded text below
|
||||
Toast.makeText(requireActivity(), "Can't open URL", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user