Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance UX for azan notification #230

Merged
merged 8 commits into from
Mar 31, 2024
83 changes: 0 additions & 83 deletions lib/components/shake_widget.dart

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class ExactAlarmPermissionOffSheet extends StatelessWidget {
const ExactAlarmPermissionOffSheet({
super.key,
required this.onGrantPermission,
required this.onCancelModal,
});

/// What will happen when "Give permission" button is pressed
final VoidCallback onGrantPermission;

/// What will happen when "Cancel" button is pressed
final VoidCallback onCancelModal;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Padding(
padding: EdgeInsets.all(24.0),
child: Icon(Icons.notifications_active_outlined, size: 80),
),
const SizedBox(height: 8),
Text(
l10n.notifSheetExactAlarmTitle,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
l10n.notifSheetExactAlarmDescription,
textAlign: TextAlign.center,
),
const SizedBox(height: 16),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
),
onPressed: onGrantPermission,
child: Text(l10n.notifSheetExactAlarmPrimaryButton),
),
TextButton(
onPressed: onCancelModal,
child: Text(l10n.notifSheetExactAlarmCancel),
),
],
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class NotificationPermissionOffSheet extends StatelessWidget {
const NotificationPermissionOffSheet({
super.key,
required this.onTurnOnNotification,
required this.onCancelModal,
});

/// What will happen when "Turn On Notification" button is pressed
final VoidCallback onTurnOnNotification;

/// What will happen when "Keep it off for now" button is pressed
final VoidCallback onCancelModal;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Padding(
padding: EdgeInsets.all(24.0),
child: Icon(Icons.notifications_off_outlined, size: 80),
),
const SizedBox(height: 8),
Text(
l10n.notifSheetNotificationTitle,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 8),
Text(
l10n.notifSheetNotificationDescription,
textAlign: TextAlign.center,
),
const SizedBox(height: 16),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
),
onPressed: onTurnOnNotification,
child: Text(l10n.notifSheetNotificationPrimaryButton),
),
TextButton(
onPressed: onCancelModal,
child: Text(l10n.notifSheetNotificationCancel),
),
],
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class AutostartSettingDialog extends StatelessWidget {
const AutostartSettingDialog({
super.key,
required this.leadingCount,
required this.onSkip,
required this.onGrantPermission,
});

final String leadingCount;
final VoidCallback onSkip;
final VoidCallback onGrantPermission;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return AlertDialog(
title: Text(l10n.permissionDialogTitle),
content: Text('$leadingCount) ${l10n.autostartDialogPermissionContent}'),
actions: [
TextButton(
onPressed: onSkip,
child: Text(l10n.permissionDialogSkip),
),
TextButton(
onPressed: onGrantPermission,
child: Text(l10n.permissionDialogGrant),
)
],
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class NotificationExactAlarmPermissionDialog extends StatelessWidget {
const NotificationExactAlarmPermissionDialog({
super.key,
required this.leadingCount,
required this.onSkip,
required this.onGrantPermission,
});

final String leadingCount;
final VoidCallback onSkip;
final VoidCallback onGrantPermission;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return AlertDialog(
title: Text(l10n.permissionDialogTitle),
content:
Text('$leadingCount) ${l10n.notifExactAlarmDialogPermissionContent}'),
actions: [
TextButton(
onPressed: onSkip,
child: Text(l10n.permissionDialogSkip),
),
TextButton(
onPressed: onGrantPermission,
child: Text(l10n.permissionDialogGrant),
)
],
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class NotificationPermissionDialog extends StatelessWidget {
const NotificationPermissionDialog(
{super.key, required this.leadingCount, required this.onGrantPermission});

final String leadingCount;
final VoidCallback onGrantPermission;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return AlertDialog(
title: Text(l10n.permissionDialogTitle),
content: Text('$leadingCount) ${l10n.notifDialogPermissionContent}'),
actions: [
TextButton(
onPressed: onGrantPermission,
child: Text(l10n.permissionDialogGrant),
)
],
);
}
}
19 changes: 18 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
"onboardingLocationSet": "Set location",
"onboardingThemeFav": "Set your favourite theme",
"onboardingNotifOption": "Select notification preferences",
"onboardingNotifDefault": "Default notification sound",
"onboardingNotifDefault": "Default notification",
"onboardingNotifAzan": "Azan (full)",
"onboardingNotifShortAzan": "Azan (short)",
"onboardingNotifAutostart": "**Autostart** need to be enabled for the app to send notifications. [Learn more...]({link})",
Expand All @@ -241,6 +241,12 @@
"onboardingFinishDesc": "Welcome aboard. Do explore other features and tweak other settings as well.",
"onboardingDone": "Done",
"onboardingNext": "Next",
"permissionDialogTitle": "Permission required",
"permissionDialogSkip": "Skip",
"permissionDialogGrant": "Grant",
"autostartDialogPermissionContent": "Please allow app to Autostart to keep receive notifications even if the device restarts",
"notifDialogPermissionContent": "Please grant the notification permission to allow this app to show notifications",
"notifExactAlarmDialogPermissionContent": "Please grant the app permission to schedule notifications at exact time",
"zoneUpdatedToast": "Location updated",
"zoneYourLocation": "Your location",
"zoneSetManually": "Set manually",
Expand Down Expand Up @@ -277,6 +283,17 @@
"notifSettingCancel": "Cancel",
"notifSettingProceed": "Proceed",
"notifSettingNotifDemo": "This is how the notification/azan will sound like",
"notifSettingsExactAlarmPermissionTitle": "Notification scheduling permission",
"notifSettingsExactAlarmPermissionGrantedSubtitle": "Permission granted. The app can send azan notification on prayer times",
"notifSettingsExactAlarmPermissionNotGrantedSubtitle": "Permission not granted. The app cannot send the azan notification. Tap here to grant permission",
"notifSheetExactAlarmTitle": "We require one more permission to trigger the notification/azan at the right time",
"notifSheetExactAlarmDescription": "This permission is needed to push the notification at the correct time. If you say no, the app might still schedule the notification, but the delivery may be delayed.",
"notifSheetExactAlarmPrimaryButton": "Grant now",
"notifSheetExactAlarmCancel": "Cancel",
"notifSheetNotificationTitle": "Notification/Azan is turned off",
"notifSheetNotificationDescription": "We may require some permissions to be able to play the notification/azan",
"notifSheetNotificationPrimaryButton": "Turn On Notification'",
"notifSheetNotificationCancel": "Keep it off for now",
"contributenDesc": "Alhamdulillah. If you love using our app and would like to show your appreciation, you can now make a financial contribution to support our ongoing efforts. May Allah SWT rewards your kindness.",
"contributeShare": "Share this app",
"contributeShareDesc": "Share your experience of using this app with your family and friends.",
Expand Down
19 changes: 18 additions & 1 deletion lib/l10n/app_ms.arb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"onboardingLocationSet": "Tetapkan lokasi",
"onboardingThemeFav": "Tetapkan tema kegemaran anda",
"onboardingNotifOption": "Pilih jenis pemberitahuan",
"onboardingNotifDefault": "Bunyi pemberitahuan lalai",
"onboardingNotifDefault": "Pemberitahuan lalai",
"onboardingNotifAzan": "Azan (penuh)",
"onboardingNotifShortAzan": "Azan (pendek)",
"onboardingNotifAutostart": "**Autostart** perlu dihidupkan untuk apl menghantar pemberitahuan. [Ketahui lebih lanjut..]({link})",
Expand All @@ -145,6 +145,12 @@
"onboardingFinishDesc": "Selamat datang. Terokai ciri dan ubah suai tetapan lain mengikut citarasa anda.",
"onboardingDone": "Selesai",
"onboardingNext": "Seterusnya",
"permissionDialogTitle": "Kebenaran Diperlukan",
"permissionDialogSkip": "Langkau",
"permissionDialogGrant": "Berikan",
"autostartDialogPermissionContent": "Sila benarkan aplikasi untuk Autostart agar dapat menerima pemberitahuan walaupun peranti dihidupkan semula",
"notifDialogPermissionContent": "Sila berikan kebenaran pemberitahuan untuk membolehkan aplikasi ini menunjukkan pemberitahuan",
"notifExactAlarmDialogPermissionContent": "Sila berikan kebenaran aplikasi untuk menjadual pemberitahuan pada masa yang tepat",
"zoneUpdatedToast": "Lokasi dikemaskini",
"zoneYourLocation": "Lokasi anda",
"zoneSetManually": "Pilih sendiri",
Expand Down Expand Up @@ -174,6 +180,17 @@
"notifSettingCancel": "Batal",
"notifSettingProceed": "Teruskan",
"notifSettingNotifDemo": "Notifikasi/azan akan berbunyi seperti ini",
"notifSettingsExactAlarmPermissionTitle": "Kebenaran Penjadualan Pemberitahuan",
"notifSettingsExactAlarmPermissionGrantedSubtitle": "Kebenaran diberikan. Aplikasi boleh menghantar pemberitahuan azan pada waktu solat",
"notifSettingsExactAlarmPermissionNotGrantedSubtitle": "Kebenaran tidak diberikan. Aplikasi tidak dapat menghantar pemberitahuan azan. Ketik di sini untuk memberikan kebenaran",
"notifSheetExactAlarmTitle": "Kami perlukan satu lagi kebenaran untuk memulakan pemberitahuan/azan pada masa yang betul",
"notifSheetExactAlarmDescription": "Kebenaran ini diperlukan untuk menghantar pemberitahuan pada masa yang betul. Jika anda menolak, aplikasi mungkin masih menjadual pemberitahuan, tetapi penghantaran mungkin terlewat.",
"notifSheetExactAlarmPrimaryButton": "Berikan sekarang",
"notifSheetExactAlarmCancel": "Batal",
"notifSheetNotificationTitle": "Pemberitahuan/Azan dimatikan",
"notifSheetNotificationDescription": "Kami mungkin memerlukan beberapa kebenaran untuk dapat memainkan pemberitahuan/azan",
"notifSheetNotificationPrimaryButton": "Hidupkan Pemberitahuan",
"notifSheetNotificationCancel": "Biar dimatikan untuk masa ini",
"contributenDesc": "Alhamdulillah. Saya menghargai niat anda untuk menderma ke aplikasi Waktu Solat Malaysia. Semoga Allah SWT membalas jasa baik kalian.",
"contributeShare": "Kongsi aplikasi ini",
"contributeShareDesc": "Kongsi pengalaman anda menggunakan aplikasi ini dengan keluarga dan rakan anda.",
Expand Down
Loading
Loading