Skip to content

Commit fe1e39b

Browse files
committed
.
1 parent 37bde31 commit fe1e39b

3 files changed

Lines changed: 25 additions & 7 deletions

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,19 @@ module openflow {
296296
if (!this.$scope.$$phase) { this.$scope.$apply(); }
297297
}
298298
}
299+
function iosGetOnesignalToken() {
300+
return new Promise<any>(async (resolve, reject) => {
301+
try {
302+
(window as any).bridge.post('onesignaltoken', {}, (results, error) => {
303+
if (error) { return reject(error); }
304+
console.log(results);
305+
resolve(results);
306+
});
307+
} catch (error) {
308+
reject(error);
309+
}
310+
});
311+
}
299312
export class LoginCtrl {
300313
public localenabled: boolean = false;
301314
public providers: any = false;
@@ -354,8 +367,8 @@ module openflow {
354367
}
355368
}
356369
try {
357-
console.debug("iosGetOnesignalToken");
358-
var results = await openflow.iosGetOnesignalToken();
370+
console.debug("LoginCtrl::iosGetOnesignalToken");
371+
var results = await iosGetOnesignalToken();
359372
q.onesignalid = results.token;
360373
} catch (error) {
361374
console.log(error);

OpenFlow/src/public/WebSocketClient.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module openflow {
2828
public id: string;
2929
public message: any;
3030
}
31-
export function iosGetOnesignalToken() {
31+
function iosGetOnesignalToken() {
3232
return new Promise<any>(async (resolve, reject) => {
3333
try {
3434
(window as any).bridge.post('onesignaltoken', {}, (results, error) => {
@@ -40,7 +40,6 @@ module openflow {
4040
reject(error);
4141
}
4242
});
43-
4443
}
4544
export class WebSocketClient {
4645
private _socketObject: ReconnectingWebSocket = null;
@@ -96,7 +95,13 @@ module openflow {
9695
var q: SigninMessage = new SigninMessage();
9796
this.getJSON("/jwt", async (error: any, data: any) => {
9897
try {
99-
if (data === null || data === undefined || (data.jwt === "" && data.rawAssertion === "")) {
98+
if (data === null || data === undefined) {
99+
if ((data.jwt === null || data.jwt === undefined || data.jwt.trim() === "") ||
100+
(data.rawAssertion === null || data.rawAssertion === undefined || data.rawAssertion.trim() === "")) {
101+
data = null;
102+
}
103+
}
104+
if (data === null || data === undefined) {
100105
if (this.$location.path() !== "/Login") {
101106
console.log("path: " + this.$location.path());
102107
console.log("WebSocketClient::onopen: Not signed in, redirect /Login");
@@ -130,7 +135,7 @@ module openflow {
130135
}
131136
}
132137
try {
133-
console.debug("iosGetOnesignalToken");
138+
console.debug("WebSocketClient::iosGetOnesignalToken");
134139
var results = await iosGetOnesignalToken();
135140
q.onesignalid = results.token;
136141
} catch (error) {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.130
1+
0.0.131

0 commit comments

Comments
 (0)