Skip to content

Conversation

@tuyen-vuduc
Copy link
Contributor

@tuyen-vuduc tuyen-vuduc commented Oct 17, 2021

At the moment, the lib doesn't allow to change the name of the background task on iOS, hence only one background task is allowed.

This PR will allow us as developers to define as many tasks as we desire and with any unique names we want.

There is an extra step to let iOS know about these names in our AppDeledgate.cs.

WorkmanagerPlugin.registerTask(withIdentifier: "task-identifier")

Readme is updated with instructions.

@ened
Copy link
Collaborator

ened commented Oct 29, 2021

@tuyen-vuduc hi & sorry for not coming back to this PR for such a long time.

To be honest I don't fully understand it yet, perhaps the change set is too big.

From my understanding:
To make unique refresh/processing tasks work in the background, developers will need to add all their task identifiers to the .plist file first, right. So instead of the single entry that we use currently, multiple are needed.
This may be a useful breaking change.

.registerTaskWithIdentifier - is supposed to be called when the App starts in AppDelegate, do we need to add warnings that this should ONLY be called in applicationDidFinishLaunch:withOptions ?

@tuyen-vuduc
Copy link
Contributor Author

@ened Yeah, that's right.

  1. We need to put any task names we want in info.plist
  2. We need to register in applicationDidFinishLaunch:withOptions

In my last two projects, we need more than one tasks with different names. And I think it'll be more natural to define the name we want, not the name hard-coded. That's why I create this PR.

@tuyen-vuduc tuyen-vuduc force-pushed the feature/ios-allow-to-define-custom-task-id branch from 9924a26 to 7c19d72 Compare October 31, 2021 00:21
Copy link
Collaborator

@ened ened left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could split this PR.
There are changes in iOS example setup, example file itself (the new nesting due to the scrollview prevents efficient review) and the good change itself. Possible?

@clragon
Copy link
Contributor

clragon commented Jan 10, 2022

are there any updates on this? having multiple tasks on iOS would be great.

@ened
Copy link
Collaborator

ened commented Jan 30, 2022

@tuyen-vuduc any chance you could pick this up again?

@tuyen-vuduc
Copy link
Contributor Author

@ened Yeah, I am about to finish this within the week.

@tuyen-vuduc tuyen-vuduc force-pushed the feature/ios-allow-to-define-custom-task-id branch from 7c19d72 to 70291cd Compare February 1, 2022 01:06
@tuyen-vuduc
Copy link
Contributor Author

@ened Could you check why the UT fails on CI/CD check?

@ened
Copy link
Collaborator

ened commented Feb 5, 2022

@ened Could you check why the UT fails on CI/CD check?

Can you please install flutter 2.10 on your machine, run flutter pub upgrade and push the changes? I had similar warnings earlier.

@ened
Copy link
Collaborator

ened commented Feb 6, 2022

hi @tuyen-vuduc, does https://stackoverflow.com/a/58224050/375209 help with the error you currently showing in the integration test log?

Copy link
Collaborator

@ened ened left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Let's get the docs right and sort the conflict. Then happy to merge.

@tuyen-vuduc
Copy link
Contributor Author

@ened is it ok for merging?

@tuyen-vuduc tuyen-vuduc requested a review from ened March 13, 2022 08:46
@tuyen-vuduc
Copy link
Contributor Author

@ened How are you? Are you planning to merge this PR?

@ened ened merged commit 01e93fd into fluttercommunity:main May 15, 2022
@tuyen-vuduc tuyen-vuduc deleted the feature/ios-allow-to-define-custom-task-id branch December 20, 2022 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants