Skip to content

Commit

Permalink
Merge pull request #7 from MehediHasannOvi/Ramadan-panner-2024-Update
Browse files Browse the repository at this point in the history
add notification
  • Loading branch information
MehediHasannOvi authored Sep 2, 2024
2 parents 9fe9e93 + 19ed1f6 commit 8a1e1a9
Show file tree
Hide file tree
Showing 16 changed files with 340 additions and 415 deletions.
2 changes: 2 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"name": "ramadanplanner",
"request": "launch",
Expand All @@ -21,5 +22,6 @@
"type": "dart",
"flutterMode": "release"
}

]
}
4 changes: 2 additions & 2 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ababildev.ramadanplanner">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
Expand Down
6 changes: 3 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
package="com.ababildev.ramadanplanner">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY " />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> -->
<uses-permission android:name="android.permission.INTERNET"/>


Expand Down
1 change: 1 addition & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
- provider: true
26 changes: 21 additions & 5 deletions lib/app/modules/fastscreen/controllers/fastscreen_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:ramadanplanner/app/model/locationmodel.dart';
import 'package:ramadanplanner/app/routes/app_pages.dart';
import 'package:ramadanplanner/app/service/notification/firebasenotification.dart';

class FastscreenController extends GetxController {
final FirebaseNotificationService firebasenotificationService = FirebaseNotificationService();

final TextEditingController name = TextEditingController();
List<LocationModel> locationList = [];
LocationModel? selectedLocation;
Expand Down Expand Up @@ -48,16 +51,29 @@ class FastscreenController extends GetxController {
}
}

screenChange() {
if (Hive.box("user").get("name") != null) {
Get.offAllNamed(Routes.NAVIGATIONBAR);
}
}

