Skip to content

Commit 1354694

Browse files
authored
Merge branch 'main' into really_fix_crash_and_rotation
2 parents 8e893b6 + bea6d51 commit 1354694

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

Django Files/Views/ContentView.swift

+25-15
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct ContentView: View {
7070
selectedServer: server,
7171
columnVisibility: $columnVisibility,
7272
showingEditor: $showingEditor,
73-
needsRefresh: $needsRefresh,
73+
needsRefresh: $needsRefresh
7474
)
7575
.id(server.url)
7676
.onAppear {
@@ -143,6 +143,8 @@ public struct AuthViewContainer: View {
143143
@Environment(\.presentationMode) private var presentationMode: Binding<PresentationMode>
144144
@Query private var items: [DjangoFilesSession]
145145

146+
@State private var isAuthViewLoading: Bool = true
147+
146148
var viewingSettings: Binding<Bool>
147149
let selectedServer: DjangoFilesSession
148150
var columnVisibility: Binding<NavigationSplitViewVisibility>
@@ -151,30 +153,27 @@ public struct AuthViewContainer: View {
151153

152154
@State private var authController: AuthController = AuthController()
153155

154-
var backButton : some View { Button(action: {
155-
self.presentationMode.wrappedValue.dismiss()
156-
}) {
157-
HStack {
158-
if !UIDevice.current.localizedModel.contains("iPad") {
159-
Text("Server List")
160-
}
161-
}
162-
}
163-
}
164156
public var body: some View {
165-
if selectedServer.url != "" {
166-
ZStack{
167-
Color.djangoFilesBackground.ignoresSafeArea()
168-
LoadingView().frame(width: 100, height: 100)
157+
if viewingSettings.wrappedValue{
158+
SessionSelector(session: selectedServer, viewingSelect: viewingSettings)
159+
.onAppear(){
160+
columnVisibility.wrappedValue = .automatic
161+
}
162+
}
163+
else if selectedServer.url != "" {
164+
Color.djangoFilesBackground.ignoresSafeArea()
165+
.overlay{
169166
AuthView(
170167
authController: authController,
171168
httpsUrl: selectedServer.url,
172169
doReset: authController.url?.absoluteString ?? "" != selectedServer.url || !selectedServer.auth,
173170
session: selectedServer
174171
)
175172
.onStartedLoading {
173+
isAuthViewLoading = true
176174
}
177175
.onCancelled {
176+
isAuthViewLoading = false
178177
dismiss()
179178
}
180179
.onAppear(){
@@ -186,11 +185,17 @@ public struct AuthViewContainer: View {
186185
authController.onStartedLoadingAction = {
187186
}
188187

188+
authController.onLoadedAction = {
189+
isAuthViewLoading = false
190+
191+
}
189192
authController.onCancelledAction = {
193+
isAuthViewLoading = false
190194
dismiss()
191195
}
192196

193197
authController.onSchemeRedirectAction = {
198+
isAuthViewLoading = false
194199
guard let resolve = authController.schemeURL else{
195200
return
196201
}
@@ -220,6 +225,11 @@ public struct AuthViewContainer: View {
220225
}
221226
}
222227
}
228+
.overlay {
229+
if isAuthViewLoading {
230+
LoadingView().frame(width: 100, height: 100)
231+
}
232+
}
223233
}
224234
.ignoresSafeArea()
225235
.edgesIgnoringSafeArea(.all)

0 commit comments

Comments
 (0)