package top.yeij.hearth.webview import top.yeij.hearth.webapp.Tab // webAPP 内容 WebView 宿主接口:由 MainActivity 实现,管理多 WebView 的生命周期、 // 可见性、导航,并把标签状态同步回桌面 H5 顶栏 // Web app content WebView host interface: implemented by MainActivity, managing // multi-WebView lifecycle, visibility, and navigation, and syncing tab state // back to the desktop H5 topbar interface WebAppHost { // 创建内容 WebView 加载 url 并显示(已存在则切换到该标签);ua 为清单声明的 UA, // scale 为清单声明的初始缩放百分比(可为 null) // Create a content WebView loading url and show it (switch if already open); // ua is the manifest-declared UA, scale is the initial zoom percentage (nullable) fun openWebView(id: String, url: String, ua: String?, scale: Int?) // 销毁对应内容 WebView // Destroy the corresponding content WebView fun closeWebView(id: String) // 切换可见内容 WebView(其它内容 WebView GONE) // Switch the visible content WebView (hide the others with GONE) fun switchWebView(id: String) // 当前可见 WebView 回退,无历史返回 false // Go back on the visible WebView, false when no history fun goBack(): Boolean // 当前可见 WebView 前进,无历史返回 false // Go forward on the visible WebView, false when no history fun goForward(): Boolean // 当前可见 WebView 重载 // Reload the visible WebView fun reload() // 将标签状态推送到桌面 H5 顶栏 // Push the tab state to the desktop H5 topbar fun syncTabs(tabs: List) // 隐藏所有内容 WebView(把前台 webapp 丢到后台,标签状态保留) // Hide all content WebViews (send the foreground webapp to background, // keeping the tab state) fun hideAll() }