1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 04:22:30 +01:00

Add more checking frequencies, use DurationListPreference

This commit is contained in:
Stypox 2022-01-24 10:12:25 +01:00
parent 0397a3120f
commit 40ea51e622
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
5 changed files with 22 additions and 26 deletions

View File

@ -19,10 +19,10 @@ data class ScheduleOptions(
fun from(context: Context): ScheduleOptions {
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
return ScheduleOptions(
interval = TimeUnit.HOURS.toMillis(
interval = TimeUnit.SECONDS.toMillis(
preferences.getString(
context.getString(R.string.streams_notifications_interval_key),
context.getString(R.string.streams_notifications_interval_default)
null
)?.toLongOrNull() ?: context.getString(
R.string.streams_notifications_interval_default
).toLong()

View File

@ -703,11 +703,6 @@
<string name="streams_notifications_interval_title">Частота проверки</string>
<string name="enable_streams_notifications_title">Уведомлять о новых видео</string>
<string name="enable_streams_notifications_summary">Получать уведомления о новых видео из каналов, на которые Вы подписаны</string>
<string name="every_hour">Каждый час</string>
<string name="every_two_hours">Каждые 2 часа</string>
<string name="every_three_hours">Каждые 3 часа</string>
<string name="twice_per_day">Дважды в день</string>
<string name="every_day">Каждый день</string>
<string name="streams_notifications_network_title">Тип подключения</string>
<string name="any_network">Любая сеть</string>
<string name="notifications_disabled">Уведомления отключены</string>

View File

@ -1271,20 +1271,26 @@
<string name="recaptcha_cookies_key" translatable="false">recaptcha_cookies_key</string>
<string name="enable_streams_notifications" translatable="false">enable_streams_notifications</string>
<string name="streams_notifications_interval_key" translatable="false">streams_notifications_interval</string>
<string name="streams_notifications_interval_default" translatable="false">3</string>
<string-array name="streams_notifications_interval_values">
<item>1</item>
<item>2</item>
<item>3</item>
<item>12</item>
<item>24</item>
</string-array>
<string name="streams_notifications_interval_default" translatable="false">14400</string>
<!-- Values will be localized in runtime -->
<string-array name="streams_notifications_interval_description">
<item>@string/every_hour</item>
<item>@string/every_two_hours</item>
<item>@string/every_three_hours</item>
<item>@string/twice_per_day</item>
<item>@string/every_day</item>
<item>15 minutes</item>
<item>30 minutes</item>
<item>1 hour</item>
<item>2 hours</item>
<item>4 hours</item>
<item>12 hours</item>
<item>1 day</item>
</string-array>
<!-- Notifications check frequency in seconds -->
<string-array name="streams_notifications_interval_values">
<item>900</item>
<item>1800</item>
<item>3600</item>
<item>7200</item>
<item>14400</item>
<item>43200</item>
<item>86400</item>
</string-array>
<string name="streams_notifications_network_key" translatable="false">streams_notifications_network</string>
<string name="streams_notifications_network_any" translatable="false">any</string>

View File

@ -539,11 +539,6 @@
<string name="enable_streams_notifications_title">New streams notifications</string>
<string name="enable_streams_notifications_summary">Notify about new streams from subscriptions</string>
<string name="streams_notifications_interval_title">Checking frequency</string>
<string name="every_hour">Every hour</string>
<string name="every_two_hours">Every 2 hours</string>
<string name="every_three_hours">Every 3 hours</string>
<string name="twice_per_day">Twice per day</string>
<string name="every_day">Every day</string>
<string name="streams_notifications_network_title">Required network connection</string>
<string name="any_network">Any network</string>
<!-- Updates Settings -->

View File

@ -12,7 +12,7 @@
app:singleLineTitle="false"
app:iconSpaceReserved="false" />
<ListPreference
<org.schabi.newpipe.settings.custom.DurationListPreference
android:defaultValue="@string/streams_notifications_interval_default"
android:dependency="@string/enable_streams_notifications"
android:entries="@array/streams_notifications_interval_description"