Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: printScheduledTasks returns string #585

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions workmanager/ios/Classes/SwiftWorkmanagerPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -456,15 +456,17 @@ extension SwiftWorkmanagerPlugin: FlutterPlugin {
if #available(iOS 13.0, *) {
BGTaskScheduler.shared.getPendingTaskRequests { taskRequests in
if taskRequests.isEmpty {
print("[BGTaskScheduler] There are no scheduled tasks")
result(true)
let str = "[BGTaskScheduler] There are no scheduled tasks"
print(str)
result(str)
return
}
print("[BGTaskScheduler] Scheduled Tasks:")
var str = "[BGTaskScheduler] Scheduled Tasks:"
for taskRequest in taskRequests {
print("[BGTaskScheduler] Task Identifier: \(taskRequest.identifier) earliestBeginDate: \(taskRequest.earliestBeginDate?.formatted() ?? "")")
str += "\n[BGTaskScheduler] Task Identifier: \(taskRequest.identifier) earliestBeginDate: \(taskRequest.earliestBeginDate?.formatted() ?? "")"
}
result(true)
print(str)
result(str)
}
} else {
result(FlutterError(code: "99",
Expand Down
2 changes: 1 addition & 1 deletion workmanager/lib/src/workmanager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class Workmanager {
/// development/debugging.
///
/// Currently only supported on iOS and only on iOS 13+.
Future<void> printScheduledTasks() async =>
Future<String> printScheduledTasks() async =>
await _foregroundChannel.invokeMethod("printScheduledTasks");
}

Expand Down
Loading