Skip to content

Commit

Permalink
chore: use script_runner
Browse files Browse the repository at this point in the history
  • Loading branch information
blockbasti committed Jul 6, 2024
1 parent eb9b6be commit f996768
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
run: |
flutter config --no-analytics
flutter pub get
sh ./scripts/generate_code.sh
dart pub global activate script_runner
scr build
- name: Build APKs
run: flutter build apk --build-number $(printf '%(%Y%m%d)T\n' -1) --debug
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
run: |
flutter config --no-analytics
flutter pub get
sh ./scripts/generate_code.sh
dart pub global activate script_runner
scr build
- name: Build APKs
if: ${{ steps.release.outputs.release_created }}
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,9 @@ Contributions are what make the open source community such an amazing place to l
### Building the app

1. Run `flutter pub get`
2. Run `./scripts/generate_code.sh` or
`flutter pub run flutter_oss_licenses:generate.dart` and
`flutter pub run intl_utils:generate` to generate licenses and translations
3. Run `flutter build apk` or run using your IDE
2. Install [script_runner](https://pub.dev/packages/script_runner) by running `flutter pub global activate script_runner`
3. Run `scr build`
4. Run `flutter build apk` or run using your IDE

<!-- LICENSE -->
## License
Expand Down
Binary file modified android/app/src/main/res/drawable-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions android/app/src/main/res/values-night-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#2E3440</item>
<item name="android:windowSplashScreenIconBackgroundColor">#2E3440</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
21 changes: 21 additions & 0 deletions android/app/src/main/res/values-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<item name="android:windowSplashScreenBackground">#D8DEE9</item>
<item name="android:windowSplashScreenIconBackgroundColor">#D8DEE9</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
15 changes: 10 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_phoenix/flutter_phoenix.dart';
import 'package:pref/pref.dart';
import 'package:prefs/prefs.dart';

import 'generated/l10n.dart';
import 'layouts/home_page.dart';
import 'utils/migrations.dart';
import 'utils/tts_helper.dart';
import 'utils/sound_helper.dart';
import 'utils/tts_helper.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
GestureBinding.instance.resamplingEnabled = true;
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
await Prefs.init();

PrefServiceShared.init(
Expand All @@ -36,9 +38,12 @@ void main() async {
SoundHelper.loadSounds(),
Migrations.runMigrations(),
]).then(
(_) => runApp(
PrefService(service: service, child: Phoenix(child: JAWTApp())),
),
(_) {
runApp(
PrefService(service: service, child: Phoenix(child: JAWTApp())),
);
FlutterNativeSplash.remove();
},
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ packages:
source: sdk
version: "0.0.0"
flutter_native_splash:
dependency: "direct dev"
dependency: "direct main"
description:
name: flutter_native_splash
sha256: edf39bcf4d74aca1eb2c1e43c3e445fd9f494013df7f0da752fefe72020eedc0
Expand Down
14 changes: 11 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
flutter_file_dialog: '^3.0.2'
flutter_localizations:
sdk: flutter
flutter_native_splash: '^2.4.0'
flutter_phoenix: '^1.1.1'
flutter_tts: '^4.0.2'
fluttertoast: '^8.2.5'
Expand All @@ -34,7 +35,6 @@ dev_dependencies:
build_runner: '^2.4.11'
flutter_launcher_icons: '^0.13.1'
flutter_lints: '^4.0.0'
flutter_native_splash: '^2.4.0'
flutter_oss_licenses: '^3.0.2'
intl_utils: '^2.8.7'
json_serializable: '^6.8.0'
Expand Down Expand Up @@ -68,9 +68,17 @@ flutter_native_splash:
android: true
ios: false
web: false
android12:
image: 'assets/ic_launcher_foreground.png'
android_12:
color: '#D8DEE9'
icon_background_color: '#D8DEE9'
color_dark: '#2E3440'
icon_background_color_dark: '#2E3440'

script_runner:
scripts:
- licenses: dart pub run flutter_oss_licenses:generate.dart
- translations: dart run intl_utils:generate
- launcher_icons: flutter pub run flutter_launcher_icons
- native_splash: flutter pub run flutter_native_splash:create
- build_runner: dart run build_runner build --delete-conflicting-outputs
- build: scr licenses && scr translations && scr launcher_icons && scr native_splash && scr build_runner
8 changes: 0 additions & 8 deletions scripts/generate_code.sh

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/pre_changelog.js

This file was deleted.

0 comments on commit f996768

Please sign in to comment.