Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for mobile (React Native) #160

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
893200e
Configure new mobile app (React Native)
tsirysndr Apr 3, 2023
27a9b0b
clear commented code
tsirysndr Apr 3, 2023
10a2084
[mobile] configure storybook
tsirysndr Apr 4, 2023
5c6f9dc
[mobile] add artists component stories
tsirysndr Apr 4, 2023
9960bd2
[mobile] add songs component stories
tsirysndr Apr 4, 2023
fd2e745
[mobile] add miniplayer component stories
tsirysndr Apr 4, 2023
7458f16
[mobile] display miniplayer on all screens
tsirysndr Apr 4, 2023
4a2add6
[mobile] add player component stories
tsirysndr Apr 4, 2023
3d54fa3
[mobile] add header component
tsirysndr Apr 5, 2023
4bd6acd
[mobile] wrap MiniPlayer with TouchableOpacity
tsirysndr Apr 5, 2023
2c1aa48
[mobile] configure View Pager
tsirysndr Apr 5, 2023
43f848b
[mobile] configure GraphQL and recoil global state
tsirysndr Apr 5, 2023
4b321d3
[mobile] update control buttons size
tsirysndr Apr 5, 2023
8c8ecd5
[mobile] connect MiniPlayer to Recoil global state
tsirysndr Apr 6, 2023
8a900fd
[mobile] highlight current song
tsirysndr Apr 6, 2023
dbcb315
[mobile] highlight current song
tsirysndr Apr 6, 2023
9c24a90
[mobile] Setup app navigation
tsirysndr Apr 19, 2023
539a731
[mobile] Fix MiniPlayer background color
tsirysndr Apr 19, 2023
f68c128
[mobile] add artists, albums and tracks screen stories
tsirysndr Apr 7, 2023
1af38a4
[mobile] Configure react-native-config
tsirysndr Apr 21, 2023
ded7c64
fix(searcher): skip track if already indexed
tsirysndr Apr 21, 2023
abdd2f4
chore(settings): update the default settings directory in android
tsirysndr Apr 21, 2023
1d951a1
fix(searcher): skip artist if already indexed
tsirysndr Apr 22, 2023
da73d0e
[mobile] add Search, Devices and Account screens
tsirysndr Apr 22, 2023
f189760
[mobile] configure search filters
tsirysndr Apr 22, 2023
adb03bf
[mobile] fix crash on navigate to Player screen
tsirysndr Apr 22, 2023
82fcf16
[mobile] update play/pause button styles
tsirysndr Apr 22, 2023
c2df0e3
[mobile] render search results
tsirysndr Apr 23, 2023
3c1981f
[mobile] fetch albums, artists and tracks from API
tsirysndr Apr 23, 2023
a5b7d34
[mobile] browse all artists, albums and tracks
tsirysndr Apr 23, 2023
cec3a28
[mobile] implement play queue state logics
tsirysndr Apr 23, 2023
94bcba0
[mobile] fix cover not displayed
tsirysndr Apr 23, 2023
ce88962
[mobile] update SearchResults Component
tsirysndr Apr 24, 2023
2abba4a
don't wrap database connection inside Mutex
tsirysndr Apr 24, 2023
00cac2e
run `cargo fix`
tsirysndr Apr 24, 2023
8de9352
[mobile] fix track title number of lines
tsirysndr Apr 24, 2023
6ed36d9
[mobile] update Album Details Screen
tsirysndr Apr 24, 2023
856d15a
[mobile] center album infos
tsirysndr Apr 25, 2023
d33b0ce
chore: bump version code
tsirysndr Apr 25, 2023
0857039
[mobile] update ArtistDetails screen
tsirysndr Apr 25, 2023
571daf2
[mobile] replace BlurView
tsirysndr Apr 25, 2023
72fb59e
[mobile] memoize position
tsirysndr Apr 25, 2023
a3c8b88
chore: bump version code
tsirysndr Apr 25, 2023
ac925de
[mobile] fix uniq key issue
tsirysndr Apr 25, 2023
a8eb80e
[mobile] update ArtistDetails screen
tsirysndr Apr 25, 2023
2435019
[mobile] add Filter Screen
tsirysndr Apr 26, 2023
9a3b63e
Merge branch 'master' into mobile-app
tsirysndr Apr 26, 2023
955a1d1
fix(storage): solve issue with track's album returned from API
tsirysndr Apr 26, 2023
725f10c
[mobile] update Filter Screen
tsirysndr Apr 26, 2023
bc3a284
chore: update Cargo.toml
tsirysndr Apr 26, 2023
751c186
[mobile] keep the tabbar on front
tsirysndr Apr 26, 2023
3afecd9
[mobile] Add ContextMenu Modal
tsirysndr Apr 26, 2023
5a2db28
[mobile] update ContextMenu
tsirysndr Apr 27, 2023
e413e0c
[mobile] add ContextMenu to Player Screen
tsirysndr Apr 27, 2023
8e9505a
[mobile] update PlayerControls width
tsirysndr Apr 27, 2023
1bca8f7
[mobile] use default backdrop opacity
tsirysndr Apr 27, 2023
86e224a
[mobile] add ContextMenu to AlbumScreen
tsirysndr Apr 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 112 additions & 100 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ path = "src/main.rs"

