-
Notifications
You must be signed in to change notification settings - Fork 2
iOS: unify host connection status in navigation bar #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7211bed
446540d
45f7851
54d05d2
5af6c62
91fd90c
a1fe2fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,12 +2,28 @@ import SwiftUI | |
| import UIKit | ||
|
|
||
| struct FilesHeaderStrip: View { | ||
| @EnvironmentObject private var syncService: SyncService | ||
|
|
||
| let relativePath: String | ||
| let language: FilesLanguage | ||
| let fileSize: Int | ||
| let isFilesLive: Bool | ||
| let transitionNamespace: Namespace.ID? | ||
|
|
||
| private var filesBrowserStatusSuffix: String? { | ||
| let phase = syncService.status(for: .files).phase | ||
| let connection = syncService.connectionState | ||
| if phase == .ready && (connection == .connected || connection == .syncing) { | ||
| return nil | ||
| } | ||
| if phase == .hydrating || phase == .syncingInitialData || connection == .syncing { | ||
| return "Syncing" | ||
| } | ||
| if connection == .connecting { | ||
| return "Connecting" | ||
| } | ||
| return "Offline" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [🟡 Medium] [🔵 Bug] The new fallback branch maps every non-ready/non-hydrating/non-connecting state to // apps/ios/ADE/Views/Files/FilesDetailComponents.swift
if connection == .connecting {
return "Connecting"
}
return "Offline" |
||
| } | ||
|
|
||
| var body: some View { | ||
| HStack(alignment: .center, spacing: 12) { | ||
| Image(systemName: fileIcon(for: relativePath)) | ||
|
|
@@ -38,9 +54,9 @@ struct FilesHeaderStrip: View { | |
| Text("Read only") | ||
| .font(.caption2.weight(.medium)) | ||
| .foregroundStyle(ADEColor.textSecondary) | ||
| if !isFilesLive { | ||
| if let filesBrowserStatusSuffix { | ||
| Text("·").foregroundStyle(ADEColor.textMuted) | ||
| Text("Offline") | ||
| Text(filesBrowserStatusSuffix) | ||
| .font(.caption2.weight(.semibold)) | ||
| .foregroundStyle(ADEColor.warning) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.