Skip to content

Commit

Permalink
Decode string that is received in Universal bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
rleojoseph committed Oct 16, 2023
1 parent c964195 commit 9e914c2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion js-miniapp-bridge/src/common-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,16 @@ export class MiniAppBridge {
* @param {[String]} value Additional message sent from the native on invoking for the eventType
*/
execCustomEventsCallback(eventType: string, value: string) {

// This fix is added to decode the string from the host app.
// Reason: Some characters are not escaped properly, so the data is encoded in the native application
// and decoded here.
let decoded = ''
if (eventType === "miniappreceivejsoninfo") {
decoded = atob(value)
}
const event = new CustomEvent(eventType, {
detail: { message: value },
detail: { message: decoded },
});
let queueObj = mabCustomEventQueue.filter(
customEvent => customEvent === event
Expand Down

0 comments on commit 9e914c2

Please sign in to comment.