Skip to content

Commit

Permalink
fix #43 and #45
Browse files Browse the repository at this point in the history
  • Loading branch information
adzukimame committed May 26, 2024
1 parent ca937e3 commit 09dee4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
17 changes: 8 additions & 9 deletions packages/frontend/src/boot/main-boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,15 @@ export async function mainBoot() {
}
});

document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') {
setTimeout(() => {
const state = stream.getReadyState();
if (state === 2 || state === 3) {
if (/ipad|mobile|iphone|android/.test(navigator.userAgent.toLowerCase())) {
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') {
setTimeout(() => {
stream.reconnect();
}
}, 500);
}
});
}, 500);
}
});
}

for (const plugin of ColdDeviceStorage.get('plugins').filter(p => p.active)) {
import('@/plugin.js').then(async ({ install }) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/misskey-js/etc/misskey-js.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2858,8 +2858,6 @@ export class Stream extends EventEmitter<StreamEvents> {
// (undocumented)
disconnectToChannel(connection: NonSharedConnection): void;
// (undocumented)
getReadyState(): number;
// (undocumented)
heartbeat(): void;
// (undocumented)
ping(): void;
Expand Down
4 changes: 0 additions & 4 deletions packages/misskey-js/src/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
this.stream.reconnect();
}

public getReadyState(): number {
return this.stream.readyState;
}

/**
* Close this connection
*/
Expand Down

0 comments on commit 09dee4a

Please sign in to comment.