package com.key.vibekeyboard.ViewModel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;

import com.key.vibekeyboard.Room.MyDatabase;
import com.key.vibekeyboard.Room.WallpaperInfo;

import java.util.List;

public class FavoriteViewModel extends ViewModel {
    private final LiveData<List<WallpaperInfo>> favoriteList;
    private final MyDatabase database;

    public FavoriteViewModel() {
        // 获取数据库实例
        database = MyDatabase.getInstance();
        // 通过 LiveData 监听数据库中的喜欢列表变化
        favoriteList = database.wallpaperInfoDao().getLiveLikeList(true);
    }

    // 提供一个获取喜欢列表 LiveData 的方法
    public LiveData<List<WallpaperInfo>> getFavoriteList() {
        return favoriteList;
    }
}
