Skip to content

Commit

Permalink
Revamp settings section (#2938)
Browse files Browse the repository at this point in the history
* Coding

Signed-off-by: Marino Faggiana <[email protected]>

* normalized

Signed-off-by: Marino Faggiana <[email protected]>

* Improve E2EE image

Signed-off-by: Marino Faggiana <[email protected]>

* replace tabBarController with NCMainTabBarController

Signed-off-by: Marino Faggiana <[email protected]>

* normalized

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Marino Faggiana <[email protected]>
  • Loading branch information
marinofaggiana authored Jun 4, 2024
1 parent 4bc08ff commit a37b32f
Show file tree
Hide file tree
Showing 45 changed files with 3,362 additions and 3,197 deletions.
308 changes: 202 additions & 106 deletions Nextcloud.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

203 changes: 0 additions & 203 deletions iOSClient/Diagnostics/NCCapabilitiesView.swift

This file was deleted.

2 changes: 1 addition & 1 deletion iOSClient/GUI/HUDView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ struct ContentView: View {
}
HUDView(showHUD: $showHUD, textLabel: NSLocalizedString("_wait_", comment: ""), image: "doc.badge.arrow.up")
.offset(y: showHUD ? (geo.size.height / 2) : -200)
.animation(.easeOut)
.animation(.easeOut, value: showHUD)
}
}
}
Expand Down
22 changes: 14 additions & 8 deletions iOSClient/Settings/CCAdvanced.h → iOSClient/GUI/LazyView.swift
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// CCAdvanced.h
// LazyView.swift
// Nextcloud
//
// Created by Marino Faggiana on 12/04/17.
// Copyright (c) 2017 Marino Faggiana. All rights reserved.
// Created by Marino Faggiana on 01/06/24.
// Copyright © 2024 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <[email protected]>
//
Expand All @@ -21,9 +21,15 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

#import <MessageUI/MFMailComposeViewController.h>
#import <XLForm.h>
import SwiftUI

@interface CCAdvanced : XLFormViewController <MFMailComposeViewControllerDelegate>

@end
/// LazyView is a view that delays the initialization of its contained view until it is actually needed.
struct LazyView<Content: View>: View {
let build: () -> Content
init(_ build: @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
}
49 changes: 49 additions & 0 deletions iOSClient/GUI/ViewOnAppear.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// ViewOnAppear.swift
// Nextcloud
//
// Created by Aditya Tyagi on 17/03/24.
// Copyright © 2024 Marino Faggiana. All rights reserved.
//
// Author Aditya Tyagi <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//

import Foundation
import SwiftUI

/// A protocol defining methods to handle view appearance events.
protocol ViewOnAppearHandling: ObservableObject {
/// Triggered when the view appears.
func onViewAppear()
}

extension View {
@discardableResult func defaultViewModifier(_ model: some ViewOnAppearHandling) -> some View {
return modifier(DefaultViewModifier(viewModel: model))
}
}

/// A view modifier that automatically calls a view model's `onViewAppear` function when the view appears on screen.
struct DefaultViewModifier<ViewModel: ViewOnAppearHandling>: ViewModifier {
@ObservedObject var viewModel: ViewModel

func body(content: Content) -> some View {
content
.onAppear {
viewModel.onViewAppear() // Call onViewAppear on view appearance
}
}
}
Loading

0 comments on commit a37b32f

Please sign in to comment.