|
|
|
@ -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()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|