Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4b9cb25 authored by Romain Hunault's avatar Romain Hunault 🚴🏻
Browse files

Use a translatable trouble shoot page

parent 556eaacd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import foundation.e.apps.databinding.DialogErrorLogBinding
import foundation.e.apps.ui.LoginViewModel
import foundation.e.apps.ui.MainActivityViewModel
import timber.log.Timber
import java.util.Locale

/**
 * Parent class of all fragments.
@@ -233,7 +234,7 @@ abstract class TimeoutFragment(@LayoutRes layoutId: Int) : Fragment(layoutId) {
    }

    private fun openTroubleshootingPage() {
        val troubleshootUrl = getString(R.string.troubleshootURL)
        val troubleshootUrl = getString(R.string.troubleshootURL, Locale.getDefault().language)
        val openUrlIntent = Intent(Intent.ACTION_VIEW)
        openUrlIntent.data = Uri.parse(troubleshootUrl)
        startActivity(openUrlIntent)
+11 −2
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ package foundation.e.apps.ui.settings

import android.content.ClipData
import android.content.ClipboardManager
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import android.widget.Toast
@@ -39,14 +41,15 @@ import com.google.gson.Gson
import dagger.hilt.android.AndroidEntryPoint
import foundation.e.apps.BuildConfig
import foundation.e.apps.R
import foundation.e.apps.data.enums.User
import foundation.e.apps.data.application.UpdatesDao
import foundation.e.apps.ui.LoginViewModel
import foundation.e.apps.data.enums.User
import foundation.e.apps.databinding.CustomPreferenceBinding
import foundation.e.apps.install.updates.UpdatesWorkManager
import foundation.e.apps.ui.LoginViewModel
import foundation.e.apps.ui.MainActivityViewModel
import foundation.e.apps.utils.SystemInfoProvider
import timber.log.Timber
import java.util.Locale
import javax.inject.Inject

@AndroidEntryPoint
@@ -58,6 +61,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
    private var showAllApplications: CheckBoxPreference? = null
    private var showFOSSApplications: CheckBoxPreference? = null
    private var showPWAApplications: CheckBoxPreference? = null
    private var troubleShootPreference: Preference? = null

    val loginViewModel: LoginViewModel by lazy {
        ViewModelProvider(requireActivity())[LoginViewModel::class.java]
@@ -86,6 +90,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
        showAllApplications = findPreference<CheckBoxPreference>("showAllApplications")
        showFOSSApplications = findPreference<CheckBoxPreference>("showFOSSApplications")
        showPWAApplications = findPreference<CheckBoxPreference>("showPWAApplications")
        troubleShootPreference = findPreference(getString(R.string.having_troubles))

        val updateCheckInterval =
            preferenceManager.findPreference<Preference>(getString(R.string.update_check_intervals))
        updateCheckInterval?.setOnPreferenceChangeListener { _, newValue ->
@@ -126,6 +132,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
        allSourceCheckboxes.forEach {
            it?.onPreferenceChangeListener = sourceCheckboxListener
        }

        val troubleshootUrl = getString(R.string.troubleshootURL, Locale.getDefault().language)
        troubleShootPreference?.intent = Intent(Intent.ACTION_VIEW, Uri.parse(troubleshootUrl))
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@
    <string name="system_app">System app</string>
    <string name="additional_file_for">Additional file for %s</string>
    <string name="having_troubles">Having troubles?</string>
    <string name="troubleshootURL" translatable="false">https://doc.e.foundation/support-topics/app_lounge_troubleshooting</string>
    <string name="troubleshootURL" translatable="false">https://e.foundation/%1$s/get-e-os/#applounge</string>
    <string name="share">Share</string>
    <string name="restricted_app">[%1$s] Restricted App</string>
    <string name="age_rate_limit_message">You are too young to be able to install %1$s. Please check with your parent your age group is correct or disable parental control to be able to install it.</string>
+1 −4
Original line number Diff line number Diff line
@@ -27,9 +27,6 @@
    <Preference
        android:key="@string/having_troubles"
        android:layout="@layout/custom_preferences_troubleshooting_link">
            <intent
                android:action="android.intent.action.VIEW"
                android:data="@string/troubleshootURL"/>
    </Preference>

    <PreferenceCategory