Search in sources :

Example 1 with VideoEntitlementData

use of com.zype.android.zypeapi.model.VideoEntitlementData in project zype-android by zype.

the class DataRepository method updateVideoEntitlements.

private void updateVideoEntitlements(List<VideoEntitlementData> entitlements) {
    for (VideoEntitlementData item : entitlements) {
        Video video = getVideoSync(item.videoId);
        if (video == null) {
            loadVideo(item.videoId, response -> {
                if (response.isSuccessful) {
                    Video dbVideo = getVideoSync(item.videoId);
                    if (dbVideo != null) {
                        dbVideo.isEntitled = 1;
                        dbVideo.entitlementUpdatedAt = item.createdAt;
                        updateVideo(dbVideo);
                    }
                }
            });
        } else {
            video.isEntitled = 1;
            video.entitlementUpdatedAt = item.createdAt;
            updateVideo(video);
        }
    }
}
Also used : PlaylistVideo(com.zype.android.Db.Entity.PlaylistVideo) Video(com.zype.android.Db.Entity.Video) FavoriteVideo(com.zype.android.Db.Entity.FavoriteVideo) VideoEntitlementData(com.zype.android.zypeapi.model.VideoEntitlementData)

Aggregations

FavoriteVideo (com.zype.android.Db.Entity.FavoriteVideo)1 PlaylistVideo (com.zype.android.Db.Entity.PlaylistVideo)1 Video (com.zype.android.Db.Entity.Video)1 VideoEntitlementData (com.zype.android.zypeapi.model.VideoEntitlementData)1