Skip to content

Commit

Permalink
Merge branch 'main' into redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Dec 21, 2023
2 parents 20e03ca + e72d58d commit 4463bff
Show file tree
Hide file tree
Showing 114 changed files with 5,049 additions and 978 deletions.
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Contributing to Finamp

Thanks for your interest in contributing to Finamp! This document goes over how to get started on Finamp development, and other ways to contribute.

## Setting up a Development Environment

Finamp is a fairly standard Flutter app, so all you have to do is [install Flutter](https://docs.flutter.dev/get-started/install). Once Flutter is installed, you should be able to run Finamp on emulators/real devices.

### Android Keys

To build release APKs, you need to set up a signing key for Android. To get that set up, follow [this guide](https://docs.flutter.dev/deployment/android#signing-the-app) from the Flutter documentation. Note that if you have Finamp installed already, your phone may panic because the key is different.

### The Arcane Arts (Code Generation)

![A conversation between me and Chaphasilor. I say "did you try running (the Dart build command)?" They reply "I wasn't aware I need to use the arcane arts for this"](assets/arcane-arts.png)

Because Dart doesn't support macros and stuff, a few dependencies rely on code generation which must be run manually. These dependencies are:

* Hive - the database that Finamp uses for storing all data
* `json_serializable` - For deserialising JSON into classes
* Chopper - For talking to Jellyfin over HTTP
* This layer (`lib/services/jellyfin_api.dart`) is not used by the app directly. The user-facing API is located at `lib/services/jellyfin_api_helper.dart`.

To rebuild these files, run `dart run build_runner build --delete-conflicting-outputs`. This must be done when:

* Modifying a class that is returned by Jellyfin (such as the classes in `lib/models/jellyfin_models.dart`)
* Adding fields to a database class (annotated with `@HiveType`)

If you don't rebuild generated files, you will encounter:

* Settings not persisting
* Hive errors on startup
* Missing data when converting JSON to classes

### Hive

As said earlier, Finamp uses Hive for all data storage needs. If you're doing work that involves data storage, I recommend you read [the Hive docs](https://docs.hivedb.dev/#/). Please ensure that your changes work when upgrading Finamp from the current release to your changes, as not handling upgrades will cause the app to crash. When downgrading, you will have to wipe your app data if any changes were made to Hive.

When creating new types, note that you'll also have to register an adapter in `main.dart`. After code generation, there should be a class called `[YourType]Adapter`, which you can initialise in `setupHive`.

## The Redesign

The biggest main piece of work being done on Finamp at the moment is the redesign. The relevant issue can be found [here](https://github.com/jmshrv/finamp/issues/220). The `redesign` branch has diverged a lot from `main`, but I try to keep it updated. If you're struggling to decide what to work on, the redesign is a good place to look :)

## Translating

Finamp uses Weblate to manage translations: **https://hosted.weblate.org/engage/finamp/**

Feel free to add new languages if yours isn't there yet. If you have any questions, such as the context of a string, you can ask in the [Translation Discussions](https://github.com/jmshrv/finamp/discussions/categories/translations).
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

Finamp is a Jellyfin music player for Android and iOS. Its main feature is the ability to download songs for offline listening.

**Breaking changes are coming** - see the [plan](DOWNLOADS_PLAN.md)

## Downloading

[<img src="app-store-badges/fdroid.png"
Expand All @@ -22,15 +20,9 @@ Note: The F-Droid release may take a day or two to get updates because since [F-

The app is also available as an APK from the [releases page](https://github.com/jmshrv/finamp/releases).

## Translations

<a href="https://hosted.weblate.org/engage/finamp/">
<img src="https://hosted.weblate.org/widgets/finamp/-/finamp/multi-auto.svg" alt="Translation status" />
</a>

Finamp uses Weblate to manage translations: **https://hosted.weblate.org/engage/finamp/**
## Contributing

Feel free to add new languages if yours isn't there yet. If you have any questions, such as the context of a string, you can ask in the [Translation Discussions](https://github.com/jmshrv/finamp/discussions/categories/translations).
Finamp is a community-driven project and relies on people like **you** and their contributions. To learn how you could help out with making Finamp even better, take a look at our [Contribution Guidelines](CONTRIBUTING.md)

## Known Issues

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
Binary file added assets/arcane-arts.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/36.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New features and bug fixes. Full changelog at https://github.com/jmshrv/finamp/releases/tag/0.6.15
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/37.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug created in 0.6.15. Full changelog at https://github.com/jmshrv/finamp/releases/tag/0.6.16
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/38.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix F-Droid build. Changes from 0.6.16 (which was missed) can be seen at https://github.com/jmshrv/finamp/releases/tag/0.6.16
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/39.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Quality of life and bug fixes. Full changelog at https://github.com/jmshrv/finamp/releases/tag/0.6.18
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ SPEC CHECKSUMS:
flutter_vibrate: 9f4c2ab57008965f78969472367c329dd77eb801
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780

Expand Down
25 changes: 25 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@
1AB3434728AEB3BA00B8C792 /* Info-Debug.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Debug.plist"; sourceTree = "<group>"; };
1AB3434828AEB3BA00B8C792 /* Info-Profile.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Profile.plist"; sourceTree = "<group>"; };
1AB3434928AEB3BA00B8C792 /* Info-Release.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Info-Release.plist"; sourceTree = "<group>"; };
1AC8B9DA2A73FD5E00200E3C /* zh-Hant-HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-HK"; path = "zh-Hant-HK.lproj/Main.strings"; sourceTree = "<group>"; };
1AC8B9DB2A73FD5E00200E3C /* zh-Hant-HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-HK"; path = "zh-Hant-HK.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
1AC8B9DC2A73FD7C00200E3C /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Main.strings; sourceTree = "<group>"; };
1AC8B9DD2A73FD7C00200E3C /* hr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
1AC8B9DE2A73FD9000200E3C /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Main.strings; sourceTree = "<group>"; };
1AC8B9DF2A73FD9000200E3C /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
1AC8B9E02A73FDB500200E3C /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/Main.strings; sourceTree = "<group>"; };
1AC8B9E12A73FDB500200E3C /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
1AC8B9E22A73FDC000200E3C /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Main.strings; sourceTree = "<group>"; };
1AC8B9E32A73FDC000200E3C /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
1AD2DF3A2921A4A6006B24E3 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Main.strings; sourceTree = "<group>"; };
1AD2DF3B2921A4A6006B24E3 /* cs */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
1AD2DF3C2921A4AF006B24E3 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Main.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -254,6 +264,11 @@
tr,
vi,
ja,
"zh-Hant-HK",
hr,
el,
th,
uk,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
Expand Down Expand Up @@ -396,6 +411,11 @@
1A3D4FC129E71B4700C17E1B /* tr */,
1A3D4FC329E71B4B00C17E1B /* vi */,
1A5F1B1929F734E500E6F504 /* ja */,
1AC8B9DA2A73FD5E00200E3C /* zh-Hant-HK */,
1AC8B9DC2A73FD7C00200E3C /* hr */,
1AC8B9DE2A73FD9000200E3C /* el */,
1AC8B9E02A73FDB500200E3C /* th */,
1AC8B9E22A73FDC000200E3C /* uk */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand Down Expand Up @@ -428,6 +448,11 @@
1A3D4FC229E71B4700C17E1B /* tr */,
1A3D4FC429E71B4B00C17E1B /* vi */,
1A5F1B1A29F734E500E6F504 /* ja */,
1AC8B9DB2A73FD5E00200E3C /* zh-Hant-HK */,
1AC8B9DD2A73FD7C00200E3C /* hr */,
1AC8B9DF2A73FD9000200E3C /* el */,
1AC8B9E12A73FDB500200E3C /* th */,
1AC8B9E32A73FDC000200E3C /* uk */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
Expand Down
4 changes: 4 additions & 0 deletions ios/Runner/Info-Debug.plist
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,9 @@
<false/>
<key>NSLocalNetworkUsageDescription</key>
<string>Required for debugging</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>FLTEnableImpeller</key>
<false/>
</dict>
</plist>
4 changes: 4 additions & 0 deletions ios/Runner/Info-Profile.plist
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,9 @@
<false/>
<key>NSLocalNetworkUsageDescription</key>
<string>Required for debugging</string>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>FLTEnableImpeller</key>
<false/>
</dict>
</plist>
4 changes: 4 additions & 0 deletions ios/Runner/Info-Release.plist
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>FLTEnableImpeller</key>
<false/>
</dict>
</plist>
1 change: 1 addition & 0 deletions ios/Runner/el.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/el.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/hr.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/hr.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/th.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/th.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/uk.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/uk.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/zh-Hant-HK.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/zh-Hant-HK.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

84 changes: 84 additions & 0 deletions lib/color_schemes.g.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import 'package:flutter/material.dart';

const jellyfinBlueColor = Color(0xFF00A4DC);
const jellyfinPurpleColor = Color(0xFFAA5CC3);

const lightColorScheme = ColorScheme(
brightness: Brightness.light,
// Primary
primary: Color(0xFF00668A),
onPrimary: Color(0xFFFFFFFF),
primaryContainer: Color(0xFFC4E8FF),
onPrimaryContainer: Color(0xFF001E2C),
// Secondary
secondary: Color(0xFF406374),
onSecondary: Color(0xFFFFFFFF),
secondaryContainer: Color(0xFFCCE8F8),
onSecondaryContainer: Color(0xFF1B333F),
// Tertiary
tertiary: Color(0xFF893DA2),
onTertiary: Color(0xFFFFFFFF),
tertiaryContainer: Color(0xFFFAD7FF),
onTertiaryContainer: Color(0xFF330044),
// Error
error: Color(0xFFBA1A1A),
errorContainer: Color(0xFFFFDAD6),
onError: Color(0xFFFFFFFF),
onErrorContainer: Color(0xFF410002),
// Background & Surface
background: Color(0xFFFCFDFE),
onBackground: Color(0xFF191C1E),
surface: Color(0xFFFCFDFE),
onSurface: Color(0xFF191C1E),
surfaceVariant: Color(0xFFDDE4E8),
onSurfaceVariant: Color(0xFF41484D),
// Other colors
outline: Color(0xFF727A7F),
onInverseSurface: Color(0xFFF0F1F3),
inverseSurface: Color(0xFF2E3133),
inversePrimary: Color(0xFF7BD0FF),
shadow: Color(0xFF000000),
surfaceTint: Color(0xFF00668A),
outlineVariant: Color(0xFFC0C7CD),
scrim: Color(0xFF000000),
);

const darkColorScheme = ColorScheme(
brightness: Brightness.dark,
// Primary
primary: jellyfinBlueColor,
onPrimary: Color(0xFF001E2C),
primaryContainer: Color(0xFF004C68),
onPrimaryContainer: Color(0xFFC3E7FF),
// Secondary
secondary: Color(0xFF60B4DD),
onSecondary: Color(0xFF112732),
secondaryContainer: Color(0xFF206B8C),
onSecondaryContainer: Color(0xFFCEEEFF),
// Tertiary
tertiary: Color(0xFFC979E2),
onTertiary: Color(0xFF3D0050),
tertiaryContainer: Color(0xFF762A90),
onTertiaryContainer: Color(0xFFFAD7FF),
// Error
error: Color(0xFFFFB4AB),
errorContainer: Color(0xFF93000A),
onError: Color(0xFF690005),
onErrorContainer: Color(0xFFFFDAD6),
// Background & Surface
background: Color(0xFF101315),
onBackground: Color(0xFFE1E2E5),
surface: Color(0xFF101315),
onSurface: Color(0xFFE1E2E5),
surfaceVariant: Color(0xFF333A3E),
onSurfaceVariant: Color(0xFFC0C7CD),
// Other colors
outline: Color(0xFF80878C),
onInverseSurface: Color(0xFF191C1E),
inverseSurface: Color(0xFFE1E2E5),
inversePrimary: Color(0xFF00668A),
shadow: Color(0xFF000000),
surfaceTint: Color(0xFF7BD0FF),
outlineVariant: Color(0xFF41484D),
scrim: Color(0xFF000000),
);
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';

import '../../models/finamp_models.dart';
import '../../generate_material_color.dart';

class CustomDownloadLocationForm extends StatefulWidget {
const CustomDownloadLocationForm({Key? key, required this.formKey})
Expand Down Expand Up @@ -38,9 +37,7 @@ class _CustomDownloadLocationFormState
ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(4)),
child: Material(
color: generateMaterialColor(
Theme.of(context).dialogBackgroundColor)
.shade600,
color: Theme.of(context).colorScheme.secondaryContainer,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Row(
Expand Down Expand Up @@ -152,4 +149,4 @@ class _CustomDownloadLocationFormState
),
);
}
}
}
8 changes: 5 additions & 3 deletions lib/components/AlbumScreen/album_screen_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class _AlbumScreenContentState extends State<AlbumScreenContent> {
horizontal: 16.0,
vertical: 16.0,
),
color: Theme.of(context).primaryColor,
color: Theme.of(context).colorScheme.surfaceVariant,
child: Text(
AppLocalizations.of(context)!
.discNumber(childrenOfThisDisc[0].parentIndexNumber!),
Expand Down Expand Up @@ -128,13 +128,15 @@ class SongsSliverList extends StatefulWidget {
required this.parent,
this.onRemoveFromList,
this.showPlayCount = false,
this.isOnArtistScreen = false,
}) : super(key: key);

final List<BaseItemDto> childrenForList;
final Future<List<BaseItemDto>> childrenForQueue;
final BaseItemDto parent;
final BaseItemDtoCallback? onRemoveFromList;
final bool showPlayCount;
final bool isOnArtistScreen;

@override
State<SongsSliverList> createState() => _SongsSliverListState();
Expand Down Expand Up @@ -178,15 +180,15 @@ class _SongsSliverListState extends State<SongsSliverList> {
item: item,
childrenFuture: widget.childrenForQueue,
indexFuture: indexOffset.then((offset) => offset + index),
parentId: widget.parent.id,
parentName: widget.parent.name,
parentItem: widget.parent,
onRemoveFromList: () {
final item = removeItem();
if (widget.onRemoveFromList != null) {
widget.onRemoveFromList!(item);
}
},
isInPlaylist: widget.parent.type == "Playlist",
isOnArtistScreen: widget.isOnArtistScreen,
// show artists except for this one scenario
showArtists: !(
// we're on album screen
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:io';
import 'dart:math';

import 'package:finamp/models/finamp_models.dart';
Expand Down

0 comments on commit 4463bff

Please sign in to comment.