Skip to content

Commit

Permalink
Fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
gee1k committed Oct 2, 2020
1 parent f37a562 commit 1f8e88c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
20 changes: 11 additions & 9 deletions uPic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1030;
LastUpgradeCheck = 1110;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = "Svend Jin";
TargetAttributes = {
16A6DC5322AA375700813706 = {
Expand Down Expand Up @@ -1146,6 +1146,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -1208,6 +1209,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -1247,7 +1249,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20200814;
CURRENT_PROJECT_VERSION = 20201002;
DEVELOPMENT_TEAM = W863J6W8DZ;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist";
Expand All @@ -1256,7 +1258,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.20.0;
MARKETING_VERSION = 0.20.1;
PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1277,7 +1279,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20200814;
CURRENT_PROJECT_VERSION = 20201002;
DEVELOPMENT_TEAM = W863J6W8DZ;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist";
Expand All @@ -1286,7 +1288,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.20.0;
MARKETING_VERSION = 0.20.1;
PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1303,7 +1305,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20200814;
CURRENT_PROJECT_VERSION = 20201002;
DEVELOPMENT_TEAM = W863J6W8DZ;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = uPicFinderExtension/Info.plist;
Expand All @@ -1313,7 +1315,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.20.0;
MARKETING_VERSION = 0.20.1;
PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic.uPicFinderExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1330,7 +1332,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 20200814;
CURRENT_PROJECT_VERSION = 20201002;
DEVELOPMENT_TEAM = W863J6W8DZ;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = uPicFinderExtension/Info.plist;
Expand All @@ -1340,7 +1342,7 @@
"@executable_path/../../../../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 0.20.0;
MARKETING_VERSION = 0.20.1;
PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic.uPicFinderExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion uPic.xcodeproj/xcshareddata/xcschemes/uPic.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
21 changes: 16 additions & 5 deletions uPic/Models/BaseUploader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ import Alamofire
class BaseUploader {

func start() {
(NSApplication.shared.delegate as? AppDelegate)?.uploadStart()
DispatchQueue.main.async {
(NSApplication.shared.delegate as? AppDelegate)?.uploadStart()
}
}

func progress(percent: Double) {
(NSApplication.shared.delegate as? AppDelegate)?.uploadProgress(percent: percent)
DispatchQueue.main.async {
(NSApplication.shared.delegate as? AppDelegate)?.uploadProgress(percent: percent)
}
}

func completed(url: String, _ fileData: Data?, _ fileUrl: URL?, _ fileName: String?) {
Expand Down Expand Up @@ -72,11 +76,16 @@ class BaseUploader {

ConfigManager.shared.addHistory(previewModel)
}
(NSApplication.shared.delegate as? AppDelegate)?.uploadCompleted(url: url)

DispatchQueue.main.async {
(NSApplication.shared.delegate as? AppDelegate)?.uploadCompleted(url: url)
}
}

func faild(errorMsg: String? = "") {
(NSApplication.shared.delegate as? AppDelegate)?.uploadFaild(errorMsg: errorMsg)
DispatchQueue.main.async {
(NSApplication.shared.delegate as? AppDelegate)?.uploadFaild(errorMsg: errorMsg)
}
}

/*********************************************************** static *******************************************************************/
Expand Down Expand Up @@ -169,7 +178,9 @@ class BaseUploader {
if (!BaseUploader.checkFileSize(fileSize: UInt64(data.count), limitSize: limitSize)) {

let errorMsg = "\("File is over the size limit! Limit:".localized)\(ByteCountFormatter.string(fromByteCount: Int64(limitSize), countStyle: .binary))"
(NSApplication.shared.delegate as? AppDelegate)?.uploadFaild(errorMsg: errorMsg)
DispatchQueue.main.async {
(NSApplication.shared.delegate as? AppDelegate)?.uploadFaild(errorMsg: errorMsg)
}
return
}

Expand Down

0 comments on commit 1f8e88c

Please sign in to comment.