UX: Send background color to iPad app too
Previously, we were only updating mobile devices.
This commit is contained in:
parent
b2c94cc8ea
commit
f57ecf22e0
|
@ -1,7 +1,5 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import Mobile from "discourse/lib/mobile";
|
||||
import { setResolverOption } from "discourse-common/resolver";
|
||||
import { isAppWebview, postRNWebviewMessage } from "discourse/lib/utilities";
|
||||
|
||||
// Initializes the `Mobile` helper object.
|
||||
export default {
|
||||
|
@ -16,14 +14,5 @@ export default {
|
|||
site.set("isMobileDevice", Mobile.isMobileDevice);
|
||||
|
||||
setResolverOption("mobileView", Mobile.mobileView);
|
||||
|
||||
if (isAppWebview()) {
|
||||
later(() => {
|
||||
postRNWebviewMessage(
|
||||
"headerBg",
|
||||
$(".d-header").css("background-color")
|
||||
);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
import { later } from "@ember/runloop";
|
||||
import { isAppWebview, postRNWebviewMessage } from "discourse/lib/utilities";
|
||||
|
||||
// Send bg color to webview so iOS status bar matches site theme
|
||||
export default {
|
||||
name: "webview-background",
|
||||
after: "inject-objects",
|
||||
|
||||
initialize() {
|
||||
if (isAppWebview()) {
|
||||
later(() => {
|
||||
const header = document.querySelectorAll(".d-header")[0];
|
||||
if (header) {
|
||||
const styles = window.getComputedStyle(header);
|
||||
postRNWebviewMessage("headerBg", styles.backgroundColor);
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue