Skip to content

Commit 16dfea9

Browse files
committed
feat: move fixed port setting to Advanced
so regular users can use it
1 parent dece858 commit 16dfea9

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/analytics/UsageAnalytics.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ object UsageAnalytics {
584584
R.string.type_in_answer_focus_key, // Focus ‘type in answer’
585585
R.string.media_import_allow_all_files_key, // Allow all files in media imports
586586
R.string.enable_api_key, // Enable AnkiDroid API
587+
R.string.use_fixed_port_pref_key, // localStorage in Study Screen
587588
// ******************************** App bar buttons ****************************************
588589
R.string.reset_custom_buttons_key,
589590
R.string.custom_button_undo_key,

AnkiDroid/src/main/java/com/ichi2/anki/settings/Prefs.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ object Prefs {
188188
val answerButtonsSize: Int
189189
get() = getInt(R.string.answer_button_size_preference, 100)
190190

191+
// **************************************** Advanced **************************************** //
192+
193+
var useFixedPortInReviewer by booleanPref(R.string.use_fixed_port_pref_key, false)
194+
195+
var reviewerPort by intPref(R.string.reviewer_port_pref_key, defaultValue = 0)
196+
191197
// ************************************* Developer options ********************************** //
192198

193199
/**
@@ -198,8 +204,4 @@ object Prefs {
198204
var isDevOptionsEnabled: Boolean
199205
get() = getBoolean(R.string.dev_options_enabled_by_user_key, false) || BuildConfig.DEBUG
200206
set(value) = putBoolean(R.string.dev_options_enabled_by_user_key, value)
201-
202-
var useFixedPortInReviewer by booleanPref(R.string.use_fixed_port_pref_key, false)
203-
204-
var reviewerPort by intPref(R.string.reviewer_port_pref_key, defaultValue = 0)
205207
}

AnkiDroid/src/main/res/values/10-preferences.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ this formatter is used if the bind only applies to the answer">A: %s</string>
293293
<string name="pref_cat_experimental" maxLength="41" tools:ignore="UnusedResources">Experimental</string>
294294
<string name="readtext_deprecation_warn">AnkiDroid has introduced a better TTS mechanism which is compatible with other Anki clients and includes more voices and improvements to language playback!\n\nPlease upgrade as soon as possible, as this setting will be removed soon</string>
295295
<string name="readtext_reviewer_warn" tools:ignore="UnusedResources">Please upgrade to the new text to speech format</string>
296+
<string name="pref_fixed_port_title" maxLength="41">localStorage in Study Screen</string>
297+
<string name="pref_fixed_port_summary"
298+
>Enables JavaScript localStorage by using a fixed server port in the Study Screen</string>
296299

297300
<!-- Developer options -->
298301
<string name="pref_cat_dev_options" maxLength="41">Developer options</string>

AnkiDroid/src/main/res/xml/preferences_advanced.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
android:key="@string/media_import_allow_all_files_key"
8989
android:summary="@string/media_import_allow_all_files_summ"
9090
android:title="@string/media_import_allow_all_files" />
91+
<SwitchPreferenceCompat
92+
android:title="@string/pref_fixed_port_title"
93+
android:key="@string/use_fixed_port_pref_key"
94+
android:summary="@string/pref_fixed_port_summary"
95+
android:defaultValue="false"/>
9196
</PreferenceCategory>
9297
<PreferenceCategory
9398
android:key="@string/pref_cat_plugins_key"

AnkiDroid/src/main/res/xml/preferences_dev_options.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
android:title="Set Database to pre-Scoped Storage default"
4949
android:summary="Touch here to set the database path to /storage/emulated/0/AnkiDroid"
5050
android:key="@string/pref_set_database_path_debug_key"/>
51-
<SwitchPreferenceCompat
52-
android:title="Use fixed port in the Reviewer"
53-
android:key="@string/use_fixed_port_pref_key"
54-
android:defaultValue="false"/>
5551
<SwitchPreferenceCompat
5652
android:title="New congrats screen"
5753
android:key="@string/new_congrats_screen_pref_key"

0 commit comments

Comments
 (0)