Skip to content

Commit

Permalink
URI encode the URL message from JS to ObjC.
Browse files Browse the repository at this point in the history
Not sure how this ever worked by only doing a JSON.stringify is not good enough to pass a URI from JS to ObjC. Stray "/" characters were getting introduced that caused corruption and failed calls.

Fixes issue with Fold account info not getting properly saved off.
  • Loading branch information
paullinator committed Nov 29, 2016
1 parent d2b4656 commit f53ac51
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/js/airbitz-bridge-ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ function _native(functionName, cbid, args, block) {
if (args) {
data.args = args;
}
return openUrl(b, "bridge://airbitz.co/" + JSON.stringify(data), cbid);

var jsonStr = JSON.stringify(data)
var uriString = encodeURIComponent(jsonStr)

return openUrl(b, "bridge://airbitz.co/" + uriString, cbid);
}

function openUrl(block, url, cbid) {
Expand Down Expand Up @@ -159,7 +163,10 @@ function _bridge() {
},

writeData: function(key, value) {
_handleBlocking(_native('writeData', newId(), {'key': key, 'value': value}, true));
var nid = newId()
var nret = _native('writeData', nid, {'key': key, 'value': value}, true)
_handleBlocking(nret);
// _handleBlocking(_native('writeData', newId(), {'key': key, 'value': value}, true));
},

clearData: function() {
Expand Down

0 comments on commit f53ac51

Please sign in to comment.