fix(statusbar): make the statusbar work on ios + greatly improve loadtimes

This commit is contained in:
cocobo1 2025-11-16 19:40:27 +02:00
parent 0bfc83b4d9
commit 01b36e7978
2 changed files with 6 additions and 16 deletions

View file

@ -24,7 +24,6 @@ export interface PluginSettingsStorage {
}
export interface BunnyPluginManifest extends BunnyManifest {
name: string;
readonly type: "plugin";
readonly spec: 3;
readonly main: string;

View file

@ -29,29 +29,20 @@ function getBarStyle() {
}
export default function fixStatusBar() {
const origSetBarStyle = StatusBar.setBarStyle;
if (Platform.OS == "android") {
const origSetBarStyle = StatusBar.setBarStyle;
StatusBar.setBarStyle = function (_style: any, ...args: any[]) {
return origSetBarStyle.call(this, getBarStyle(), ...args);
};
}
if (Platform.OS == "ios") {
if (Platform.OS === "ios") {
function applyStatusBar() {
const style = getBarStyle();
StatusBar.setBarStyle(style, true);
origSetBarStyle.call(StatusBar, style, true);
}
const unsubscribe = ThemeStore?.addChangeListener?.(applyStatusBar);
StatusBar.setBarStyle(getBarStyle());
let delay = 200;
for (let i = 0; i < 5; i++, delay *= 2) {
setTimeout(applyStatusBar, delay);
}
return unsubscribe;
applyStatusBar();
setInterval(applyStatusBar, 500);
}
}