ja2375 / add_2_calendar

A really simple Flutter plugin to add events to each platform's default calendar..
MIT License
185 stars 111 forks source link

[iOS17] call to Add2Calendar.addEvent2Cal never returns #151

Open sperochon opened 8 months ago

sperochon commented 8 months ago

Hello,

Using: Flutter 3.16.5 add_2_calendar 3.0.1 Testing on iPhone with iOS 17 And compiling with Xcode 15 + sdk iOS 17

The issue is: the call to addEvent2Cal never returns. It is stuck (= the second line return isNativeCalendarShown; is never executed)

final isNativeCalendarShown = await Add2Calendar.addEvent2Cal(event);
return isNativeCalendarShown;

After spending a few hours, I've finally found the cause of this bug which is only 1 missing line 🤯😭. The fix https://github.com/ja2375/add_2_calendar/pull/136 forgot to call completion callback completion?(true) line 105 of file Add2CalendarPlugin.swift

if #available(iOS 17, *) {
    OperationQueue.main.addOperation {
        self.presentEventCalendarDetailModal(event: event, eventStore: eventStore)
    }
}

should be

if #available(iOS 17, *) {
    OperationQueue.main.addOperation {
        self.presentEventCalendarDetailModal(event: event, eventStore: eventStore)
    }
    completion?(true)
}

Thanks

sperochon commented 8 months ago

It seems that the PR https://github.com/ja2375/add_2_calendar/pull/150 will indirectly fix this issue too when it will be merged on master...

michaeljajou commented 3 months ago

Can we get this merged?