| author | Da Risk <da_risk@geekorum.com> |
| Fri, 02 May 2025 17:06:24 -0400 | |
| changeset 71 | 92cbb2785189 |
| parent 54 | 3377ea7d1f03 |
| permissions | -rw-r--r-- |
|
47
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
1 |
/* |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
2 |
* AboutOss is an utility library to retrieve and display |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
3 |
* opensource licenses in Android applications. |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
4 |
* |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2023-2025 by Frederic-Charles Barthelery. |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
6 |
* |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
7 |
* This file is part of AboutOss. |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
8 |
* |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
9 |
* AboutOss is free software: you can redistribute it and/or modify |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
10 |
* it under the terms of the GNU General Public License as published by |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
11 |
* the Free Software Foundation, either version 3 of the License, or |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
12 |
* (at your option) any later version. |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
13 |
* |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
14 |
* AboutOss is distributed in the hope that it will be useful, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
17 |
* GNU General Public License for more details. |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
18 |
* |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
20 |
* along with AboutOss. If not, see <http://www.gnu.org/licenses/>. |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
21 |
*/ |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
22 |
package com.geekorum.aboutoss.sampleapp |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
23 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
24 |
import androidx.lifecycle.viewmodel.CreationExtras |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
25 |
import com.geekorum.aboutoss.core.licensee.LicenseeLicenseInfoRepository |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
26 |
import com.geekorum.aboutoss.ui.common.OpenSourceLicensesViewModel |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
27 |
import kotlinx.coroutines.Dispatchers |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
28 |
import org.jetbrains.compose.resources.ExperimentalResourceApi |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
29 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
30 |
@OptIn(ExperimentalResourceApi::class) |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
31 |
actual fun CreationExtras.createPrebuildOpenSourceLicensesViewModel(): OpenSourceLicensesViewModel {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
32 |
val licenseInfoRepository = LicenseeLicenseInfoRepository( |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
33 |
mainCoroutineDispatcher = Dispatchers.Main, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
34 |
ioCoroutineDispatcher = Dispatchers.IO, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
35 |
licenseeResourcePath = "app/cash/licensee/prebuilt_artifacts.json", |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
36 |
) |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
37 |
|
|
54
3377ea7d1f03
sample: update PrebuiltLicensesViewModel
Da Risk <da_risk@geekorum.com>
parents:
50
diff
changeset
|
38 |
return OpenSourceLicensesViewModel(licenseInfoRepository) |
|
47
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
39 |
} |