Skip to content

Commit 81e0f7b

Browse files
authored
Merge pull request #121 from akaMrNagar/dev
Bug fixes
2 parents cd3ea84 + ddab67f commit 81e0f7b

File tree

14 files changed

+109
-60
lines changed

14 files changed

+109
-60
lines changed

android/app/src/main/java/com/mindful/android/receivers/alarm/NotificationBatchReceiver.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ class NotificationBatchReceiver : BroadcastReceiver() {
180180
.setLargeIcon(appIcon)
181181
.setContentTitle(appName)
182182
.setGroup(packageName)
183-
.setGroupSummary(false)
184183
.setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_SUMMARY)
185184
.setStyle(messagingStyle)
186185
.setAutoCancel(true)

android/app/src/main/java/com/mindful/android/services/accessibility/TrackingManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class TrackingManager(
2525
@WorkerThread
2626
fun onNewEvent(packageName: String) {
2727
if (lastActiveApp != packageName && packageName != SYSTEM_UI_PACKAGE) {
28-
lastActiveApp = packageName
2928
debouncer.submit {
29+
lastActiveApp = packageName
3030
broadcastEvent(ACTION_NEW_APP_LAUNCHED)
3131
}
3232
}

android/app/src/main/java/com/mindful/android/utils/DateTimeUtils.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,21 @@ object DateTimeUtils {
8080
*/
8181
fun todayCalToTod(): Int {
8282
val calendar = Calendar.getInstance()
83-
return calendar.get(Calendar.HOUR_OF_DAY) * 60 + calendar.get(Calendar.MINUTE)
83+
return (calendar.get(Calendar.HOUR_OF_DAY) * 60) + calendar.get(Calendar.MINUTE)
8484
}
8585

8686
/**
8787
* Calculated the difference between time now and future tod minutes.
8888
*
89-
* @param futureTotalMinutes The total minutes from Time Of Day dart object.
89+
* @param futureTod The total minutes from Time Of Day dart object.
9090
* @return The difference in MS. If the difference is negative then return 0
9191
*/
92-
fun todDifferenceFromNow(futureTotalMinutes: Int): Long {
92+
fun todDifferenceFromNow(futureTod: Int): Long {
9393
val now = System.currentTimeMillis()
94-
val futureCal = todToTodayCal(futureTotalMinutes)
94+
val futureCal = todToTodayCal(futureTod)
9595

9696
// If the future time already passed today, move to tomorrow
97-
if (futureCal.timeInMillis <= now) {
97+
if (futureTod < todayCalToTod()) {
9898
futureCal.add(Calendar.DAY_OF_YEAR, 1)
9999
}
100100

@@ -103,7 +103,7 @@ object DateTimeUtils {
103103
}
104104

105105
/**
106-
* Checks if current system time is outside the star and end Time Of Day
106+
* Checks if current system time is outside the start and end Time Of Day
107107
*
108108
* @param startTod The start TOD in minutes
109109
* @param endTod The end TOD in minutes
@@ -117,7 +117,7 @@ object DateTimeUtils {
117117
// now=3 is between end=2 start=5 then outside
118118
nowTod in endTod until startTod
119119
}
120-
// Sane day
120+
// Same day
121121
else {
122122
// now=3 is not between start=2 end=5 then outside
123123
nowTod !in startTod until endTod

lib/l10n/app_en.arb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@
455455
"daily_label": "Daily",
456456
"search_notifications_sheet_info": "Easily find past notifications by searching through their title or content. Helps you quickly locate important alerts.",
457457
"search_notifications_hint": "Search notifications...",
458+
"search_notifications_empty_list_hint": "No notifications found matching your search.",
458459
"@----------------------------- APPS DASHBOARD SCREEN -----------------------------": {},
459460
"app_info_none_warning": "Couldn't find the app for the given package. Returning to the home screen.",
460461
"emergency_fab_button": "Emergency",

lib/l10n/generated/app_localizations.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,12 @@ abstract class AppLocalizations {
21212121
/// **'Search notifications...'**
21222122
String get search_notifications_hint;
21232123

2124+
/// No description provided for @search_notifications_empty_list_hint.
2125+
///
2126+
/// In en, this message translates to:
2127+
/// **'No notifications found matching your search.'**
2128+
String get search_notifications_empty_list_hint;
2129+
21242130
/// No description provided for @app_info_none_warning.
21252131
///
21262132
/// In en, this message translates to:

lib/l10n/generated/app_localizations_en.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ class AppLocalizationsEn extends AppLocalizations {
10951095
@override
10961096
String get search_notifications_hint => 'Search notifications...';
10971097

1098+
@override
1099+
String get search_notifications_empty_list_hint => 'No notifications found matching your search.';
1100+
10981101
@override
10991102
String get app_info_none_warning => 'Couldn\'t find the app for the given package. Returning to the home screen.';
11001103

lib/l10n/generated/app_localizations_ja.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ class AppLocalizationsJa extends AppLocalizations {
10951095
@override
10961096
String get search_notifications_hint => 'Search notifications...';
10971097

1098+
@override
1099+
String get search_notifications_empty_list_hint => 'No notifications found matching your search.';
1100+
10981101
@override
10991102
String get app_info_none_warning => 'Couldn\'t find the app for the given package. Returning to the home screen.';
11001103

lib/l10n/generated/app_localizations_tr.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ class AppLocalizationsTr extends AppLocalizations {
10951095
@override
10961096
String get search_notifications_hint => 'Search notifications...';
10971097

1098+
@override
1099+
String get search_notifications_empty_list_hint => 'No notifications found matching your search.';
1100+
10981101
@override
10991102
String get app_info_none_warning => 'Verilen paket için uygulama bulunamadı. Ana ekrana dönülüyor.';
11001103

lib/l10n/generated/app_localizations_zh.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ class AppLocalizationsZh extends AppLocalizations {
10951095
@override
10961096
String get search_notifications_hint => 'Search notifications...';
10971097

1098+
@override
1099+
String get search_notifications_empty_list_hint => 'No notifications found matching your search.';
1100+
10981101
@override
10991102
String get app_info_none_warning => '无法找到给定包名的应用程序。返回主屏幕。';
11001103

lib/providers/restrictions/bedtime_provider.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import 'package:flutter_riverpod/flutter_riverpod.dart';
1212
import 'package:mindful/core/database/adapters/time_of_day_adapter.dart';
1313
import 'package:mindful/core/database/app_database.dart';
14+
import 'package:mindful/core/extensions/ext_date_time.dart';
1415
import 'package:mindful/core/services/drift_db_service.dart';
1516
import 'package:mindful/core/services/method_channel_service.dart';
1617
import 'package:mindful/core/utils/default_models_utils.dart';
@@ -22,6 +23,12 @@ final bedtimeScheduleProvider =
2223
);
2324

2425
class BedtimeScheduleNotifier extends StateNotifier<BedtimeSchedule> {
26+
/// Returns `TRUE` if the time now is between the bedtime schedule otherwise `FALSE`.
27+
bool get isBetweenSchedule => DateTime.now().isBetweenTod(
28+
state.scheduleStartTime,
29+
state.scheduleEndTime,
30+
);
31+
2532
BedtimeScheduleNotifier() : super(defaultBedtimeScheduleModel) {
2633
_init();
2734
}

0 commit comments

Comments
 (0)