diff --git a/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel2.kt b/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel2.kt index f1f7a6133..4a20ca28c 100644 --- a/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel2.kt +++ b/android/app/src/main/java/github/tornaco/android/thanos/main/NavViewModel2.kt @@ -85,7 +85,16 @@ class NavViewModel2 @Inject constructor(@ApplicationContext private val context: } fun loadFeatures() { - + viewModelScope.launch { + thanox.ifServiceInstalled { thanox -> + val feats = PrebuiltFeatures.all { + it.requiredFeature == null || thanox.hasFeature(it.requiredFeature) + } + _state.value = _state.value.copy( + features = feats + ) + } + } } fun loadCoreStatus() { diff --git a/android/app/src/main/java/github/tornaco/android/thanos/main/PrebuiltFeatures.kt b/android/app/src/main/java/github/tornaco/android/thanos/main/PrebuiltFeatures.kt index a92bd813f..608df3ff6 100644 --- a/android/app/src/main/java/github/tornaco/android/thanos/main/PrebuiltFeatures.kt +++ b/android/app/src/main/java/github/tornaco/android/thanos/main/PrebuiltFeatures.kt @@ -180,9 +180,11 @@ object PrebuiltFeatures { ) - fun all(): List { + fun all(filter: (FeatureItem) -> Boolean = { true }): List { return listOf( boost, secure, ext, notification, guide - ) + ).map { + it.copy(items = it.items.filter(filter)) + } } } \ No newline at end of file