Skip to content
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

Add option for in-app browser log in #3251

Merged
merged 9 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Brand/NCBrand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ let userAgent: String = {
var doNotAskPasscodeAtStartup: Bool = false
var disable_source_code_in_settings: Bool = false
var enforce_passcode_lock = false
var use_in_app_browser_for_login = true
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marinofaggiana This is needed for a patch, will revert later


// (name: "Name 1", url: "https://cloud.nextcloud.com"),(name: "Name 2", url: "https://cloud.nextcloud.com")
var enforce_servers: [(name: String, url: String)] = []
Expand Down
20 changes: 17 additions & 3 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
F310B1EF2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F310B1EE2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift */; };
F314F1142A30E2DE00BC7FAB /* View+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E8A390295DC5E0006CB2D0 /* View+Extension.swift */; };
F321DA8A2B71205A00DDA0E6 /* NCTrashSelectTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */; };
F32FADA92D1176E3007035E2 /* UIButton+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F32FADA82D1176DE007035E2 /* UIButton+Extension.swift */; };
F33918C42C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33918C32C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift */; };
F33918C52C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33918C32C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift */; };
F33918C62C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F33918C32C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift */; };
Expand Down Expand Up @@ -180,6 +181,7 @@
F3BB464D2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F3BB464C2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib */; };
F3BB46522A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BB46512A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift */; };
F3BB46542A3A1E9D00461F6E /* CCCellMore.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3BB46532A3A1E9D00461F6E /* CCCellMore.swift */; };
F3CA33842D10726E00672333 /* NCLoginPollModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3CA33832D10726E00672333 /* NCLoginPollModel.swift */; };
F3E173B02C9AF637006D177A /* ScreenAwakeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E173AF2C9AF637006D177A /* ScreenAwakeManager.swift */; };
F3E173C02C9B1067006D177A /* AwakeMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E173BF2C9B1067006D177A /* AwakeMode.swift */; };
F3E173C12C9B1067006D177A /* AwakeMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3E173BF2C9B1067006D177A /* AwakeMode.swift */; };
Expand Down Expand Up @@ -1181,7 +1183,6 @@
AAF806B32CE25EFE009C2D43 /* NCShareToggleCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareToggleCell.swift; sourceTree = "<group>"; };
AAF806B52CE34C72009C2D43 /* NCShareDownloadLimitViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareDownloadLimitViewController.swift; sourceTree = "<group>"; };
AAF806B72CE37C15009C2D43 /* NCShareDownloadLimitTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareDownloadLimitTableViewController.swift; sourceTree = "<group>"; };
AAF806B92CE38BB2009C2D43 /* NextcloudKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = NextcloudKit; path = ../NextcloudKit; sourceTree = SOURCE_ROOT; };
AF1A9B6327D0CA1E00F17A9E /* UIAlertController+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIAlertController+Extension.swift"; sourceTree = "<group>"; };
AF22B20B277C6F4D00DAB0CC /* NCShareCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCell.swift; sourceTree = "<group>"; };
AF22B215277D196700DAB0CC /* NCShareExtension+DataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCShareExtension+DataSource.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1220,6 +1221,7 @@
D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = "<group>"; };
F310B1EE2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCViewerMedia+VisionKit.swift"; sourceTree = "<group>"; };
F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTrashSelectTabBar.swift; sourceTree = "<group>"; };
F32FADA82D1176DE007035E2 /* UIButton+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Extension.swift"; sourceTree = "<group>"; };
F33918C32C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileNameValidator+Extensions.swift"; sourceTree = "<group>"; };
F33EE6F12BF4C9B200CA1A51 /* PKCS12.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PKCS12.swift; sourceTree = "<group>"; };
F343A4B22A1E01FF00DDA874 /* PHAsset+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PHAsset+Extension.swift"; sourceTree = "<group>"; };
Expand All @@ -1242,6 +1244,7 @@
F3BB464C2A39ADCC00461F6E /* NCMoreAppSuggestionsCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCMoreAppSuggestionsCell.xib; sourceTree = "<group>"; };
F3BB46512A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMoreAppSuggestionsCell.swift; sourceTree = "<group>"; };
F3BB46532A3A1E9D00461F6E /* CCCellMore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CCCellMore.swift; sourceTree = "<group>"; };
F3CA33832D10726E00672333 /* NCLoginPollModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginPollModel.swift; sourceTree = "<group>"; };
F3E173AF2C9AF637006D177A /* ScreenAwakeManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenAwakeManager.swift; sourceTree = "<group>"; };
F3E173BF2C9B1067006D177A /* AwakeMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AwakeMode.swift; sourceTree = "<group>"; };
F3EF2E0B2BFCF3810025EF46 /* NCLoginPoll.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginPoll.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2069,6 +2072,15 @@
path = Cells;
sourceTree = "<group>";
};
F3CA33802D106FF900672333 /* Poll */ = {
isa = PBXGroup;
children = (
F3EF2E0B2BFCF3810025EF46 /* NCLoginPoll.swift */,
F3CA33832D10726E00672333 /* NCLoginPollModel.swift */,
);
path = Poll;
sourceTree = "<group>";
};
F3E173BE2C9B1057006D177A /* ScreenAwakeManager */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2654,6 +2666,7 @@
F7A0D14E259229FA008F8A13 /* Extensions */ = {
isa = PBXGroup;
children = (
F32FADA82D1176DE007035E2 /* UIButton+Extension.swift */,
F7AC1CAF28AB94490032D99F /* Array+Extension.swift */,
F7817CF729801A3500FFBC65 /* Data+Extension.swift */,
AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */,
Expand Down Expand Up @@ -2766,14 +2779,14 @@
F7BFFA621A24D7300044ED85 /* Login */ = {
isa = PBXGroup;
children = (
F3CA33802D106FF900672333 /* Poll */,
F702F2F025EE5CDA008F8E80 /* NCLogin.storyboard */,
F702F2F625EE5CEC008F8E80 /* NCLogin.swift */,
F738D48F2756740100CD1D38 /* NCLoginNavigationController.swift */,
F745B252222D88AE00346520 /* NCLoginQRCode.swift */,
F7AE00F4230D5F9E007ACF8A /* NCLoginProvider.swift */,
F7BC287D26663F6C004D46C5 /* NCViewCertificateDetails.storyboard */,
F7BC287F26663F85004D46C5 /* NCViewCertificateDetails.swift */,
F3EF2E0B2BFCF3810025EF46 /* NCLoginPoll.swift */,
);
path = Login;
sourceTree = "<group>";
Expand Down Expand Up @@ -3069,7 +3082,6 @@
F7F67B9F1A24D27800EE80DA = {
isa = PBXGroup;
children = (
AAF806B92CE38BB2009C2D43 /* NextcloudKit */,
F7B8B82F25681C3400967775 /* GoogleService-Info.plist */,
F7C1CDD91E6DFC6F005D92BE /* Brand */,
F7F67BAA1A24D27800EE80DA /* iOSClient */,
Expand Down Expand Up @@ -4326,8 +4338,10 @@
F7AE00F8230E81CB007ACF8A /* NCBrowserWeb.swift in Sources */,
F77DD6A82C5CC093009448FB /* NCSession.swift in Sources */,
F702F30825EE5D47008F8E80 /* NCPopupViewController.swift in Sources */,
F3CA33842D10726E00672333 /* NCLoginPollModel.swift in Sources */,
F733598125C1C188002ABA72 /* NCAskAuthorization.swift in Sources */,
370D26AF248A3D7A00121797 /* NCCellProtocol.swift in Sources */,
F32FADA92D1176E3007035E2 /* UIButton+Extension.swift in Sources */,
F768822C2C0DD1E7001CF441 /* NCKeychain.swift in Sources */,
F7BFFD282C8846020029A201 /* NCHud.swift in Sources */,
F71CD6CA2930D7B1006C95C1 /* NCApplicationHandle.swift in Sources */,
Expand Down
40 changes: 40 additions & 0 deletions iOSClient/Extensions/UIButton+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// UIButton+Extension.swift
// Nextcloud
//
// Created by Milen Pivchev on 17.12.24.
// Copyright © 2024 Marino Faggiana. All rights reserved.
//
Comment on lines +1 to +7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been the usual license header instead, right? 😁


extension UIButton {
func hideButtonAndShowSpinner(tint: UIColor = .white) {
self.isHidden = true

let spinnerTag = Int(bitPattern: Unmanaged.passUnretained(self).toOpaque())
if self.superview?.subviews.first(where: { view -> Bool in
return view.isKind(of: UIActivityIndicatorView.self) && view.tag == spinnerTag
}) != nil {
return
}

let spinner = UIActivityIndicatorView(style: .medium)
spinner.tag = spinnerTag
spinner.color = tint
spinner.startAnimating()
spinner.center = self.center
self.superview?.addSubview(spinner)
spinner.translatesAutoresizingMaskIntoConstraints = false
spinner.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
spinner.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
}

func hideSpinnerAndShowButton() {
let spinnerTag = Int(bitPattern: Unmanaged.passUnretained(self).toOpaque())
let spinner = self.superview?.subviews.first(where: { view -> Bool in
return view.isKind(of: UIActivityIndicatorView.self) && view.tag == spinnerTag
})

spinner?.removeFromSuperview()
self.isHidden = false
}
}
Loading
Loading