kiwix / kiwix-apple

Kiwix for offline access on iOS and macOS
https://apple.kiwix.org
GNU Lesser General Public License v3.0
438 stars 70 forks source link

Support ZIM files with Service Worker #341

Closed kelson42 closed 6 months ago

kelson42 commented 3 years ago

New ZIMit based ZIM file use Service Worker.

automactic commented 3 years ago

TLDR: I don't think this is really possible right now.

In iOS 14, browser apps can become the default browser by using com.apple.developer.web-browser entitlement. (e.g. use Firefox as the default browser on iPhone) This AFAIK is the only way to have WkWebView support service workers right now.

Kiwix is not a generic purpose internet browser and cannot use this entitlement (I can positively say the app will be rejected if we do it), therefore there doesn't seem to be a way to support this request

See apple doc for more: link

kelson42 commented 3 years ago

I have the same analysis. Kiwix is not a Web browser, therefore not concerned by the current "web browser app" approach.

This post is of interest as well https://dev.to/ben/will-ios-14-support-service-workers-in-wkwebview-5gn.

That said, the situation is evolving and it seems possible that WKWebView will support serive workers in the future.

For the moment, I believe this is important to ignore entries with the tag _sw:yes.

We will then re-evaluate the situation in a year.

automactic commented 3 years ago

ignore entries with the tag _sw:yes

Just to be clear: you mean not to show these files in the library right? What happens if user open such a file with kiwix?

kelson42 commented 3 years ago

Yes this is what I mean. If open locally, the. The zim will display an error because it can itself detect that SW are not supported.

automactic commented 3 years ago

What happens if user try to manually open such a file?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

kelson42 commented 3 years ago

Not sure, but a message should be displayed that to be displayed this ZIM file needs service workers and this is not available.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

kelson42 commented 1 year ago

This ticket should better be updated because two years have passed.

rgaudin commented 1 year ago

Couldn't find a definitive answer online. Seems like it's available for app-bound-domains (a selection of up to 10 static domains you declare in the app) but I could not find any information regarding custom url scheme and service workers with WKWebView. Should probably be tested but lack of information online might demonstrate a lack of interest

stephane-archer commented 1 year ago

Do you think Mac Os has the same limitation as iOS? Do you have more alternatives than WKWebView?

BenjaminJMueller commented 1 year ago

Can we expect an update here in the following months? Would be highly appreciated if Zimit files would work on iOS and macOS soon.

kelson42 commented 1 year ago

@rgaudin I have seen https://github.com/ionic-team/capacitor/issues/4122 which seems to confirm that SW are available for app-bounds-domain. That means that we could use such a bound-domain to allow SW:

rgaudin commented 1 year ago

Both needs to be tested as it's not guaranteed that it would be allowed

kelson42 commented 1 year ago

It seems that we will be able to create ZIM files without SW with Zimit in version 2.0. Therefore this feature request priority is significantly lowered.

kelson42 commented 6 months ago

Closing as this won’t be necessary anymore once zimit2 will be released.