1 /* 2 * Copyright (C) 2023 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.di 18 19 import com.android.systemui.qs.tiles.base.interactor.QSTileDataInteractor 20 import com.android.systemui.qs.tiles.base.interactor.QSTileDataToStateMapper 21 import com.android.systemui.qs.tiles.base.interactor.QSTileUserActionInteractor 22 import kotlinx.coroutines.CoroutineScope 23 24 /** 25 * Base QS tile component. It should be used with [QSTileScope] to create a custom tile scoped 26 * component. Pass this component to 27 * [com.android.systemui.qs.tiles.base.viewmodel.QSTileViewModelFactory.Component]. 28 */ 29 interface QSTileComponent<T> { 30 dataInteractornull31 fun dataInteractor(): QSTileDataInteractor<T> 32 33 fun userActionInteractor(): QSTileUserActionInteractor<T> 34 35 fun dataToStateMapper(): QSTileDataToStateMapper<T> 36 37 /** 38 * Use [com.android.systemui.qs.tiles.base.viewmodel.QSTileCoroutineScopeFactory] to create a 39 * [CoroutineScope] provided by this method. This enables you to use the same scope the 40 * [com.android.systemui.qs.tiles.viewmodel.QSTileViewModel] uses. This scope is cancelled when 41 * the view model is destroyed. 42 */ 43 @QSTileScope fun coroutineScope(): CoroutineScope 44 } 45