mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 07:20:30 +05:30
Merge pull request #7325 from Bnyro/master
refactor: enable full local mode by default
This commit is contained in:
commit
5bb969fe2b
@ -348,7 +348,7 @@ object PlayerHelper {
|
||||
val fullLocalMode: Boolean
|
||||
get() = PreferenceHelper.getBoolean(
|
||||
PreferenceKeys.FULL_LOCAL_MODE,
|
||||
false
|
||||
true
|
||||
)
|
||||
|
||||
val localStreamExtraction: Boolean
|
||||
|
@ -19,6 +19,7 @@ import com.github.libretube.api.RetrofitInstance
|
||||
import com.github.libretube.api.obj.PipedInstance
|
||||
import com.github.libretube.constants.PreferenceKeys
|
||||
import com.github.libretube.helpers.BackupHelper
|
||||
import com.github.libretube.helpers.PlayerHelper
|
||||
import com.github.libretube.helpers.PreferenceHelper
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.parcelize.Parcelize
|
||||
@ -69,6 +70,7 @@ class WelcomeViewModel(
|
||||
PreferenceKeys.FETCH_INSTANCE,
|
||||
_uiState.value.instances[selectedInstanceIndex].apiUrl
|
||||
)
|
||||
PreferenceHelper.putBoolean(PreferenceKeys.FULL_LOCAL_MODE, false)
|
||||
refreshAndNavigate()
|
||||
}
|
||||
}
|
||||
@ -79,7 +81,7 @@ class WelcomeViewModel(
|
||||
|
||||
// only skip the welcome activity if the restored backup contains an instance
|
||||
val instancePref = PreferenceHelper.getString(PreferenceKeys.FETCH_INSTANCE, "")
|
||||
if (instancePref.isNotEmpty()) {
|
||||
if (instancePref.isNotEmpty() || PlayerHelper.fullLocalMode) {
|
||||
refreshAndNavigate()
|
||||
}
|
||||
}
|
||||
@ -101,7 +103,7 @@ class WelcomeViewModel(
|
||||
|
||||
@Parcelize
|
||||
data class UiState(
|
||||
val fullLocalMode: Boolean = false,
|
||||
val fullLocalMode: Boolean = true,
|
||||
val selectedInstanceIndex: Int? = null,
|
||||
val instances: List<PipedInstance> = emptyList(),
|
||||
@StringRes val error: Int? = null,
|
||||
|
@ -45,19 +45,12 @@
|
||||
android:id="@+id/operation_mode_group"
|
||||
app:selectionRequired="true"
|
||||
app:singleSelection="true"
|
||||
app:checkedButton="@+id/piped_toggle_group_button"
|
||||
app:checkedButton="@+id/full_local_mode_toggle_group_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/piped_toggle_group_button"
|
||||
style="?attr/materialButtonOutlinedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/piped" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/full_local_mode_toggle_group_button"
|
||||
style="?attr/materialButtonOutlinedStyle"
|
||||
@ -65,9 +58,31 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/full_local_mode" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/piped_toggle_group_button"
|
||||
style="?attr/materialButtonOutlinedStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/piped" />
|
||||
|
||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/local_mode_info_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/full_local_mode_desc" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
tools:visibility="gone"
|
||||
android:id="@+id/instances_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -93,21 +108,6 @@
|
||||
tools:listitem="@layout/instance_row" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/local_mode_info_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/full_local_mode_desc" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
|
Loading…
x
Reference in New Issue
Block a user