Skip to content

Commit

Permalink
add: fcm
Browse files Browse the repository at this point in the history
  • Loading branch information
YumNumm committed May 7, 2023
1 parent 60a81f2 commit aa22148
Show file tree
Hide file tree
Showing 38 changed files with 1,403 additions and 284 deletions.
250 changes: 179 additions & 71 deletions .dart_tool/package_config.json

Large diffs are not rendered by default.

Binary file modified assets/images/earthquake_happened.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions ios/FcmServiceExtension/FcmServiceExtension.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.awn.50b0def6</string>
</array>
</dict>
</plist>
13 changes: 13 additions & 0 deletions ios/FcmServiceExtension/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.usernotifications.service</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
</dict>
</dict>
</plist>
35 changes: 35 additions & 0 deletions ios/FcmServiceExtension/NotificationService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// NotificationService.swift
// FcmServiceExtension
//
// Created by 尾上 遼太朗 on 2023/05/08.
//

import UserNotifications

class NotificationService: UNNotificationServiceExtension {

var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?

override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

if let bestAttemptContent = bestAttemptContent {
// Modify the notification content here...
bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"

contentHandler(bestAttemptContent)
}
}

override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
contentHandler(bestAttemptContent)
}
}

}
74 changes: 73 additions & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,84 @@ flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
... # Here are some configurations automatically generated by flutter

# Start of the permission_handler configuration
target.build_configurations.each do |config|

# You can enable the permissions needed here. For example to enable camera
# permission, just remove the `#` character in front so it looks like this:
#
# ## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1'
#
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',

## dart: PermissionGroup.calendar
# 'PERMISSION_EVENTS=1',

## dart: PermissionGroup.reminders
# 'PERMISSION_REMINDERS=1',

## dart: PermissionGroup.contacts
# 'PERMISSION_CONTACTS=1',

## dart: PermissionGroup.camera
# 'PERMISSION_CAMERA=1',

## dart: PermissionGroup.microphone
# 'PERMISSION_MICROPHONE=1',

## dart: PermissionGroup.speech
# 'PERMISSION_SPEECH_RECOGNIZER=1',

## dart: PermissionGroup.photos
# 'PERMISSION_PHOTOS=1',

## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
# 'PERMISSION_LOCATION=1',

## dart: PermissionGroup.notification
'PERMISSION_NOTIFICATIONS=1',

## dart: PermissionGroup.mediaLibrary
# 'PERMISSION_MEDIA_LIBRARY=1',

## dart: PermissionGroup.sensors
# 'PERMISSION_SENSORS=1',

## dart: PermissionGroup.bluetooth
# 'PERMISSION_BLUETOOTH=1',

## dart: PermissionGroup.appTrackingTransparency
# 'PERMISSION_APP_TRACKING_TRANSPARENCY=1',

## dart: PermissionGroup.criticalAlerts
# 'PERMISSION_CRITICAL_ALERTS=1'
]

end
# End of the permission_handler configuration
end
end

################ Awesome Notifications FCM pod mod ###################
awesome_fcm_pod_file = File.expand_path(File.join('plugins', 'awesome_notifications_fcm', 'ios', 'Scripts', 'AwesomeFcmPodFile'), '.symlinks')
require awesome_fcm_pod_file
target 'FcmServiceExtension' do
use_frameworks!
use_modular_headers!

install_awesome_fcm_ios_pod_target File.dirname(File.realpath(__FILE__))
end
update_awesome_fcm_service_target('FcmServiceExtension', File.dirname(File.realpath(__FILE__)), flutter_root)
################ Awesome Notifications FCM pod mod ###################

191 changes: 185 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,22 +1,201 @@
PODS:
- awesome_notifications (0.0.5):
- Flutter
- IosAwnCore (= 0.7.3)
- awesome_notifications_fcm (0.7.3):
- awesome_notifications
- Firebase
- Firebase/Messaging
- Flutter
- IosAwnCore (= 0.7.3)
- IosAwnFcmDist (= 0.7.5)
- Firebase (10.7.0):
- Firebase/Core (= 10.7.0)
- Firebase/Analytics (10.7.0):
- Firebase/Core
- Firebase/Core (10.7.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 10.7.0)
- Firebase/CoreOnly (10.7.0):
- FirebaseCore (= 10.7.0)
- Firebase/Messaging (10.7.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 10.7.0)
- firebase_analytics (10.3.0):
- Firebase/Analytics (= 10.7.0)
- firebase_core
- Flutter
- firebase_core (2.11.0):
- Firebase/CoreOnly (= 10.7.0)
- Flutter
- firebase_messaging (14.5.0):
- Firebase/Messaging (= 10.7.0)
- firebase_core
- Flutter
- FirebaseAnalytics (10.7.0):
- FirebaseAnalytics/AdIdSupport (= 10.7.0)
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- FirebaseAnalytics/AdIdSupport (10.7.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleAppMeasurement (= 10.7.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- FirebaseCore (10.7.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Logger (~> 7.8)
- FirebaseCoreInternal (10.9.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseInstallations (10.9.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseMessaging (10.7.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.2)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Reachability (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30910.0, >= 2.30908.0)
- Flutter (1.0.0)
- shared_preferences_ios (0.0.1):
- GoogleAppMeasurement (10.7.0):
- GoogleAppMeasurement/AdIdSupport (= 10.7.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (10.7.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.7.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (10.7.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/MethodSwizzler (~> 7.8)
- GoogleUtilities/Network (~> 7.8)
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- nanopb (< 2.30910.0, >= 2.30908.0)
- GoogleDataTransport (9.2.3):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.11.1):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.11.1):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.11.1):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.11.1):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.11.1):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.11.1)"
- GoogleUtilities/Reachability (7.11.1):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.11.1):
- GoogleUtilities/Logger
- IosAwnCore (0.7.3)
- IosAwnFcmDist (0.7.5):
- IosAwnCore (= 0.7.3)
- nanopb (2.30909.0):
- nanopb/decode (= 2.30909.0)
- nanopb/encode (= 2.30909.0)
- nanopb/decode (2.30909.0)
- nanopb/encode (2.30909.0)
- permission_handler_apple (9.0.4):
- Flutter
- PromisesObjC (2.2.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- awesome_notifications (from `.symlinks/plugins/awesome_notifications/ios`)
- awesome_notifications_fcm (from `.symlinks/plugins/awesome_notifications_fcm/ios`)
- firebase_analytics (from `.symlinks/plugins/firebase_analytics/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)

SPEC REPOS:
trunk:
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreInternal
- FirebaseInstallations
- FirebaseMessaging
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleUtilities
- IosAwnCore
- IosAwnFcmDist
- nanopb
- PromisesObjC

EXTERNAL SOURCES:
awesome_notifications:
:path: ".symlinks/plugins/awesome_notifications/ios"
awesome_notifications_fcm:
:path: ".symlinks/plugins/awesome_notifications_fcm/ios"
firebase_analytics:
:path: ".symlinks/plugins/firebase_analytics/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_messaging:
:path: ".symlinks/plugins/firebase_messaging/ios"
Flutter:
:path: Flutter
shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences_ios/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"

SPEC CHECKSUMS:
awesome_notifications: d63d9a25f126860f9a600850d99772237895b3ba
awesome_notifications_fcm: 7e2d7ab4ca1826fe3a9a5ca96771ace73e05db48
Firebase: 0219acf760880eeec8ce479895bd7767466d9f81
firebase_analytics: 216977fc8c05f54c2c4935181e3f1a368949c5cd
firebase_core: dee76ded6c693fdb38b8ea39aef7129e32e587a3
firebase_messaging: 67fbcdaf6a7c81849590e542eff2409dc49d9fa5
FirebaseAnalytics: f8133442ee6f8512e28ff19e62ce15398bfaeace
FirebaseCore: e317665b9d744727a97e623edbbed009320afdd7
FirebaseCoreInternal: d2b4acb827908e72eca47a9fd896767c3053921e
FirebaseInstallations: c58489c9caacdbf27d1da60891a87318e20218e0
FirebaseMessaging: ac9062bcc35ed56e15a0241d8fd317022499baf8
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
GoogleAppMeasurement: fe17c92a32207dd5cdd4e8d742767f2da74857f6
GoogleDataTransport: f0308f5905a745f94fb91fea9c6cbaf3831cb1bd
GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
IosAwnCore: 6494e0e174d49f04f513e8a002187be226889a37
IosAwnFcmDist: 47578dd46472304b20f1965ad12cc893c877e57c
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: 7a17730a34a5addcab10013947231587146b4d7a

COCOAPODS: 1.12.0
Loading

0 comments on commit aa22148

Please sign in to comment.