Docker Build and Push / build-image (push) Successful in 3m52s
根因: Tauri targetSdk 37 强制 edge-to-edge, MainActivity 不处理 IME Insets, 系统不再因键盘缩小窗口, 清单 adjustResize 失效, 键盘直接盖住 WebView。 - 新增 scripts/ci/android-softinput.sh: init 后注入 windowSoftInputMode=adjustResize, 并重写 MainActivity.kt 监听 IME Insets, 键盘可见时把高度加到内容容器底部 (API 30+), 让 WebView 真正变矮, 所有 bottom 弹层自动上移 - CI (android-build.yml) 与本地 build-apk.sh 在 init 之后、build 之前调用该脚本 (幂等) - 新增全局 useKeepInputVisible: 输入框聚焦后用 scroll-into-view-if-needed 滚入可视区, 覆盖页面滚动与 Popup 内部滚动 - 弹层补 max-height + 内部滚动, 防止键盘弹出后顶部被顶出屏幕 - calibrateSafeTop 在键盘弹出时保留旧值, 避免误判导致整页跳动
61 lines
2.6 KiB
React
61 lines
2.6 KiB
React
import { Routes, Route, Navigate, useLocation } from 'react-router-dom'
|
|
import MobileShell from './layouts/MobileShell.jsx'
|
|
import LoginPage from './pages/LoginPage.jsx'
|
|
import MacroPage from './pages/MacroPage.jsx'
|
|
import MonitorPage from './pages/MonitorPage.jsx'
|
|
import ServerDetail from './pages/monitor/ServerDetail.jsx'
|
|
import MePage from './pages/MePage.jsx'
|
|
import CheckinPage from './pages/checkin/CheckinPage.jsx'
|
|
import TaskPage from './pages/task/TaskPage.jsx'
|
|
import { useAuth } from './auth/AuthContext.jsx'
|
|
import { PowerSyncProvider } from './lib/powersync/react.jsx'
|
|
import useKeepInputVisible from './hooks/useKeepInputVisible.js'
|
|
|
|
// 默认落地页: 打卡 (V0.2 起打卡是第一个 Tab 且为默认选中)
|
|
const HOME_PATH = '/checkin'
|
|
|
|
// 已登录访问 /login 自动回默认页
|
|
function RedirectIfAuthed({ children }) {
|
|
const { user, loading } = useAuth()
|
|
if (loading) return null
|
|
if (user) return <Navigate to={HOME_PATH} replace />
|
|
return children
|
|
}
|
|
|
|
// 未登录访问受保护页面 → 跳 /login
|
|
function RequireAuth({ children }) {
|
|
const { user, loading } = useAuth()
|
|
const location = useLocation()
|
|
if (loading) return <div className="page-loading">加载中...</div>
|
|
if (!user) return <Navigate to="/login" state={{ from: location }} replace />
|
|
return children
|
|
}
|
|
|
|
export default function App() {
|
|
// 全局: 输入框聚焦时滚进可视区 (登录页与内页都覆盖)
|
|
useKeepInputVisible()
|
|
|
|
return (
|
|
<PowerSyncProvider>
|
|
<Routes>
|
|
<Route path="/login" element={<RedirectIfAuthed><LoginPage /></RedirectIfAuthed>} />
|
|
<Route element={<RequireAuth><MobileShell /></RequireAuth>}>
|
|
{/* 打卡为默认首页 */}
|
|
<Route path="/" element={<Navigate to={HOME_PATH} replace />} />
|
|
<Route path="/checkin" element={<CheckinPage />} />
|
|
{/* 任务模块 (V0.2): 首屏(最近项目+当前项目) / 项目列表 / 深链 (T-VW-08/09) */}
|
|
<Route path="/task" element={<TaskPage />} />
|
|
<Route path="/task/list" element={<TaskPage />} />
|
|
<Route path="/task/:pid" element={<TaskPage />} />
|
|
{/* 宏观: 新闻 / 经济文章 + 外接 ifinance 分类 (动态 tab); 报警已迁至监控 (V0.2.2) */}
|
|
<Route path="/macro" element={<Navigate to="/macro/news" replace />} />
|
|
<Route path="/macro/*" element={<MacroPage />} />
|
|
<Route path="/monitor" element={<MonitorPage />} />
|
|
<Route path="/monitor/server/:uuid" element={<ServerDetail />} />
|
|
<Route path="/me" element={<MePage />} />
|
|
</Route>
|
|
<Route path="*" element={<Navigate to={HOME_PATH} replace />} />
|
|
</Routes>
|
|
</PowerSyncProvider>
|
|
)
|
|
} |