[dependencies.music-player-server]
path = "server"
version = "0.2.0"
version = "0.2.1"

[dependencies.music-player-playback]
path = "playback"
Expand All @@ -63,19 +63,19 @@ version = "0.1.3"

[dependencies.music-player-storage]
path = "storage"
version = "0.1.6"
version = "0.1.10"

[dependencies.music-player-addons]
path = "addons"
version = "0.1.4"
version = "0.1.6"

[dependencies.music-player-tracklist]
path = "tracklist"
version = "0.1.7"

[dependencies.music-player-client]
path = "client"
version = "0.1.4"
version = "0.1.6"

[dependencies.music-player-webui]
path = "webui"
Expand All @@ -87,7 +87,7 @@ version = "0.1.2"

[dependencies.music-player-graphql]
path = "graphql"
version = "0.1.7"
version = "0.1.11"

[dependencies.music-player-types]
path = "types"
Expand Down
4 changes: 2 additions & 2 deletions addons/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "music-player-addons"
version = "0.1.5"
version = "0.1.6"
edition = "2021"
repository = "https://github.com/tsirysndr/music-player"
license = "MIT"
Expand All @@ -14,7 +14,7 @@ version = "0.1.5"

[dependencies.music-player-client]
path = "../client"
version = "0.1.4"
version = "0.1.6"

[dependencies.music-player-tracklist]
path = "../tracklist"
Expand Down
6 changes: 3 additions & 3 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "music-player-client"
version = "0.1.5"
version = "0.1.6"
edition = "2021"
repository = "https://github.com/tsirysndr/music-player"
license = "MIT"
Expand All @@ -16,7 +16,7 @@ envtestkit = "1.1.2"

[dependencies.music-player-server]
path = "../server"
version = "0.2.0"
version = "0.2.1"

[dependencies.music-player-settings]
path = "../settings"
Expand All @@ -32,7 +32,7 @@ version = "0.1.10"

[dev-dependencies.music-player-storage]
path = "../storage"
version = "0.1.4"
version = "0.1.10"

[dev-dependencies.music-player-tracklist]
path = "../tracklist"
Expand Down
4 changes: 2 additions & 2 deletions client/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub async fn setup_new_params(
Arc<Mutex<UnboundedSender<PlayerCommand>>>,
Arc<Mutex<UnboundedReceiver<PlayerCommand>>>,
Arc<Mutex<Tracklist>>,
Arc<tokio::sync::Mutex<Database>>,
Database,
SocketAddr,
String,
) {
Expand All @@ -50,7 +50,7 @@ pub async fn setup_new_params(
let addr: SocketAddr = format!("0.0.0.0:{}", port).parse().unwrap();
let url = format!("http://{}:{}", settings.host, port);

let db = Arc::new(tokio::sync::Mutex::new(Database::new().await));
let db = Database::new().await;

return (
backend,
Expand Down
12 changes: 6 additions & 6 deletions client/src/tests/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async fn play() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down Expand Up @@ -95,7 +95,7 @@ async fn pause() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down Expand Up @@ -150,7 +150,7 @@ async fn stop() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down Expand Up @@ -203,7 +203,7 @@ async fn next() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down Expand Up @@ -256,7 +256,7 @@ async fn prev() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down Expand Up @@ -310,7 +310,7 @@ async fn current() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down
4 changes: 2 additions & 2 deletions client/src/tests/tracklist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async fn add() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down Expand Up @@ -86,7 +86,7 @@ async fn list() -> Result<(), Box<dyn std::error::Error>> {
Playback::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx)),
)))
.add_service(tonic_web::enable(TracklistServiceServer::new(
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), Arc::clone(&db)),
Tracklist::new(Arc::clone(&tracklist), Arc::clone(&cmd_tx), db),
)))
.serve_with_shutdown(addr, rx.map(drop))
.await
Expand Down
6 changes: 3 additions & 3 deletions graphql/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "music-player-graphql"
version = "0.1.10"
version = "0.1.11"
edition = "2021"
repository = "https://github.com/tsirysndr/music-player"
license = "MIT"
Expand All @@ -25,7 +25,7 @@ version = "0.1.4"

