update status js api according to latest changes in web3 opt-in EIP

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-08-27 11:26:05 +03:00
parent bca9ae25af
commit b754092710
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
2 changed files with 14 additions and 10 deletions

View File

@ -20,8 +20,9 @@ WebViewBridge.onMessage = function (message) {
}
else
{
window.STATUS_API = data.data;
window.postMessage({ type: 'STATUS_API_SUCCESS', permissions: data.keys }, "*");
window.dispatchEvent(new CustomEvent('statusapi', { detail: { permissions: data.keys,
data: data.data
} }));
}
}

View File

@ -78,14 +78,17 @@
{:db (assoc-in db [:browser/options :show-permission] {:requested-permission requested-permission
:params params})})
{:dispatch [:next-dapp-permission params]}))
(assoc (update-dapp-permissions-fx cofx {:dapp dapp-name
:permissions (vec (set (concat (keys permissions-allowed)
user-permissions)))})
:send-to-bridge-fx [{:type constants/status-api-success
:data permissions-allowed
:keys (keys permissions-allowed)}
(:webview-bridge db)]
:dispatch [:check-permissions-queue])))
(cond-> (update-dapp-permissions-fx cofx {:dapp dapp-name
:permissions (vec (set (concat (keys permissions-allowed)
user-permissions)))})
(not (zero? (count permissions-allowed)))
(assoc :send-to-bridge-fx [{:type constants/status-api-success
:data permissions-allowed
:keys (keys permissions-allowed)}
(:webview-bridge db)])
true
(assoc :dispatch [:check-permissions-queue]))))
(defn next-permission [{:keys [params permission permissions-data]} cofx]
(request-permission