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

Verified Commit 8f22b3f6 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Do not reload backends without actual settings update

parent 4c9a3fac
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -169,12 +169,18 @@ class UnifiedLocationServiceRoot(private val service: UnifiedLocationServiceEntr
        }
    }

    private fun <E> Set<E>.contentEquals(other: Set<E>): Boolean {
        if (other.size != size) return false
        return containsAll(other)
    }

    override fun getLocationBackends(): Array<String> {
        return Preferences(service).locationBackends.toTypedArray()
    }

    override fun setLocationBackends(backends: Array<String>) {
        checkAdminPermission();
        if (Preferences(service).locationBackends.contentEquals(backends.toSet())) return
        Preferences(service).locationBackends = backends.toSet()
        reloadPreferences()
    }
@@ -185,6 +191,7 @@ class UnifiedLocationServiceRoot(private val service: UnifiedLocationServiceEntr

    override fun setGeocoderBackends(backends: Array<String>) {
        checkAdminPermission();
        if (Preferences(service).geocoderBackends.contentEquals(backends.toSet())) return
        Preferences(service).geocoderBackends = backends.toSet()
        reloadPreferences()
    }
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ class BackendDetailsFragment : Fragment(R.layout.backend_details), BackendDetail
    }

    override fun onEnabledChange(entry: BackendInfo?, newValue: Boolean) {
        if (entry?.enabled?.get() == newValue) return
        Log.d(TAG, "onEnabledChange: ${entry?.signedComponent} = $newValue")
        val activity = requireActivity() as AppCompatActivity
        entry?.enabled?.set(newValue)