Skip to content
Closed
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
39 changes: 27 additions & 12 deletions iOSClient/Login/NCLoginProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
//

import UIKit
@preconcurrency import WebKit
import WebKit
import NextcloudKit
import FloatingPanel

class NCLoginProvider: UIViewController {
var webView: WKWebView?
let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
let utility = NCUtility()
var titleView: String = ""
var urlBase = ""
Expand Down Expand Up @@ -55,19 +56,34 @@
NCContentPresenter().showError(error: error, priority: .max)
}

if let host = URL(string: urlBase)?.host {
titleView = host
if let activeTableAccount = NCManageDatabase.shared.getActiveTableAccount(), NCKeychain().getPassword(account: activeTableAccount.account).isEmpty {
titleView = NSLocalizedString("_user_", comment: "") + " " + activeTableAccount.userId + " " + NSLocalizedString("_in_", comment: "") + " " + host
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
}
}
self.navigationController?.navigationBar.backgroundColor = NCBrandColor.shared.customer
}

self.title = titleView
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// Stop timer error network
appDelegate.timerErrorNetworkingDisabled = true

Check failure on line 80 in iOSClient/Login/NCLoginProvider.swift

View workflow job for this annotation

GitHub Actions / Build and Test

value of type 'AppDelegate' has no member 'timerErrorNetworkingDisabled'
}

override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
NCActivityIndicator.shared.stop()
appDelegate.timerErrorNetworkingDisabled = false

Check failure on line 86 in iOSClient/Login/NCLoginProvider.swift

View workflow job for this annotation

GitHub Actions / Build and Test

value of type 'AppDelegate' has no member 'timerErrorNetworkingDisabled'
}

func loadWebPage(webView: WKWebView, url: URL) {
Expand Down Expand Up @@ -158,7 +174,8 @@
let account: String = "\(username) \(urlBase)"
let user = username

NextcloudKit.shared.getUserProfile(account: account) { account, userProfile, _, error in
NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase)

Check failure on line 177 in iOSClient/Login/NCLoginProvider.swift

View workflow job for this annotation

GitHub Actions / Build and Test

extra arguments at positions #1, #2, #3, #4, #5 in call

Check failure on line 177 in iOSClient/Login/NCLoginProvider.swift

View workflow job for this annotation

GitHub Actions / Build and Test

missing argument for parameter 'delegate' in call
NextcloudKit.shared.getUserProfile(account: account) { _, userProfile, _, error in
if error == .success, let userProfile {
NextcloudKit.shared.appendSession(account: account,
urlBase: urlBase,
Expand All @@ -172,16 +189,14 @@
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)
NCSession.shared.appendSession(account: account, urlBase: urlBase, user: user, userId: userProfile.userId)
NCManageDatabase.shared.deleteAccount(account)

Check failure on line 192 in iOSClient/Login/NCLoginProvider.swift

View workflow job for this annotation

GitHub Actions / Build and Test

value of type 'NCManageDatabase' has no member 'deleteAccount'
NCManageDatabase.shared.addAccount(account, urlBase: urlBase, user: user, userId: userProfile.userId, password: password)
NCAccount().changeAccount(account, userProfile: userProfile, controller: nil) { }

self.appDelegate.changeAccount(account, userProfile: userProfile) { }
let window = UIApplication.shared.firstWindow
if let controller = window?.rootViewController as? NCMainTabBarController {
controller.account = account
if window?.rootViewController is NCMainTabBarController {
self.dismiss(animated: true)
} else {
if let controller = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? NCMainTabBarController {
controller.account = account
controller.modalPresentationStyle = .fullScreen
controller.view.alpha = 0

Expand Down
Loading