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