Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/nextcloud/ios into scree…
Browse files Browse the repository at this point in the history
…n-awake-option

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>

# Conflicts:
#	Nextcloud.xcodeproj/project.pbxproj
#	iOSClient/Networking/NCNetworkingProcess.swift
  • Loading branch information
mpivchev committed Sep 25, 2024
2 parents d50046a + 87eb276 commit c41732c
Show file tree
Hide file tree
Showing 117 changed files with 7,598 additions and 979 deletions.
2 changes: 0 additions & 2 deletions Cartfile

This file was deleted.

2 changes: 0 additions & 2 deletions Cartfile.resolved

This file was deleted.

262 changes: 230 additions & 32 deletions Nextcloud.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,20 @@
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "2">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<RemoteRunnable
runnableDebuggingMode = "0"
BundleIdentifier = "it.twsweb.Nextcloud"
RemotePath = "/var/containers/Bundle/Application/92F13FE8-7056-4509-8468-5856675AB1CA/Nextcloud.app">
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F77B0DEB1D118A16002130FE"
BuildableName = "Nextcloud.app"
BlueprintName = "Nextcloud"
ReferencedContainer = "container:Nextcloud.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,10 @@ branch. Maybe start working on [starter issues](https://github.com/nextcloud/ios

Easy starting points are also reviewing [pull requests](https://github.com/nextcloud/ios/pulls)

### Xcode 15 Project Setup
### Xcode 16 Project Setup

#### Dependencies

After forking a repository you have to build the dependencies. Dependencies are managed with Carthage version 0.38.0 or later.
Run

```
carthage update --use-xcframeworks --platform iOS
```
to fetch and compile the dependencies.

In order to build the project in Xcode you will also need a file `GoogleService-Info.plist` at the root of the repository which contains the Firebase configuration. For development work you can use a mock version found [here](https://github.com/firebase/quickstart-ios/blob/master/mock-GoogleService-Info.plist).

### Creating Pull requests
Expand Down
1 change: 0 additions & 1 deletion Share/NCShareExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import UIKit
import NextcloudKit
import TOPasscodeViewController

enum NCShareExtensionError: Error {
case cancel, fileUpload, noAccount, noFiles
Expand Down
1 change: 1 addition & 0 deletions Share/Share-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

#import "NCEndToEndEncryption.h"
#import "UIImage+animatedGIF.h"
#import "TOPasscodeViewController.h"
2 changes: 1 addition & 1 deletion Widget/Files/FilesData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
account: activeTableAccount.account,
options: options)
if result.error == .success, let data = result.data {
utility.createImage(ocId: file.ocId, etag: file.etag, classFile: file.classFile, data: data)
utility.createImage(ocId: file.ocId, etag: file.etag, data: data)
}
}
if image == nil {
Expand Down
17 changes: 9 additions & 8 deletions iOSClient/Activity/NCActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import UIKit
import SwiftRichString
import NextcloudKit
import SVGKit

class NCActivity: UIViewController, NCSharePagingContent {
@IBOutlet weak var viewContainerConstraint: NSLayoutConstraint!
Expand Down Expand Up @@ -150,10 +151,6 @@ extension NCActivity: UITableViewDelegate {
return 50
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 80
}

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50))
view.backgroundColor = .clear
Expand Down Expand Up @@ -223,7 +220,6 @@ extension NCActivity: UITableViewDataSource {
cell.indexPath = indexPath
cell.tableComments = comment
cell.delegate = self
cell.sizeToFit()

// Image
let fileName = NCSession.shared.getFileName(urlBase: metadata.urlBase, user: comment.actorId)
Expand All @@ -233,7 +229,7 @@ extension NCActivity: UITableViewDataSource {
cell.labelUser.textColor = NCBrandColor.shared.textColor
// Date
cell.labelDate.text = utility.dateDiff(comment.creationDateTime as Date)
cell.labelDate.textColor = .systemGray4
cell.labelDate.textColor = .lightGray
// Message
cell.labelMessage.text = comment.message
cell.labelMessage.textColor = NCBrandColor.shared.textColor
Expand All @@ -244,6 +240,8 @@ extension NCActivity: UITableViewDataSource {
cell.buttonMenu.isHidden = true
}

cell.sizeToFit()

return cell
}

Expand All @@ -264,11 +262,14 @@ extension NCActivity: UITableViewDataSource {

// icon
if !activity.icon.isEmpty {
activity.icon = activity.icon.replacingOccurrences(of: ".png", with: ".svg")
let fileNameIcon = (activity.icon as NSString).lastPathComponent
let fileNameLocalPath = utilityFileSystem.directoryUserData + "/" + fileNameIcon

if FileManager.default.fileExists(atPath: fileNameLocalPath) {
if let image = UIImage(contentsOfFile: fileNameLocalPath) {
let image = fileNameIcon.contains(".svg") ? SVGKImage(contentsOfFile: fileNameLocalPath)?.uiImage : UIImage(contentsOfFile: fileNameLocalPath)

if let image {
cell.icon.image = image.withTintColor(NCBrandColor.shared.textColor, renderingMode: .alwaysOriginal)
}
} else {
Expand Down Expand Up @@ -352,7 +353,7 @@ extension NCActivity {
var bottom: CGFloat = 0

if let mainTabBar = self.tabBarController?.tabBar as? NCMainTabBar {
bottom = -mainTabBar.getHeight()
bottom = -mainTabBar.getHeight()
}
NCActivityIndicator.shared.start(backgroundView: self.view, bottom: bottom - 35, style: .medium)

Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Activity/NCActivityTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ extension NCActivityTableViewCell: UICollectionViewDelegateFlowLayout {
}
}

class NCOperationDownloadThumbnailActivity: ConcurrentOperation {
class NCOperationDownloadThumbnailActivity: ConcurrentOperation, @unchecked Sendable {
var collectionView: UICollectionView?
var fileNamePreviewLocalPath: String
var fileId: String
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/BrowserWeb/NCBrowserWeb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//

import UIKit
import WebKit
@preconcurrency import WebKit

@objc protocol NCBrowserWebDelegate: AnyObject {
@objc optional func browserWebDismiss()
Expand Down
32 changes: 25 additions & 7 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ extension NCManageDatabase {
return []
}

func getResultsMetadatas(predicate: NSPredicate, sortedByKeyPath: String, ascending: Bool, arraySlice: Int = 0) -> [tableMetadata] {
func getResultsMetadatas(predicate: NSPredicate, sortedByKeyPath: String, ascending: Bool, arraySlice: Int) -> [tableMetadata] {
do {
let realm = try Realm()
let results = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: sortedByKeyPath, ascending: ascending).prefix(arraySlice)
Expand Down Expand Up @@ -1059,27 +1059,45 @@ extension NCManageDatabase {
}

func getResultMetadataFromFileId(_ fileId: String?) -> tableMetadata? {
guard let fileId else { return nil }

do {
let realm = try Realm()
guard let fileId = fileId else { return nil }
guard let result = realm.objects(tableMetadata.self).filter("fileId == %@", fileId).first else { return nil }
return result
return realm.objects(tableMetadata.self).filter("fileId == %@", fileId).first
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)")
}
return nil
}

func getResultsMetadatas(predicate: NSPredicate, sortedByKeyPath: String? = nil, ascending: Bool = false) -> [tableMetadata]? {
func getResultMetadataFromOcId(_ ocId: String?) -> tableMetadata? {
guard let ocId else { return nil }

do {
let realm = try Realm()
return realm.objects(tableMetadata.self).filter("ocId == %@", ocId).first
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)")
}
return nil
}

func getResultsMetadatas(predicate: NSPredicate, sortedByKeyPath: String? = nil, ascending: Bool = false, freeze: Bool = false) -> Results<tableMetadata>? {
do {
let realm = try Realm()
realm.refresh()
if let sortedByKeyPath {
let results = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: sortedByKeyPath, ascending: ascending)
return Array(results)
if freeze {
return results.freeze()
}
return results
} else {
let results = realm.objects(tableMetadata.self).filter(predicate)
return Array(results)
if freeze {
return results.freeze()
}
return results
}
} catch let error as NSError {
NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)")
Expand Down
3 changes: 2 additions & 1 deletion iOSClient/Data/NCManageDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ class NCManageDatabase: NSObject {

if isAppex {
if bundleFileName == "File Provider Extension.appex" {
objectTypesAppex = [tableMetadata.self,
objectTypesAppex = [NCKeyValue.self,
tableMetadata.self,
tableLocalFile.self,
tableDirectory.self,
tableTag.self,
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class NCFiles: NCCollectionViewCommon {
self.serverUrl = self.utilityFileSystem.getHomeServer(session: self.session)
self.isSearchingMode = false
self.isEditMode = false
self.selectOcId.removeAll()
self.fileSelect.removeAll()
self.layoutForView = self.database.getLayoutForView(account: self.session.account, key: self.layoutKey, serverUrl: self.serverUrl)

if self.isLayoutList {
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Login/NCLoginProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
//

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

Expand Down
19 changes: 10 additions & 9 deletions iOSClient/Main/Collection Common/Cell/NCGridCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
var ocId = ""
var ocIdTransfer = ""
var account = ""
private var user = ""
var user = ""

weak var gridCellDelegate: NCGridCellDelegate?

Expand Down Expand Up @@ -99,25 +99,26 @@ class NCGridCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
accessibilityValue = nil
isAccessibilityElement = true

imageItem.image = nil
imageItem.layer.cornerRadius = 6
imageItem.layer.masksToBounds = true

imageSelect.isHidden = true
imageSelect.image = NCImageCache.shared.getImageCheckedYes()
imageStatus.image = nil
imageFavorite.image = nil
imageLocal.image = nil
labelTitle.text = ""
labelInfo.text = ""
labelSubinfo.text = ""
imageVisualEffect.layer.cornerRadius = 6
imageVisualEffect.clipsToBounds = true
imageVisualEffect.alpha = 0.5

imageSelect.isHidden = true
imageSelect.image = NCImageCache.shared.getImageCheckedYes()

let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPress(gestureRecognizer:)))
longPressedGesture.minimumPressDuration = 0.5
longPressedGesture.delegate = self
longPressedGesture.delaysTouchesBegan = true
self.addGestureRecognizer(longPressedGesture)

labelTitle.text = ""
labelInfo.text = ""
labelSubinfo.text = ""
}

override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
Expand Down
53 changes: 24 additions & 29 deletions iOSClient/Main/Collection Common/Cell/NCListCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,47 +110,42 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto

override func awakeFromNib() {
super.awakeFromNib()
initCell()
}

imageItem.layer.cornerRadius = 6
imageItem.layer.masksToBounds = true
override func prepareForReuse() {
super.prepareForReuse()
initCell()
}

// use entire cell as accessibility element
func initCell() {
accessibilityHint = nil
accessibilityLabel = nil
accessibilityValue = nil
isAccessibilityElement = true

imageItem.image = nil
imageItem.layer.cornerRadius = 6
imageItem.layer.masksToBounds = true
imageStatus.image = nil
imageFavorite.image = nil
imageFavoriteBackground.isHidden = true
imageLocal.image = nil
labelTitle.text = ""
labelInfo.text = ""
labelSubinfo.text = ""
imageShared.image = nil
imageMore.image = nil
separatorHeightConstraint.constant = 0.5
tag0.text = ""
tag1.text = ""
titleInfoTrailingDefault()

let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPress(gestureRecognizer:)))
longPressedGesture.minimumPressDuration = 0.5
longPressedGesture.delegate = self
longPressedGesture.delaysTouchesBegan = true
self.addGestureRecognizer(longPressedGesture)

separator.backgroundColor = .separator
separatorHeightConstraint.constant = 0.5

labelTitle.text = ""
labelInfo.text = ""
labelSubinfo.text = ""
labelTitle.textColor = NCBrandColor.shared.textColor
labelInfo.textColor = NCBrandColor.shared.textColor2
labelSubinfo.textColor = NCBrandColor.shared.textColor2

imageFavoriteBackground.isHidden = true
}

override func prepareForReuse() {
super.prepareForReuse()
imageItem.backgroundColor = nil
if fileFavoriteImage?.image != nil {
imageFavoriteBackground.isHidden = false
} else {
imageFavoriteBackground.isHidden = true
}

accessibilityHint = nil
accessibilityLabel = nil
accessibilityValue = nil
}

override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
Expand Down
Loading

0 comments on commit c41732c

Please sign in to comment.