diff --git a/lib/main.dart b/lib/main.dart index 0ab9eb8..d4339b4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -137,6 +137,7 @@ Future _configureLocalTimeZone() async { tz.setLocalLocation(tz.getLocation(timeZoneName)); } +// ignore_for_file: avoid_print void readAllGetStorage() { // print (almost) all GetStorage item to the console print("-----All GET STORAGE-----"); diff --git a/lib/notificationUtil/isolate_handler_notification.dart b/lib/notificationUtil/isolate_handler_notification.dart index 132062e..f1a77ce 100644 --- a/lib/notificationUtil/isolate_handler_notification.dart +++ b/lib/notificationUtil/isolate_handler_notification.dart @@ -30,7 +30,6 @@ void schedulePrayNotification(List times) async { DebugToast.show('SCHEDULING $howMuchToSchedule notifications'); - print('howMuchToSchedule is $howMuchToSchedule'); // for debug dialog GetStorage().write(kNumberOfNotifsScheduled, howMuchToSchedule); @@ -105,8 +104,6 @@ void schedulePrayNotification(List times) async { scheduledTime: tz.TZDateTime.from( DateTime.fromMillisecondsSinceEpoch(isyakTimeEpoch), tz.local)); } - - print('Notification scheduled #${i + 1}'); } scheduleAlertNotification( @@ -120,7 +117,6 @@ void schedulePrayNotification(List times) async { 1, 0, 5), //2021-01-01 00:05:00.000+0800 ); - print('DONE SCHEDULING NOTIFS'); DebugToast.show('FINISH SCHEDULE NOTIFS'); //This timestamp is later used to determine wether notification should be updated or not diff --git a/lib/views/Settings part/NotificationSettingPage.dart b/lib/views/Settings part/NotificationSettingPage.dart index 9066fb2..baf8914 100644 --- a/lib/views/Settings part/NotificationSettingPage.dart +++ b/lib/views/Settings part/NotificationSettingPage.dart @@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:get_storage/get_storage.dart'; +import 'troubleshoot_notif.dart'; import '../../CONSTANTS.dart'; import '../../utils/cupertinoSwitchListTile.dart'; import '../../utils/custom_navigator_pop.dart'; @@ -28,12 +29,16 @@ class _NotificationPageSettingState extends State { const Padding(padding: EdgeInsets.all(8.0), child: Text('Basic')), Card( child: ListTile( - contentPadding: - const EdgeInsets.symmetric(horizontal: 16, vertical: 8), title: const Text('App notification System Setting'), + isThreeLine: true, subtitle: const Text( 'Customize sound, toggle channel of prayer notification etc.'), - trailing: const Icon(Icons.launch_rounded), + trailing: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + Icon(Icons.launch_rounded), + ], + ), onTap: () async { await AppSettings.openNotificationSettings(); }, @@ -41,10 +46,26 @@ class _NotificationPageSettingState extends State { ), const Padding( padding: EdgeInsets.all(8.0), child: Text('Troubleshooting')), + Card( + child: ListTile( + title: + const Text('Fix notification didn\'t show on some device.'), + subtitle: const Text('Example: Xiaomi / Redmi, Realme etc.'), + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (_) => const TroubleshootNotif(), + )), + ), + ), + const Padding( + padding: EdgeInsets.all(8.0), + child: Text('Advanced troubleshooting')), Card( child: Container( padding: const EdgeInsets.symmetric(vertical: 8.0), child: CupertinoSwitchListTile( + activeColor: CupertinoColors.activeBlue, title: const Text('Limit notification scheduling'), subtitle: const Text( 'Enable if you experiencing an extreme slowdown in app. Notification will schedule weekly basis. Default is OFF (monthly).'), @@ -61,30 +82,30 @@ class _NotificationPageSettingState extends State { title: const Text('Force rescheduling notification...'), onTap: () { showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - content: const Text( - 'By default, notification will not rescheduled if the last scheduler ran is less than two days.\n\nTap proceed to start an immediate notification scheduling. The app will be restarted.'), - actions: [ - TextButton( - onPressed: () { - Navigator.pop(context); - }, - child: const Text('Cancel'), - ), - TextButton( - onPressed: () { - GetStorage().write(kForceUpdateNotif, true); - print(GetStorage().read(kForceUpdateNotif)); - Get.forceAppUpdate(); - CustomNavigatorPop.popTo(context, 3); - }, - child: const Text('Proceed'), - ) - ], - ); - }); + context: context, + builder: (BuildContext context) { + return AlertDialog( + content: const Text( + 'By default, notification will not rescheduled if the last scheduler ran is less than two days.\n\nTap proceed to start an immediate notification scheduling. The app will be restarted.'), + actions: [ + TextButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text('Cancel'), + ), + TextButton( + onPressed: () { + GetStorage().write(kForceUpdateNotif, true); + Get.forceAppUpdate(); + CustomNavigatorPop.popTo(context, 3); + }, + child: const Text('Proceed'), + ) + ], + ); + }, + ); }, ), ), diff --git a/lib/views/Settings part/troubleshoot_notif.dart b/lib/views/Settings part/troubleshoot_notif.dart new file mode 100644 index 0000000..b5427a8 --- /dev/null +++ b/lib/views/Settings part/troubleshoot_notif.dart @@ -0,0 +1,75 @@ +import 'package:app_settings/app_settings.dart'; +import 'package:flutter/material.dart'; +import '../../utils/launchUrl.dart'; + +class TroubleshootNotif extends StatelessWidget { + const TroubleshootNotif({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text.rich( + TextSpan( + style: TextStyle(height: 1.3), + children: [ + TextSpan(text: 'Some apps installed from the '), + TextSpan( + text: 'Google Play Store ', + style: TextStyle(fontWeight: FontWeight.bold)), + TextSpan(text: 'will disable '), + TextSpan( + text: 'Autostart ', + style: TextStyle(fontWeight: FontWeight.bold)), + TextSpan( + text: + 'by default. Due to this behaviour, prayer notification (sometimes) will not appear on your phone. '), + ], + ), + ), + const Text('\n'), + const Text.rich( + TextSpan( + style: TextStyle(height: 1.3), + children: [ + TextSpan(text: 'The solution is to enable '), + TextSpan( + text: 'Autostart ', + style: TextStyle(fontWeight: FontWeight.bold)), + TextSpan( + text: + 'for this app. Tap the button below to open App Setting, then find the Autostart option there to enable it.'), + ], + ), + ), + Card( + child: ListTile( + title: const Text('Open App Setting'), + onTap: () => AppSettings.openAppSettings(), + trailing: const Icon(Icons.launch_rounded), + ), + ), + const Text( + '\nRelated Article:', + style: TextStyle(fontWeight: FontWeight.bold), + ), + TextButton( + onPressed: () { + LaunchUrl.normalLaunchUrl( + url: + 'https://telegra.ph/Notification-didnt-show-on-some-devices-07-31'); + }, + child: + const Text('Notification didn\'t show on some devices')) + ], + ), + ), + ), + ); + } +} diff --git a/lib/views/ZoneChooser.dart b/lib/views/ZoneChooser.dart index 9e128e1..d7840a2 100644 --- a/lib/views/ZoneChooser.dart +++ b/lib/views/ZoneChooser.dart @@ -267,7 +267,6 @@ class LocationChooser { static Widget onErrorWidget(BuildContext context, {@required String errorMessage, Function onRetryPressed}) { - print(errorMessage); return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/views/appBody.dart b/lib/views/appBody.dart index b7c03ee..fd7ecdc 100644 --- a/lib/views/appBody.dart +++ b/lib/views/appBody.dart @@ -48,8 +48,7 @@ class _AppBodyState extends State { // Releases an ad resource when it fails to load ad.dispose(); - print( - 'Ad load failed (code=${error.code} message=${error.message})'); + throw error; }, ), request: const AdRequest()); diff --git a/lib/views/feedbackPage.dart b/lib/views/feedbackPage.dart index 088e851..d3085ee 100644 --- a/lib/views/feedbackPage.dart +++ b/lib/views/feedbackPage.dart @@ -120,7 +120,6 @@ class _FeedbackPageState extends State { shrinkWrap: true, itemCount: _deviceInfo.length + 1, itemBuilder: (context, index) { - print(_deviceInfo.length); if (index < _deviceInfo.length) { var key = _deviceInfo.keys.elementAt(index); return ListTile( @@ -180,7 +179,6 @@ class _FeedbackPageState extends State { if (_formKey.currentState.validate()) { FocusScope.of(context).unfocus(); setState(() => _isSendLoading = true); - print('Sending report...'); try { await _reportsCollection.add({ 'Date creation': FieldValue.serverTimestamp(), @@ -214,8 +212,6 @@ class _FeedbackPageState extends State { backgroundColor: Colors.red, )); setState(() => _isSendLoading = false); - } catch (e) { - print('Err: $e'); } } }, diff --git a/pubspec.yaml b/pubspec.yaml index 5d6a73a..a06e52d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: App waktu solat seluruh Malaysia publish_to: "none" # Remove this line if you wish to publish to pub.dev -version: 1.26.137-pre.5+64 +version: 1.26.138-pre.6+65 environment: sdk: ">=2.7.0 <3.0.0" diff --git a/scratch.dart b/scratch.dart index 954d942..2a39b2f 100644 --- a/scratch.dart +++ b/scratch.dart @@ -1,4 +1,5 @@ // import 'package:geolocator/geolocator.dart'; +//ignore_for_file: avoid_print import 'package:intl/intl.dart';