Open sdlaver opened 1 year ago
Oh dear.
So maybe we need to have that conversation, again, about using the ability to autoplay a video or not as a way to feature detect low power mode being on or off.
On Android its much simpler https://stackoverflow.com/a/31896873
On Android its much simpler
I'm not sure this is a problem for native apps. Native apps aren't as aggressively paused as webpages are.
There are no web APIs for detecting low power mode, because of fingerprinting & security concerns.
Proposed solution:
I think that's good iff this also affects native apps. If it's only web apps that are affected, we should probably find a way to prevent wallet-adapter
from even making the call if it believes the device to be in low power mode.
On receipt of the callback, the wallet can display appropriate UI to the user, and then return control to the dApp.
In this event, should we just invent and throw a protocol error and let the dApp handle it? Again, hesitant to do that if it's only web apps that are affected.
Yes, it can affect native dApps as well. There's a fix for native dApps (on top of https://github.com/solana-mobile/mobile-wallet-adapter/issues/97) that involves giving a service handle for the backgrounded dApp to the wallet app.
should we just invent and throw a protocol error and let the dApp handle it?
To handle it, the dapp needs to be able to receive the protocol error. For a web dapp, if the websocket connection is never established, there's no way for the wallet to give it any error or result codes.
Sorry, I'm not being clear.
To handle it, the dapp needs to be able to receive the protocol error. For a web dapp, if the websocket connection is never established, there's no way for the wallet to give it any error or result codes.
I meant to throw the protocol error from the client. Call transact()
on the client. Client throws a SolanaMobileWalletAdapterProtocolError
if the phone is found to be in low-power mode (ie. it doesn't even bother trying to associate).
Details on a proposed client-only solution, here: #343.
When Battery Saver mode is enabled, Chrome web pages are paused immediately upon backgrounding. This breaks MWA, as the dapp is not able to communicate with the wallet.
Wallets should detect this case, and inform the user on why the connection failed, and how to address it (disable battery saver mode).