mobile: make mobile flag runtime-configurable

we need to pass a few more things around but it's not that bad. This
will allow you to launch damus with --mobile for mobile testing without
recompilation.
This commit is contained in:
William Casarin
2024-05-31 00:52:27 -05:00
parent 83eab71148
commit 2305f1e50a
15 changed files with 101 additions and 99 deletions

View File

@@ -14,7 +14,7 @@ pub use account_management::AccountManagementView;
pub use account_switcher::AccountSelectionWidget;
pub use mention::Mention;
pub use note::Note;
pub use preview::{Preview, PreviewApp};
pub use preview::{Preview, PreviewApp, PreviewConfig};
pub use profile::{ProfilePic, ProfilePreview};
pub use relay::RelayView;
pub use side_panel::DesktopSidePanel;
@@ -53,16 +53,12 @@ pub fn hline(ui: &egui::Ui) {
#[inline]
#[allow(unreachable_code)]
pub fn is_mobile() -> bool {
#[cfg(feature = "emulate_mobile")]
{
return true;
}
pub fn is_compiled_as_mobile() -> bool {
#[cfg(any(target_os = "android", target_os = "ios"))]
{
true
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
{
false