Skip to content

Commit

Permalink
Merge pull request #8 from MehediHasannOvi/Ramadan-panner-2024-Update
Browse files Browse the repository at this point in the history
add firebase notification
  • Loading branch information
MehediHasannOvi authored Sep 4, 2024
2 parents 8a1e1a9 + cc4ddd7 commit 1865e28
Show file tree
Hide file tree
Showing 25 changed files with 513 additions and 275 deletions.
27 changes: 0 additions & 27 deletions .firebase/hosting.YnVpbGRcd2Vi.cache

This file was deleted.

2 changes: 1 addition & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"projects": {
"default": "ramadan-remainder"
"default": "ramadanplannerbd"
}
}
20 changes: 20 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on merge
on:
push:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_RAMADANPLANNERBD }}
channelId: live
projectId: ramadanplannerbd
21 changes: 21 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools

name: Deploy to Firebase Hosting on PR
on: pull_request
permissions:
checks: write
contents: read
pull-requests: write
jobs:
build_and_preview:
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_RAMADANPLANNERBD }}
projectId: ramadanplannerbd
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ if (flutterVersionName == null) {
}

apply plugin: 'com.android.application'
// START: FlutterFire Configuration
apply plugin: 'com.google.gms.google-services'
// END: FlutterFire Configuration
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

Expand Down
24 changes: 7 additions & 17 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
{
"project_info": {
"project_number": "897038968699",
"project_id": "ramadan-remainder",
"storage_bucket": "ramadan-remainder.appspot.com"
"project_number": "123081775898",
"project_id": "ramadanplannerbd",
"storage_bucket": "ramadanplannerbd.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:897038968699:android:6eb05b44cddca28b737fde",
"mobilesdk_app_id": "1:123081775898:android:3790bdec5a64dec58a6aa3",
"android_client_info": {
"package_name": "com.ababildev.ramadanplanner"
}
},
"oauth_client": [
{
"client_id": "897038968699-8ltat0magdapep6r3p4dbsuip7jfb0d6.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBSPLR8RGF3atQIix__ypgfWoNEAksVjN0"
"current_key": "AIzaSyB5l4HwLkylYvk7_9P0aQk95zGXv4lbGFQ"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "897038968699-8ltat0magdapep6r3p4dbsuip7jfb0d6.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<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.WAKE_LOCK" />
<!-- <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_COARSE_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
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
5 changes: 3 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ababildev.ramadanplanner">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<!-- <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_FINE_LOCATION" /> -->
<!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> -->
<uses-permission android:name="android.permission.INTERNET"/>

Expand Down
3 changes: 3 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ buildscript {
}

dependencies {
// START: FlutterFire Configuration
classpath 'com.google.gms:google-services:4.3.15'
// END: FlutterFire Configuration
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20"
classpath 'com.android.tools.build:gradle:4.2.2'
Expand Down
29 changes: 28 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
{
"flutter": {
"platforms": {
"android": {
"default": {
"projectId": "ramadanplannerbd",
"appId": "1:123081775898:android:3790bdec5a64dec58a6aa3",
"fileOutput": "android/app/google-services.json"
}
},
"dart": {
"lib/firebase_options.dart": {
"projectId": "ramadanplannerbd",
"configurations": {
"android": "1:123081775898:android:3790bdec5a64dec58a6aa3",
"ios": "1:123081775898:ios:14596f687d7ec5058a6aa3",
"web": "1:123081775898:web:8407066bc5eb1f158a6aa3"
}
}
}
}
},
"hosting": {
"public": "build/web",
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
34 changes: 22 additions & 12 deletions lib/app/modules/fastscreen/controllers/fastscreen_controller.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:ramadanplanner/app/data/dinerkaj.dart';
import 'package:ramadanplanner/app/model/locationmodel.dart';
import 'package:ramadanplanner/app/routes/app_pages.dart';
import 'package:ramadanplanner/app/service/notification/firebasenotification.dart';
// import 'package:ramadanplanner/app/service/notification/firebasenotification.dart';
import 'package:ramadanplanner/app/service/notification/notification_service_mobile.dart';

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

final TextEditingController name = TextEditingController();
List<LocationModel> locationList = [];
LocationModel? selectedLocation;
Expand Down Expand Up @@ -58,17 +59,26 @@ class FastscreenController extends GetxController {
}

@override
void onInit() {
Future.delayed( const Duration(
milliseconds: 10,
), () {
screenChange();
firebasenotificationService.requestNotificationPermissions();
void onInit() {
Future.delayed(
const Duration(
milliseconds: 100,
), () {
screenChange();
update();
NotificationService().dalyscheduleNotifications(
payLoad: 'DailyTask',
title: "আস-সালামু আলাইকুম \n আজকের দিনের কাজ হলো",
body: "${dinerkaj[DateTime.now().day - 1]}",
timeSlots: [
{'hour': 6, 'minute': 0},
{'hour': 17, 'minute': 0},
],
);
fetchLocations();
});

super.onInit();

fetchLocations();
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/home/controllers/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'package:sizer/sizer.dart';
import 'package:timezone/data/latest.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
import '../../../../Util/app_colors.dart';
import '../../../service/notification/notification.dart';
import '../../../service/notification/notification_service_mobile.dart';
import '../../../data/dinerkaj.dart';
import '../../../data/hadis.dart';
import 'package:http/http.dart' as http;
Expand Down
4 changes: 2 additions & 2 deletions lib/app/modules/praytime/views/praytime_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ class PraytimeView extends GetView<PraytimeController> {
icon: 'assets/icon/Icon_Fajr.svg',
),
prayTime(
title: 'Sunrise',
title: 'সূর্যোদয়',
time: controller.getSunRiceTime(),
icon: 'assets/icon/Sunrise.svg',
),
prayTime(
title: 'সূর্যোদয়',
title: 'যুহর',
time: controller.getdhuhrTime(),
icon: 'assets/icon/Icon_Dhuhr.svg',
),
Expand Down
2 changes: 2 additions & 0 deletions lib/app/service/notification/firebasenotification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class FirebaseNotificationService {
await Firebase.initializeApp();
_initializeLocalNotifications();
_setupFirebaseMessaging();
requestNotificationPermissions();

}

// Initialize local notifications
Expand Down
Loading

0 comments on commit 1865e28

Please sign in to comment.