Skip to content

Commit

Permalink
Merge pull request builttoroam#431 from lucky-lusa/develop
Browse files Browse the repository at this point in the history
While I cannot vouch for how well it did in background / isolate, adding those lines does not impact current use cases.
  • Loading branch information
thomassth authored Oct 1, 2022
2 parents 45a3989 + 6f1c1dc commit 405ed57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {
}

private fun arePermissionsGranted(): Boolean {
if (atLeastAPI(23)) {
if (atLeastAPI(23) && _binding != null) {
val writeCalendarPermissionGranted = _binding!!.activity.checkSelfPermission(Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED
val readCalendarPermissionGranted = _binding!!.activity.checkSelfPermission(Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED
return writeCalendarPermissionGranted && readCalendarPermissionGranted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class DeviceCalendarPlugin() : FlutterPlugin, MethodCallHandler, ActivityAware {
context = flutterPluginBinding.applicationContext
channel = MethodChannel(flutterPluginBinding.binaryMessenger, CHANNEL_NAME)
channel.setMethodCallHandler(this)
_calendarDelegate = CalendarDelegate(null, context!!)
}

override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
Expand Down

0 comments on commit 405ed57

Please sign in to comment.