1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.qs.tiles.impl.qr
18 
19 import android.content.res.mainResources
20 import com.android.systemui.classifier.fakeFalsingManager
21 import com.android.systemui.kosmos.Kosmos
22 import com.android.systemui.kosmos.applicationCoroutineScope
23 import com.android.systemui.kosmos.backgroundCoroutineContext
24 import com.android.systemui.kosmos.testDispatcher
25 import com.android.systemui.kosmos.testScope
26 import com.android.systemui.qrcodescanner.dagger.QRCodeScannerModule
27 import com.android.systemui.qrcodescanner.qrCodeScannerController
28 import com.android.systemui.qs.qsEventLogger
29 import com.android.systemui.qs.tiles.base.actions.qsTileIntentUserInputHandler
30 import com.android.systemui.qs.tiles.base.analytics.qsTileAnalytics
31 import com.android.systemui.qs.tiles.base.interactor.fakeDisabledByPolicyInteractor
32 import com.android.systemui.qs.tiles.base.viewmodel.QSTileViewModelImpl
33 import com.android.systemui.qs.tiles.impl.custom.qsTileLogger
34 import com.android.systemui.qs.tiles.impl.qr.domain.interactor.QRCodeScannerTileDataInteractor
35 import com.android.systemui.qs.tiles.impl.qr.domain.interactor.QRCodeScannerTileUserActionInteractor
36 import com.android.systemui.qs.tiles.impl.qr.ui.QRCodeScannerTileMapper
37 import com.android.systemui.user.data.repository.fakeUserRepository
38 import com.android.systemui.util.time.systemClock
39 
40 val Kosmos.qsQRCodeScannerTileConfig by
<lambda>null41     Kosmos.Fixture { QRCodeScannerModule.provideQRCodeScannerTileConfig(qsEventLogger) }
42 
43 val Kosmos.qrCodeScannerTileDataInteractor by
<lambda>null44     Kosmos.Fixture {
45         QRCodeScannerTileDataInteractor(
46             backgroundCoroutineContext,
47             applicationCoroutineScope,
48             qrCodeScannerController
49         )
50     }
51 
52 val Kosmos.qrCodeScannerTileUserActionInteractor by
<lambda>null53     Kosmos.Fixture { QRCodeScannerTileUserActionInteractor(qsTileIntentUserInputHandler) }
54 
55 val Kosmos.qrCodeScannerTileMapper by
<lambda>null56     Kosmos.Fixture { QRCodeScannerTileMapper(mainResources, mainResources.newTheme()) }
57 
58 val Kosmos.qsQRCodeScannerViewModel by
<lambda>null59     Kosmos.Fixture {
60         QSTileViewModelImpl(
61             qsQRCodeScannerTileConfig,
62             { qrCodeScannerTileUserActionInteractor },
63             { qrCodeScannerTileDataInteractor },
64             { qrCodeScannerTileMapper },
65             fakeDisabledByPolicyInteractor,
66             fakeUserRepository,
67             fakeFalsingManager,
68             qsTileAnalytics,
69             qsTileLogger,
70             systemClock,
71             testDispatcher,
72             testDispatcher,
73             testScope.backgroundScope,
74         )
75     }
76