1 /* 2 * Copyright 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.photopicker.core.banners 18 19 internal typealias DismissStrategy = BannerDeclaration.DismissStrategy 20 21 /** 22 * The data required to declare a unique Photopicker Banner implementation. 23 * 24 * @property id A unique string id of the banner 25 * @property dismissable Whether the banner is dismiss-able by the user 26 * @property dismissableStrategy How to track the banner's dismiss state. 27 */ 28 interface BannerDeclaration { 29 val id: String 30 val dismissable: Boolean 31 val dismissableStrategy: DismissStrategy 32 33 /** Various logic for how banner dismissal is tracked between invocations of Photopicker. */ 34 enum class DismissStrategy { 35 36 /** 37 * The banner dismissal is tracked per uid (caller's uid). Each UID will have its own 38 * dismissal state for each banner using this strategy. 39 * 40 * @see [PhotopickerConfiguration#callingPackageUid] 41 */ 42 PER_UID, 43 44 /** 45 * The banner dismissal is tracked globally across all Photopicker configurations. This 46 * banner can only be dismissed once across all types of Photopicker sessions. Note that 47 * this is ONCE per [UserProfile]. 48 */ 49 ONCE, 50 51 /** 52 * The banner dismissal is tracked only for the current Photopicker session. Future sessions 53 * will return a non-dismissed state for any banners dismissed with this strategy. 54 */ 55 SESSION, 56 57 /** The Banner cannot be dismissed. */ 58 NONE, 59 } 60 } 61