mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00: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);
|
||||
|
|
|
|||
|
|
@ -15,10 +15,12 @@ import com.cappielloantonio.tempo.model.Download;
|
|||
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.repository.SongRepository;
|
||||
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.DownloadUtil;
|
||||
import com.cappielloantonio.tempo.util.MappingUtil;
|
||||
import com.cappielloantonio.tempo.util.NetworkUtil;
|
||||
|
|
@ -34,6 +36,7 @@ public class SongBottomSheetViewModel extends AndroidViewModel {
|
|||
private final AlbumRepository albumRepository;
|
||||
private final ArtistRepository artistRepository;
|
||||
private final FavoriteRepository favoriteRepository;
|
||||
private final SharingRepository sharingRepository;
|
||||
|
||||
private Child song;
|
||||
|
||||
|
|
@ -46,6 +49,7 @@ public class SongBottomSheetViewModel extends AndroidViewModel {
|
|||
albumRepository = new AlbumRepository();
|
||||
artistRepository = new ArtistRepository();
|
||||
favoriteRepository = new FavoriteRepository();
|
||||
sharingRepository = new SharingRepository();
|
||||
}
|
||||
|
||||
public Child getSong() {
|
||||
|
|
@ -128,4 +132,8 @@ public class SongBottomSheetViewModel extends AndroidViewModel {
|
|||
|
||||
return instantMix;
|
||||
}
|
||||
|
||||
public MutableLiveData<Share> shareTrack() {
|
||||
return sharingRepository.createShare(song.getId(), song.getTitle(), null);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue