gdnmobilelab / hybrid Goto Github PK
View Code? Open in Web Editor NEWHack project to try out service worker in iOS concept
Hack project to try out service worker in iOS concept
We're using our own custom PushSubscription object that is not at all compatible with the web one - need to write up how it's formatted and how you might use it to send notifications.
As per:
https://github.com/gdnmobilelab/hybrid/blob/dev/hybrid/HybridWebView.swift#L115
WebViewClient.postMessage()
should allow MessagePorts to be used to communicate back to the worker from the webview. We could implement this when communicating within the app itself, but it's not currently possible to facilitate that communication between the notification-content extension and the app, so we're not providing it at all (to be consistent).
The problem is that we can run two identical workers - one in the app, and the other in the notification extension. If the latter fires the postMessage()
, we can't send the port back to the app worker, as it won't know what to do with it. We also can't really fire it back in the notification extension, as we have no idea whether the content worker will still be available (in most postMessage cases, we will have closed the notification).
No immediate answers come to mind. TBD.
Right now, we push a new view onto our navigation stack by interception clicks on <a>
tags. But sometimes we're going to want to do this programatically. Right now we can do:
window.hybridEvents.emit('pushWebview','/');
but we need something better than that.
The bridge function binds when the JS code calls then()
or catch()
. But, it seems like that doesn't work if it's inside a function, like:
.then(function() {
return promisedThing
}
.then(function() {
})
I guess because the promise library doesn't actually call promisedThing.then()
at any point. Not sure what the answer is right now. To be revisited.
Which makes it lose its video and canvas views, for some reason
I found you used indexeddbshim
, but not the one in js-src/package.json
.
It looks like packaged IndexedDBShim-node6, but can't be installed directly from GitHub because they have different package names.
So how can I install the right indexeddbshim
?
The domain checker fails because it's looking in main bundle, not app bundle
Need to look up the exact criteria
Right now it just outputs an ES module, but I've discovered this means that the variables it sets can actually be overwritten, which breaks core functionality. format: 'iife'
will mean the whole thing is wrapped in a function that'll stop this from occurring.
Browsing through the code, it could do with some extra examination. Still remaining issue with not knowing when MessagePorts are disposed of on web side, and when to dispose of them in native.
We want to be able to use it to recreate a video later on.
Also we should be able to pass an existing notification video to have it do the same thing.
Doesn't currently exist as we've been using code bundlers that mean it isn't necessary, but it's a key part of the spec a lot of people use.
Key issue with it is that it's synchronous, and can involve network operations, which can take a lot of time. If they happen on the main thread then the app is going to become unresponsive. I'm also not entirely sure what happens when we try to execute JS in the context of a function call that's already happening.
There are two implementation options:
thenInBackground
, then evaluate everything synchronously. But still need to resolve potential issue of evaluating code while we're evaluating code.importScripts()
calls, replace them with script content. Sounds gross, but I can't think of any reason why it wouldn't work in the exact same way.Right now the render checker is checking an image that's blurry, since it is being scaled down to 1x. As a result, the box we're checking for needs to be more than 1px big in order to be read successfully.
I've started a branch called high-res-render-check
to tackle this, but it isn't that important right now so it's on the back burner.
Is there a chance the indexes will get confused?
UglifyJS ends up putting an importScripts() call in a series of comma-separated declarations, and the script currently injects a semicolon, which breaks that. Need to come up with an answer that doesn't cause some other knock-on issues.
Not sure what even happens with this right now, depends if Alamofire follows 301/302 redirects or not. But we might need to map the stored cache URLs so that they forward to our local URLs rather than the real ones.
Right now ServiceWorkerRegistration only tracks one worker, returning it in the active, waiting and installing attributes if the install state matches. We should track multiple workers - e.g. one in active, but another incoming worker in installing.
Right now the notification extension parses the payload JSON and extracts "notification.show" commands, and sets the content to whatever is specified. That's not great, because it ties in a dependency to our custom commands.
Problems to overcome:
the notification extension has an incredibly low memory limit, meaning that we can't load a worker in it. So we can't parse push events there.
the app didReceiveNotification function doesn't get called if the user force quit the app
Thinking the answer will involve:
extra title and body keys to be sent along with any notification request to act as placeholders for the iOS notification
didReceiveNotification can hopefully fire and replace that content if necessary. But we can't depend on it.
this doesn't leave the notification service with all that much to do. Maybe optionally add images? That's about it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.