Skip to content

Commit

Permalink
README and syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutetium-Vanadium committed Jul 15, 2020
1 parent 0812f1a commit 79b1729
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 13 deletions.
28 changes: 19 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,11 @@ If you have any issues or suggestions, feel free to [open a pull request](https:

If you wish to customize or learn more about the project, go [here](docs/codestructure.md).

## Downloading
## Download and Installation

### Build Dependecies

First [install flutter](https://flutter.dev/docs/get-started/install). After that run:
For android, you can directly download a built version of the latest release [here](https://github.com/Lutetium-Vanadium/Music-Flutter/releases). First generate the API Keys and then download the APK from the latest release.

```sh
flutter pub get
```

This will install dependecies.
If you are on iOS or want to download and build the project yourself, follow the steps given below.

### Api keys

Expand All @@ -68,6 +62,16 @@ Steps to create the API Keys can be viewed [here](docs/apikeys.md).
Once you have those created, you can move onto running the app.
You will need to enter the api keys directly in the app.

### Build Dependecies

First [install flutter](https://flutter.dev/docs/get-started/install). After that run:

```sh
flutter pub get
```

This will install dependecies.

### Testing

To run the tests, written for the app, run:
Expand Down Expand Up @@ -146,6 +150,12 @@ Once finished building, the APK will be available at `build/app/outputs/apk/rele
flutter install
```

You may be shown this popup when installing the app:

<img src="docs/images/play_protect.png" height="200">

You can safely click 'Install Anyway'.

#### For iOS

See flutter's [ios](https://flutter.dev/docs/deployment/ios) release documentaion.
Expand Down
Binary file added docs/images/play_protect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lib/routes/SyncStatus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class _SyncStatusPageState extends State<SyncStatusPage> {
),
],
);
} else if (event is SyncSongsFailed) {
widget = Text(
"Retrying ${event.failed} song${event.failed == 1 ? "" : "s"}.");
} else if (event is SyncAlbumsInitial) {
widget = Text("Checking Albums...");
} else if (event is SyncAlbumsName) {
Expand Down
12 changes: 9 additions & 3 deletions lib/sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ class FirestoreSync {

List<List<int>> _diff<T extends DbCollection>(
List<T> local, List<Map<String, dynamic>> online) {
local.sort((a, b) => (a.getId < b.getId ? -1 : 1));
online.sort((a, b) => (_getId(a) < _getId(b) ? -1 : 1));

List<int> toAdd = [];
List<int> toDelete = [];
List<int> toUpdate = [];
Expand Down Expand Up @@ -250,6 +247,9 @@ class FirestoreSync {
var dbSongs = await db.getSongs();
var firestoreSongs = snapshot.documents.map((d) => d.data).toList();

dbSongs.sort((a, b) => (a.getId < b.getId ? -1 : 1));
firestoreSongs.sort((a, b) => (_getId(a) < _getId(b) ? -1 : 1));

var diff = _diff(dbSongs, firestoreSongs);

List<int> failed = [];
Expand Down Expand Up @@ -327,6 +327,9 @@ class FirestoreSync {
var dbAlbums = await db.getAlbums();
var firestoreAlbums = snapshot.documents.map((d) => d.data).toList();

dbAlbums.sort((a, b) => (a.getId < b.getId ? -1 : 1));
firestoreAlbums.sort((a, b) => (_getId(a) < _getId(b) ? -1 : 1));

var diff = _diff(dbAlbums, firestoreAlbums);

await Future.wait(diff[0].map((idx) {
Expand Down Expand Up @@ -378,6 +381,9 @@ class FirestoreSync {
var dbAlbums = await db.getCustomAlbums();
var firestoreAlbums = snapshot.documents.map((d) => d.data).toList();

dbAlbums.sort((a, b) => (a.getId < b.getId ? -1 : 1));
firestoreAlbums.sort((a, b) => (_getId(a) < _getId(b) ? -1 : 1));

var diff = _diff(dbAlbums, firestoreAlbums);

await Future.wait(diff[0].map((idx) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.

publish_to: "none"

version: 0.0.1+2
version: 0.0.1+3

environment:
sdk: ">=2.7.0 <3.0.0"
Expand Down

0 comments on commit 79b1729

Please sign in to comment.