()
| 507 | const ready = async (ms = 8000, step = 60) => { |
| 508 | const start = Date.now(); |
| 509 | const ok = () => { |
| 510 | try { |
| 511 | const a = (App as any).android; |
| 512 | const act = a && (a.foregroundActivity || a.startActivity); |
| 513 | const inProg = !!g.__NS_DEV_RESET_IN_PROGRESS__; |
| 514 | return !!act && !inProg; |
| 515 | } catch { |
| 516 | return false; |
| 517 | } |
| 518 | }; |
| 519 | while (Date.now() - start < ms) { |
| 520 | if (ok()) return true; |
| 521 | await new Promise((r) => setTimeout(r, step)); |