Skip to content

Commit

Permalink
fix FPN
Browse files Browse the repository at this point in the history
  • Loading branch information
Moktadir authored and Moktadir committed Aug 14, 2023
1 parent e0b9bf0 commit bc02a2f
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
} catch(Exception e) {
Log.e(TAG, "Error registering plugin flutter_plugin_android_lifecycle, io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin", e);
}
try {
flutterEngine.getPlugins().add(new net.wolverinebeach.flutter_timezone.FlutterTimezonePlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin flutter_timezone, net.wolverinebeach.flutter_timezone.FlutterTimezonePlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
} catch(Exception e) {
Expand Down
6 changes: 6 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
end
end
8 changes: 1 addition & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,6 @@ PODS:
- Flutter
- flutter_native_splash (0.0.1):
- Flutter
- flutter_timezone (0.0.1):
- Flutter
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
Expand Down Expand Up @@ -866,7 +864,6 @@ DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
Expand Down Expand Up @@ -919,8 +916,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_timezone:
:path: ".symlinks/plugins/flutter_timezone/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
shared_preferences_foundation:
Expand Down Expand Up @@ -951,7 +946,6 @@ SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2
GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084
Expand All @@ -968,6 +962,6 @@ SPEC CHECKSUMS:
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f

PODFILE CHECKSUM: fff3348f19d060f45045a9c9fbca3a264147c2f7
PODFILE CHECKSUM: 7d5e3f23e4fb9e70511336e82aa7ca90020bb7a0

COCOAPODS: 1.12.1
14 changes: 10 additions & 4 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import UIKit
import Flutter
import flutter_local_notifications

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
GeneratedPluginRegistrant.register(with: registry)}

GeneratedPluginRegistrant.register(with: self)

if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}

