1 /* 2 * Copyright (C) 2025 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.wallpaper.picker.data 18 19 /** 20 * This class contains possible error codes thrown by photos app and that can be handled differently 21 * in the view layer. 22 */ 23 class PhotosErrorData(val message: String) { 24 companion object { 25 // These strings are not in strings.xml because in current implementation, we don't show 26 // these on the screen directly, so they do not need translation. 27 private const val NO_ERROR = "No error!" 28 private const val UNIMPLEMENTED_MESSAGE = "The feature is not available!" 29 private const val NO_PHOTOS_MESSAGE = "No suitable photos are available!" 30 private const val UNAUTHENTICATED_MESSAGE = "Login to photos for suggested photos!" 31 private const val DEFAULT_MESSAGE = "Unknown error!" 32 33 val OK = PhotosErrorData(NO_ERROR) 34 val UNIMPLEMENTED = PhotosErrorData(UNIMPLEMENTED_MESSAGE) 35 val NO_PHOTOS = PhotosErrorData(NO_PHOTOS_MESSAGE) 36 val UNAUTHENTICATED = PhotosErrorData(UNAUTHENTICATED_MESSAGE) 37 val DEFAULT = PhotosErrorData(DEFAULT_MESSAGE) 38 } 39 } 40