Giter VIP home page Giter VIP logo

hybrid's People

Contributors

alastaircoote avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hydra1983

hybrid's Issues

Track multiple service workers inside ServiceWorkerRegistration

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.

importScripts issue with commas

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.

Take another look at MessagePorts

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.

Push Notifications

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.

Change rollup build to output iife

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.

PushSubscription object

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.

Render check is not scaled to screen resolution

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.

MessagePorts in client.postMessage

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.

Cache items with redirects

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.

importScripts()

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:

  • Take worker operations off the main thread (actually not difficult, PromiseKit has thenInBackground, then evaluate everything synchronously. But still need to resolve potential issue of evaluating code while we're evaluating code.
  • Apply a regex to the downloaded code and pick up 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.

Pushing a new webview via JS

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.

How to install `indexeddbshim`

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?

JS Promise bridge doesn't always work

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.

Notification onTap actions

  • onTap cannot open external links. Don't think it's actually possible for it to, as all notifications open the app. But need to look into it.
  • Also seems to be very inconsistent in opening that page - sometimes it just doesn't, other times it does then adds the default homepage afterwards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.