[dependencies.music-player-storage]
path = "../storage"
version = "0.1.6"
version = "0.1.10"

[dependencies.music-player-entity]
path = "../entity"
Expand All @@ -45,7 +45,7 @@ version = "0.1.2"

[dependencies.music-player-addons]
path = "../addons"
version = "0.1.5"
version = "0.1.6"

[dev-dependencies.music-player-migration]
path = "../migration"
Expand Down
44 changes: 20 additions & 24 deletions graphql/src/schema/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use music_player_storage::{
searcher::Searcher,
Database,
};
use music_player_types::types::{self, RemoteCoverUrl, RemoteTrackUrl};
use music_player_types::types::{RemoteCoverUrl, RemoteTrackUrl};
use sea_orm::{ActiveModelTrait, ActiveValue};
use tokio::sync::Mutex;

Expand Down Expand Up @@ -56,9 +56,13 @@ impl LibraryQuery {
.collect());
}

let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
let results = TrackRepository::new(db.lock().await.get_connection())
.find_all(filter, 100)
let db = ctx.data::<Database>().unwrap();
let results = TrackRepository::new(db.get_connection())
.find_all(
filter,
Some(offset.unwrap_or(0) as u64),
limit.unwrap_or(100) as u64,
)
.await?;

Ok(results.into_iter().map(Into::into).collect())
Expand Down Expand Up @@ -99,10 +103,10 @@ impl LibraryQuery {
.collect());
}

let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
let db = ctx.data::<Database>().unwrap();

let results = ArtistRepository::new(db.lock().await.get_connection())
.find_all(filter)
let results = ArtistRepository::new(db.get_connection())
.find_all(filter, offset.map(|x| x as u64), limit.map(|x| x as u64))
.await?;

Ok(results.into_iter().map(Into::into).collect())
Expand Down Expand Up @@ -144,10 +148,10 @@ impl LibraryQuery {
.collect());
}

let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
let db = ctx.data::<Database>().unwrap();

let results = AlbumRepository::new(db.lock().await.get_connection())
.find_all(filter)
let results = AlbumRepository::new(db.get_connection())
.find_all(filter, offset.map(|x| x as u64), limit.map(|x| x as u64))
.await?;

Ok(results.into_iter().map(Into::into).collect())
Expand Down Expand Up @@ -175,11 +179,9 @@ impl LibraryQuery {
.with_remote_cover_url(base_url.as_str()));
}

let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
let db = ctx.data::<Database>().unwrap();

let track = TrackRepository::new(db.lock().await.get_connection())
.find(&id)
.await?;
let track = TrackRepository::new(db.get_connection()).find(&id).await?;

Ok(track.into())
}
Expand Down Expand Up @@ -207,11 +209,9 @@ impl LibraryQuery {
.into());
}

let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
let db = ctx.data::<Database>().unwrap();

let artist = ArtistRepository::new(db.lock().await.get_connection())
.find(&id)
.await?;
let artist = ArtistRepository::new(db.get_connection()).find(&id).await?;

Ok(artist.into())
}
Expand Down Expand Up @@ -239,19 +239,15 @@ impl LibraryQuery {
.with_remote_track_url(base_url.as_str()));
}

let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
let db = ctx.data::<Database>().unwrap();

let album = AlbumRepository::new(db.lock().await.get_connection())
.find(&id)
.await?;
let album = AlbumRepository::new(db.get_connection()).find(&id).await?;

Ok(album.into())
}

async fn search(&self, ctx: &Context<'_>, keyword: String) -> Result<SearchResult, Error> {
let db = ctx.data::<Arc<Mutex<Database>>>().unwrap();
let searcher = ctx.data::<Arc<Mutex<Searcher>>>().unwrap();
let mut db = db.lock().await;
let indexer = searcher.lock().await;
let artists = indexer.artist.search(&keyword)?;
let albums = indexer.album.search(&keyword)?;
Expand Down
Loading