1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2026-05-25 23:02:11 +00:00

shared: Add missing settings implementation

This seems to have gotten missed during moving settings to different modules

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2026-05-22 23:27:06 +08:00
parent 0f2bbf11ff
commit 01e3742521
4 changed files with 73 additions and 0 deletions
@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package net.newpipe.app.di.settings
import android.content.Context
import androidx.preference.PreferenceManager
import com.russhwolf.settings.Settings
import com.russhwolf.settings.SharedPreferencesSettings
import org.koin.core.annotation.Singleton
/**
* Settings for Android based on SharedPreferences
*/
@Singleton
fun provideSettings(context: Context): Settings = SharedPreferencesSettings(
PreferenceManager.getDefaultSharedPreferences(context)
)
@@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package net.newpipe.app.di.settings
import org.koin.core.annotation.ComponentScan
import org.koin.core.annotation.Configuration
import org.koin.core.annotation.Module
/**
* Settings module to access key-value pairs across different platforms.
* See individual platform packages for the declarations included in this module.
*/
@Module
@ComponentScan
@Configuration
class SettingsModule
@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package net.newpipe.app.di.settings
import com.russhwolf.settings.NSUserDefaultsSettings
import com.russhwolf.settings.Settings
import org.koin.core.annotation.Singleton
import platform.Foundation.NSUserDefaults
/**
* Settings for iOS based on UserDefaultsSettings
*/
@Singleton
fun provideSettings(): Settings = NSUserDefaultsSettings(NSUserDefaults())
@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: 2026 NewPipe e.V. <https://newpipe-ev.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package net.newpipe.app.di.settings
import com.russhwolf.settings.PreferencesSettings
import com.russhwolf.settings.Settings
import java.util.prefs.Preferences
import org.koin.core.annotation.Singleton
/**
* Settings for JVM devices based on Java Preferences
*/
@Singleton
fun provideSettings(): Settings = PreferencesSettings(Preferences.userRoot())