| author | Da Risk <da_risk@geekorum.com> |
| Sun, 13 Dec 2020 17:19:23 -0400 | |
| changeset 769 | 179666072c7c |
| parent 733 | 95b5b040a087 |
| child 846 | ac0863af5ef6 |
| permissions | -rw-r--r-- |
| 135 | 1 |
/* |
2 |
* Geekttrss is a RSS feed reader application on the Android Platform. |
|
3 |
* |
|
| 611 | 4 |
* Copyright (C) 2017-2020 by Frederic-Charles Barthelery. |
| 135 | 5 |
* |
6 |
* This file is part of Geekttrss. |
|
7 |
* |
|
8 |
* Geekttrss is free software: you can redistribute it and/or modify |
|
9 |
* it under the terms of the GNU General Public License as published by |
|
10 |
* the Free Software Foundation, either version 3 of the License, or |
|
11 |
* (at your option) any later version. |
|
12 |
* |
|
13 |
* Geekttrss is distributed in the hope that it will be useful, |
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 |
* GNU General Public License for more details. |
|
17 |
* |
|
18 |
* You should have received a copy of the GNU General Public License |
|
19 |
* along with Geekttrss. If not, see <http://www.gnu.org/licenses/>. |
|
20 |
*/ |
|
21 |
package com.geekorum.ttrss.settings |
|
22 |
||
23 |
import android.app.Application |
|
|
140
8a681134625a
Fix SettingsInitializer and CrashlyticsInitializer with strict mode
Da Risk <da_risk@geekorum.com>
parents:
139
diff
changeset
|
24 |
import android.os.StrictMode.allowThreadDiskWrites |
|
235
adf383200966
Don't use deprecated android.preference use androidx
Da Risk <da_risk@geekorum.com>
parents:
140
diff
changeset
|
25 |
import androidx.preference.PreferenceManager |
| 135 | 26 |
import com.geekorum.geekdroid.dagger.AppInitializer |
27 |
import com.geekorum.ttrss.R |
|
|
139
74f1150de442
Add helper method to run with temporary strict mode
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
28 |
import com.geekorum.ttrss.debugtools.withStrictMode |
| 135 | 29 |
import dagger.Binds |
30 |
import dagger.Module |
|
| 733 | 31 |
import dagger.hilt.InstallIn |
| 769 | 32 |
import dagger.hilt.components.SingletonComponent |
| 135 | 33 |
import dagger.multibindings.IntoSet |
34 |
import javax.inject.Inject |
|
35 |
||
|
140
8a681134625a
Fix SettingsInitializer and CrashlyticsInitializer with strict mode
Da Risk <da_risk@geekorum.com>
parents:
139
diff
changeset
|
36 |
class SettingsInitializer @Inject constructor() : AppInitializer {
|
| 135 | 37 |
override fun initialize(app: Application) {
|
|
140
8a681134625a
Fix SettingsInitializer and CrashlyticsInitializer with strict mode
Da Risk <da_risk@geekorum.com>
parents:
139
diff
changeset
|
38 |
withStrictMode(allowThreadDiskWrites()) {
|
|
139
74f1150de442
Add helper method to run with temporary strict mode
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
39 |
PreferenceManager.setDefaultValues(app, R.xml.pref_general, false) |
|
74f1150de442
Add helper method to run with temporary strict mode
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
40 |
} |
| 135 | 41 |
} |
42 |
||
43 |
} |
|
44 |
||
45 |
@Module |
|
| 769 | 46 |
@InstallIn(SingletonComponent::class) |
| 135 | 47 |
abstract class SettingsInitializerModule {
|
48 |
@Binds |
|
49 |
@IntoSet |
|
|
140
8a681134625a
Fix SettingsInitializer and CrashlyticsInitializer with strict mode
Da Risk <da_risk@geekorum.com>
parents:
139
diff
changeset
|
50 |
abstract fun bindSettingsInitializer(settingsInitializer: SettingsInitializer): AppInitializer |
| 135 | 51 |
|
52 |
} |