@override
void onInit() {
Future.delayed(Duration.zero, () {
if (Hive.box("user").get("name") != null) {
Get.offAllNamed(Routes.NAVIGATIONBAR);
}
void onInit() {
Future.delayed( const Duration(
milliseconds: 10,
), () {
screenChange();
firebasenotificationService.requestNotificationPermissions();
});

super.onInit();

fetchLocations();
}

@override
void onClose() {
name.dispose();
super.onClose();
}
}
38 changes: 2 additions & 36 deletions lib/app/modules/home/controllers/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import '../../../data/hadis.dart';
import 'package:http/http.dart' as http;

class HomeController extends GetxController {

HijriCalendar currentDate = HijriCalendar.now();


Expand Down Expand Up @@ -51,29 +51,6 @@ class HomeController extends GetxController {
return dataIndex;
}

// This function is for edit name button this will show a dialog box to edit name
// and when user fast time open the app it will show a dialog box to enter name

// getusername() {
// Timer(const Duration(seconds: 0), () {
// Get.defaultDialog(
// backgroundColor: AppColors.secondaryColor,
// buttonColor: AppColors.quaternaryColor,
// titleStyle: const TextStyle(color: Colors.white),
// titlePadding: const EdgeInsets.all(10),
// confirmTextColor: Colors.black,
// barrierDismissible: false,
// radius: 5,
// title: "আপনার নাম এবং লোকেশন সিলেক্ট করুন",
// content:

// onConfirm: () {

// });
// });
// }

// THis function use for Location and Timezone for the app to get the current time and location


@override
Expand All @@ -83,18 +60,7 @@ class HomeController extends GetxController {

getDataIndexForCurrentDate();

NotificationService()
.scheduleNotification(
// scheduledDate: nextInstanceOfOneAm(1),
title: "আজকের দিনের কাজ",
body: "${dinerkaj[getDataIndexForCurrentDate()]}",
)
.then((value) => print(
"Notification Scheduled",
));

// here load the location and timezone


// getpraylanght;
super.onInit();
}
Expand Down
97 changes: 38 additions & 59 deletions lib/app/modules/home/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,70 +25,46 @@ class HomeView extends GetView<HomeController> {
return Scaffold(
extendBody: true,
extendBodyBehindAppBar: true,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
title: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
body: ListView(
padding: EdgeInsets.zero,
children: [
SizedBox(
height: 2.h,
height: 4.h,
),
AppText(
text: "আস-সালামু আলাইকুম",
fontSize: 14,
fontWeight: FontWeight.normal,
color: Colors.grey,
// textAlign: TextAlign.left,
Padding(
padding: const EdgeInsets.only(left: 20),
child: AppText(
text: "আস-সালামু আলাইকুম",
fontSize: 14,
fontWeight: FontWeight.normal,
color: Colors.grey,
// textAlign: TextAlign.left,
),
),
const SizedBox(
height: 5,
),
GetBuilder<HomeController>(
init: HomeController(),
initState: (_) {},
builder: (_) {
return Row(
children: [
AppText(
text: Hive.box('user').get('name') ?? "User",
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.white,
),


],
);
},
),
]),
actions: [
IconButton(
onPressed: () async {
// Get.toNamed(Routes.ABOUT);
Hive.box("user").delete('name');
Hive.box("user").delete('location');
// print(Hive.box("user").get("location"),);
},
icon: const Icon(
CupertinoIcons.heart_circle,
color: AppColors.quinaryColor,
)),
IconButton(
onPressed: () async {
Get.toNamed(Routes.ABOUT);

Padding(
padding: const EdgeInsets.only(left: 20),
child: GetBuilder<HomeController>(
init: HomeController(),
initState: (_) {},
builder: (_) {
return Row(
children: [
AppText(
text: Hive.box('user').get('name') ?? "User",
fontSize: 16,
fontWeight: FontWeight.w400,
color: Colors.white,
),
],
);
},
icon: const Icon(
CupertinoIcons.heart_circle,
color: AppColors.quinaryColor,
)),
],
),
body: ListView(
padding: EdgeInsets.zero,
children: [
),
),
SizedBox(
height: 10.h,
height: 4.h,
),
Container(
margin: const EdgeInsets.all(20),
Expand Down Expand Up @@ -204,16 +180,19 @@ class HomeView extends GetView<HomeController> {
builder: (_) {
final dinerkaj = Hive.box('Dtrack').length;
return manuButton("দিনের কাজ", "$dinerkaj/9",
() => Get.toNamed(Routes.DAILY_TRACKING));
() => Get.toNamed(Routes.DAILY_TRACKING , ));
},
),
GetBuilder<QuranTrackerController>(
init: QuranTrackerController(),
initState: (_) {},
builder: (_) {
final quranData = Hive.box('quranData').length;
return manuButton("কোরআন", "$quranData/3",
() => Get.toNamed(Routes.QURAN_TRACKER));
return manuButton(
"কোরআন",
"$quranData/3",
() => Get.toNamed(Routes.QURAN_TRACKER,
));
},
),
manuButton("আল্লাহ'র নাম", "99",
Expand Down
27 changes: 14 additions & 13 deletions lib/app/modules/praytime/controllers/praytime_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class PraytimeController extends GetxController {
late double latitude;
late double longitude;
late Coordinates myCoordinates;

final params = CalculationMethod.karachi.getParameters();
final madhab = Madhab.hanafi;
PrayerTimes? prayerTimes;

// Get formatted time as a String
String get formattedTime {
return DateFormat('HH:mm').format(currentTime.value);
return DateFormat('HH:mm').format(currentTime.value,);
}

String date = DateFormat('d MMMM, yyyy').format(DateTime.now());
Expand Down Expand Up @@ -68,19 +68,20 @@ class PraytimeController extends GetxController {

// List of prayer times in order, each with a name and time
final List<Map<String, dynamic>> prayerTimesList = [
{'name': 'Fajr', 'time': prayerTimes.fajr},
{'name': 'Sunrise', 'time': prayerTimes.sunrise},
{'name': 'Dhuhr', 'time': prayerTimes.dhuhr},
{'name': 'Asr', 'time': prayerTimes.asr},
{'name': 'Maghrib', 'time': prayerTimes.maghrib},
{'name': 'Isha', 'time': prayerTimes.isha},
{'name': 'ফজর', 'time': prayerTimes.fajr},
{'name': 'সূর্যোদয়', 'time': prayerTimes.sunrise},
{'name': 'যুহর', 'time': prayerTimes.dhuhr},
{'name': 'আসর', 'time': prayerTimes.asr},
{'name': 'মাগরিব', 'time': prayerTimes.maghrib},
{'name': 'ইশা', 'time': prayerTimes.isha},
];

// Find the current prayer time
final currentPrayer = prayerTimesList.lastWhere(
(prayer) => now.isAfter(prayer['time'] as DateTime) || now.isAtSameMomentAs(prayer['time'] as DateTime),
orElse: () => {'name': 'None', 'time': prayerTimesList.first['time']}
);
(prayer) =>
now.isAfter(prayer['time'] as DateTime) ||
now.isAtSameMomentAs(prayer['time'] as DateTime),
orElse: () => {'name': 'None', 'time': prayerTimesList.first['time']});

final nextPrayer = prayerTimesList.firstWhere(
(prayer) => (prayer['time'] as DateTime).isAfter(now),
Expand All @@ -93,13 +94,13 @@ class PraytimeController extends GetxController {
final minutes = difference.inMinutes % 60;

// Format the output
return '${currentPrayer['name']} ${hours < 0 && minutes < 0 ? 'Less than 0h 01m' : '${hours}h ${minutes}m'} until ${nextPrayer['name']} (${DateFormat('hh:mm a').format(nextPrayer['time'] as DateTime)})';
return '${currentPrayer['name']} ${hours < 0 && minutes < 0 ? 'Less than 0h 01m' : '${hours}h ${minutes}m'} পরবর্তী নামাজ ${nextPrayer['name']} (${DateFormat('hh:mm a').format(nextPrayer['time'] as DateTime)})';
}

@override
void onInit() {
super.onInit();

// Initialize latitude and longitude
latitude = Hive.box("user").get("latitude");
longitude = Hive.box("user").get("longitude");
Expand Down
10 changes: 5 additions & 5 deletions lib/app/modules/praytime/views/praytime_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class PraytimeView extends GetView<PraytimeController> {
height: 20,
),
prayTime(
title: 'Fajr',
title: 'ফজর',
time: controller.getFajrTime(),
icon: 'assets/icon/Icon_Fajr.svg',
),
Expand All @@ -122,22 +122,22 @@ class PraytimeView extends GetView<PraytimeController> {
icon: 'assets/icon/Sunrise.svg',
),
prayTime(
title: 'Dhuhr',
title: 'সূর্যোদয়',
time: controller.getdhuhrTime(),
icon: 'assets/icon/Icon_Dhuhr.svg',
),
prayTime(
title: 'Asr',
title: 'আসর',
time: controller.getasrTime(),
icon: 'assets/icon/Icon_Asr.svg',
),
prayTime(
title: 'Maghrib',
title: 'মাগরিব',
time: controller.getmaghribTime(),
icon: 'assets/icon/Icon_Maghrib.svg',
),
prayTime(
title: 'Isha',
title: 'ইশা',
time: controller.getishaTime(),
icon: 'assets/icon/Icon_Isha.svg',
),
Expand Down
Loading

0 comments on commit 8a1e1a9

Please sign in to comment.