- New Platform.gd autoload: is_ios_safari() detects iPhone/iPad Safari via JavaScriptBridge UA check (no Chrome/CriOS), gating all iOS memory paths - ModelCache.release_model(url, etag): evicts a model from in-memory cache on iOS Safari when a unit leaves the board; no-op on other platforms so disk cache is always preserved for fast reload - unit_mesh_builder: stores resolved model URL+ETag per unit (_unit_model_urls, _unit_model_etags); calls ModelCache.release_model in the to_remove loop so PackedScene refs are freed as soon as the unit is pooled or freed - ContentCache.get_model_url_for_definition: stub for looking up a card's Model3D CDN URL without a loaded unit dict (foundation for future eviction paths) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
19 lines
764 B
GDScript
19 lines
764 B
GDScript
extends Node
|
|
## Platform — thin detection helpers for per-platform code paths.
|
|
##
|
|
## Usage:
|
|
## if Platform.is_ios_safari():
|
|
## ... # memory-constrained path
|
|
|
|
## Returns true when running on iOS Safari (web export, Safari UA, iPhone/iPad,
|
|
## not Chrome/CriOS). Used to gate memory-reduction paths for the ~300 MB per-tab
|
|
## limit that iOS Safari enforces.
|
|
static func is_ios_safari() -> bool:
|
|
if not OS.has_feature("web"):
|
|
return false
|
|
var ua: String = JavaScriptBridge.eval("navigator.userAgent")
|
|
var has_safari: bool = ua.contains("Safari")
|
|
var has_chrome: bool = ua.contains("Chrome") or ua.contains("CriOS")
|
|
var is_ios_device: bool = ua.contains("iPhone") or ua.contains("iPad")
|
|
return has_safari and not has_chrome and is_ios_device
|