Skip to content
Open
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
9 changes: 9 additions & 0 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; };
AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* Shareable.swift */; };
CB3666201AF7550816B5CD6A /* NCContextMenuComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8932E90EC4278026D86CCCC9 /* NCContextMenuComment.swift */; };
AFCE353927E5DE0500FEA6C2 /* NCShare+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */; };
B54315302DA647A400981E7E /* NCLoginWeb.swift in Sources */ = {isa = PBXBuildFile; fileRef = B543152F2DA647A400981E7E /* NCLoginWeb.swift */; };
C04E2F232A17BB4D001BAD85 /* FilesIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04E2F222A17BB4D001BAD85 /* FilesIntegrationTests.swift */; };
D575039F27146F93008DC9DC /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; };
D5B6AA7827200C7200D49C24 /* NCActivityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */; };
F310B1EF2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F310B1EE2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift */; };
F31165022F9674A1009A1E37 /* AppIcon.icon in Resources */ = {isa = PBXBuildFile; fileRef = F31165012F9674A1009A1E37 /* AppIcon.icon */; };
Expand Down Expand Up @@ -1263,6 +1267,8 @@
AFCE353827E5DE0400FEA6C2 /* Shareable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shareable.swift; sourceTree = "<group>"; };
B4C7A5B36D1ED178FB6B76CB /* NCContextMenuPlayerTracks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuPlayerTracks.swift; sourceTree = "<group>"; };
BB7697C94BA14450A0867940 /* NCContextMenuProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuProfile.swift; sourceTree = "<group>"; };
AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Helper.swift"; sourceTree = "<group>"; };
B543152F2DA647A400981E7E /* NCLoginWeb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCLoginWeb.swift; sourceTree = "<group>"; };
C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
C04E2F202A17BB4D001BAD85 /* NextcloudIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2974,6 +2980,8 @@
F7BFFA621A24D7300044ED85 /* Login */ = {
isa = PBXGroup;
children = (
B543152F2DA647A400981E7E /* NCLoginWeb.swift */,
F3CA33802D106FF900672333 /* Poll */,
F702F2F025EE5CDA008F8E80 /* NCLogin.storyboard */,
F702F2F625EE5CEC008F8E80 /* NCLogin.swift */,
F745B252222D88AE00346520 /* NCLoginQRCode.swift */,
Expand Down Expand Up @@ -4870,6 +4878,7 @@
F752BA052E58C05200616A26 /* Maintenance.swift in Sources */,
F763D29D2A249C4500A3C901 /* NCManageDatabase+Capabilities.swift in Sources */,
F76882252C0DD1E7001CF441 /* NCSettingsAdvancedModel.swift in Sources */,
B54315302DA647A400981E7E /* NCLoginWeb.swift in Sources */,
F7C7B489245EBA4100D93E60 /* NCViewerQuickLook.swift in Sources */,
F758B45E212C569D00515F55 /* NCScanCell.swift in Sources */,
F78B87E72B62527100C65ADC /* NCMediaDataSource.swift in Sources */,
Expand Down
35 changes: 25 additions & 10 deletions iOSClient/Login/NCLogin.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="BpI-xK-1SU">
<rect key="frame" x="100" y="188" width="240" height="120"/>
<rect key="frame" x="100" y="241.66666666666663" width="240" height="120"/>
<constraints>
<constraint firstAttribute="height" constant="120" id="E9d-5O-bto"/>
<constraint firstAttribute="width" constant="240" id="xwH-mh-yDU"/>
</constraints>
</imageView>
<textField opaque="NO" clipsSubviews="YES" tag="1" contentMode="scaleToFill" layoutMarginsFollowReadableWidth="YES" insetsLayoutMarginsFromSafeArea="NO" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder=" Server address https://…" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="szn-G7-5sK">
<rect key="frame" x="50" y="338" width="340" height="44"/>
<rect key="frame" x="50" y="391.66666666666669" width="340" height="44"/>
<accessibility key="accessibilityConfiguration" identifier="serverAddress"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="I2v-Zr-IWf"/>
Expand All @@ -36,7 +36,7 @@
<textInputTraits key="textInputTraits" autocorrectionType="no" keyboardType="URL" returnKeyType="done"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="HQd-pF-3cE">
<rect key="frame" x="350" y="340" width="40" height="40"/>
<rect key="frame" x="350" y="393.66666666666669" width="40" height="40"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<accessibility key="accessibilityConfiguration" identifier="submitServerAddress"/>
<constraints>
Expand All @@ -53,13 +53,13 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="The link to your Nextcloud web interface when you open it in the browser." textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PJH-5i-Tkf">
<rect key="frame" x="60" y="400" width="320" height="28.666666666666686"/>
<rect key="frame" x="60" y="453.66666666666669" width="320" height="28.666666666666686"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6tp-bh-Z9k" userLabel="QRCode">
<rect key="frame" x="192.66666666666666" y="528.66666666666663" width="55" height="50"/>
<rect key="frame" x="192.66666666666666" y="582.33333333333337" width="55" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="55" id="3hb-Ez-hOz"/>
<constraint firstAttribute="height" constant="50" id="OLT-tb-4Qb"/>
Expand All @@ -74,7 +74,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5lM-dt-8fM">
<rect key="frame" x="195" y="618.66666666666663" width="50" height="50"/>
<rect key="frame" x="195" y="682.33333333333337" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="0RD-Gi-CTv"/>
<constraint firstAttribute="width" constant="50" id="NuK-Yo-LoT"/>
Expand All @@ -84,7 +84,7 @@
</connections>
</button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="system" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IXM-eK-wKA" userLabel="Choose Server">
<rect key="frame" x="50" y="338" width="290" height="44"/>
<rect key="frame" x="50" y="391.66666666666669" width="290" height="44"/>
<color key="backgroundColor" white="1" alpha="0.40478847789115646" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="k9B-my-RAo"/>
Expand All @@ -96,7 +96,7 @@
<state key="normal" title="Name 1"/>
</button>
<imageView hidden="YES" opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrowtriangle.down.circle" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="rza-UC-nsA">
<rect key="frame" x="310" y="350.33333333333337" width="20" height="19.666666666666629"/>
<rect key="frame" x="310" y="403.66666666666669" width="20" height="19.666666666666686"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="Y46-VP-7nh"/>
Expand All @@ -111,14 +111,14 @@
<constraint firstItem="PJH-5i-Tkf" firstAttribute="leading" secondItem="8lf-3Y-f5R" secondAttribute="leading" constant="60" id="3aW-cF-rdF"/>
<constraint firstItem="8lf-3Y-f5R" firstAttribute="trailing" secondItem="HQd-pF-3cE" secondAttribute="trailing" constant="50" id="94K-sw-8AT"/>
<constraint firstItem="6tp-bh-Z9k" firstAttribute="centerX" secondItem="8lf-3Y-f5R" secondAttribute="centerX" id="Apc-1U-CwU"/>
<constraint firstItem="BpI-xK-1SU" firstAttribute="top" secondItem="8lf-3Y-f5R" secondAttribute="top" constant="20" id="Gkg-up-7eW"/>
<constraint firstItem="BpI-xK-1SU" firstAttribute="top" secondItem="Bv6-g3-l0M" secondAttribute="centerY" multiplier="0.5" constant="2.5" id="Gkg-up-7eW"/>
<constraint firstItem="8lf-3Y-f5R" firstAttribute="centerX" secondItem="BpI-xK-1SU" secondAttribute="centerX" id="IxG-UI-0vq"/>
<constraint firstItem="rza-UC-nsA" firstAttribute="top" secondItem="BpI-xK-1SU" secondAttribute="bottom" constant="41.5" id="MS5-cH-8Ea"/>
<constraint firstItem="6tp-bh-Z9k" firstAttribute="top" secondItem="PJH-5i-Tkf" secondAttribute="bottom" constant="100" id="MZQ-GT-XSM"/>
<constraint firstItem="IXM-eK-wKA" firstAttribute="leading" secondItem="8lf-3Y-f5R" secondAttribute="leading" constant="50" id="SE6-52-VoG"/>
<constraint firstItem="PJH-5i-Tkf" firstAttribute="top" secondItem="szn-G7-5sK" secondAttribute="bottom" constant="18" id="Vfj-lG-7wT"/>
<constraint firstItem="HQd-pF-3cE" firstAttribute="centerY" secondItem="szn-G7-5sK" secondAttribute="centerY" id="cG8-kL-pdu"/>
<constraint firstItem="5lM-dt-8fM" firstAttribute="top" secondItem="6tp-bh-Z9k" secondAttribute="bottom" constant="40" id="i5K-Jt-epF"/>
<constraint firstItem="5lM-dt-8fM" firstAttribute="top" secondItem="6tp-bh-Z9k" secondAttribute="bottom" constant="50" id="i5K-Jt-epF"/>
<constraint firstItem="szn-G7-5sK" firstAttribute="top" secondItem="BpI-xK-1SU" secondAttribute="bottom" constant="30" id="lWz-Yy-NCO"/>
<constraint firstItem="5lM-dt-8fM" firstAttribute="centerX" secondItem="8lf-3Y-f5R" secondAttribute="centerX" id="mKe-Nn-9dd"/>
<constraint firstItem="HQd-pF-3cE" firstAttribute="leading" secondItem="IXM-eK-wKA" secondAttribute="trailing" constant="30" id="p5X-FY-AQg">
Expand Down Expand Up @@ -199,6 +199,21 @@
</objects>
<point key="canvasLocation" x="6312.2727272727279" y="-1210.6694560669457"/>
</scene>
<!--Login Web-->
<scene sceneID="j8o-Lk-HsF">
<objects>
<viewController storyboardIdentifier="NCLoginWeb" id="hFi-DN-BXw" customClass="NCLoginWeb" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Npw-WL-mzw">
<rect key="frame" x="0.0" y="0.0" width="440" height="956"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="763-qA-dBR"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="fJz-iW-pCF" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="6145" y="-1212"/>
</scene>
</scenes>
<resources>
<image name="arrow.right" catalog="system" width="128" height="95"/>
Expand Down
42 changes: 42 additions & 0 deletions iOSClient/Login/NCLoginProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ protocol NCLoginProviderDelegate: AnyObject {
/// Handles login authentication using ASWebAuthenticationSession with WKWebView fallback for mTLS.
///
class NCLoginProvider: NSObject, ASWebAuthenticationPresentationContextProviding {

var webView: WKWebView?
let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
let utility = NCUtility()
var titleView: String = ""

var initialURLString = ""
weak var delegate: NCLoginProviderDelegate?
var controller: NCMainTabBarController?
Expand Down Expand Up @@ -94,6 +100,39 @@ class NCLoginProvider: NSObject, ASWebAuthenticationPresentationContextProviding
// Fall back to WKWebView if ASWebAuthenticationSession fails to start
fallbackToWebView(url: url)
}
// if #available(iOS 13, *) {
// let keyWindow = UIApplication.shared.connectedScenes
// .filter({$0.activationState == .foregroundActive})
// .map({$0 as? UIWindowScene})
// .compactMap({$0})
// .first?.windows
// .filter({$0.isKeyWindow}).first
// let statusBar = UIView(frame: (keyWindow?.windowScene?.statusBarManager?.statusBarFrame)!)
// statusBar.backgroundColor = NCBrandColor.shared.customer
// keyWindow?.addSubview(statusBar)
// } else {
// if let statusBar = UIApplication.shared.value(forKey: "statusBar") as? UIView {
// statusBar.backgroundColor = NCBrandColor.shared.customer
// }
// }

//
// nkLog(debug: "Cancelling existing polling task because view did disappear...")
// pollingTask?.cancel()
// pollingTask = nil
// appDelegate.timerErrorNetworkingDisabled = false
}

// MARK: - Navigation

private func loadWebPage(url: URL) {
let language = NSLocale.preferredLanguages[0] as String
var request = URLRequest(url: url)

request.addValue("true", forHTTPHeaderField: "OCS-APIRequest")
request.addValue(language, forHTTPHeaderField: "Accept-Language")

webView.load(request)
}

///
Expand Down Expand Up @@ -260,6 +299,7 @@ class NCLoginProvider: NSObject, ASWebAuthenticationPresentationContextProviding
///
private func createPollingTask(token: String, endpoint: String) -> Task<Void, any Error> {
let options = NKRequestOptions(customUserAgent: userAgent)

var grantValues: (urlBase: String, loginName: String, appPassword: String)?

return Task { @MainActor in
Expand Down Expand Up @@ -375,6 +415,8 @@ class NCLoginProviderWebViewFallback: UIViewController, WKNavigationDelegate {
}

func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
nkLog(debug: "Web view did receive authentication challenge.")

DispatchQueue.global().async {
if let serverTrust = challenge.protectionSpace.serverTrust {
completionHandler(.useCredential, URLCredential(trust: serverTrust))
Expand Down
Loading
Loading