return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HomeController extends GetxController with ExceptionHandler {
RxString title = "".obs;
RxString body = "".obs;

/// GET POST LIST
/// GET POST LIST 'HIVE IMPLEMENTED'
final postList = RxList<Posts>();

getPostList() async {
Expand Down Expand Up @@ -59,7 +59,6 @@ class HomeController extends GetxController with ExceptionHandler {

@override
void onReady() async {
// TODO: implement onReady
await getPostList();

super.onReady();
Expand Down
5 changes: 1 addition & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,14 @@ Future<void> main() async {
});

// Device info
// DeviceInfoHelper.initializeDeviceInfo();
// DeviceInfoHelper.initializeDeviceInfo();

// Shared pref
await MySharedPref.init();

// inti fcm services
// await FcmHelper.initFcm();

// FCM foreground message
// FirebaseMessaging.onMessage.listen(FcmHelper.fcmForegroundHandler);

// initialize local notifications service
// LocalNotificationHelper.initializeNotifications();

Expand Down
3 changes: 2 additions & 1 deletion lib/utils/fcm_notification/fcm_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:logger/logger.dart';

import '../../app/data/local/my_shared_pref.dart';

import 'local_notification_helper.dart';

class FcmHelper {
Expand All @@ -22,7 +23,7 @@ class FcmHelper {
// initialize fcm and firebase core
await Firebase.initializeApp(
// TODO: uncomment this line if you connected to firebase via cli
// options: DefaultFirebaseOptions.currentPlatform,
// options: DefaultFirebaseOptions.currentPlatform,
);

// initialize firebase
Expand Down
72 changes: 5 additions & 67 deletions lib/utils/fcm_notification/local_notification_helper.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_timezone/flutter_timezone.dart';
import 'package:logger/logger.dart';
import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart' as tz;

class LocalNotificationHelper {
static int id = 0;
Expand All @@ -24,56 +19,10 @@ class LocalNotificationHelper {

static void initializeNotifications() async {
WidgetsFlutterBinding.ensureInitialized();
await _configureLocalTimeZone();

const AndroidInitializationSettings initializationSettingsAndroid =
AndroidInitializationSettings('@mipmap/ic_launcher');

final List<DarwinNotificationCategory> darwinNotificationCategories =
<DarwinNotificationCategory>[
DarwinNotificationCategory(
'textCategory',
actions: <DarwinNotificationAction>[
DarwinNotificationAction.text(
'text_1',
'Action 1',
buttonTitle: 'Send',
placeholder: 'Placeholder',
),
],
),
DarwinNotificationCategory(
'plainCategory',
actions: <DarwinNotificationAction>[
DarwinNotificationAction.plain('id_1', 'Action 1'),
DarwinNotificationAction.plain(
'id_2',
'Action 2 (destructive)',
options: <DarwinNotificationActionOption>{
DarwinNotificationActionOption.destructive,
},
),
DarwinNotificationAction.plain(
'id_3',
'Action 3 (foreground)',
options: <DarwinNotificationActionOption>{
DarwinNotificationActionOption.foreground,
},
),
DarwinNotificationAction.plain(
'id_4',
'Action 4 (auth required)',
options: <DarwinNotificationActionOption>{
DarwinNotificationActionOption.authenticationRequired,
},
),
],
options: <DarwinNotificationCategoryOption>{
DarwinNotificationCategoryOption.hiddenPreviewShowTitle,
},
)
];

final DarwinInitializationSettings initializationSettingsDarwin =
DarwinInitializationSettings(
requestAlertPermission: true,
Expand All @@ -90,7 +39,6 @@ class LocalNotificationHelper {
),
);
},
notificationCategories: darwinNotificationCategories,
);

final LinuxInitializationSettings initializationSettingsLinux =
Expand Down Expand Up @@ -131,21 +79,10 @@ class LocalNotificationHelper {
static Future<void> _onNotificationTap(String? payload) async {
if (payload != null) {
// Use the payload data to navigate to the specific page
// await Get.find<HomeController>()
// .getNotifications(MySharedPref.getLangID() ?? "2");
//
// Get.key.currentState
// ?.pushNamed(Routes.NOTIFICATION_HOME, arguments: payload);
}
}

static Future<void> _configureLocalTimeZone() async {
if (kIsWeb || Platform.isLinux) {
return;
// Get.key.currentState
// ?.pushNamed(Routes.YOUR_PAGE, arguments: payload);
}
tz.initializeTimeZones();
final String timeZoneName = await FlutterTimezone.getLocalTimezone();
tz.setLocalLocation(tz.getLocation(timeZoneName));
}

static Future<void> _notificationTapBackground(
Expand Down Expand Up @@ -173,8 +110,9 @@ class LocalNotificationHelper {
priority: Priority.high,
ticker: 'ticker',
);
const NotificationDetails platformChannelSpecifics =
NotificationDetails(android: androidPlatformChannelSpecifics);
const NotificationDetails platformChannelSpecifics = NotificationDetails(
android: androidPlatformChannelSpecifics,
iOS: DarwinNotificationDetails());

await flutterLocalNotificationsPlugin.show(
id,
Expand Down
2 changes: 0 additions & 2 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import firebase_auth
import firebase_core
import firebase_messaging
import flutter_local_notifications
import flutter_timezone
import path_provider_foundation
import shared_preferences_foundation
import sqflite
Expand All @@ -25,7 +24,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin"))
FlutterTimezonePlugin.register(with: registry.registrar(forPlugin: "FlutterTimezonePlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
Expand Down
38 changes: 15 additions & 23 deletions pubspec.lock
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,10 @@ packages:
dependency: "direct main"
description:
name: flutter_native_splash
sha256: ba45d8cfbd778478a74696b012f33ffb6b1760c9bc531b21e2964444a4870dae
sha256: ecff62b3b893f2f665de7e4ad3de89f738941fcfcaaba8ee601e749efafa4698
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.3.2"
flutter_otp_text_field:
dependency: "direct main"
description:
Expand Down Expand Up @@ -555,14 +555,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_timezone:
dependency: "direct main"
description:
name: flutter_timezone
sha256: "4508018aba499c837f723e2e718259eb677410490638b7ea669b11113d083e68"
url: "https://pub.dev"
source: hosted
version: "1.0.7"
flutter_web_plugins:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -596,18 +588,18 @@ packages:
dependency: transitive
description:
name: gql
sha256: c2d4248adf2cc568976d9bb42803531232a981eff205b9931b73389e0665ac63
sha256: "56c5707f84128dfad2db16f513bbfe011f0dae96073bbdc4e6a9925915641a03"
url: "https://pub.dev"
source: hosted
version: "1.0.1-alpha+1690479830964"
version: "1.0.1-alpha+1691943394579"
gql_dedupe_link:
dependency: transitive
description:
name: gql_dedupe_link
sha256: "307a33a0723edd5d9de652e38f6ccb01fbf04b90464e32efca7a3fa9027367d3"
sha256: "80419ab0618dea72a0961617cf24fba690ff4e63fffdd57a701b0c7de08b8360"
url: "https://pub.dev"
source: hosted
version: "2.0.4-alpha+1690479831065"
version: "2.0.4-alpha+1691943394662"
gql_error_link:
dependency: transitive
description:
Expand All @@ -620,10 +612,10 @@ packages:
dependency: transitive
description:
name: gql_exec
sha256: "257b6eeb206343349b188a4bfe874ba5826ec7992461a97890ebf4802eaa9a86"
sha256: "7b8c816f1d4830a21ae37e107bb035073b2f5613acde8f76a7768a7eb23322d3"
url: "https://pub.dev"
source: hosted
version: "1.0.1-alpha+1690479830973"
version: "1.0.1-alpha+1691943394588"
gql_http_link:
dependency: transitive
description:
Expand All @@ -636,10 +628,10 @@ packages:
dependency: transitive
description:
name: gql_link
sha256: "6e429187a7c199c9a7bb7fc26c8ed0673dae9be3a00c8be6ecf15ba9b713b3cb"
sha256: "255a0262425b6efd9df2312fd90546105baaad22a98a9873dfca56efbe9163eb"
url: "https://pub.dev"
source: hosted
version: "1.0.1-alpha+1690479830981"
version: "1.0.1-alpha+1691943394596"
gql_transform_link:
dependency: transitive
description:
Expand Down Expand Up @@ -692,10 +684,10 @@ packages:
dependency: "direct dev"
description:
name: hive_generator
sha256: "65998cc4d2cd9680a3d9709d893d2f6bb15e6c1f92626c3f1fa650b4b3281521"
sha256: "06cb8f58ace74de61f63500564931f9505368f45f98958bd7a6c35ba24159db4"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "2.0.1"
html:
dependency: transitive
description:
Expand Down Expand Up @@ -1036,10 +1028,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: f39696b83e844923b642ce9dd4bd31736c17e697f6731a5adf445b1274cf3cd4
sha256: d29753996d8eb8f7619a1f13df6ce65e34bc107bef6330739ed76f18b22310ef
url: "https://pub.dev"
source: hosted
version: "2.3.2"
version: "2.3.3"
shared_preferences_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -1190,7 +1182,7 @@ packages:
source: hosted
version: "0.5.1"
timezone:
dependency: "direct main"
dependency: transitive
description:
name: timezone
sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0"
Expand Down
Loading

0 comments on commit bc02a2f

Please sign in to comment.