| author | Da Risk <da_risk@geekorum.com> |
| Tue, 09 Nov 2021 22:09:00 -0400 | |
| changeset 846 | ac0863af5ef6 |
| parent 742 | 47a7b0b61d5e |
| child 878 | fa560bc490f9 |
| permissions | -rw-r--r-- |
|
70
156cab5de5b6
Add GoogleFlavorApplicationComponent. Use it to inject GoogleFlavorApplication
Da Risk <da_risk@geekorum.com>
parents:
0
diff
changeset
|
1 |
/* |
| 0 | 2 |
* Geekttrss is a RSS feed reader application on the Android Platform. |
3 |
* |
|
|
846
ac0863af5ef6
build: update licence header check
Da Risk <da_risk@geekorum.com>
parents:
742
diff
changeset
|
4 |
* Copyright (C) 2017-2021 by Frederic-Charles Barthelery. |
| 0 | 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 |
|
22 |
||
|
215
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
23 |
import android.content.Context |
|
584
8a679747c426
Google: allow disk reads when installing SplitCompat
Da Risk <da_risk@geekorum.com>
parents:
232
diff
changeset
|
24 |
import android.os.StrictMode.allowThreadDiskReads |
|
197
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
25 |
import com.geekorum.geekdroid.dagger.AppInitializer |
|
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
26 |
import com.geekorum.ttrss.debugtools.StrictModeInitializer |
|
584
8a679747c426
Google: allow disk reads when installing SplitCompat
Da Risk <da_risk@geekorum.com>
parents:
232
diff
changeset
|
27 |
import com.geekorum.ttrss.debugtools.withStrictMode |
|
215
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
28 |
import com.google.android.play.core.splitcompat.SplitCompat |
| 0 | 29 |
|
30 |
class GoogleFlavorApplication : Application() {
|
|
31 |
||
|
215
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
32 |
/** |
|
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
33 |
* Allow to load code/resources from on demand modules |
|
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
34 |
*/ |
|
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
35 |
override fun attachBaseContext(base: Context?) {
|
|
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
36 |
super.attachBaseContext(base) |
|
584
8a679747c426
Google: allow disk reads when installing SplitCompat
Da Risk <da_risk@geekorum.com>
parents:
232
diff
changeset
|
37 |
withStrictMode(allowThreadDiskReads()) {
|
|
8a679747c426
Google: allow disk reads when installing SplitCompat
Da Risk <da_risk@geekorum.com>
parents:
232
diff
changeset
|
38 |
SplitCompat.install(this) |
|
8a679747c426
Google: allow disk reads when installing SplitCompat
Da Risk <da_risk@geekorum.com>
parents:
232
diff
changeset
|
39 |
} |
|
215
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
40 |
} |
|
42f01704382b
GoogleFlavorApplication: use SplitCompat to give access to downloaded modules
Da Risk <da_risk@geekorum.com>
parents:
197
diff
changeset
|
41 |
|
|
197
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
42 |
override fun sortAppInitializers(initializers: Set<AppInitializer>): List<AppInitializer> {
|
|
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
43 |
val result = mutableListOf<AppInitializer>() |
|
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
44 |
val strictModeInitializer = initializers.find { it is StrictModeInitializer }
|
|
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
45 |
strictModeInitializer?.let { result.add(it) }
|
|
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
46 |
result.addAll(initializers) |
|
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
47 |
return result.distinct() |
|
304a57b89da3
AppInitializers: sort them to be sure that some are initialized before others
Da Risk <da_risk@geekorum.com>
parents:
137
diff
changeset
|
48 |
} |
|
70
156cab5de5b6
Add GoogleFlavorApplicationComponent. Use it to inject GoogleFlavorApplication
Da Risk <da_risk@geekorum.com>
parents:
0
diff
changeset
|
49 |
} |