From 1fbf3bd060c4357aba1fa37f1927d9bc8473ad03 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 27 Sep 2023 18:05:19 +0900 Subject: [PATCH 01/17] =?UTF-8?q?[Add]=20#227=20-=20Share=20Extension,=20A?= =?UTF-8?q?pp=20Group=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base.lproj/MainInterface.storyboard | 24 +++ ShareExtension/Info.plist | 18 ++ ShareExtension/ShareExtension.entitlements | 10 ++ ShareExtension/ShareViewController.swift | 30 ++++ pophory-iOS.xcodeproj/project.pbxproj | 166 ++++++++++++++++++ pophory-iOS/pophory-iOS.entitlements | 4 + pophory-iOS/pophory-iOSRelease.entitlements | 4 + 7 files changed, 256 insertions(+) create mode 100644 ShareExtension/Base.lproj/MainInterface.storyboard create mode 100644 ShareExtension/Info.plist create mode 100644 ShareExtension/ShareExtension.entitlements create mode 100644 ShareExtension/ShareViewController.swift diff --git a/ShareExtension/Base.lproj/MainInterface.storyboard b/ShareExtension/Base.lproj/MainInterface.storyboard new file mode 100644 index 00000000..286a5089 --- /dev/null +++ b/ShareExtension/Base.lproj/MainInterface.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ShareExtension/Info.plist b/ShareExtension/Info.plist new file mode 100644 index 00000000..4b1f7e70 --- /dev/null +++ b/ShareExtension/Info.plist @@ -0,0 +1,18 @@ + + + + + NSExtension + + NSExtensionAttributes + + NSExtensionActivationRule + TRUEPREDICATE + + NSExtensionMainStoryboard + MainInterface + NSExtensionPointIdentifier + com.apple.share-services + + + diff --git a/ShareExtension/ShareExtension.entitlements b/ShareExtension/ShareExtension.entitlements new file mode 100644 index 00000000..d11cc25d --- /dev/null +++ b/ShareExtension/ShareExtension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.Team.pophory-iOS + + + diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift new file mode 100644 index 00000000..d1874b1b --- /dev/null +++ b/ShareExtension/ShareViewController.swift @@ -0,0 +1,30 @@ +// +// ShareViewController.swift +// ShareExtension +// +// Created by 김다예 on 2023/09/27. +// + +import UIKit +import Social + +class ShareViewController: SLComposeServiceViewController { + + override func isContentValid() -> Bool { + // Do validation of contentText and/or NSExtensionContext attachments here + return true + } + + override func didSelectPost() { + // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments. + + // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context. + self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil) + } + + override func configurationItems() -> [Any]! { + // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here. + return [] + } + +} diff --git a/pophory-iOS.xcodeproj/project.pbxproj b/pophory-iOS.xcodeproj/project.pbxproj index e3dd7f3a..b8a50fc6 100644 --- a/pophory-iOS.xcodeproj/project.pbxproj +++ b/pophory-iOS.xcodeproj/project.pbxproj @@ -69,6 +69,9 @@ 3B5CDBD72A94DDDB001382C4 /* FirebaseAnalyticsSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3B5CDBD62A94DDDB001382C4 /* FirebaseAnalyticsSwift */; }; 3B5CDBD92A94DDDB001382C4 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 3B5CDBD82A94DDDB001382C4 /* FirebaseCrashlytics */; }; 3B5CDBDB2A94DDDB001382C4 /* FirebaseDynamicLinks in Frameworks */ = {isa = PBXBuildFile; productRef = 3B5CDBDA2A94DDDB001382C4 /* FirebaseDynamicLinks */; }; + 6B05C56D2AC4277800A75C00 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C56C2AC4277800A75C00 /* ShareViewController.swift */; }; + 6B05C5702AC4277800A75C00 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B05C56E2AC4277800A75C00 /* MainInterface.storyboard */; }; + 6B05C5742AC4277800A75C00 /* ShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 6B09D2282A6808DA00DF4275 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B09D2272A6808DA00DF4275 /* ShareViewController.swift */; }; 6B09D22A2A6808EA00DF4275 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B09D2292A6808EA00DF4275 /* ShareView.swift */; }; 6B29DC592A5494A000F93EC7 /* PhotoInfoStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B29DC542A5494A000F93EC7 /* PhotoInfoStackView.swift */; }; @@ -179,6 +182,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 6B05C5722AC4277800A75C00 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = B1631EFF2A1759EA0050974F /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6B05C5692AC4277800A75C00; + remoteInfo = ShareExtension; + }; B1631F1E2A1759EB0050974F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = B1631EFF2A1759EA0050974F /* Project object */; @@ -195,6 +205,20 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 6B05C5752AC4277800A75C00 /* Embed Foundation Extensions */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 6B05C5742AC4277800A75C00 /* ShareExtension.appex in Embed Foundation Extensions */, + ); + name = "Embed Foundation Extensions"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 3703F0F42A6071B50017A381 /* PostIdentityTokenDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostIdentityTokenDTO.swift; sourceTree = ""; }; 3703F0F62A60A9BE0017A381 /* SignUpIndicatorCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpIndicatorCollectionViewCell.swift; sourceTree = ""; }; @@ -254,6 +278,11 @@ 3B3A09122A56A56F00C8A740 /* PhotoDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDetailView.swift; sourceTree = ""; }; 3B3A09142A56A6C700C8A740 /* PhotoDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDetailViewController.swift; sourceTree = ""; }; 3B3BE7182A56CC820064E716 /* PophoryNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PophoryNavigationController.swift; sourceTree = ""; }; + 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; + 6B05C56C2AC4277800A75C00 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; + 6B05C56F2AC4277800A75C00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; + 6B05C5712AC4277800A75C00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6B05C5792AC4277E00A75C00 /* ShareExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShareExtension.entitlements; sourceTree = ""; }; 6B09D2272A6808DA00DF4275 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; 6B09D2292A6808EA00DF4275 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = ""; }; 6B29DC542A5494A000F93EC7 /* PhotoInfoStackView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoInfoStackView.swift; sourceTree = ""; }; @@ -365,6 +394,13 @@ /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 6B05C5672AC4277800A75C00 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; B1631F042A1759EA0050974F /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -615,6 +651,17 @@ path = ViewController; sourceTree = ""; }; + 6B05C56B2AC4277800A75C00 /* ShareExtension */ = { + isa = PBXGroup; + children = ( + 6B05C5792AC4277E00A75C00 /* ShareExtension.entitlements */, + 6B05C56C2AC4277800A75C00 /* ShareViewController.swift */, + 6B05C56E2AC4277800A75C00 /* MainInterface.storyboard */, + 6B05C5712AC4277800A75C00 /* Info.plist */, + ); + path = ShareExtension; + sourceTree = ""; + }; 6B09D2262A6808BF00DF4275 /* Share */ = { isa = PBXGroup; children = ( @@ -899,6 +946,7 @@ B1631F092A1759EA0050974F /* pophory-iOS */, B1631F202A1759EB0050974F /* pophory-iOSTests */, B1631F2A2A1759EB0050974F /* pophoryUITests */, + 6B05C56B2AC4277800A75C00 /* ShareExtension */, B1631F082A1759EA0050974F /* Products */, ); sourceTree = ""; @@ -909,6 +957,7 @@ B1631F072A1759EA0050974F /* pophory-iOS.app */, B1631F1D2A1759EB0050974F /* pophoryTests.xctest */, B1631F272A1759EB0050974F /* pophoryUITests.xctest */, + 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */, ); name = Products; sourceTree = ""; @@ -1111,6 +1160,23 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 6B05C5692AC4277800A75C00 /* ShareExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6B05C5782AC4277800A75C00 /* Build configuration list for PBXNativeTarget "ShareExtension" */; + buildPhases = ( + 6B05C5662AC4277800A75C00 /* Sources */, + 6B05C5672AC4277800A75C00 /* Frameworks */, + 6B05C5682AC4277800A75C00 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ShareExtension; + productName = ShareExtension; + productReference = 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; B1631F062A1759EA0050974F /* pophory-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = B1631F312A1759EB0050974F /* Build configuration list for PBXNativeTarget "pophory-iOS" */; @@ -1119,10 +1185,12 @@ B1631F042A1759EA0050974F /* Frameworks */, B1631F052A1759EA0050974F /* Resources */, 3B5CDBC32A94CEA9001382C4 /* Run Script */, + 6B05C5752AC4277800A75C00 /* Embed Foundation Extensions */, ); buildRules = ( ); dependencies = ( + 6B05C5732AC4277800A75C00 /* PBXTargetDependency */, ); name = "pophory-iOS"; packageProductDependencies = ( @@ -1187,6 +1255,9 @@ LastSwiftUpdateCheck = 1430; LastUpgradeCheck = 1430; TargetAttributes = { + 6B05C5692AC4277800A75C00 = { + CreatedOnToolsVersion = 14.3.1; + }; B1631F062A1759EA0050974F = { CreatedOnToolsVersion = 14.3; }; @@ -1226,11 +1297,20 @@ B1631F062A1759EA0050974F /* pophory-iOS */, B1631F1C2A1759EB0050974F /* pophoryTests */, B1631F262A1759EB0050974F /* pophoryUITests */, + 6B05C5692AC4277800A75C00 /* ShareExtension */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 6B05C5682AC4277800A75C00 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B05C5702AC4277800A75C00 /* MainInterface.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B1631F052A1759EA0050974F /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -1289,6 +1369,14 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 6B05C5662AC4277800A75C00 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B05C56D2AC4277800A75C00 /* ShareViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; B1631F032A1759EA0050974F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1464,6 +1552,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 6B05C5732AC4277800A75C00 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6B05C5692AC4277800A75C00 /* ShareExtension */; + targetProxy = 6B05C5722AC4277800A75C00 /* PBXContainerItemProxy */; + }; B1631F1F2A1759EB0050974F /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = B1631F062A1759EA0050974F /* pophory-iOS */; @@ -1477,6 +1570,14 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 6B05C56E2AC4277800A75C00 /* MainInterface.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 6B05C56F2AC4277800A75C00 /* Base */, + ); + name = MainInterface.storyboard; + sourceTree = ""; + }; B1631F152A1759EB0050974F /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -1488,6 +1589,60 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 6B05C5762AC4277800A75C00 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = CQJ9UKUU35; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = ShareExtension/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = ShareExtension; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Team.pophory-iOS.ShareExtension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6B05C5772AC4277800A75C00 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = CQJ9UKUU35; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = ShareExtension/Info.plist; + INFOPLIST_KEY_CFBundleDisplayName = ShareExtension; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Team.pophory-iOS.ShareExtension"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; B1631F2F2A1759EB0050974F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1608,6 +1763,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37A271662AA71D40001FFC38 /* Debug.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "pophory-iOS/pophory-iOS.entitlements"; @@ -1649,6 +1805,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 37A271672AA71D9E001FFC38 /* Release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "pophory-iOS/pophory-iOSRelease.entitlements"; @@ -1771,6 +1928,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 6B05C5782AC4277800A75C00 /* Build configuration list for PBXNativeTarget "ShareExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6B05C5762AC4277800A75C00 /* Debug */, + 6B05C5772AC4277800A75C00 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; B1631F022A1759EA0050974F /* Build configuration list for PBXProject "pophory-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/pophory-iOS/pophory-iOS.entitlements b/pophory-iOS/pophory-iOS.entitlements index adde977c..34bf6c18 100644 --- a/pophory-iOS/pophory-iOS.entitlements +++ b/pophory-iOS/pophory-iOS.entitlements @@ -10,5 +10,9 @@ applinks:pophory.page.link + com.apple.security.application-groups + + group.Team.pophory-iOS + diff --git a/pophory-iOS/pophory-iOSRelease.entitlements b/pophory-iOS/pophory-iOSRelease.entitlements index adde977c..34bf6c18 100644 --- a/pophory-iOS/pophory-iOSRelease.entitlements +++ b/pophory-iOS/pophory-iOSRelease.entitlements @@ -10,5 +10,9 @@ applinks:pophory.page.link + com.apple.security.application-groups + + group.Team.pophory-iOS + From a98956c2f44dadb6c7498f3d70f142a1c3f5984c Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 27 Sep 2023 18:28:18 +0900 Subject: [PATCH 02/17] =?UTF-8?q?[Setting]=20#227=20-=20=EC=82=AC=EC=A7=84?= =?UTF-8?q?=EB=A7=8C=20=EA=B3=B5=EC=9C=A0=20=EB=9C=A8=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/Info.plist | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ShareExtension/Info.plist b/ShareExtension/Info.plist index 4b1f7e70..648b655b 100644 --- a/ShareExtension/Info.plist +++ b/ShareExtension/Info.plist @@ -2,12 +2,22 @@ + NSExtensionFileProviderDocumentGroup + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExtension NSExtensionAttributes NSExtensionActivationRule - TRUEPREDICATE + + NSExtensionActivationSupportsImageWithMaxCount + 1 + NSExtensionMainStoryboard MainInterface From a3016ec937086167dda9eecab40f17917c82fe7b Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Mon, 2 Oct 2023 17:34:27 +0900 Subject: [PATCH 03/17] =?UTF-8?q?[Feat]=20#227=20-=20Share=20Extension=20V?= =?UTF-8?q?iew=201=EC=B0=A8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/Info.plist | 9 +- ShareExtension/ShareViewController.swift | 170 ++++++++++++++-- ShareExtension/View/PhotoInfoStackView.swift | 133 ++++++++++++ ShareExtension/View/ShareView.swift | 203 +++++++++++++++++++ pophory-iOS.xcodeproj/project.pbxproj | 54 ++++- 5 files changed, 549 insertions(+), 20 deletions(-) create mode 100644 ShareExtension/View/PhotoInfoStackView.swift create mode 100644 ShareExtension/View/ShareView.swift diff --git a/ShareExtension/Info.plist b/ShareExtension/Info.plist index 648b655b..b9a0b58a 100644 --- a/ShareExtension/Info.plist +++ b/ShareExtension/Info.plist @@ -2,8 +2,13 @@ - NSExtensionFileProviderDocumentGroup - + UIAppFonts + + Pretendard-Regular.otf + Pretendard-Medium.otf + Pretendard-SemiBold.otf + Pretendard-Bold.otf + NSAppTransportSecurity NSAllowsArbitraryLoads diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index d1874b1b..8efeca97 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -8,23 +8,161 @@ import UIKit import Social -class ShareViewController: SLComposeServiceViewController { - - override func isContentValid() -> Bool { - // Do validation of contentText and/or NSExtensionContext attachments here - return true - } - - override func didSelectPost() { - // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments. +final class ShareViewController: UIViewController { - // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context. - self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil) + private let rootView = ShareView() + + override func loadView() { + super.loadView() + + view = rootView } - - override func configurationItems() -> [Any]! { - // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here. - return [] + + override func viewDidLoad() { + super.viewDidLoad() + } - + +// // MARK: - Properties +// +// private var presignedURL: FetchPresignedURLRequestDTO? +// private let networkManager = AddPhotoNetworkManager() +// +// private var albumID: Int? +// private var photoCount: Int? +// private var maxPhotoCount: Int? +// +// private var albumList: FetchAlbumListResponseDTO? { +// didSet { +// if let albums = albumList?.albums { +// if albums.count != 0 { +// self.albumID = albums[0].id +// self.photoCount = albums[0].photoCount +// self.maxPhotoCount = albums[0].photoLimit +// } +// } +// } +// } +// +// private var photoImage = UIImage() +// private var dateTaken: String = DateManager.dateToString(date: Date()) +// private var studioID: Int = -1 +// +// // MARK: - UI Properties +// +// private let rootView = AddPhotoView() +// +// // MARK: - Life Cycle +// +// override func loadView() { +// super.loadView() +// +// view = rootView +// } +// +// override func viewWillAppear(_ animated: Bool) { +// super.viewWillAppear(animated) +// +// networkManager.requestGetAlumListAPI() { [weak self] albumList in +// self?.albumList = albumList +// } +// } +// +// override func viewDidLoad() { +// super.viewDidLoad() +// +// setupTarget() +// networkManager.requestGetPresignedURLAPI() { [weak self] presignedURL in +// self?.presignedURL = presignedURL +// } +// } +//} +// +//extension ShareViewController { +// +// // MARK: - @objc +// +// @objc func onclickDateButton() { +// let customModalVC = CalendarModalViewController() +// customModalVC.modalPresentationStyle = .custom +// +// let customTransitionDelegate = CustomModalTransitionDelegate(customHeight: 340) +// customModalVC.transitioningDelegate = customTransitionDelegate +// +// customModalVC.delegate = self +// customModalVC.setPickerDate(fordate: DateManager.stringToDate(date: rootView.dateStackView.getExplain())) +// present(customModalVC, animated: true, completion: nil) +// } +// +// @objc func onclicStudioButton() { +// let customModalVC = StudioModalViewController() +// customModalVC.modalPresentationStyle = .custom +// +// let customTransitionDelegate = CustomModalTransitionDelegate(customHeight: 232) +// customModalVC.transitioningDelegate = customTransitionDelegate +// customModalVC.delegate = self +// customModalVC.selectedStudioIndex = studioID +// present(customModalVC, animated: true, completion: nil) +// } +// +// @objc func onclickAddPhotoButton() { +// guard let maxPhotoCount = self.maxPhotoCount else { return } +// if let photoCount = photoCount { +// if photoCount >= maxPhotoCount { +// showPopup(popupType: .simple, +// image: ImageLiterals.img_albumfull, +// primaryText: "포포리 앨범이 가득찼어요", +// secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!", firstButtonHandler: goToHome) +// } else { +// if let urlString = presignedURL?.presignedUrl, let url = URL(string: urlString) { +// networkManager.uploadImageToPresignedURL(image: photoImage, presignedURL: url, completion: {_ in +// }) +// } else { +// print("Invalid URL") +// } +// let photoInfo = PostPhotoS3RequestDTO(fileName: presignedURL?.fileName, albumId: albumID, takenAt: dateTaken, studioId: studioID, width: Int(photoImage.size.width), height: Int(photoImage.size.height)) +// networkManager.requestPostPhotoAPI(photoInfo: photoInfo) { +// self.goToHome() +// } +// } +// } +// } +// +// // MARK: - Private Methods +// +// private func setupTarget() { +// rootView.dateStackView.infoButton.addTarget(self, action: #selector(onclickDateButton), for: .touchUpInside) +// rootView.studioStackView.infoButton.addTarget(self, action: #selector(onclicStudioButton), for: .touchUpInside) +// rootView.photoAddButton.addTarget(self, action: #selector(onclickAddPhotoButton), for: .touchUpInside) +// } +// +// private func goToHome() { +// dismiss(animated: false) +// navigationController?.popToRootViewController(animated: true) +// } +// +// // MARK: - Methods +// +// func setupRootViewImage(forImage: UIImage?, forType: PhotoCellType) { +// rootView.photo.image = forImage +// rootView.photoType = forType +// photoImage = forImage ?? UIImage() +// } +//} +// +//// MARK: - DataBind Protocol +// +//extension ShareViewController: DateDataBind, StudioDataBind { +// +// func dateDataBind(text: String) { +// rootView.dateStackView.setupExplain(explain: text) +// rootView.dateStackView.setupSelected(selected: true) +// dateTaken = text +// } +// +// func studioDataBind(text: String, forIndex: Int) { +// rootView.studioStackView.setupExplain(explain: text) +// rootView.studioStackView.setupSelected(selected: true) +// studioID = forIndex +// } } diff --git a/ShareExtension/View/PhotoInfoStackView.swift b/ShareExtension/View/PhotoInfoStackView.swift new file mode 100644 index 00000000..061ca949 --- /dev/null +++ b/ShareExtension/View/PhotoInfoStackView.swift @@ -0,0 +1,133 @@ +// +// PhotoInfoStackView.swift +// ShareExtension +// +// Created by 김다예 on 2023/10/02. +// + +import UIKit + +import SnapKit + +class PhotoInfoStackView: UIStackView { + + // MARK: - Properties + + /// 선택 완료 시 선택된 label의 색 변경하기 위한 변수 + private var didSelected: Bool = false { + didSet { + changeInfoLabelColor(selected: didSelected) + } + } + + // MARK: - UI Properties + + private let mainLabel: UILabel = { + let label = UILabel() + label.font = .head3 + label.textColor = .pophoryBlack + label.textAlignment = .left + return label + }() + + lazy var infoButton: UIButton = { + let button = UIButton() + button.backgroundColor = .pophoryGray100 + button.layer.cornerRadius = 18 + button.layer.borderWidth = 1 + button.layer.borderColor = UIColor.pophoryGray300.cgColor + return button + }() + + private let infoLabel: UILabel = { + let label = UILabel() + label.font = .text1 + label.textColor = .pophoryBlack + label.textAlignment = .left + return label + }() + + private var infoIcon = UIImageView() + + // MARK: - Life Cycle + + override init(frame: CGRect) { + super.init(frame: frame) + + setupStyle() + setupLayout() + } + + required init(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +extension PhotoInfoStackView { + + // MARK: - Layout + + private func setupStyle() { + self.axis = .vertical + self.spacing = 16 + } + + private func setupLayout() { + self.addArrangedSubview(mainLabel) + self.addArrangedSubview(infoButton) + + mainLabel.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + } + infoButton.snp.makeConstraints { + $0.height.equalTo(58) + $0.leading.trailing.equalToSuperview() + } + + infoButton.addSubview(infoLabel) + infoButton.addSubview(infoIcon) + + infoLabel.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.leading.equalToSuperview().inset(16) + } + infoIcon.snp.makeConstraints { + $0.centerY.equalToSuperview() + $0.trailing.equalToSuperview().inset(17) + } + } + + // MARK: - @objc + + // MARK: - Private Methods + + private func changeInfoLabelColor(selected: Bool) { + if selected { + infoLabel.textColor = .pophoryBlack + } else { + infoLabel.textColor = .pophoryGray400 + } + } + + // MARK: - Public Methods + + public func setupTitle(title: String) { + mainLabel.text = title + } + + public func setupSelected(selected: Bool) { + changeInfoLabelColor(selected: selected) + } + + public func setupIcon(icon: UIImage) { + infoIcon.image = icon + } + + public func setupExplain(explain: String) { + infoLabel.text = explain + } + + func getExplain() -> String? { + return infoLabel.text + } +} diff --git a/ShareExtension/View/ShareView.swift b/ShareExtension/View/ShareView.swift new file mode 100644 index 00000000..941dc6cc --- /dev/null +++ b/ShareExtension/View/ShareView.swift @@ -0,0 +1,203 @@ +// +// ShareView.swift +// ShareExtension +// +// Created by 김다예 on 2023/10/02. +// + +import UIKit + +import SnapKit + +@frozen +enum PhotoCellType { + case vertical + case horizontal + case none +} + +class ShareView: UIView { + +// MARK: - UI Properties + + var photoType: PhotoCellType = .vertical { + didSet { + switch photoType { + case .vertical, .none: + photoView.image = ImageLiterals.addPhotoBackgroundVertical + setupVerticle() + case .horizontal: + photoView.image = ImageLiterals.addPhotoBackgroundHorizontal + setupHorizontal() + } + } + } + + // iphone 13 mini 기준 verticle 이미지 height + private var imageConstraint: CGFloat = 285 + + // MARK: - UI Properties + + private let scrollView: UIScrollView = { + let scrollView = UIScrollView() + scrollView.backgroundColor = .white + scrollView.showsHorizontalScrollIndicator = false + return scrollView + }() + private let scrollContentsView: UIView = { + let view = UIView() + view.backgroundColor = .white + return view + }() + + let photoView: UIImageView = { + let view = UIImageView() + view.image = ImageLiterals.addPhotoBackgroundVertical + return view + }() + + let photo = UIImageView() + + private let photoInfoStackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .vertical + stackView.spacing = 22 + return stackView + }() + private let photoAddButtonView: UIView = { + let view = UIView() + view.backgroundColor = .pophoryWhite + return view + }() + + let photoAddButton: UIButton = { + let button = UIButton() + button.backgroundColor = .black + button.setTitle("사진 추가하기", for: .normal) + button.setTitleColor(.pophoryWhite, for: .normal) + button.layer.cornerRadius = 30 + return button + }() + + let dateStackView: PhotoInfoStackView = { + let stackView = PhotoInfoStackView() + stackView.setupTitle(title: "찍은 날짜") + stackView.setupSelected(selected: true) + stackView.setupIcon(icon: ImageLiterals.calanderIcon) + stackView.setupExplain(explain: DateManager.dateToString(date: Date())) + return stackView + }() + let studioStackView: PhotoInfoStackView = { + let stackView = PhotoInfoStackView() + stackView.setupTitle(title: "사진관") + stackView.setupSelected(selected: false) + stackView.setupIcon(icon: ImageLiterals.downIcon) + stackView.setupExplain(explain: "사진관을 선택해줘") + return stackView + }() + + // MARK: - Life Cycle + + override init(frame: CGRect) { + super.init(frame: frame) + + setupStyle() + setupLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +extension ShareView { + + // MARK: - Layout + + private func setupStyle() { + self.backgroundColor = .pophoryWhite + } + + private func setupLayout() { + self.addSubview(scrollView) + self.addSubview(photoAddButtonView) + + scrollView.snp.makeConstraints { + $0.top.equalTo(safeAreaLayoutGuide) + $0.left.right.equalToSuperview() + $0.bottom.equalTo(photoAddButtonView.snp.top) + } + photoAddButtonView.snp.makeConstraints { + $0.height.equalTo(80) + $0.top.equalTo(scrollView.snp.bottom) + $0.bottom.equalTo(safeAreaLayoutGuide) + $0.leading.trailing.equalToSuperview() + } + + scrollView.addSubview(scrollContentsView) + + scrollContentsView.snp.makeConstraints { + $0.edges.width.equalToSuperview() + } + + photoInfoStackView.addArrangedSubview(dateStackView) + photoInfoStackView.addArrangedSubview(studioStackView) + + scrollContentsView.addSubview(photoView) + scrollContentsView.addSubview(photoInfoStackView) + + photoView.addSubview(photo) + + photoView.snp.makeConstraints { + $0.height.equalTo(325) + $0.top.leading.trailing.equalToSuperview() + } + photoInfoStackView.snp.makeConstraints { + $0.top.equalTo(photoView.snp.bottom).offset(20) + $0.leading.trailing.equalToSuperview().inset(20) + $0.bottom.equalToSuperview().inset(22) + } + + photo.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(94) + $0.top.bottom.equalToSuperview().inset(20) + } + + photoAddButtonView.addSubview(photoAddButton) + + photoAddButton.snp.makeConstraints { + $0.height.equalTo(60) + $0.centerY.equalToSuperview() + $0.horizontalEdges.equalToSuperview().inset(20) + } + } + + // MARK: - func + + func setupVerticle() { + photo.snp.remakeConstraints { + var width: CGFloat = 188 + // 세로 제약조건을 superView에 20씩 걸어놓고 사진의 원본 비율에 따라 width를 구함 + if let imageWidth = photo.image?.size.width, let imageHeight = photo.image?.size.height { + width = imageWidth * (imageConstraint / imageHeight) + } + $0.width.equalTo(width) + $0.centerX.equalToSuperview() + $0.top.bottom.equalToSuperview().inset(20) + } + } + + func setupHorizontal() { + photo.snp.remakeConstraints { + var height: CGFloat = 188 + // 가로 제약조건을 superView에 45씩 걸어놓고 사진의 원본 비율에 따라 height를 구함 + if let imageWidth = photo.image?.size.width, let imageHeight = photo.image?.size.height { + height = imageHeight * (imageConstraint / imageWidth) + } + $0.height.equalTo(height) + $0.centerY.equalToSuperview() + $0.leading.trailing.equalToSuperview().inset(45) + } + } +} + diff --git a/pophory-iOS.xcodeproj/project.pbxproj b/pophory-iOS.xcodeproj/project.pbxproj index b8a50fc6..9e3c1f86 100644 --- a/pophory-iOS.xcodeproj/project.pbxproj +++ b/pophory-iOS.xcodeproj/project.pbxproj @@ -72,6 +72,17 @@ 6B05C56D2AC4277800A75C00 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C56C2AC4277800A75C00 /* ShareViewController.swift */; }; 6B05C5702AC4277800A75C00 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B05C56E2AC4277800A75C00 /* MainInterface.storyboard */; }; 6B05C5742AC4277800A75C00 /* ShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + 6B05C5C12ACAA35800A75C00 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C5C02ACAA35800A75C00 /* ShareView.swift */; }; + 6B05C5C22ACAA50E00A75C00 /* ImageLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91F3A75F2A517E9E00C06D1B /* ImageLiterals.swift */; }; + 6B05C5C32ACAA5B000A75C00 /* ColorLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DCA6AB2A4ABAE200FF8F90 /* ColorLiterals.swift */; }; + 6B05C5C42ACAA78F00A75C00 /* FontLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DCA6AD2A4ABAF300FF8F90 /* FontLiterals.swift */; }; + 6B05C5C52ACAA79D00A75C00 /* Pretendard-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 376BF64F2A548FB60007D4C3 /* Pretendard-Bold.otf */; }; + 6B05C5C62ACAA79F00A75C00 /* Pretendard-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 37DCA6B12A4AC7CC00FF8F90 /* Pretendard-Medium.otf */; }; + 6B05C5C72ACAA7A200A75C00 /* Pretendard-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 37DCA6B02A4AC7CC00FF8F90 /* Pretendard-SemiBold.otf */; }; + 6B05C5C82ACAA7A400A75C00 /* Pretendard-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 37DCA6B22A4AC7CD00FF8F90 /* Pretendard-Regular.otf */; }; + 6B05C5CB2ACAA82800A75C00 /* PhotoInfoStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C5CA2ACAA82800A75C00 /* PhotoInfoStackView.swift */; }; + 6B05C5CD2ACAA8CF00A75C00 /* DateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB37C722A55EB7400E49B12 /* DateManager.swift */; }; + 6B05C5DB2ACAB37500A75C00 /* Assets.xcassets in Sources */ = {isa = PBXBuildFile; fileRef = B1631F132A1759EB0050974F /* Assets.xcassets */; }; 6B09D2282A6808DA00DF4275 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B09D2272A6808DA00DF4275 /* ShareViewController.swift */; }; 6B09D22A2A6808EA00DF4275 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B09D2292A6808EA00DF4275 /* ShareView.swift */; }; 6B29DC592A5494A000F93EC7 /* PhotoInfoStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B29DC542A5494A000F93EC7 /* PhotoInfoStackView.swift */; }; @@ -283,6 +294,9 @@ 6B05C56F2AC4277800A75C00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; 6B05C5712AC4277800A75C00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 6B05C5792AC4277E00A75C00 /* ShareExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShareExtension.entitlements; sourceTree = ""; }; + 6B05C5C02ACAA35800A75C00 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = ""; }; + 6B05C5CA2ACAA82800A75C00 /* PhotoInfoStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoInfoStackView.swift; sourceTree = ""; }; + 6B05C5CF2ACAAB8600A75C00 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 6B09D2272A6808DA00DF4275 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; 6B09D2292A6808EA00DF4275 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = ""; }; 6B29DC542A5494A000F93EC7 /* PhotoInfoStackView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoInfoStackView.swift; sourceTree = ""; }; @@ -654,6 +668,7 @@ 6B05C56B2AC4277800A75C00 /* ShareExtension */ = { isa = PBXGroup; children = ( + 6B05C5C92ACAA81200A75C00 /* View */, 6B05C5792AC4277E00A75C00 /* ShareExtension.entitlements */, 6B05C56C2AC4277800A75C00 /* ShareViewController.swift */, 6B05C56E2AC4277800A75C00 /* MainInterface.storyboard */, @@ -662,6 +677,23 @@ path = ShareExtension; sourceTree = ""; }; + 6B05C5C92ACAA81200A75C00 /* View */ = { + isa = PBXGroup; + children = ( + 6B05C5C02ACAA35800A75C00 /* ShareView.swift */, + 6B05C5CA2ACAA82800A75C00 /* PhotoInfoStackView.swift */, + ); + path = View; + sourceTree = ""; + }; + 6B05C5CE2ACAAB8500A75C00 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 6B05C5CF2ACAAB8600A75C00 /* XCTest.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 6B09D2262A6808BF00DF4275 /* Share */ = { isa = PBXGroup; children = ( @@ -948,6 +980,7 @@ B1631F2A2A1759EB0050974F /* pophoryUITests */, 6B05C56B2AC4277800A75C00 /* ShareExtension */, B1631F082A1759EA0050974F /* Products */, + 6B05C5CE2ACAAB8500A75C00 /* Frameworks */, ); sourceTree = ""; }; @@ -1173,6 +1206,8 @@ dependencies = ( ); name = ShareExtension; + packageProductDependencies = ( + ); productName = ShareExtension; productReference = 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */; productType = "com.apple.product-type.app-extension"; @@ -1308,6 +1343,10 @@ buildActionMask = 2147483647; files = ( 6B05C5702AC4277800A75C00 /* MainInterface.storyboard in Resources */, + 6B05C5C52ACAA79D00A75C00 /* Pretendard-Bold.otf in Resources */, + 6B05C5C82ACAA7A400A75C00 /* Pretendard-Regular.otf in Resources */, + 6B05C5C62ACAA79F00A75C00 /* Pretendard-Medium.otf in Resources */, + 6B05C5C72ACAA7A200A75C00 /* Pretendard-SemiBold.otf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1373,6 +1412,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 6B05C5DB2ACAB37500A75C00 /* Assets.xcassets in Sources */, + 6B05C5CD2ACAA8CF00A75C00 /* DateManager.swift in Sources */, + 6B05C5C42ACAA78F00A75C00 /* FontLiterals.swift in Sources */, + 6B05C5C12ACAA35800A75C00 /* ShareView.swift in Sources */, + 6B05C5CB2ACAA82800A75C00 /* PhotoInfoStackView.swift in Sources */, + 6B05C5C32ACAA5B000A75C00 /* ColorLiterals.swift in Sources */, + 6B05C5C22ACAA50E00A75C00 /* ImageLiterals.swift in Sources */, 6B05C56D2AC4277800A75C00 /* ShareViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1596,11 +1642,13 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = CQJ9UKUU35; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = ShareExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShareExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1612,7 +1660,7 @@ SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; @@ -1623,11 +1671,13 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = CQJ9UKUU35; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = ShareExtension/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ShareExtension; INFOPLIST_KEY_NSHumanReadableCopyright = ""; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1639,7 +1689,7 @@ SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; From ed8b1129ff9ef9704e8c9bd88e280479459913e2 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 4 Oct 2023 13:50:16 +0900 Subject: [PATCH 04/17] =?UTF-8?q?[Add]=20#227=20-=20Share=20Extension=20SP?= =?UTF-8?q?M=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pophory-iOS.xcodeproj/project.pbxproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pophory-iOS.xcodeproj/project.pbxproj b/pophory-iOS.xcodeproj/project.pbxproj index 9e3c1f86..18f14180 100644 --- a/pophory-iOS.xcodeproj/project.pbxproj +++ b/pophory-iOS.xcodeproj/project.pbxproj @@ -83,6 +83,7 @@ 6B05C5CB2ACAA82800A75C00 /* PhotoInfoStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C5CA2ACAA82800A75C00 /* PhotoInfoStackView.swift */; }; 6B05C5CD2ACAA8CF00A75C00 /* DateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB37C722A55EB7400E49B12 /* DateManager.swift */; }; 6B05C5DB2ACAB37500A75C00 /* Assets.xcassets in Sources */ = {isa = PBXBuildFile; fileRef = B1631F132A1759EB0050974F /* Assets.xcassets */; }; + 6B05C5DF2ACD262C00A75C00 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 6B05C5DE2ACD262C00A75C00 /* SnapKit */; }; 6B09D2282A6808DA00DF4275 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B09D2272A6808DA00DF4275 /* ShareViewController.swift */; }; 6B09D22A2A6808EA00DF4275 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B09D2292A6808EA00DF4275 /* ShareView.swift */; }; 6B29DC592A5494A000F93EC7 /* PhotoInfoStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B29DC542A5494A000F93EC7 /* PhotoInfoStackView.swift */; }; @@ -412,6 +413,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6B05C5DF2ACD262C00A75C00 /* SnapKit in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1207,6 +1209,7 @@ ); name = ShareExtension; packageProductDependencies = ( + 6B05C5DE2ACD262C00A75C00 /* SnapKit */, ); productName = ShareExtension; productReference = 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */; @@ -2120,6 +2123,11 @@ package = 3B5CDBD32A94DDDB001382C4 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; productName = FirebaseDynamicLinks; }; + 6B05C5DE2ACD262C00A75C00 /* SnapKit */ = { + isa = XCSwiftPackageProductDependency; + package = 37DCA6842A4A97CA00FF8F90 /* XCRemoteSwiftPackageReference "SnapKit" */; + productName = SnapKit; + }; 9161CADE2A5460AA002B8B77 /* Kingfisher */ = { isa = XCSwiftPackageProductDependency; package = 9161CADD2A5460AA002B8B77 /* XCRemoteSwiftPackageReference "Kingfisher" */; From b88ec2fa4875835da4b5ad3de1f9a68f5d819357 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Tue, 10 Oct 2023 16:18:27 +0900 Subject: [PATCH 05/17] =?UTF-8?q?[Feat]=20#227=20-=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EB=B3=B5=EC=82=AC,=20URL=20Scheme=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/ShareViewController.swift | 195 ++++-------------- .../Global/Supporting Files/Info.plist | 17 +- 2 files changed, 58 insertions(+), 154 deletions(-) diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index 8efeca97..0f390a04 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -7,162 +7,57 @@ import UIKit import Social +import UniformTypeIdentifiers final class ShareViewController: UIViewController { - private let rootView = ShareView() - - override func loadView() { - super.loadView() - - view = rootView - } - - override func viewDidLoad() { - super.viewDidLoad() + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + guard let extensionItem = extensionContext?.inputItems.first as? NSExtensionItem, + let itemProvider = extensionItem.attachments?.first else { + self.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil) + return + } + handleIncomingText(itemProvider: itemProvider) } - -// // MARK: - Properties -// -// private var presignedURL: FetchPresignedURLRequestDTO? -// private let networkManager = AddPhotoNetworkManager() -// -// private var albumID: Int? -// private var photoCount: Int? -// private var maxPhotoCount: Int? -// -// private var albumList: FetchAlbumListResponseDTO? { -// didSet { -// if let albums = albumList?.albums { -// if albums.count != 0 { -// self.albumID = albums[0].id -// self.photoCount = albums[0].photoCount -// self.maxPhotoCount = albums[0].photoLimit -// } + + private func handleIncomingText(itemProvider: NSItemProvider) { +// itemProvider.loadItem(forTypeIdentifier: UTType.text.identifier, options: nil) { (item, error) in +// if let error { +// print(error) // } -// } -// } -// -// private var photoImage = UIImage() -// private var dateTaken: String = DateManager.dateToString(date: Date()) -// private var studioID: Int = -1 -// -// // MARK: - UI Properties -// -// private let rootView = AddPhotoView() -// -// // MARK: - Life Cycle -// -// override func loadView() { -// super.loadView() -// -// view = rootView -// } -// -// override func viewWillAppear(_ animated: Bool) { -// super.viewWillAppear(animated) -// -// networkManager.requestGetAlumListAPI() { [weak self] albumList in -// self?.albumList = albumList -// } -// } -// -// override func viewDidLoad() { -// super.viewDidLoad() -// -// setupTarget() -// networkManager.requestGetPresignedURLAPI() { [weak self] presignedURL in -// self?.presignedURL = presignedURL -// } -// } -//} -// -//extension ShareViewController { -// -// // MARK: - @objc -// -// @objc func onclickDateButton() { -// let customModalVC = CalendarModalViewController() -// customModalVC.modalPresentationStyle = .custom -// -// let customTransitionDelegate = CustomModalTransitionDelegate(customHeight: 340) -// customModalVC.transitioningDelegate = customTransitionDelegate -// -// customModalVC.delegate = self -// customModalVC.setPickerDate(fordate: DateManager.stringToDate(date: rootView.dateStackView.getExplain())) -// present(customModalVC, animated: true, completion: nil) -// } -// -// @objc func onclicStudioButton() { -// let customModalVC = StudioModalViewController() -// customModalVC.modalPresentationStyle = .custom -// -// let customTransitionDelegate = CustomModalTransitionDelegate(customHeight: 232) -// customModalVC.transitioningDelegate = customTransitionDelegate -// customModalVC.delegate = self -// customModalVC.selectedStudioIndex = studioID -// present(customModalVC, animated: true, completion: nil) -// } -// -// @objc func onclickAddPhotoButton() { -// guard let maxPhotoCount = self.maxPhotoCount else { return } -// if let photoCount = photoCount { -// if photoCount >= maxPhotoCount { -// showPopup(popupType: .simple, -// image: ImageLiterals.img_albumfull, -// primaryText: "포포리 앨범이 가득찼어요", -// secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!", firstButtonHandler: goToHome) -// } else { -// if let urlString = presignedURL?.presignedUrl, let url = URL(string: urlString) { -// networkManager.uploadImageToPresignedURL(image: photoImage, presignedURL: url, completion: {_ in -// }) -// } else { -// print("Invalid URL") -// } -// let photoInfo = PostPhotoS3RequestDTO(fileName: presignedURL?.fileName, albumId: albumID, takenAt: dateTaken, studioId: studioID, width: Int(photoImage.size.width), height: Int(photoImage.size.height)) -// networkManager.requestPostPhotoAPI(photoInfo: photoInfo) { -// self.goToHome() -// } +// self.extensionContext?.completeRequest(returningItems: nil) { _ in +// guard let url = URL(string: "pophoryiOS://") else { return } +// print(item) +// self.openURL(url) // } // } -// } -// -// // MARK: - Private Methods -// -// private func setupTarget() { -// rootView.dateStackView.infoButton.addTarget(self, action: #selector(onclickDateButton), for: .touchUpInside) -// rootView.studioStackView.infoButton.addTarget(self, action: #selector(onclicStudioButton), for: .touchUpInside) -// rootView.photoAddButton.addTarget(self, action: #selector(onclickAddPhotoButton), for: .touchUpInside) -// } -// -// private func goToHome() { -// dismiss(animated: false) -// navigationController?.popToRootViewController(animated: true) -// } -// -// // MARK: - Methods -// -// func setupRootViewImage(forImage: UIImage?, forType: PhotoCellType) { -// rootView.photo.image = forImage -// rootView.photoType = forType -// photoImage = forImage ?? UIImage() -// } -//} -// -//// MARK: - DataBind Protocol -// -//extension ShareViewController: DateDataBind, StudioDataBind { -// -// func dateDataBind(text: String) { -// rootView.dateStackView.setupExplain(explain: text) -// rootView.dateStackView.setupSelected(selected: true) -// dateTaken = text -// } -// -// func studioDataBind(text: String, forIndex: Int) { -// rootView.studioStackView.setupExplain(explain: text) -// rootView.studioStackView.setupSelected(selected: true) -// studioID = forIndex -// } + if + itemProvider.canLoadObject(ofClass: UIImage.self) { // itemProvider가 불러온 이미지 값 가져올 수 있다면 실행 + + itemProvider.loadObject(ofClass: UIImage.self) { image, error in + self.extensionContext?.completeRequest(returningItems: nil) { _ in + guard let url = URL(string: "pophoryiOS://") else { return } + + let pasteboard = [[UTType.png.identifier : image]] + self.openURL(url) + UIPasteboard.general.setItems(pasteboard) + } + } + } + } + + @objc + @discardableResult + func openURL(_ url: URL) -> Bool { + var responder: UIResponder? = self + while responder != nil { + if let application = responder as? UIApplication { + return application.perform(#selector(openURL(_:)), with: url) != nil + } + responder = responder?.next + } + return false + } } diff --git a/pophory-iOS/Global/Supporting Files/Info.plist b/pophory-iOS/Global/Supporting Files/Info.plist index 3b332ef7..a3586a87 100644 --- a/pophory-iOS/Global/Supporting Files/Info.plist +++ b/pophory-iOS/Global/Supporting Files/Info.plist @@ -4,15 +4,24 @@ BASE_URL $(BASE_URL) - PHPhotoLibraryPreventAutomaticLimitedAccessAlert - - NSPhotoLibraryUsageDescription - 포포리에 네컷사진을 업로드하기 위해 사진 라이브러리에 엑세스를 허용해 주세요. + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + pophoryiOS + + + NSAppTransportSecurity NSAllowsArbitraryLoads + PHPhotoLibraryPreventAutomaticLimitedAccessAlert + UIAppFonts Pretendard-Bold.otf From 252e9e38f82ef9998f84edf8a6ced0497d26434b Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Tue, 10 Oct 2023 16:19:23 +0900 Subject: [PATCH 06/17] =?UTF-8?q?[Delete]=20#227=20-=20View=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/View/PhotoInfoStackView.swift | 133 ------------ ShareExtension/View/ShareView.swift | 203 ------------------- pophory-iOS.xcodeproj/project.pbxproj | 16 -- 3 files changed, 352 deletions(-) delete mode 100644 ShareExtension/View/PhotoInfoStackView.swift delete mode 100644 ShareExtension/View/ShareView.swift diff --git a/ShareExtension/View/PhotoInfoStackView.swift b/ShareExtension/View/PhotoInfoStackView.swift deleted file mode 100644 index 061ca949..00000000 --- a/ShareExtension/View/PhotoInfoStackView.swift +++ /dev/null @@ -1,133 +0,0 @@ -// -// PhotoInfoStackView.swift -// ShareExtension -// -// Created by 김다예 on 2023/10/02. -// - -import UIKit - -import SnapKit - -class PhotoInfoStackView: UIStackView { - - // MARK: - Properties - - /// 선택 완료 시 선택된 label의 색 변경하기 위한 변수 - private var didSelected: Bool = false { - didSet { - changeInfoLabelColor(selected: didSelected) - } - } - - // MARK: - UI Properties - - private let mainLabel: UILabel = { - let label = UILabel() - label.font = .head3 - label.textColor = .pophoryBlack - label.textAlignment = .left - return label - }() - - lazy var infoButton: UIButton = { - let button = UIButton() - button.backgroundColor = .pophoryGray100 - button.layer.cornerRadius = 18 - button.layer.borderWidth = 1 - button.layer.borderColor = UIColor.pophoryGray300.cgColor - return button - }() - - private let infoLabel: UILabel = { - let label = UILabel() - label.font = .text1 - label.textColor = .pophoryBlack - label.textAlignment = .left - return label - }() - - private var infoIcon = UIImageView() - - // MARK: - Life Cycle - - override init(frame: CGRect) { - super.init(frame: frame) - - setupStyle() - setupLayout() - } - - required init(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} - -extension PhotoInfoStackView { - - // MARK: - Layout - - private func setupStyle() { - self.axis = .vertical - self.spacing = 16 - } - - private func setupLayout() { - self.addArrangedSubview(mainLabel) - self.addArrangedSubview(infoButton) - - mainLabel.snp.makeConstraints { - $0.leading.trailing.equalToSuperview() - } - infoButton.snp.makeConstraints { - $0.height.equalTo(58) - $0.leading.trailing.equalToSuperview() - } - - infoButton.addSubview(infoLabel) - infoButton.addSubview(infoIcon) - - infoLabel.snp.makeConstraints { - $0.centerY.equalToSuperview() - $0.leading.equalToSuperview().inset(16) - } - infoIcon.snp.makeConstraints { - $0.centerY.equalToSuperview() - $0.trailing.equalToSuperview().inset(17) - } - } - - // MARK: - @objc - - // MARK: - Private Methods - - private func changeInfoLabelColor(selected: Bool) { - if selected { - infoLabel.textColor = .pophoryBlack - } else { - infoLabel.textColor = .pophoryGray400 - } - } - - // MARK: - Public Methods - - public func setupTitle(title: String) { - mainLabel.text = title - } - - public func setupSelected(selected: Bool) { - changeInfoLabelColor(selected: selected) - } - - public func setupIcon(icon: UIImage) { - infoIcon.image = icon - } - - public func setupExplain(explain: String) { - infoLabel.text = explain - } - - func getExplain() -> String? { - return infoLabel.text - } -} diff --git a/ShareExtension/View/ShareView.swift b/ShareExtension/View/ShareView.swift deleted file mode 100644 index 941dc6cc..00000000 --- a/ShareExtension/View/ShareView.swift +++ /dev/null @@ -1,203 +0,0 @@ -// -// ShareView.swift -// ShareExtension -// -// Created by 김다예 on 2023/10/02. -// - -import UIKit - -import SnapKit - -@frozen -enum PhotoCellType { - case vertical - case horizontal - case none -} - -class ShareView: UIView { - -// MARK: - UI Properties - - var photoType: PhotoCellType = .vertical { - didSet { - switch photoType { - case .vertical, .none: - photoView.image = ImageLiterals.addPhotoBackgroundVertical - setupVerticle() - case .horizontal: - photoView.image = ImageLiterals.addPhotoBackgroundHorizontal - setupHorizontal() - } - } - } - - // iphone 13 mini 기준 verticle 이미지 height - private var imageConstraint: CGFloat = 285 - - // MARK: - UI Properties - - private let scrollView: UIScrollView = { - let scrollView = UIScrollView() - scrollView.backgroundColor = .white - scrollView.showsHorizontalScrollIndicator = false - return scrollView - }() - private let scrollContentsView: UIView = { - let view = UIView() - view.backgroundColor = .white - return view - }() - - let photoView: UIImageView = { - let view = UIImageView() - view.image = ImageLiterals.addPhotoBackgroundVertical - return view - }() - - let photo = UIImageView() - - private let photoInfoStackView: UIStackView = { - let stackView = UIStackView() - stackView.axis = .vertical - stackView.spacing = 22 - return stackView - }() - private let photoAddButtonView: UIView = { - let view = UIView() - view.backgroundColor = .pophoryWhite - return view - }() - - let photoAddButton: UIButton = { - let button = UIButton() - button.backgroundColor = .black - button.setTitle("사진 추가하기", for: .normal) - button.setTitleColor(.pophoryWhite, for: .normal) - button.layer.cornerRadius = 30 - return button - }() - - let dateStackView: PhotoInfoStackView = { - let stackView = PhotoInfoStackView() - stackView.setupTitle(title: "찍은 날짜") - stackView.setupSelected(selected: true) - stackView.setupIcon(icon: ImageLiterals.calanderIcon) - stackView.setupExplain(explain: DateManager.dateToString(date: Date())) - return stackView - }() - let studioStackView: PhotoInfoStackView = { - let stackView = PhotoInfoStackView() - stackView.setupTitle(title: "사진관") - stackView.setupSelected(selected: false) - stackView.setupIcon(icon: ImageLiterals.downIcon) - stackView.setupExplain(explain: "사진관을 선택해줘") - return stackView - }() - - // MARK: - Life Cycle - - override init(frame: CGRect) { - super.init(frame: frame) - - setupStyle() - setupLayout() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} - -extension ShareView { - - // MARK: - Layout - - private func setupStyle() { - self.backgroundColor = .pophoryWhite - } - - private func setupLayout() { - self.addSubview(scrollView) - self.addSubview(photoAddButtonView) - - scrollView.snp.makeConstraints { - $0.top.equalTo(safeAreaLayoutGuide) - $0.left.right.equalToSuperview() - $0.bottom.equalTo(photoAddButtonView.snp.top) - } - photoAddButtonView.snp.makeConstraints { - $0.height.equalTo(80) - $0.top.equalTo(scrollView.snp.bottom) - $0.bottom.equalTo(safeAreaLayoutGuide) - $0.leading.trailing.equalToSuperview() - } - - scrollView.addSubview(scrollContentsView) - - scrollContentsView.snp.makeConstraints { - $0.edges.width.equalToSuperview() - } - - photoInfoStackView.addArrangedSubview(dateStackView) - photoInfoStackView.addArrangedSubview(studioStackView) - - scrollContentsView.addSubview(photoView) - scrollContentsView.addSubview(photoInfoStackView) - - photoView.addSubview(photo) - - photoView.snp.makeConstraints { - $0.height.equalTo(325) - $0.top.leading.trailing.equalToSuperview() - } - photoInfoStackView.snp.makeConstraints { - $0.top.equalTo(photoView.snp.bottom).offset(20) - $0.leading.trailing.equalToSuperview().inset(20) - $0.bottom.equalToSuperview().inset(22) - } - - photo.snp.makeConstraints { - $0.leading.trailing.equalToSuperview().inset(94) - $0.top.bottom.equalToSuperview().inset(20) - } - - photoAddButtonView.addSubview(photoAddButton) - - photoAddButton.snp.makeConstraints { - $0.height.equalTo(60) - $0.centerY.equalToSuperview() - $0.horizontalEdges.equalToSuperview().inset(20) - } - } - - // MARK: - func - - func setupVerticle() { - photo.snp.remakeConstraints { - var width: CGFloat = 188 - // 세로 제약조건을 superView에 20씩 걸어놓고 사진의 원본 비율에 따라 width를 구함 - if let imageWidth = photo.image?.size.width, let imageHeight = photo.image?.size.height { - width = imageWidth * (imageConstraint / imageHeight) - } - $0.width.equalTo(width) - $0.centerX.equalToSuperview() - $0.top.bottom.equalToSuperview().inset(20) - } - } - - func setupHorizontal() { - photo.snp.remakeConstraints { - var height: CGFloat = 188 - // 가로 제약조건을 superView에 45씩 걸어놓고 사진의 원본 비율에 따라 height를 구함 - if let imageWidth = photo.image?.size.width, let imageHeight = photo.image?.size.height { - height = imageHeight * (imageConstraint / imageWidth) - } - $0.height.equalTo(height) - $0.centerY.equalToSuperview() - $0.leading.trailing.equalToSuperview().inset(45) - } - } -} - diff --git a/pophory-iOS.xcodeproj/project.pbxproj b/pophory-iOS.xcodeproj/project.pbxproj index 18f14180..9e405147 100644 --- a/pophory-iOS.xcodeproj/project.pbxproj +++ b/pophory-iOS.xcodeproj/project.pbxproj @@ -72,7 +72,6 @@ 6B05C56D2AC4277800A75C00 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C56C2AC4277800A75C00 /* ShareViewController.swift */; }; 6B05C5702AC4277800A75C00 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6B05C56E2AC4277800A75C00 /* MainInterface.storyboard */; }; 6B05C5742AC4277800A75C00 /* ShareExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 6B05C56A2AC4277800A75C00 /* ShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 6B05C5C12ACAA35800A75C00 /* ShareView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C5C02ACAA35800A75C00 /* ShareView.swift */; }; 6B05C5C22ACAA50E00A75C00 /* ImageLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91F3A75F2A517E9E00C06D1B /* ImageLiterals.swift */; }; 6B05C5C32ACAA5B000A75C00 /* ColorLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DCA6AB2A4ABAE200FF8F90 /* ColorLiterals.swift */; }; 6B05C5C42ACAA78F00A75C00 /* FontLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37DCA6AD2A4ABAF300FF8F90 /* FontLiterals.swift */; }; @@ -80,7 +79,6 @@ 6B05C5C62ACAA79F00A75C00 /* Pretendard-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 37DCA6B12A4AC7CC00FF8F90 /* Pretendard-Medium.otf */; }; 6B05C5C72ACAA7A200A75C00 /* Pretendard-SemiBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 37DCA6B02A4AC7CC00FF8F90 /* Pretendard-SemiBold.otf */; }; 6B05C5C82ACAA7A400A75C00 /* Pretendard-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = 37DCA6B22A4AC7CD00FF8F90 /* Pretendard-Regular.otf */; }; - 6B05C5CB2ACAA82800A75C00 /* PhotoInfoStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B05C5CA2ACAA82800A75C00 /* PhotoInfoStackView.swift */; }; 6B05C5CD2ACAA8CF00A75C00 /* DateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB37C722A55EB7400E49B12 /* DateManager.swift */; }; 6B05C5DB2ACAB37500A75C00 /* Assets.xcassets in Sources */ = {isa = PBXBuildFile; fileRef = B1631F132A1759EB0050974F /* Assets.xcassets */; }; 6B05C5DF2ACD262C00A75C00 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 6B05C5DE2ACD262C00A75C00 /* SnapKit */; }; @@ -295,8 +293,6 @@ 6B05C56F2AC4277800A75C00 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; 6B05C5712AC4277800A75C00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 6B05C5792AC4277E00A75C00 /* ShareExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShareExtension.entitlements; sourceTree = ""; }; - 6B05C5C02ACAA35800A75C00 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = ""; }; - 6B05C5CA2ACAA82800A75C00 /* PhotoInfoStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoInfoStackView.swift; sourceTree = ""; }; 6B05C5CF2ACAAB8600A75C00 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 6B09D2272A6808DA00DF4275 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = ""; }; 6B09D2292A6808EA00DF4275 /* ShareView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareView.swift; sourceTree = ""; }; @@ -670,7 +666,6 @@ 6B05C56B2AC4277800A75C00 /* ShareExtension */ = { isa = PBXGroup; children = ( - 6B05C5C92ACAA81200A75C00 /* View */, 6B05C5792AC4277E00A75C00 /* ShareExtension.entitlements */, 6B05C56C2AC4277800A75C00 /* ShareViewController.swift */, 6B05C56E2AC4277800A75C00 /* MainInterface.storyboard */, @@ -679,15 +674,6 @@ path = ShareExtension; sourceTree = ""; }; - 6B05C5C92ACAA81200A75C00 /* View */ = { - isa = PBXGroup; - children = ( - 6B05C5C02ACAA35800A75C00 /* ShareView.swift */, - 6B05C5CA2ACAA82800A75C00 /* PhotoInfoStackView.swift */, - ); - path = View; - sourceTree = ""; - }; 6B05C5CE2ACAAB8500A75C00 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -1418,8 +1404,6 @@ 6B05C5DB2ACAB37500A75C00 /* Assets.xcassets in Sources */, 6B05C5CD2ACAA8CF00A75C00 /* DateManager.swift in Sources */, 6B05C5C42ACAA78F00A75C00 /* FontLiterals.swift in Sources */, - 6B05C5C12ACAA35800A75C00 /* ShareView.swift in Sources */, - 6B05C5CB2ACAA82800A75C00 /* PhotoInfoStackView.swift in Sources */, 6B05C5C32ACAA5B000A75C00 /* ColorLiterals.swift in Sources */, 6B05C5C22ACAA50E00A75C00 /* ImageLiterals.swift in Sources */, 6B05C56D2AC4277800A75C00 /* ShareViewController.swift in Sources */, From 147e8b8774720ebdd9ce6fb373c1cd5ed17b0729 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Tue, 10 Oct 2023 20:12:38 +0900 Subject: [PATCH 07/17] =?UTF-8?q?[Chore]=20#227=20-=20URL=20Scheme=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/ShareViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index 0f390a04..8f3b5145 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -38,7 +38,7 @@ final class ShareViewController: UIViewController { itemProvider.loadObject(ofClass: UIImage.self) { image, error in self.extensionContext?.completeRequest(returningItems: nil) { _ in - guard let url = URL(string: "pophoryiOS://") else { return } + guard let url = URL(string: "pophoryiOS://share") else { return } let pasteboard = [[UTType.png.identifier : image]] self.openURL(url) From f5513be1c8fa5b687a3391c71134dcf00d16ec16 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 11 Oct 2023 14:31:16 +0900 Subject: [PATCH 08/17] =?UTF-8?q?[Feat]=20#227=20-=20=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EB=B6=88=EB=9F=AC=EC=98=A4=EA=B8=B0=EA=B9=8C=EC=A7=80=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/ShareViewController.swift | 3 +- .../Global/Resources/SceneDelegate.swift | 41 +++++++++++++++++-- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index 8f3b5145..b932fd8a 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -40,9 +40,8 @@ final class ShareViewController: UIViewController { self.extensionContext?.completeRequest(returningItems: nil) { _ in guard let url = URL(string: "pophoryiOS://share") else { return } - let pasteboard = [[UTType.png.identifier : image]] self.openURL(url) - UIPasteboard.general.setItems(pasteboard) + UIPasteboard.general.image = image as? UIImage } } } diff --git a/pophory-iOS/Global/Resources/SceneDelegate.swift b/pophory-iOS/Global/Resources/SceneDelegate.swift index a30c2bd1..4985ebdb 100644 --- a/pophory-iOS/Global/Resources/SceneDelegate.swift +++ b/pophory-iOS/Global/Resources/SceneDelegate.swift @@ -8,6 +8,7 @@ import UIKit import FirebaseDynamicLinks +import UniformTypeIdentifiers class SceneDelegate: UIResponder, UIWindowSceneDelegate { @@ -57,7 +58,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { let rootVC = ShareViewController() rootVC.setupShareID(forShareID: shareID) rootVC.rootView.shareButton.addTarget(self, action: #selector(self.setupRoot), for: .touchUpInside) - + window.rootViewController = rootVC window.makeKeyAndVisible() self.window = window @@ -67,6 +68,38 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } } + func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { + guard let url = URLContexts.first?.url else { return } + + // shareExtension 받았을 때 + if let range = url.absoluteString.range(of: "//") { + let substring = url.absoluteString[range.upperBound...] + + if substring == "share" { + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.overrideUserInterfaceStyle = UIUserInterfaceStyle.light + let rootVC = AddPhotoViewController() + + var imageType: PhotoCellType = .vertical + guard let image = UIPasteboard.general.image else { return } + + if image.size.width > image.size.height { + imageType = .horizontal + } else { + imageType = .vertical + } + + rootVC.setupRootViewImage(forImage: image , forType: imageType) + + window.rootViewController = rootVC + window.makeKeyAndVisible() + self.window = window + } + } + } + } + func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system. // This occurs shortly after the scene enters the background, or when its session is discarded. @@ -98,7 +131,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { @objc func setupRoot() { let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") var rootViewController: UIViewController - + if isLoggedIn { rootViewController = TabBarController() } else { @@ -109,11 +142,11 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { rootViewController = rootVC } let navigationController = PophoryNavigationController(rootViewController: rootViewController) - + window?.rootViewController = navigationController window?.makeKeyAndVisible() } - + func setRootViewController() { let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") From 740332a531c3093a35f575b0d19f31526ce13728 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Thu, 12 Oct 2023 03:58:52 +0900 Subject: [PATCH 09/17] =?UTF-8?q?[Feat]=20#227=20-=20=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Resources/SceneDelegate.swift | 25 ++++++++++++------- .../AddPhotoViewController.swift | 3 ++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pophory-iOS/Global/Resources/SceneDelegate.swift b/pophory-iOS/Global/Resources/SceneDelegate.swift index 4985ebdb..2977efa4 100644 --- a/pophory-iOS/Global/Resources/SceneDelegate.swift +++ b/pophory-iOS/Global/Resources/SceneDelegate.swift @@ -76,26 +76,33 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { let substring = url.absoluteString[range.upperBound...] if substring == "share" { - if let windowScene = scene as? UIWindowScene { - let window = UIWindow(windowScene: windowScene) - window.overrideUserInterfaceStyle = UIUserInterfaceStyle.light - let rootVC = AddPhotoViewController() + + let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") + var rootViewController: UIViewController + + if isLoggedIn { + let addPhotoViewController = AddPhotoViewController() var imageType: PhotoCellType = .vertical guard let image = UIPasteboard.general.image else { return } - if image.size.width > image.size.height { imageType = .horizontal } else { imageType = .vertical } - rootVC.setupRootViewImage(forImage: image , forType: imageType) + addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) + + rootViewController = addPhotoViewController + } else { + let appleLoginManager = AppleLoginManager() + let rootVC = OnboardingViewController(appleLoginManager: appleLoginManager) + appleLoginManager.delegate = rootVC - window.rootViewController = rootVC - window.makeKeyAndVisible() - self.window = window + rootViewController = rootVC } + window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + window?.makeKeyAndVisible() } } } diff --git a/pophory-iOS/Screen/AddPhoto/ViewController/AddPhotoViewController.swift b/pophory-iOS/Screen/AddPhoto/ViewController/AddPhotoViewController.swift index 9c5e96c3..1859aa78 100644 --- a/pophory-iOS/Screen/AddPhoto/ViewController/AddPhotoViewController.swift +++ b/pophory-iOS/Screen/AddPhoto/ViewController/AddPhotoViewController.swift @@ -139,7 +139,8 @@ extension AddPhotoViewController { private func goToHome() { dismiss(animated: false) - navigationController?.popToRootViewController(animated: true) + let tabBarViewController = TabBarController() + self.navigationController?.pushViewController(tabBarViewController, animated: true) } // MARK: - Methods From 0efdb1439c7c4956e54f7e6d953a17867d6400aa Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Thu, 12 Oct 2023 03:59:11 +0900 Subject: [PATCH 10/17] =?UTF-8?q?[Chore]=20#227=20-=20=ED=8F=B0=ED=8A=B8?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/Info.plist | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ShareExtension/Info.plist b/ShareExtension/Info.plist index b9a0b58a..e144bb2c 100644 --- a/ShareExtension/Info.plist +++ b/ShareExtension/Info.plist @@ -2,13 +2,6 @@ - UIAppFonts - - Pretendard-Regular.otf - Pretendard-Medium.otf - Pretendard-SemiBold.otf - Pretendard-Bold.otf - NSAppTransportSecurity NSAllowsArbitraryLoads @@ -29,5 +22,12 @@ NSExtensionPointIdentifier com.apple.share-services + UIAppFonts + + Pretendard-Regular.otf + Pretendard-Medium.otf + Pretendard-SemiBold.otf + Pretendard-Bold.otf + From bfb999f04422b537450010e2e8fbcfe2f9082f31 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Thu, 12 Oct 2023 04:15:13 +0900 Subject: [PATCH 11/17] =?UTF-8?q?[Chore]=20#227=20-=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pophory-iOS/Global/Resources/SceneDelegate.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pophory-iOS/Global/Resources/SceneDelegate.swift b/pophory-iOS/Global/Resources/SceneDelegate.swift index 2977efa4..846c93cb 100644 --- a/pophory-iOS/Global/Resources/SceneDelegate.swift +++ b/pophory-iOS/Global/Resources/SceneDelegate.swift @@ -92,17 +92,18 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) - rootViewController = addPhotoViewController + window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + window?.makeKeyAndVisible() } else { let appleLoginManager = AppleLoginManager() let rootVC = OnboardingViewController(appleLoginManager: appleLoginManager) appleLoginManager.delegate = rootVC rootViewController = rootVC + window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + window?.makeKeyAndVisible() } - window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - window?.makeKeyAndVisible() } } } From ce24845dfeaecaa092c15a98dad24f20c187787d Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Thu, 12 Oct 2023 14:30:35 +0900 Subject: [PATCH 12/17] =?UTF-8?q?[Feat]=20#227=20-=20=EC=95=A8=EB=B2=94=20?= =?UTF-8?q?full=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Resources/SceneDelegate.swift | 68 +++++++++++++++---- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/pophory-iOS/Global/Resources/SceneDelegate.swift b/pophory-iOS/Global/Resources/SceneDelegate.swift index 846c93cb..5b273514 100644 --- a/pophory-iOS/Global/Resources/SceneDelegate.swift +++ b/pophory-iOS/Global/Resources/SceneDelegate.swift @@ -78,23 +78,34 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { if substring == "share" { let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") + let isAlbumFull = self.isAlbumFull() var rootViewController: UIViewController if isLoggedIn { - let addPhotoViewController = AddPhotoViewController() - - var imageType: PhotoCellType = .vertical - guard let image = UIPasteboard.general.image else { return } - if image.size.width > image.size.height { - imageType = .horizontal + if isAlbumFull { + rootViewController = TabBarController() + window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + window?.rootViewController?.showPopup(popupType: .simple, + image: ImageLiterals.img_albumfull, + primaryText: "포포리 앨범이 가득찼어요", + secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!") + window?.makeKeyAndVisible() } else { - imageType = .vertical + let addPhotoViewController = AddPhotoViewController() + + var imageType: PhotoCellType = .vertical + guard let image = UIPasteboard.general.image else { return } + if image.size.width > image.size.height { + imageType = .horizontal + } else { + imageType = .vertical + } + + addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) + rootViewController = addPhotoViewController + window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + window?.makeKeyAndVisible() } - - addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) - rootViewController = addPhotoViewController - window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - window?.makeKeyAndVisible() } else { let appleLoginManager = AppleLoginManager() let rootVC = OnboardingViewController(appleLoginManager: appleLoginManager) @@ -185,6 +196,39 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } return nil } + + private func isAlbumFull() -> Bool { + let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") + + if isLoggedIn { + var maxPhotoCount: Int? + var maxPhotoLimit: Int? + var albumList: FetchAlbumListResponseDTO? { + didSet { + if let albums = albumList?.albums { + if albums.count != 0 { + maxPhotoCount = albums[0].photoLimit + maxPhotoLimit = albums[0].photoLimit + } + } + } + } + + NetworkService.shared.albumRepository.fetchAlbumList() { result in + switch result { + case .success(let response): + albumList = response + default : return + } + } + + if let maxCount = maxPhotoCount, let maxLimit = maxPhotoLimit { + if maxCount >= maxLimit { return true } + else { return false } + } + else { return true } + } else { return false } + } } // MARK: network From e396b79e097e29029176f63ba4f6c99902654011 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Mon, 16 Oct 2023 09:40:43 +0900 Subject: [PATCH 13/17] =?UTF-8?q?[Feat]=20#227=20-=20=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EC=B5=9C=EB=8C=80=20=EA=B0=9C=EC=88=98=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Resources/SceneDelegate.swift | 97 +++++++++++-------- 1 file changed, 54 insertions(+), 43 deletions(-) diff --git a/pophory-iOS/Global/Resources/SceneDelegate.swift b/pophory-iOS/Global/Resources/SceneDelegate.swift index 5b273514..936e1cea 100644 --- a/pophory-iOS/Global/Resources/SceneDelegate.swift +++ b/pophory-iOS/Global/Resources/SceneDelegate.swift @@ -77,44 +77,56 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { if substring == "share" { - let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") - let isAlbumFull = self.isAlbumFull() - var rootViewController: UIViewController - - if isLoggedIn { - if isAlbumFull { - rootViewController = TabBarController() - window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - window?.rootViewController?.showPopup(popupType: .simple, - image: ImageLiterals.img_albumfull, - primaryText: "포포리 앨범이 가득찼어요", - secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!") - window?.makeKeyAndVisible() - } else { - let addPhotoViewController = AddPhotoViewController() - - var imageType: PhotoCellType = .vertical - guard let image = UIPasteboard.general.image else { return } - if image.size.width > image.size.height { - imageType = .horizontal + self.isAlbumFull { isAlbumFull in + + let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") + var rootViewController: UIViewController + + if isLoggedIn { + if isAlbumFull { + rootViewController = TabBarController() + DispatchQueue.main.async { + self.window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + self.window?.rootViewController?.showPopup(popupType: .simple, + image: ImageLiterals.img_albumfull, + primaryText: "포포리 앨범이 가득찼어요", + secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!") + self.window?.makeKeyAndVisible() + } } else { - imageType = .vertical + let addPhotoViewController = AddPhotoViewController() + + var imageType: PhotoCellType = .vertical + guard let image = UIPasteboard.general.image else { return } + if image.size.width > image.size.height { + imageType = .horizontal + } else { + imageType = .vertical + } + + addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) + rootViewController = addPhotoViewController + DispatchQueue.main.async { + + self.window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + self.window?.makeKeyAndVisible() + } } + } else { + let appleLoginManager = AppleLoginManager() + let rootVC = OnboardingViewController(appleLoginManager: appleLoginManager) + appleLoginManager.delegate = rootVC - addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) - rootViewController = addPhotoViewController - window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - window?.makeKeyAndVisible() + + rootViewController = rootVC + DispatchQueue.main.async { + + self.window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) + self.window?.makeKeyAndVisible() + } } - } else { - let appleLoginManager = AppleLoginManager() - let rootVC = OnboardingViewController(appleLoginManager: appleLoginManager) - appleLoginManager.delegate = rootVC - - rootViewController = rootVC - window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - window?.makeKeyAndVisible() } + } } } @@ -197,7 +209,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { return nil } - private func isAlbumFull() -> Bool { + private func isAlbumFull(completion: @escaping (Bool) -> ()) { let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") if isLoggedIn { @@ -207,7 +219,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { didSet { if let albums = albumList?.albums { if albums.count != 0 { - maxPhotoCount = albums[0].photoLimit + maxPhotoCount = albums[0].photoCount maxPhotoLimit = albums[0].photoLimit } } @@ -218,16 +230,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { switch result { case .success(let response): albumList = response - default : return + if let maxCount = maxPhotoCount, let maxLimit = maxPhotoLimit { + if maxCount >= maxLimit { completion(true) } + else { completion(false) } + } + else { completion(false) } + default: completion(false) } } - - if let maxCount = maxPhotoCount, let maxLimit = maxPhotoLimit { - if maxCount >= maxLimit { return true } - else { return false } - } - else { return true } - } else { return false } + } } } From 05173e440df3876e58011d884d540ecc7c9683c3 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 18 Oct 2023 03:28:37 +0900 Subject: [PATCH 14/17] =?UTF-8?q?[Chore]=20#227=20-=20Share=20Extension=20?= =?UTF-8?q?Build=20Identifier=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pophory-iOS.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pophory-iOS.xcodeproj/project.pbxproj b/pophory-iOS.xcodeproj/project.pbxproj index b6cc1cb9..0e76603f 100644 --- a/pophory-iOS.xcodeproj/project.pbxproj +++ b/pophory-iOS.xcodeproj/project.pbxproj @@ -1642,7 +1642,7 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team.pophory-iOS.ShareExtension"; + PRODUCT_BUNDLE_IDENTIFIER = "Team.pophory-iOS.ShareExtension.ownCloud-Share-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; @@ -1671,7 +1671,7 @@ "@executable_path/../../Frameworks", ); MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = "Team.pophory-iOS.ShareExtension"; + PRODUCT_BUNDLE_IDENTIFIER = "Team.pophory-iOS.ShareExtension.ownCloud-Share-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_EMIT_LOC_STRINGS = YES; From 2e2a62de5008760a5018c87cea212c4799717fa7 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 18 Oct 2023 13:48:30 +0900 Subject: [PATCH 15/17] =?UTF-8?q?[Chore]=20#227=20-=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=A3=BC=EC=84=9D=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShareExtension/ShareViewController.swift | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index b932fd8a..c61816c4 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -23,18 +23,7 @@ final class ShareViewController: UIViewController { } private func handleIncomingText(itemProvider: NSItemProvider) { -// itemProvider.loadItem(forTypeIdentifier: UTType.text.identifier, options: nil) { (item, error) in -// if let error { -// print(error) -// } -// self.extensionContext?.completeRequest(returningItems: nil) { _ in -// guard let url = URL(string: "pophoryiOS://") else { return } -// print(item) -// self.openURL(url) -// } -// } - if - itemProvider.canLoadObject(ofClass: UIImage.self) { // itemProvider가 불러온 이미지 값 가져올 수 있다면 실행 + if itemProvider.canLoadObject(ofClass: UIImage.self) { // itemProvider가 불러온 이미지 값 가져올 수 있다면 실행 itemProvider.loadObject(ofClass: UIImage.self) { image, error in self.extensionContext?.completeRequest(returningItems: nil) { _ in From 6087edcf4e2cab8f77a05c29171031356cef90a8 Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 18 Oct 2023 16:23:42 +0900 Subject: [PATCH 16/17] =?UTF-8?q?[Chore]=20#227=20-=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EA=B5=AC=EC=A1=B0=EB=A1=9C=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Resources/SceneDelegate.swift | 75 +++++++++---------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/pophory-iOS/Global/Resources/SceneDelegate.swift b/pophory-iOS/Global/Resources/SceneDelegate.swift index 936e1cea..4f244ad9 100644 --- a/pophory-iOS/Global/Resources/SceneDelegate.swift +++ b/pophory-iOS/Global/Resources/SceneDelegate.swift @@ -80,53 +80,17 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { self.isAlbumFull { isAlbumFull in let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") - var rootViewController: UIViewController if isLoggedIn { if isAlbumFull { - rootViewController = TabBarController() - DispatchQueue.main.async { - self.window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - self.window?.rootViewController?.showPopup(popupType: .simple, - image: ImageLiterals.img_albumfull, - primaryText: "포포리 앨범이 가득찼어요", - secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!") - self.window?.makeKeyAndVisible() - } + self.setupAlbumFullViewController() } else { - let addPhotoViewController = AddPhotoViewController() - - var imageType: PhotoCellType = .vertical - guard let image = UIPasteboard.general.image else { return } - if image.size.width > image.size.height { - imageType = .horizontal - } else { - imageType = .vertical - } - - addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) - rootViewController = addPhotoViewController - DispatchQueue.main.async { - - self.window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - self.window?.makeKeyAndVisible() - } + self.setupAddphotoViewcontroller() } } else { - let appleLoginManager = AppleLoginManager() - let rootVC = OnboardingViewController(appleLoginManager: appleLoginManager) - appleLoginManager.delegate = rootVC - - - rootViewController = rootVC - DispatchQueue.main.async { - - self.window?.rootViewController = PophoryNavigationController(rootViewController: rootViewController) - self.window?.makeKeyAndVisible() - } + self.setupRootViewController() } } - } } } @@ -178,7 +142,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { window?.makeKeyAndVisible() } - func setRootViewController() { + func setupRootViewController() { let isLoggedIn = UserDefaults.standard.bool(forKey: "isLoggedIn") var rootViewController: UIViewController @@ -240,6 +204,37 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } } } + + private func setupAlbumFullViewController() { + let tabBarController = TabBarController() + DispatchQueue.main.async { + self.window?.rootViewController = PophoryNavigationController(rootViewController: tabBarController) + self.window?.rootViewController?.showPopup(popupType: .simple, + image: ImageLiterals.img_albumfull, + primaryText: "포포리 앨범이 가득찼어요", + secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!") + self.window?.makeKeyAndVisible() + } + } + + private func setupAddphotoViewcontroller() { + let addPhotoViewController = AddPhotoViewController() + + var imageType: PhotoCellType = .vertical + guard let image = UIPasteboard.general.image else { return } + if image.size.width > image.size.height { + imageType = .horizontal + } else { + imageType = .vertical + } + + addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) + DispatchQueue.main.async { + + self.window?.rootViewController = PophoryNavigationController(rootViewController: addPhotoViewController) + self.window?.makeKeyAndVisible() + } + } } // MARK: network From 751f7cd55584d1bb29ee7c8c3c3d7c2b13b1845d Mon Sep 17 00:00:00 2001 From: Daye Kim Date: Wed, 18 Oct 2023 16:25:22 +0900 Subject: [PATCH 17/17] =?UTF-8?q?[Chore]=20#227=20-=20DispatchQueue=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Resources/SceneDelegate.swift | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/pophory-iOS/Global/Resources/SceneDelegate.swift b/pophory-iOS/Global/Resources/SceneDelegate.swift index 4f244ad9..78293e39 100644 --- a/pophory-iOS/Global/Resources/SceneDelegate.swift +++ b/pophory-iOS/Global/Resources/SceneDelegate.swift @@ -207,14 +207,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { private func setupAlbumFullViewController() { let tabBarController = TabBarController() - DispatchQueue.main.async { - self.window?.rootViewController = PophoryNavigationController(rootViewController: tabBarController) - self.window?.rootViewController?.showPopup(popupType: .simple, - image: ImageLiterals.img_albumfull, - primaryText: "포포리 앨범이 가득찼어요", - secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!") - self.window?.makeKeyAndVisible() - } + self.window?.rootViewController = PophoryNavigationController(rootViewController: tabBarController) + self.window?.rootViewController?.showPopup(popupType: .simple, + image: ImageLiterals.img_albumfull, + primaryText: "포포리 앨범이 가득찼어요", + secondaryText: "아쉽지만,\n다음 업데이트에서 만나요!") + self.window?.makeKeyAndVisible() + } private func setupAddphotoViewcontroller() { @@ -227,13 +226,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } else { imageType = .vertical } - - addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) - DispatchQueue.main.async { - - self.window?.rootViewController = PophoryNavigationController(rootViewController: addPhotoViewController) - self.window?.makeKeyAndVisible() - } + + addPhotoViewController.setupRootViewImage(forImage: image , forType: imageType) + + self.window?.rootViewController = PophoryNavigationController(rootViewController: addPhotoViewController) + self.window?.makeKeyAndVisible() + } }