* window.ForemMobile namespaced functions * Fix broken Buildkite * Wait for data-loaded before using Runtime in pack * Bring back sprockets base * Better error handling * Smal fixes to ConsumerApp to support Android platform * Fix typo * utilities/waitForDataLoaded.js * Update app/javascript/utilities/waitForDataLoaded.js Co-authored-by: Nick Taylor <nick@forem.com> * Review feedback * Fix failing spec * Cleanup promise * Remove old utility file * Add Cypress check for namespaced availability * More specs * Refactor to rely on ForemMobile for native bridge messaging * Fix spec/requests/api/v0/instances_spec.rb * Fix devices spec * Remove changes to /api/instance * Refactor to dynamic import * Fix typo * Fixed custom event detail payload for tests. * mock ForemMobile function instead of webkit call directly * failing jest test debug * Another attempt * Fixed broken test that was missing an onMainImageUrlChange prop on the component. * Fixed mobile bridging E2E tests. * Move Cypress tests to mobileFlows * Add JSDocs + cypress spec for injectJSMessage when logged out * Cleanup + Disable native image upload until AppStore approval Co-authored-by: Nick Taylor <nick@forem.com> Co-authored-by: Nick Taylor <nick@dev.to>
27 lines
847 B
JavaScript
27 lines
847 B
JavaScript
import { h, render } from 'preact';
|
|
import { RuntimeBanner } from '../runtimeBanner';
|
|
import { waitOnBaseData } from '../utilities/waitOnBaseData';
|
|
|
|
function loadElement() {
|
|
const container = document.getElementById('runtime-banner-container');
|
|
if (container) {
|
|
render(<RuntimeBanner />, container);
|
|
}
|
|
}
|
|
|
|
// This pack relies on the same logic as `packs/listings` & `packs/Chat`. The
|
|
// banner lives in every page (including the main feed) and a race condition
|
|
// occurs when the page initializes for the first time or when signing out (no
|
|
// cache request). In order to avoid this we defer the initialization until the
|
|
// page is actually ready.
|
|
waitOnBaseData()
|
|
.then(() => {
|
|
window.InstantClick.on('change', () => {
|
|
loadElement();
|
|
});
|
|
|
|
loadElement();
|
|
})
|
|
.catch((error) => {
|
|
Honeybadger.notify(error);
|
|
});
|