The Android app translates copy by looking it up in a dictionary. 33 strings had no entry, so English, Japanese and Polish users saw them in Chinese: the default dialog OK button, the Sign in button, the editor save statuses (Saving, Local draft, Not saved), revision restore states, search empty state, and delete, upload, load and connection errors. Add English, Japanese and Polish entries for them and a test that keeps them translated. On iOS, the launch spinner showed "启动中…" for every language; it now follows the app language.
36 lines
1.1 KiB
Swift
36 lines
1.1 KiB
Swift
import SwiftUI
|
|
|
|
struct RootView: View {
|
|
@Environment(AppEnvironment.self) private var env
|
|
|
|
var body: some View {
|
|
Group {
|
|
if env.session.isLoading {
|
|
ProgressView(env.preferences.t("启动中…", en: "Starting…", ja: "起動しています…", pl: "Uruchamianie…"))
|
|
} else if env.session.isSignedIn {
|
|
WorkspaceView()
|
|
} else {
|
|
LoginView()
|
|
}
|
|
}
|
|
.task {
|
|
await env.bootstrap()
|
|
await AutoLogin.attemptIfConfigured(env: env)
|
|
}
|
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
|
Task {
|
|
if env.session.isSignedIn {
|
|
await env.runSyncCycle()
|
|
}
|
|
}
|
|
}
|
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification)) { _ in
|
|
Task {
|
|
if let scope = env.session.dataScope {
|
|
_ = try? await env.outboxFlusher.flush(scope: scope)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|