Skip to content

Commit d1782b7

Browse files
committed
refactor: enable full local mode by default
1 parent a9dec3e commit d1782b7

3 files changed

Lines changed: 25 additions & 23 deletions

File tree

app/src/main/java/com/github/libretube/helpers/PlayerHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ object PlayerHelper {
348348
val fullLocalMode: Boolean
349349
get() = PreferenceHelper.getBoolean(
350350
PreferenceKeys.FULL_LOCAL_MODE,
351-
false
351+
true
352352
)
353353

354354
val localStreamExtraction: Boolean

app/src/main/java/com/github/libretube/ui/models/WelcomeViewModel.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import com.github.libretube.api.RetrofitInstance
1919
import com.github.libretube.api.obj.PipedInstance
2020
import com.github.libretube.constants.PreferenceKeys
2121
import com.github.libretube.helpers.BackupHelper
22+
import com.github.libretube.helpers.PlayerHelper
2223
import com.github.libretube.helpers.PreferenceHelper
2324
import kotlinx.coroutines.launch
2425
import kotlinx.parcelize.Parcelize
@@ -69,6 +70,7 @@ class WelcomeViewModel(
6970
PreferenceKeys.FETCH_INSTANCE,
7071
_uiState.value.instances[selectedInstanceIndex].apiUrl
7172
)
73+
PreferenceHelper.putBoolean(PreferenceKeys.FULL_LOCAL_MODE, false)
7274
refreshAndNavigate()
7375
}
7476
}
@@ -79,7 +81,7 @@ class WelcomeViewModel(
7981

8082
// only skip the welcome activity if the restored backup contains an instance
8183
val instancePref = PreferenceHelper.getString(PreferenceKeys.FETCH_INSTANCE, "")
82-
if (instancePref.isNotEmpty()) {
84+
if (instancePref.isNotEmpty() || PlayerHelper.fullLocalMode) {
8385
refreshAndNavigate()
8486
}
8587
}
@@ -101,7 +103,7 @@ class WelcomeViewModel(
101103

102104
@Parcelize
103105
data class UiState(
104-
val fullLocalMode: Boolean = false,
106+
val fullLocalMode: Boolean = true,
105107
val selectedInstanceIndex: Int? = null,
106108
val instances: List<PipedInstance> = emptyList(),
107109
@StringRes val error: Int? = null,

app/src/main/res/layout/activity_welcome.xml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,44 @@
4545
android:id="@+id/operation_mode_group"
4646
app:selectionRequired="true"
4747
app:singleSelection="true"
48-
app:checkedButton="@+id/piped_toggle_group_button"
48+
app:checkedButton="@+id/full_local_mode_toggle_group_button"
4949
android:layout_width="wrap_content"
5050
android:layout_height="wrap_content"
5151
android:layout_gravity="center"
5252
android:layout_marginBottom="10dp">
5353

5454
<com.google.android.material.button.MaterialButton
55-
android:id="@+id/piped_toggle_group_button"
55+
android:id="@+id/full_local_mode_toggle_group_button"
5656
style="?attr/materialButtonOutlinedStyle"
5757
android:layout_width="match_parent"
5858
android:layout_height="wrap_content"
59-
android:text="@string/piped" />
59+
android:text="@string/full_local_mode" />
6060

6161
<com.google.android.material.button.MaterialButton
62-
android:id="@+id/full_local_mode_toggle_group_button"
62+
android:id="@+id/piped_toggle_group_button"
6363
style="?attr/materialButtonOutlinedStyle"
6464
android:layout_width="match_parent"
6565
android:layout_height="wrap_content"
66-
android:text="@string/full_local_mode" />
66+
android:text="@string/piped" />
6767

6868
</com.google.android.material.button.MaterialButtonToggleGroup>
6969

7070
<LinearLayout
71+
android:id="@+id/local_mode_info_container"
72+
android:layout_width="match_parent"
73+
android:layout_height="wrap_content"
74+
android:orientation="vertical"
75+
android:paddingHorizontal="10dp">
76+
77+
<TextView
78+
android:layout_width="match_parent"
79+
android:layout_height="wrap_content"
80+
android:text="@string/full_local_mode_desc" />
81+
82+
</LinearLayout>
83+
84+
<LinearLayout
85+
tools:visibility="gone"
7186
android:id="@+id/instances_container"
7287
android:layout_width="match_parent"
7388
android:layout_height="wrap_content"
@@ -93,21 +108,6 @@
93108
tools:listitem="@layout/instance_row" />
94109

95110
</LinearLayout>
96-
97-
<LinearLayout
98-
android:visibility="gone"
99-
android:id="@+id/local_mode_info_container"
100-
android:layout_width="match_parent"
101-
android:layout_height="wrap_content"
102-
android:orientation="vertical"
103-
android:paddingHorizontal="10dp">
104-
105-
<TextView
106-
android:layout_width="match_parent"
107-
android:layout_height="wrap_content"
108-
android:text="@string/full_local_mode_desc" />
109-
110-
</LinearLayout>
111111
</LinearLayout>
112112

113113
<FrameLayout

0 commit comments

Comments
 (0)