Skip to content

Commit

Permalink
Merge pull request #298 from vicolo-dev/develop
Browse files Browse the repository at this point in the history
Merge pull request #269 from vicolo-dev/release/0.5.0
  • Loading branch information
AhsanSarwar45 authored Jun 24, 2024
2 parents 407bea2 + 1575300 commit 6e835b9
Show file tree
Hide file tree
Showing 32 changed files with 524 additions and 145 deletions.
10 changes: 2 additions & 8 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,15 @@
android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission
android:name="android.permission.WAKE_LOCK" />
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> -->
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> -->
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission
android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission
android:name="android.permission.VIBRATE" />
<uses-permission
android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- For before Android 12 -->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"
android:maxSdkVersion="32" />
<!-- For Android 12 and higher -->
<uses-permission
android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />

<application
android:label="@string/app_name"
Expand Down
Binary file added assets/contributors/avatars/100072714?v=4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 15 additions & 10 deletions assets/contributors/git.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,26 @@
"avatar_url": "assets/contributors/avatars/108967802?v=4.jpg",
"profile_url": "https://github.com/bdOtopsy63"
},
{
"username": "weblate",
"avatar_url": "assets/contributors/avatars/1607653?v=4.jpg",
"profile_url": "https://github.com/weblate"
},
{
"username": "CloneWith",
"avatar_url": "assets/contributors/avatars/110881926?v=4.jpg",
"profile_url": "https://github.com/CloneWith"
},
{
"username": "weblate",
"avatar_url": "assets/contributors/avatars/1607653?v=4.jpg",
"profile_url": "https://github.com/weblate"
},
{
"username": "ngocanhtve",
"avatar_url": "assets/contributors/avatars/125894401?v=4.jpg",
"profile_url": "https://github.com/ngocanhtve"
},
{
"username": "Schipunov",
"avatar_url": "assets/contributors/avatars/23407397?v=4.jpg",
"profile_url": "https://github.com/Schipunov"
},
{
"username": "zxrpn",
"avatar_url": "assets/contributors/avatars/91787031?v=4.jpg",
Expand Down Expand Up @@ -89,11 +94,6 @@
"avatar_url": "assets/contributors/avatars/45366162?v=4.jpg",
"profile_url": "https://github.com/NathanBnm"
},
{
"username": "Schipunov",
"avatar_url": "assets/contributors/avatars/23407397?v=4.jpg",
"profile_url": "https://github.com/Schipunov"
},
{
"username": "matsukky",
"avatar_url": "assets/contributors/avatars/46320254?v=4.jpg",
Expand All @@ -119,6 +119,11 @@
"avatar_url": "assets/contributors/avatars/38784748?v=4.jpg",
"profile_url": "https://github.com/jona512"
},
{
"username": "HeXedek",
"avatar_url": "assets/contributors/avatars/100072714?v=4.jpg",
"profile_url": "https://github.com/HeXedek"
},
{
"username": "thejenja",
"avatar_url": "assets/contributors/avatars/65224669?v=4.jpg",
Expand Down
1 change: 0 additions & 1 deletion fastlane/metadata/android/en-US/changelogs/211.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ This is a beta release. Please report any issues via GitHub or email.
* Fixed other apps' music not restarting after alarm rings
* Fixed upcoming alarm notification appearing after alarm rings
* Fixed upcoming alarm notification not updating for repeating alarms
* Fixed upcoming alarm notification not updating for repeating alarms
* Fixed splash color


Expand Down
1 change: 0 additions & 1 deletion fastlane/metadata/android/en-US/changelogs/212.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ This is a beta release. Please report any issues via GitHub or email.
* Fixed other apps' music not restarting after alarm rings
* Fixed upcoming alarm notification appearing after alarm rings
* Fixed upcoming alarm notification not updating for repeating alarms
* Fixed upcoming alarm notification not updating for repeating alarms
* Fixed splash color


1 change: 0 additions & 1 deletion fastlane/metadata/android/en-US/changelogs/213.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ This is a beta release. Please report any issues via GitHub or email.
* Fixed other apps' music not restarting after alarm rings
* Fixed upcoming alarm notification appearing after alarm rings
* Fixed upcoming alarm notification not updating for repeating alarms
* Fixed upcoming alarm notification not updating for repeating alarms
* Fixed splash color


Expand Down
37 changes: 37 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/231.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Changes since v0.4.3:

🚀 Features

* Widget support!
* Added analog and digital clock widgets
* Added option to customize size, alignment, color, font weight, formats
* Added localizations
* Chinese, French, Spanish, Turkish and Portuguese mostly complete
* Partial support for Bengali, German, Italian, Norwegian, Polish, Russian,and Vietnamese
* Add your favorite language here: https://hosted.weblate.org/projects/chrono

✨ Enhancements

* Added option to specify default page
* Added 'plus' button when selecting melodies and tags
* Added sections in settings to get notification and ignore baterry optimization settings
* Reversed card actions order so delete is at bottom
* Add option to change long date format (displayed on clock screen and clock widget)
* Added option to change first day of week
* Improved spinner time picker interface
* Improved dial time picker 24h interface
* Added discription for audio channel options
* Added option to change separator for digital clock widget
* Reversed card actions order so delete is at bottom
* Add option to change long date format (displayed on clock screen and clock widget)
* Added patreons list in about screen
* Added contributors list in about screen

🐛 Fixes

* Fixed app assuming foreground after alarm rings, even though it was closed before
* Fixed tap splash color
* Fixed media, notification and ringtone audio channels not working
* Fixed other apps' music not restarting after alarm rings
* Fixed upcoming alarm notification appearing after alarm rings
* Fixed upcoming alarm notification not updating for repeating alarms
37 changes: 37 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/232.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Changes since v0.4.3:

🚀 Features

* Widget support!
* Added analog and digital clock widgets
* Added option to customize size, alignment, color, font weight, formats
* Added localizations
* Chinese, French, Spanish, Turkish and Portuguese mostly complete
* Partial support for Bengali, German, Italian, Norwegian, Polish, Russian,and Vietnamese
* Add your favorite language here: https://hosted.weblate.org/projects/chrono

✨ Enhancements

* Added option to specify default page
* Added 'plus' button when selecting melodies and tags
* Added sections in settings to get notification and ignore baterry optimization settings
* Reversed card actions order so delete is at bottom
* Add option to change long date format (displayed on clock screen and clock widget)
* Added option to change first day of week
* Improved spinner time picker interface
* Improved dial time picker 24h interface
* Added discription for audio channel options
* Added option to change separator for digital clock widget
* Reversed card actions order so delete is at bottom
* Add option to change long date format (displayed on clock screen and clock widget)
* Added patreons list in about screen
* Added contributors list in about screen

🐛 Fixes

* Fixed app assuming foreground after alarm rings, even though it was closed before
* Fixed tap splash color
* Fixed media, notification and ringtone audio channels not working
* Fixed other apps' music not restarting after alarm rings
* Fixed upcoming alarm notification appearing after alarm rings
* Fixed upcoming alarm notification not updating for repeating alarms
37 changes: 37 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/233.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Changes since v0.4.3:

🚀 Features

* Widget support!
* Added analog and digital clock widgets
* Added option to customize size, alignment, color, font weight, formats
* Added localizations
* Chinese, French, Spanish, Turkish and Portuguese mostly complete
* Partial support for Bengali, German, Italian, Norwegian, Polish, Russian,and Vietnamese
* Add your favorite language here: https://hosted.weblate.org/projects/chrono

✨ Enhancements

* Added option to specify default page
* Added 'plus' button when selecting melodies and tags
* Added sections in settings to get notification and ignore baterry optimization settings
* Reversed card actions order so delete is at bottom
* Add option to change long date format (displayed on clock screen and clock widget)
* Added option to change first day of week
* Improved spinner time picker interface
* Improved dial time picker 24h interface
* Added discription for audio channel options
* Added option to change separator for digital clock widget
* Reversed card actions order so delete is at bottom
* Add option to change long date format (displayed on clock screen and clock widget)
* Added patreons list in about screen
* Added contributors list in about screen

🐛 Fixes

* Fixed app assuming foreground after alarm rings, even though it was closed before
* Fixed tap splash color
* Fixed media, notification and ringtone audio channels not working
* Fixed other apps' music not restarting after alarm rings
* Fixed upcoming alarm notification appearing after alarm rings
* Fixed upcoming alarm notification not updating for repeating alarms
9 changes: 9 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/241.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
✨ Enhancements

* Updated translations

🐛 Fixes

* Removed extra space at the end of long date formats
* Fix timer fullscreen notification not dismissing
* Fix fastest and slowest laps of stopwatch not saving
9 changes: 9 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/242.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
✨ Enhancements

* Updated translations

🐛 Fixes

* Removed extra space at the end of long date formats
* Fix timer fullscreen notification not dismissing
* Fix fastest and slowest laps of stopwatch not saving
9 changes: 9 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/243.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
✨ Enhancements

* Updated translations

🐛 Fixes

* Removed extra space at the end of long date formats
* Fix timer fullscreen notification not dismissing
* Fix fastest and slowest laps of stopwatch not saving
4 changes: 2 additions & 2 deletions lib/alarm/data/alarm_sort_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final List<ListSortOption<Alarm>> alarmSortOptions = [
ListSortOption((context) => AppLocalizations.of(context)!.timeOfDayDesc, sortTimeOfDayDescending),
];

int sortRemainingTimeDescending(Alarm a, Alarm b) {
int sortRemainingTimeAscending(Alarm a, Alarm b) {
if (a.currentScheduleDateTime == null && b.currentScheduleDateTime == null) {
return 0;
} else if (a.currentScheduleDateTime == null) {
Expand All @@ -29,7 +29,7 @@ int sortRemainingTimeDescending(Alarm a, Alarm b) {
return remainingB.compareTo(remainingA);
}

int sortRemainingTimeAscending(Alarm a, Alarm b) {
int sortRemainingTimeDescending(Alarm a, Alarm b) {
if (a.currentScheduleDateTime == null && b.currentScheduleDateTime == null) {
return 0;
} else if (a.currentScheduleDateTime == null) {
Expand Down
72 changes: 59 additions & 13 deletions lib/alarm/logic/new_alarm_snackbar.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,76 @@
import 'package:clock_app/alarm/types/alarm.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

String getNewAlarmSnackbarText(Alarm alarm) {
String getRemainingAlarmTimeText(BuildContext context, Alarm alarm) {
Duration etaNextAlarm =
alarm.currentScheduleDateTime!.difference(DateTime.now().toLocal());

String etaText = '';

AppLocalizations localizations = AppLocalizations.of(context)!;

if (etaNextAlarm.inDays > 0) {
etaText = localizations.daysString(etaNextAlarm.inDays);
} else if (etaNextAlarm.inHours > 0) {
int hours = etaNextAlarm.inHours;
int minutes = etaNextAlarm.inMinutes % 60;
if (minutes > 0) {
etaText = localizations.combinedTime(localizations.hoursString(hours),
localizations.minutesString(minutes));
} else {
etaText = localizations.hoursString(hours);
}
} else if (etaNextAlarm.inMinutes > 0) {
int minutes = etaNextAlarm.inMinutes;
etaText = localizations.minutesString(minutes);
} else {
etaText = localizations.lessThanOneMinute;
}

return etaText;
}

String getShortRemainingAlarmTimeText(BuildContext context, Alarm alarm) {
Duration etaNextAlarm =
alarm.currentScheduleDateTime!.difference(DateTime.now().toLocal());

String etaText = '';

AppLocalizations localizations = AppLocalizations.of(context)!;

if (etaNextAlarm.inDays > 0) {
int days = etaNextAlarm.inDays;
String dayTextSuffix = days <= 1 ? 'day' : 'days';
etaText = '$days $dayTextSuffix';
etaText = localizations.daysString(etaNextAlarm.inDays);
} else if (etaNextAlarm.inHours > 0) {
int hours = etaNextAlarm.inHours;
int minutes = etaNextAlarm.inMinutes % 60;
String hourTextSuffix = hours <= 1 ? 'hour' : 'hours';
String minuteTextSuffix = minutes <= 1 ? 'minute' : 'minutes';
String hoursText = '$hours $hourTextSuffix';
String minutesText = minutes == 0 ? '' : ' and $minutes $minuteTextSuffix';
etaText = '$hoursText$minutesText';
if (minutes > 0) {
etaText = '${localizations.shortHoursString(hours)} ${localizations.shortMinutesString(minutes)}';
} else {
etaText = localizations.shortHoursString(hours);
}
} else if (etaNextAlarm.inMinutes > 0) {
int minutes = etaNextAlarm.inMinutes;
String minuteTextSuffix = minutes <= 1 ? 'minute' : 'minutes';
etaText = '$minutes $minuteTextSuffix';
etaText = localizations.shortMinutesString(minutes);
} else {
etaText = 'less than 1 minute';
etaText = localizations.shortMinutesString(1);
}

return 'Alarm will ring in $etaText';
return etaText;
}

String getNewAlarmText(BuildContext context, Alarm alarm) {
AppLocalizations localizations = AppLocalizations.of(context)!;

final etaText = getRemainingAlarmTimeText(context, alarm);

return localizations.alarmRingInMessage(etaText);
}

String getNextAlarmText(BuildContext context, Alarm alarm) {
AppLocalizations localizations = AppLocalizations.of(context)!;

final etaText = getShortRemainingAlarmTimeText(context, alarm);

return localizations.nextAlarmIn(etaText);
}
Loading

0 comments on commit 6e835b9

Please sign in to comment.