Skip to content

Commit

Permalink
Bug fix (#60)
Browse files Browse the repository at this point in the history
* bug fix

* bug fix

* bug fix

* bug fix

* zoom bug fix

* bug fix

* bug fix

* color fix

* bug fix

* bug fixing

* bug fix

* bug fix
  • Loading branch information
KhorenAs authored Dec 13, 2021
1 parent 125046f commit 3503a6c
Show file tree
Hide file tree
Showing 31 changed files with 402 additions and 273 deletions.
18 changes: 13 additions & 5 deletions Stingle.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
A06E423D2627230E00F43826 /* STAlbumsCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A06E423B2627230E00F43826 /* STAlbumsCollectionViewCell.swift */; };
A06E423E2627230E00F43826 /* STAlbumsCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A06E423C2627230E00F43826 /* STAlbumsCollectionViewCell.xib */; };
A06E424526273FAB00F43826 /* STCrypto+Album.swift in Sources */ = {isa = PBXBuildFile; fileRef = A06E424426273FAB00F43826 /* STCrypto+Album.swift */; };
A072CCE92762ABA10077695F /* STFilesSelectCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A072CCE82762ABA10077695F /* STFilesSelectCollectionViewController.swift */; };
A0735833268CBF9900F82016 /* STSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = A0735832268CBF9900F82016 /* STSlider.swift */; };
A074AE3B26459602004C9E9E /* STAlbumWorker+Share.swift in Sources */ = {isa = PBXBuildFile; fileRef = A074AE3A26459602004C9E9E /* STAlbumWorker+Share.swift */; };
A074AE3E26460203004C9E9E /* STMoveAlbumFilesVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A074AE3D26460203004C9E9E /* STMoveAlbumFilesVC.swift */; };
Expand Down Expand Up @@ -520,6 +521,7 @@
A06E423B2627230E00F43826 /* STAlbumsCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STAlbumsCollectionViewCell.swift; sourceTree = "<group>"; };
A06E423C2627230E00F43826 /* STAlbumsCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = STAlbumsCollectionViewCell.xib; sourceTree = "<group>"; };
A06E424426273FAB00F43826 /* STCrypto+Album.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "STCrypto+Album.swift"; sourceTree = "<group>"; };
A072CCE82762ABA10077695F /* STFilesSelectCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STFilesSelectCollectionViewController.swift; sourceTree = "<group>"; };
A0735832268CBF9900F82016 /* STSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STSlider.swift; sourceTree = "<group>"; };
A074AE3A26459602004C9E9E /* STAlbumWorker+Share.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "STAlbumWorker+Share.swift"; sourceTree = "<group>"; };
A074AE3D26460203004C9E9E /* STMoveAlbumFilesVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = STMoveAlbumFilesVC.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -910,6 +912,7 @@
A02203F825EEDC0300D07C98 /* STNavigationController.swift */,
A064433D26160BA000D74C46 /* STSplitViewController.swift */,
A0B267732624D7B30090E4ED /* STFilesViewController.swift */,
A072CCE82762ABA10077695F /* STFilesSelectCollectionViewController.swift */,
A099F4B626302386000D4F86 /* STPopoverViewController.swift */,
);
path = Controllers;
Expand Down Expand Up @@ -1956,9 +1959,9 @@
A0A9F347261C7992000252F2 /* Trash */ = {
isa = PBXGroup;
children = (
A0B2677A2624DFAF0090E4ED /* Items */,
A0A9F349261C79BE000252F2 /* STTrashVC.swift */,
A0B267772624DFA10090E4ED /* STTrashVM.swift */,
A0B2677A2624DFAF0090E4ED /* Items */,
);
path = Trash;
sourceTree = "<group>";
Expand Down Expand Up @@ -2521,6 +2524,7 @@
A0794B96269E3EF500B40FE9 /* STSettingsDetailTableViewCell.swift in Sources */,
A042199926909E58001FBFBF /* STFileWorker+Download.swift in Sources */,
A06E424526273FAB00F43826 /* STCrypto+Album.swift in Sources */,
A072CCE92762ABA10077695F /* STFilesSelectCollectionViewController.swift in Sources */,
A08F0C192607D01800E81826 /* STNetworkOperationDecodable.swift in Sources */,
A087C46226147DA8006775D2 /* STBytesUnits.swift in Sources */,
A02203C125EED86800D07C98 /* AppDelegate.swift in Sources */,
Expand Down Expand Up @@ -2862,7 +2866,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_DEBUG_INFORMATION_LEVEL = default;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = DK366LFCDT;
ENABLE_BITCODE = NO;
Expand All @@ -2872,6 +2876,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = org.stingle.photos.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -2951,7 +2956,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_DEBUG_INFORMATION_LEVEL = default;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = DK366LFCDT;
ENABLE_BITCODE = NO;
Expand All @@ -2961,6 +2966,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = org.stingle.photos;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -3035,7 +3041,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_DEBUG_INFORMATION_LEVEL = default;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = DK366LFCDT;
ENABLE_BITCODE = NO;
Expand All @@ -3045,6 +3051,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = org.stingle.photos;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -3119,7 +3126,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_DEBUG_INFORMATION_LEVEL = default;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = DK366LFCDT;
ENABLE_BITCODE = NO;
Expand All @@ -3129,6 +3136,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.2;
PRODUCT_BUNDLE_IDENTIFIER = org.stingle.photos.dev;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
7 changes: 2 additions & 5 deletions Stingle/Common/Manager/FileUploader/IUploadFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ extension STFileUploader {
return
}
self.asset.requestGetThumb { [weak self] (thumb) in
guard let thumb = thumb, let thumbData = thumb.pngData() else {
guard let thumb = thumb, let thumbData = thumb.jpegData(compressionQuality: 0.7) else {
failure(STFileUploader.UploaderError.phAssetNotValid)
return
}
Expand Down Expand Up @@ -137,15 +137,12 @@ extension STFileUploader {
let file = try STLibrary.AlbumFile(file: encryptedFileInfo.fileName, version: version, headers: encryptedFileInfo.headers, dateCreated: dateCreated, dateModified: dateModified, isRemote: false, albumId: self.album.albumId, managedObjectID: nil)
file.updateIfNeeded(albumMetadata: self.album.albumMetadata)
return file

}

}

}



private extension PHAsset {

private static let phManager = PHImageManager.default()
Expand Down Expand Up @@ -224,7 +221,7 @@ private extension PHAsset {
let options: PHContentEditingInputRequestOptions = PHContentEditingInputRequestOptions()
options.isNetworkAccessAllowed = true
options.canHandleAdjustmentData = {(adjustmeta: PHAdjustmentData) -> Bool in
return true
return false
}

let modificationDate = self.modificationDate
Expand Down
18 changes: 18 additions & 0 deletions Stingle/Common/Manager/FileUploader/STFileUploader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class STFileUploader {
}
}

func cancelUploadIng(for files: [STLibrary.File]) {
files.forEach { file in
self.cancelUploadIng(for: file)
}
}

func cancelUploadIng(for file: STLibrary.File) {
for operation in self.operationQueue.allOperations() {
if let operation = operation as? Operation, operation.libraryFile?.identifier == file.identifier {
Expand All @@ -100,6 +106,7 @@ class STFileUploader {

var localFiles = dataBase.galleryProvider.fetchObjects(format: "isRemote == false")
let localAlbumFiles = dataBase.albumFilesProvider.fetchObjects(format: "isRemote == false")
let trashPFiles = dataBase.trashProvider.fetchObjects(format: "isRemote == false")

let albumIds: [String] = localAlbumFiles.compactMap( { return $0.albumId } )
let albums: [STLibrary.Album] = dataBase.albumsProvider.fetch(identifiers: albumIds)
Expand All @@ -114,7 +121,10 @@ class STFileUploader {
albumFile.updateIfNeeded(albumMetadata: album.albumMetadata)
}
}

localFiles.append(contentsOf: localAlbumFiles)
localFiles.append(contentsOf: trashPFiles)

return localFiles
}

Expand Down Expand Up @@ -191,6 +201,8 @@ class STFileUploader {
if file.isRemote {
if let albumFile = file as? STLibrary.AlbumFile {
STApplication.shared.dataBase.albumFilesProvider.update(models: [albumFile], reloadData: true)
} else if let trashFile = file as? STLibrary.TrashFile {
STApplication.shared.dataBase.trashProvider.update(models: [trashFile], reloadData: true)
} else {
STApplication.shared.dataBase.galleryProvider.update(models: [file], reloadData: true)
}
Expand All @@ -208,6 +220,7 @@ extension STFileUploader {
guard let weakSelf = self else {
return
}

weakSelf.observer.forEach { (observer) in
observer.fileUploader(didUpdateProgress: weakSelf, uploadInfo: uploadInfo, files: files)
}
Expand All @@ -221,6 +234,7 @@ extension STFileUploader {
guard let weakSelf = self else {
return
}

weakSelf.observer.forEach { (observer) in
observer.fileUploader(didEndSucces: weakSelf, file: file, uploadInfo: uploadInfo)
}
Expand All @@ -234,6 +248,7 @@ extension STFileUploader {
guard let weakSelf = self else {
return
}

weakSelf.observer.forEach { (observer) in
observer.fileUploader(didEndFailed: weakSelf, file: file, error: error, uploadInfo: uploadInfo)
}
Expand Down Expand Up @@ -356,6 +371,7 @@ extension STFileUploader {
case fileSystemNotValid
case wrongStorageSize
case fileNotFound
case canceled
case error(error: Error)

var message: String {
Expand All @@ -368,6 +384,8 @@ extension STFileUploader {
return "storage_size_isover".localized
case .fileNotFound:
return "error_data_not_found".localized
case .canceled:
return "error_canceled".localized
case .error(let error):
if let iError = error as? IError {
return iError.message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ extension STFileUploader {
override func cancel() {
super.cancel()
self.networkOperation?.cancel()
self.responseFailed(error: UploaderError.canceled, file: self.libraryFile)
}

//MARK: - Private
Expand Down Expand Up @@ -91,6 +92,9 @@ extension STFileUploader {
} progress: { [weak self] (progress) in
self?.responseProgress(result: progress, file: file)
} failure: { [weak self] (error) in
guard !error.isCancelled else {
return
}
self?.responseFailed(error: error, file: file)
}
}
Expand Down
5 changes: 5 additions & 0 deletions Stingle/Common/Network/Workers/File/STFileWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class STFileWorker: STWorker {
let trashProvider = STApplication.shared.dataBase.trashProvider
let request = STFilesRequest.delete(files: files)

STApplication.shared.uploader.cancelUploadIng(for: files)

self.request(request: request, success: { (response: STEmptyResponse) in
trashProvider.delete(models: files, reloadData: true)
STApplication.shared.utils.deleteFilesIfNeeded(files: files)
Expand All @@ -71,13 +73,16 @@ class STFileWorker: STWorker {
let trashProvider = STApplication.shared.dataBase.trashProvider
let galleryProvider = STApplication.shared.dataBase.galleryProvider

STApplication.shared.uploader.cancelUploadIng(for: files)

guard !remoteFiles.isEmpty else {
trashProvider.delete(models: files, reloadData: true)
galleryProvider.add(models: files, reloadData: true)
success?(STEmptyResponse())
return
}


let request = STFilesRequest.moveToGalery(files: remoteFiles)

self.request(request: request, success: { (response: STEmptyResponse) in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class STNavigationAnimator: NSObject {
case fit
}

private(set) var transitioningOperation: TransitioningOperation?
private(set) weak var transitioningOperation: TransitioningOperation?
private var interactivePops = STObserverEvents<TransitioningOperationInteractivePop>()

private func addInteractionGesture(viewController: INavigationAnimatorDestinationVC, transitioningOperation: TransitioningOperation) {
Expand Down Expand Up @@ -129,7 +129,7 @@ extension STNavigationAnimator: STNavigationAnimatorTransitioningOperationDelega

}

func transitioningOperation(didSEndNavigate transitioningOperation: TransitioningOperation) {
func transitioningOperation(didSendNavigate transitioningOperation: TransitioningOperation) {
if transitioningOperation.operation == .push {
self.addInteractionGesture(viewController: transitioningOperation.destinationVC, transitioningOperation: transitioningOperation)
}
Expand Down
Loading

0 comments on commit 3503a6c

Please sign in to comment.