Module: Everywhere::Config::Shell
- Included in:
- Everywhere::Config
- Defined in:
- lib/everywhere/config/shell.rb
Instance Method Summary collapse
-
#native_lazy_load_tabs(target: nil) ⇒ Object
The two
native:knobs that ship inside everywhere.json rather than being compiled in, resolved for the platform being stamped. - #native_splash_min_seconds(target: nil) ⇒ Object
-
#to_shell_hash(target: nil) ⇒ Object
The subset the shell needs, shipped as JSON (env var in dev, Resources/everywhere.json inside a bundled .app).
- #to_shell_json(target: nil) ⇒ Object
Instance Method Details
#native_lazy_load_tabs(target: nil) ⇒ Object
The two native: knobs that ship inside everywhere.json rather than
being compiled in, resolved for the platform being stamped. They read the
target's own section: everywhere.json is written once per target, so an
Android build that inherited native.ios.lazy_load_tabs would silently
apply a decision the app made about a different shell — and the two
platforms load tabs differently enough that the answer legitimately
differs. Without a target (the desktop dev loop, and every caller written
before Android existed) the iOS answer stands, which is what those
callers have always gotten.
15 16 17 |
# File 'lib/everywhere/config/shell.rb', line 15 def native_lazy_load_tabs(target: nil) android_target?(target) ? native_android_lazy_load_tabs : native_ios_lazy_load_tabs end |
#native_splash_min_seconds(target: nil) ⇒ Object
19 20 21 |
# File 'lib/everywhere/config/shell.rb', line 19 def native_splash_min_seconds(target: nil) android_target?(target) ? native_android_splash_min_seconds : native_ios_splash_min_seconds end |
#to_shell_hash(target: nil) ⇒ Object
The subset the shell needs, shipped as JSON (env var in dev,
Resources/everywhere.json inside a bundled .app). Pass target: so the
packaged config reflects the platform being built (its bundle id / name).
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/everywhere/config/shell.rb', line 26 def to_shell_hash(target: nil) { "name" => name(target: target), "bundle_id" => bundle_id(target: target), "version" => version(target: target), "mode" => mode, "remote_url" => remote_url, "remote_instances" => (true if remote_instances?), "entry_path" => entry_path, "tint_color" => tint_color, "background_color" => background_color, "menu" => ( unless .empty?), "tray" => (tray unless tray.empty?), "window" => window_shell_hash, "lazy_load_tabs" => native_lazy_load_tabs(target: target), "splash_min_seconds" => native_splash_min_seconds(target: target), "updates" => updates_shell_hash, "permissions" => (.keys unless .empty?), "auth" => auth_shell_hash, # Hosts the shell treats as its own for incoming universal links, so a # tapped link to any associated domain opens in-app rather than Safari. "universal_link_hosts" => (deep_linking_domains if deep_linking? && !deep_linking_domains.empty?) }.compact end |
#to_shell_json(target: nil) ⇒ Object
51 52 53 54 |
# File 'lib/everywhere/config/shell.rb', line 51 def to_shell_json(target: nil) require "json" JSON.generate(to_shell_hash(target: target)) end |