Skip to content

Commit cae3b4f

Browse files
committed
bring blob message decoding helper method over to observable flow
1 parent 9aa3e08 commit cae3b4f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/store/epics/chatEpics.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ import ChatHandler from './helpers/ChatHandler';
3030
import { combineEpics } from 'redux-observable';
3131
import createDetectVisibilityObservable from './helpers/createDetectPageVisibilityObservable';
3232

33-
// let wsUrl = `${window.location.origin.replace('http', 'ws')}/api/ws/messages/all`;
34-
// if (Capacitor.isNativePlatform()) {
35-
// // wsUrl = 'wss://www.leapchat.org/api/ws/messages/all'
36-
// wsUrl = 'ws://10.0.2.2:8080/api/ws/messages/all'
37-
// }
38-
3933
import { authUrl, wsUrl } from './helpers/urls';
4034

4135
export const chatHandler = new ChatHandler(wsUrl);
@@ -130,6 +124,12 @@ function getAuthRequestSettings({ mID }) {
130124
return settings;
131125
}
132126

127+
// Helper for parsing response from Go API
128+
//
129+
// From https://stackoverflow.com/a/36183085
130+
const b64toBlob = (base64, type = 'application/octet-stream') =>
131+
fetch(`data:${type};base64,${base64}`).then(res => res.blob());
132+
133133
const connectionAlertTtlSeconds = 4;
134134

135135
const initConnectionEpic = (action$) =>

0 commit comments

Comments
 (0)