-
-
Notifications
You must be signed in to change notification settings - Fork 890
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
4bc08ff
commit a37b32f
Showing
45 changed files
with
3,362 additions
and
3,197 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> | ||
// | ||
|
@@ -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() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
Oops, something went wrong.