Skip to content

Commit 39658bf

Browse files
authored
Merge pull request #508 from HSLdevcom/DT-6238
DT-6238 Fix virtualmonitor not working on some TVs
2 parents e22945f + 614fb22 commit 39658bf

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

src/ui/StopCardRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ const StopCardRow: FC<IProps> = ({
189189
'shortName.length',
190190
),
191191
hiddenRoutes: [],
192-
parentStation: stop.parentStation || null
192+
parentStation: stop.parentStation || null,
193193
};
194194
}),
195195
undefined,

src/ui/TrainDataPreparer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const createLineIdsArray = (data, hiddenRoutes) => {
2727
lineIds.push({
2828
gtfsId: stop.gtfsId,
2929
parentStation: {
30-
gtfsId: station.gtfsId
30+
gtfsId: station.gtfsId,
3131
},
3232
shortName: pattern.route.shortName,
3333
stringifiedPattern: stringifyPattern(pattern),

src/util/logoutUtil.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
const logoutChannel = new BroadcastChannel('logout');
1+
function isRunningOnTV() {
2+
const ua = navigator.userAgent;
3+
return /SmartTV|Tizen|Web0S|NetCast|AppleTV|HbbTV|GoogleTV|Android TV|Roku/i.test(
4+
ua,
5+
);
6+
}
7+
8+
const logoutChannel = !isRunningOnTV() ? new BroadcastChannel('logout') : null;
29

310
export const logout = setUser => {
4-
logoutChannel.postMessage('Logout');
11+
if (logoutChannel) {
12+
logoutChannel.postMessage('Logout');
13+
}
514
setUser({});
615
};
716

817
export const listenForLogoutAllTabs = setUser => {
9-
logoutChannel.onmessage = () => {
10-
logout(setUser);
11-
logoutChannel.close();
12-
};
18+
if (logoutChannel) {
19+
logoutChannel.onmessage = () => {
20+
logout(setUser);
21+
logoutChannel.close();
22+
};
23+
}
1324
};

0 commit comments

Comments
 (0)