mirror of
https://github.com/gabehf/tempus.git
synced 2026-03-12 08:50:34 -07:00
feat: implemented album and song sharing
This commit is contained in:
parent
f172a00fb7
commit
26b8f3f65c
6 changed files with 83 additions and 2 deletions
|
|
@ -11,9 +11,11 @@ import com.cappielloantonio.tempo.interfaces.StarCallback;
|
|||
import com.cappielloantonio.tempo.repository.AlbumRepository;
|
||||
import com.cappielloantonio.tempo.repository.ArtistRepository;
|
||||
import com.cappielloantonio.tempo.repository.FavoriteRepository;
|
||||
import com.cappielloantonio.tempo.repository.SharingRepository;
|
||||
import com.cappielloantonio.tempo.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Child;
|
||||
import com.cappielloantonio.tempo.subsonic.models.Share;
|
||||
import com.cappielloantonio.tempo.util.NetworkUtil;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -23,6 +25,7 @@ public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
|||
private final AlbumRepository albumRepository;
|
||||
private final ArtistRepository artistRepository;
|
||||
private final FavoriteRepository favoriteRepository;
|
||||
private final SharingRepository sharingRepository;
|
||||
|
||||
private AlbumID3 album;
|
||||
|
||||
|
|
@ -32,6 +35,7 @@ public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
|||
albumRepository = new AlbumRepository();
|
||||
artistRepository = new ArtistRepository();
|
||||
favoriteRepository = new FavoriteRepository();
|
||||
sharingRepository = new SharingRepository();
|
||||
}
|
||||
|
||||
public AlbumID3 getAlbum() {
|
||||
|
|
@ -66,6 +70,10 @@ public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
public MutableLiveData<Share> shareAlbum() {
|
||||
return sharingRepository.createShare(album.getId(), album.getName(), null);
|
||||
}
|
||||
|
||||
private void removeFavoriteOffline() {
|
||||
favoriteRepository.starLater(null, album.getId(), null, false);
|
||||
album.setStarred(null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue