fix(ios): resolve build errors and add missing configureNativeFetcher method

Fixed Swift compilation errors preventing iOS build:
- Added explicit self capture [self] in closures in DailyNotificationReactivationManager
- Removed invalid BGTaskScheduler.shared.registeredTaskIdentifiers API call
- Fixed initialization order in DailyNotificationModel (verifyEntities after container init)

Added missing configureNativeFetcher method to iOS plugin:
- Implemented method matching Android functionality
- Stores configuration in UserDefaults for persistence
- Registered method in pluginMethods array
- Supports both jwtToken and jwtSecret parameters for compatibility

This resolves the runtime error "configureNativeFetcher is not a function"
that was preventing the test app from configuring the plugin.
This commit is contained in:
Jose Olarte III
2025-12-11 16:44:18 +08:00
parent 332dfbad75
commit 1bfd87a0e4
10 changed files with 292 additions and 79 deletions
+24 -24
View File
@@ -18,7 +18,7 @@ import CoreData
* This extension adds CRUD operations and query helpers to the
* auto-generated NotificationContent Core Data class.
*/
extension NotificationContent {
extension NotificationContentEntity {
// MARK: - Constants
@@ -70,8 +70,8 @@ extension NotificationContent {
deliveryStatus: String? = nil,
deliveryAttempts: Int32 = 0,
metadata: String? = nil
) -> NotificationContent {
let entity = NotificationContent(context: context)
) -> NotificationContentEntity {
let entity = NotificationContentEntity(context: context)
let now = Date()
entity.id = id
@@ -112,7 +112,7 @@ extension NotificationContent {
static func create(
in context: NSManagedObjectContext,
from dict: [String: Any]
) -> NotificationContent? {
) -> NotificationContentEntity? {
guard let id = dict["id"] as? String else {
print("\(Self.TAG): Missing required 'id' field")
return nil
@@ -148,7 +148,7 @@ extension NotificationContent {
updatedAt = Date()
}
let entity = NotificationContent(context: context)
let entity = NotificationContentEntity(context: context)
entity.id = id
entity.pluginVersion = dict["pluginVersion"] as? String
entity.timesafariDid = dict["timesafariDid"] as? String
@@ -198,8 +198,8 @@ extension NotificationContent {
static func fetch(
by id: String,
in context: NSManagedObjectContext
) -> NotificationContent? {
let request: NSFetchRequest<NotificationContent> = NotificationContent.fetchRequest()
) -> NotificationContentEntity? {
let request: NSFetchRequest<NotificationContentEntity> = NotificationContentEntity.fetchRequest()
request.predicate = NSPredicate(format: "id == %@", id)
request.fetchLimit = 1
@@ -220,8 +220,8 @@ extension NotificationContent {
*/
static func fetchAll(
in context: NSManagedObjectContext
) -> [NotificationContent] {
let request: NSFetchRequest<NotificationContent> = NotificationContent.fetchRequest()
) -> [NotificationContentEntity] {
let request: NSFetchRequest<NotificationContentEntity> = NotificationContentEntity.fetchRequest()
do {
return try context.fetch(request)
@@ -241,8 +241,8 @@ extension NotificationContent {
static func query(
by timesafariDid: String,
in context: NSManagedObjectContext
) -> [NotificationContent] {
let request: NSFetchRequest<NotificationContent> = NotificationContent.fetchRequest()
) -> [NotificationContentEntity] {
let request: NSFetchRequest<NotificationContentEntity> = NotificationContentEntity.fetchRequest()
request.predicate = NSPredicate(format: "timesafariDid == %@", timesafariDid)
request.sortDescriptors = [NSSortDescriptor(key: "scheduledTime", ascending: true)]
@@ -261,11 +261,11 @@ extension NotificationContent {
* @param notificationType Notification type string
* @return Array of NotificationContent entities
*/
static func query(
by notificationType: String,
static func queryByNotificationType(
_ notificationType: String,
in context: NSManagedObjectContext
) -> [NotificationContent] {
let request: NSFetchRequest<NotificationContent> = NotificationContent.fetchRequest()
) -> [NotificationContentEntity] {
let request: NSFetchRequest<NotificationContentEntity> = NotificationContentEntity.fetchRequest()
request.predicate = NSPredicate(format: "notificationType == %@", notificationType)
request.sortDescriptors = [NSSortDescriptor(key: "scheduledTime", ascending: true)]
@@ -289,8 +289,8 @@ extension NotificationContent {
scheduledTimeBetween startDate: Date,
and endDate: Date,
in context: NSManagedObjectContext
) -> [NotificationContent] {
let request: NSFetchRequest<NotificationContent> = NotificationContent.fetchRequest()
) -> [NotificationContentEntity] {
let request: NSFetchRequest<NotificationContentEntity> = NotificationContentEntity.fetchRequest()
request.predicate = NSPredicate(
format: "scheduledTime >= %@ AND scheduledTime <= %@",
startDate as NSDate,
@@ -313,11 +313,11 @@ extension NotificationContent {
* @param deliveryStatus Delivery status string
* @return Array of NotificationContent entities
*/
static func query(
by deliveryStatus: String,
static func queryByDeliveryStatus(
_ deliveryStatus: String,
in context: NSManagedObjectContext
) -> [NotificationContent] {
let request: NSFetchRequest<NotificationContent> = NotificationContent.fetchRequest()
) -> [NotificationContentEntity] {
let request: NSFetchRequest<NotificationContentEntity> = NotificationContentEntity.fetchRequest()
request.predicate = NSPredicate(format: "deliveryStatus == %@", deliveryStatus)
request.sortDescriptors = [NSSortDescriptor(key: "scheduledTime", ascending: true)]
@@ -339,8 +339,8 @@ extension NotificationContent {
static func queryReadyForDelivery(
currentTime: Date,
in context: NSManagedObjectContext
) -> [NotificationContent] {
let request: NSFetchRequest<NotificationContent> = NotificationContent.fetchRequest()
) -> [NotificationContentEntity] {
let request: NSFetchRequest<NotificationContentEntity> = NotificationContentEntity.fetchRequest()
request.predicate = NSPredicate(format: "scheduledTime <= %@", currentTime as NSDate)
request.sortDescriptors = [NSSortDescriptor(key: "scheduledTime", ascending: true)]
@@ -421,7 +421,7 @@ extension NotificationContent {
static func deleteAll(
in context: NSManagedObjectContext
) -> Int {
let request: NSFetchRequest<NSFetchRequestResult> = NotificationContent.fetchRequest()
let request: NSFetchRequest<NSFetchRequestResult> = NotificationContentEntity.fetchRequest()
let deleteRequest = NSBatchDeleteRequest(fetchRequest: request)
do {