Since the same code will be running on Desktop AND Android version, sometimes I need to run platform specific code.
Is there some “synchronous” easy way to tell I’m running on Android?
Currently I’m using this ugly monstrosity which I would like to replace with something nicer:
// NOTE: platform info is not available from content scripts!
export let isAndroid = false;
// currently only Firefox can be Android
export const isAndroidPromise = $IS_FIREFOX && !$IS_THUNDERBIRD && browser.runtime.getPlatformInfo ?
browser.runtime.getPlatformInfo().then(({os}) => isAndroid = os === 'android') :
Promise.resolve(false);