Skip to content

Commit

Permalink
Merge branch 'v1.3.0' into translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Kara-Zor-El authored Dec 30, 2023
2 parents 034936f + d6666ba commit 651c488
Show file tree
Hide file tree
Showing 10 changed files with 266 additions and 170 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ OUTPUT_DIR := $(VERSION)

.DEFAULT_GOAL := all

OS := $(shell uname)

.PHONY: all
ifeq ($(OS),Darwin)
all: build_runner generate_icons ios_release ios_debug android_release android_debug app_bundle_release app_bundle_debug sha1_hashes
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.9.0'
ext.kotlin_version = '1.9.21'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
1 change: 1 addition & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extensions:
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ SPEC CHECKSUMS:
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
unrar_file: ead248ffb2e777cb67f083bc1bb1fb45d4157dbd
UnrarKit: 99e3f0222a98a212188e1a6975dcf5aa798d26dd
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b

PODFILE CHECKSUM: 4523b5d271d7828b6cdc73fe8b32bf7b646e71e2

COCOAPODS: 1.14.2
COCOAPODS: 1.14.3
1 change: 1 addition & 0 deletions lib/screens/EditScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ class _EditScreenState extends State<EditScreen> {
// entry.releaseDate = newDate.toString();
// only the month, day, and year
entry.releaseDate = DateFormat('dd MM yyyy').format(newDate);
changed = true;
});
},
),
Expand Down
146 changes: 61 additions & 85 deletions lib/screens/downloaderScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:jellybook/widgets/WaveProgressBar.dart';
import 'dart:async';
import 'package:permission_handler/permission_handler.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -227,7 +228,6 @@ class _DownloadScreenState extends State<DownloadScreen> {
appBar: AppBar(
title: Text(AppLocalizations.of(context)?.downloading ?? 'Downloading'),
automaticallyImplyLeading: !downloading,
// if the file is downloaded, have a button to force download
actions: [
if (!downloading)
IconButton(
Expand Down Expand Up @@ -266,99 +266,75 @@ class _DownloadScreenState extends State<DownloadScreen> {
)
],
),
body: Center(
child: downloading
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: MediaQuery.of(context).size.width * 0.7,
height: MediaQuery.of(context).size.width * 0.7,
child: CircularProgressIndicator(
value: progress / 100,
backgroundColor: Colors.grey,
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
),
),
SizedBox(
height: 20,
),
if (progress < 100 &&
downloadStatus == DownloadStatus.Downloading)
Text(
(AppLocalizations.of(context)?.downloadingFile ??
'Downloading File:') +
' ' +
progress.toStringAsFixed(2) +
'%',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
if (progress == 100)
Text(
AppLocalizations.of(context)?.extractingContent ??
'Extracting Content',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.4,
),
body: Stack(
children: [
Positioned.fill(
child: WaveProgressBar(
progress: progress / 100,
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.blue,
Colors.blueAccent,
Colors.teal,
],
)
: downloadStatus != DownloadStatus.DownloadFailed &&
downloadStatus != DownloadStatus.DecompressingFailed &&
!downloaded
),
),
),
Center(
child: downloading
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
AppLocalizations.of(context)?.fileDownloaded ??
'File Downloaded',
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
),
),
const SizedBox(
height: 20,
),
// Giant icon with check mark
const Icon(
Icons.check_circle,
size: 100,
color: Colors.green,
(AppLocalizations.of(context)?.downloadingFile ??
'Downloading File:') +
' ' +
progress.toStringAsFixed(2) +
'%',
style: TextStyle(
fontSize: 30, fontWeight: FontWeight.bold),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.4),
],
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
AppLocalizations.of(context)?.downloadFailed ??
"The download was unable to complete. Please try again later.",
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.red,
),
),
const SizedBox(
height: 20,
: (downloadStatus != DownloadStatus.DownloadFailed &&
downloadStatus != DownloadStatus.DecompressingFailed &&
!downloaded)
? Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
AppLocalizations.of(context)?.fileDownloaded ??
'File Downloaded',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 20),
),
SizedBox(height: 20),
Icon(Icons.check_circle,
size: 100, color: Colors.green),
],
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
AppLocalizations.of(context)?.downloadFailed ??
"The download was unable to complete. Please try again later.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.red),
),
SizedBox(height: 20),
Icon(Icons.error, size: 100, color: Colors.red),
],
),
// Giant icon with check mark
const Icon(
Icons.error,
size: 100,
color: Colors.red,
),
],
),
),
],
),
);
}
Expand Down
107 changes: 107 additions & 0 deletions lib/widgets/WaveProgressBar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import 'dart:math';
import 'package:flutter/material.dart';

/// A custom StatefulWidget that creates an animated wave progress bar.
///
/// The [WaveProgressBar] takes a progress value and an optional gradient to
/// display an animated wave indicating the current progress.
class WaveProgressBar extends StatefulWidget {
/// The current progress value. Expected to be between 0.0 and 1.0.
final double progress;

/// An optional gradient to color the wave. Defaults to null, which uses a solid blue color.
final Gradient? gradient;

/// Creates an instance of [WaveProgressBar].
///
/// Requires a [progress] value and optionally takes a [gradient].
const WaveProgressBar({Key? key, required this.progress, this.gradient})
: super(key: key);

@override
_WaveProgressBarState createState() => _WaveProgressBarState();
}

/// The state class for [WaveProgressBar] which manages the animation controller.
class _WaveProgressBarState extends State<WaveProgressBar>
with SingleTickerProviderStateMixin {
/// The animation controller for the wave animation.
AnimationController? _controller;

@override
void initState() {
super.initState();
_controller =
AnimationController(vsync: this, duration: const Duration(seconds: 2))
..addListener(() => setState(() {}))
..repeat();
}

@override
void dispose() {
_controller?.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {

return CustomPaint(
painter: WavePainter(
progress: widget.progress,
animationValue: _controller!.value,
gradient: widget.gradient),
child: Container(),
);
}
}

/// A custom painter class to draw the wave based on the progress and animation values.
class WavePainter extends CustomPainter {
/// The current progress value.
final double progress;

/// The current value of the animation, used to animate the wave.
final double animationValue;

/// An optional gradient used to color the wave.
final Gradient? gradient;

/// Creates an instance of [WavePainter] with the given [progress], [animationValue], and [gradient].
WavePainter(
{required this.progress, required this.animationValue, this.gradient});

@override
void paint(Canvas canvas, Size size) {
final paint = Paint();
if (gradient != null) {
Rect rect = Rect.fromLTWH(0, 0, size.width, size.height);
paint.shader = gradient!.createShader(rect);
} else {
paint.color = Colors.blue;
}

final path = Path();
for (double i = 0.0; i < size.width; i++) {
double waveHeight =
sin((i / size.width * 2 * pi) + (2 * pi * animationValue)) * 20;
double y = (1 - progress) * size.height + waveHeight;
if (i == 0) {
path.moveTo(i, y);
} else {
path.lineTo(i, y);
}
}

path.lineTo(size.width, size.height);
path.lineTo(0, size.height);
path.close();

canvas.drawPath(path, paint);
}

@override
bool shouldRepaint(covariant CustomPainter oldDelegate) {
return oldDelegate != this;
}
}
Loading

0 comments on commit 651c488

Please sign in to comment.