Skip to content

[stable-6.1.3] NMC/2298 - Share extension #274

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

Closed
wants to merge 1 commit into from
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
42 changes: 8 additions & 34 deletions Share/NCShareExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class NCShareExtension: UIViewController {
uploadView.layer.cornerRadius = 10

uploadLabel.text = NSLocalizedString("_upload_", comment: "")
uploadLabel.textColor = .systemBlue
uploadLabel.textColor = NCBrandColor.shared.customer
let uploadGesture = UITapGestureRecognizer(target: self, action: #selector(actionUpload))
uploadView.addGestureRecognizer(uploadGesture)

Expand Down Expand Up @@ -194,14 +194,15 @@ class NCShareExtension: UIViewController {
func setNavigationBar(navigationTitle: String) {
navigationItem.title = navigationTitle
cancelButton.title = NSLocalizedString("_cancel_", comment: "")
cancelButton.tintColor = NCBrandColor.shared.customer

// BACK BUTTON
let backButton = UIButton(type: .custom)
backButton.setImage(UIImage(named: "back"), for: .normal)
backButton.tintColor = .systemBlue
backButton.setImage(UIImage(named: "back")?.imageColor(NCBrandColor.shared.customer), for: .normal)
backButton.tintColor = NCBrandColor.shared.customer
backButton.semanticContentAttribute = .forceLeftToRight
backButton.setTitle(" " + NSLocalizedString("_back_", comment: ""), for: .normal)
backButton.setTitleColor(.systemBlue, for: .normal)
backButton.setTitleColor(NCBrandColor.shared.customer, for: .normal)
backButton.action(for: .touchUpInside) { _ in
if !self.uploadStarted {
while self.serverUrl.last != "/" { self.serverUrl.removeLast() }
Expand All @@ -214,38 +215,11 @@ class NCShareExtension: UIViewController {
self.setNavigationBar(navigationTitle: navigationTitle)
}
}

let tableAccount = self.database.getTableAccount(account: session.account)
let image = utility.loadUserImage(for: session.user, displayName: tableAccount?.displayName, urlBase: session.urlBase)
let profileButton = UIButton(type: .custom)
profileButton.setImage(image, for: .normal)

if serverUrl == utilityFileSystem.getHomeServer(session: self.session) {
var title = " "
if let userAlias = tableAccount?.alias, !userAlias.isEmpty {
title += userAlias
} else {
title += tableAccount?.displayName ?? ""
}

profileButton.setTitle(title, for: .normal)
profileButton.setTitleColor(.systemBlue, for: .normal)
}

profileButton.semanticContentAttribute = .forceLeftToRight
profileButton.sizeToFit()
profileButton.action(for: .touchUpInside) { _ in
if !self.uploadStarted {
self.showAccountPicker()
}
}
var navItems = [UIBarButtonItem(customView: profileButton)]
if serverUrl != utilityFileSystem.getHomeServer(session: self.session) {
let space = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
space.width = 20
navItems.append(contentsOf: [UIBarButtonItem(customView: backButton), space])
navigationItem.leftBarButtonItem = UIBarButtonItem(customView: backButton)
} else {
navigationItem.leftBarButtonItem = nil
}
navigationItem.setLeftBarButtonItems(navItems, animated: true)
}

func setCommandView() {
Expand Down