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

Add background processing for notification #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

loc9493
Copy link

@loc9493 loc9493 commented Aug 11, 2023

  • When app enter background mode, url request will be terminated.
  • When notifications received, using background task to poll for new notifications and display it.

func backgroundPoll(_ subscription: Subscription, completionHandler: @escaping ([Message]) -> Void) {
let user = store.getUser(baseUrl: subscription.baseUrl!)?.toBasicUser()
Log.d(tag, "Polling from \(subscription.urlString()) with user \(user?.username ?? "anonymous")")
let backgroundConfig = URLSessionConfiguration.background(withIdentifier: "com.example.myapp.background")
Copy link

Choose a reason for hiding this comment

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

Is this identifier correct? (Or important?)

Copy link
Author

Choose a reason for hiding this comment

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

It can be any String, no need to be the same with app identifier

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.

2 participants