From 6cb6ff293e60668a6697baeac160757cde40746e Mon Sep 17 00:00:00 2001 From: uhooi Date: Tue, 25 Aug 2020 16:17:52 +0900 Subject: [PATCH 01/31] Update Makefile --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c4b84668..70311ee9 100644 --- a/Makefile +++ b/Makefile @@ -102,8 +102,8 @@ clean: # Delete cache .PHONY: build-debug build-debug: # Xcode build for debug - set -o pipefail && \ -xcodebuild \ + set -o pipefail \ +&& xcodebuild \ -sdk ${TEST_SDK} \ -configuration ${TEST_CONFIGURATION} \ -workspace ${WORKSPACE_NAME} \ @@ -113,8 +113,8 @@ build \ .PHONY: test test: # Xcode test # TEST_DEVICE=[device] TEST_OS=[OS] - set -o pipefail && \ -xcodebuild \ + set -o pipefail \ +&& xcodebuild \ -sdk ${TEST_SDK} \ -configuration ${TEST_CONFIGURATION} \ -workspace ${WORKSPACE_NAME} \ From 16b04bb0f1ec9300ae29cb65f6d62fa7eccc1c5d Mon Sep 17 00:00:00 2001 From: uhooi Date: Wed, 16 Sep 2020 23:28:20 +0900 Subject: [PATCH 02/31] Update Mockolo --- Mintfile | 2 +- .../Repository/Monsters/MonstersRepository.swift | 12 ++++++------ .../Repository/Temp/UserDefaultsClient.swift | 4 ++-- UhooiPicBook/SceneDelegate.swift | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Mintfile b/Mintfile index e6f84df7..c1880a4d 100644 --- a/Mintfile +++ b/Mintfile @@ -2,6 +2,6 @@ Carthage/Carthage@0.35.0 yonaskolb/xcodegen@2.16.0 realm/SwiftLint@0.39.2 fromkk/SpellChecker@0.0.3 -uber/mockolo@1.2.4 +uber/mockolo@1.2.8 mono0926/LicensePlist@2.16.0 diff --git a/UhooiPicBook/Repository/Monsters/MonstersRepository.swift b/UhooiPicBook/Repository/Monsters/MonstersRepository.swift index 073b2185..ddce62e5 100644 --- a/UhooiPicBook/Repository/Monsters/MonstersRepository.swift +++ b/UhooiPicBook/Repository/Monsters/MonstersRepository.swift @@ -37,12 +37,12 @@ extension MonstersFirebaseClient: MonstersRepository { for document in querySnapshot.documents.filter({ $0.exists }) { let monster = document.data() guard let name = monster["name"] as? String, - let description = monster["description"] as? String, - let baseColorCode = monster["base_color"] as? String, - let iconUrlString = monster["icon_url"] as? String, - let dancingUrlString = monster["dancing_url"] as? String, - let order = monster["order"] as? Int else { - continue + let description = monster["description"] as? String, + let baseColorCode = monster["base_color"] as? String, + let iconUrlString = monster["icon_url"] as? String, + let dancingUrlString = monster["dancing_url"] as? String, + let order = monster["order"] as? Int else { + continue } monsters.append(MonsterDTO(name: name, description: description, baseColorCode: baseColorCode, iconUrlString: iconUrlString, dancingUrlString: dancingUrlString, order: order)) diff --git a/UhooiPicBook/Repository/Temp/UserDefaultsClient.swift b/UhooiPicBook/Repository/Temp/UserDefaultsClient.swift index 43edacde..28dacea4 100644 --- a/UhooiPicBook/Repository/Temp/UserDefaultsClient.swift +++ b/UhooiPicBook/Repository/Temp/UserDefaultsClient.swift @@ -28,8 +28,8 @@ extension UserDefaultsClient: MonstersTempRepository { jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase guard let data = self.userDefaults.data(forKey: key), - let monster = try? jsonDecoder.decode(MonsterEntity.self, from: data) else { - return nil + let monster = try? jsonDecoder.decode(MonsterEntity.self, from: data) else { + return nil } return monster } diff --git a/UhooiPicBook/SceneDelegate.swift b/UhooiPicBook/SceneDelegate.swift index dabfb4a3..b023120c 100644 --- a/UhooiPicBook/SceneDelegate.swift +++ b/UhooiPicBook/SceneDelegate.swift @@ -80,9 +80,9 @@ extension SceneDelegate { private func executeSpotlightActivity(_ userActivity: NSUserActivity) { guard let key = userActivity.userInfo?[CSSearchableItemActivityIdentifier] as? String, - let monster = UserDefaultsClient().loadMonster(key: key), - let nav = self.window?.rootViewController as? UINavigationController else { - return + let monster = UserDefaultsClient().loadMonster(key: key), + let nav = self.window?.rootViewController as? UINavigationController else { + return } nav.dismiss(animated: false) From 162c3b620d66f5ff44503a96497d46a140d9041a Mon Sep 17 00:00:00 2001 From: uhooi Date: Wed, 16 Sep 2020 23:36:51 +0900 Subject: [PATCH 03/31] Add final to mock --- project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.yml b/project.yml index d514555c..47947a28 100644 --- a/project.yml +++ b/project.yml @@ -105,7 +105,7 @@ targets: unset SDKROOT if which mint >/dev/null; then rm -f $SRCROOT/$TARGET_NAME/Generated/MockResults.swift - mint run uber/mockolo mockolo --sourcedirs $SRCROOT/$TARGET_NAME --destination $SRCROOT/$TARGET_NAME/Generated/MockResults.swift + mint run uber/mockolo mockolo --sourcedirs $SRCROOT/$TARGET_NAME --destination $SRCROOT/$TARGET_NAME/Generated/MockResults.swift --mock-final else echo "warning: Mint not installed, download from https://github.com/yonaskolb/Mint" fi From 696d92dcbff57fe34ea280b8c76873e053809c91 Mon Sep 17 00:00:00 2001 From: uhooi Date: Wed, 16 Sep 2020 23:40:10 +0900 Subject: [PATCH 04/31] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66397934..6c382a7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ on: - Rambafile env: - DEVELOPER_DIR: /Applications/Xcode_11.6.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer jobs: test: From 9802e710fec0288cdde4c716b68d48fe596c89fe Mon Sep 17 00:00:00 2001 From: uhooi Date: Wed, 16 Sep 2020 23:41:20 +0900 Subject: [PATCH 05/31] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 70311ee9..83458626 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ TEST_SDK := iphonesimulator TEST_CONFIGURATION := Debug TEST_PLATFORM := iOS Simulator TEST_DEVICE ?= iPhone 11 Pro Max -TEST_OS ?= 13.6 +TEST_OS ?= 14.0 TEST_DESTINATION := 'platform=${TEST_PLATFORM},name=${TEST_DEVICE},OS=${TEST_OS}' COVERAGE_OUTPUT := html_report From b44271f211741a5bc621977c441e2238b263f4eb Mon Sep 17 00:00:00 2001 From: uhooi Date: Thu, 17 Sep 2020 12:50:49 +0900 Subject: [PATCH 06/31] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6977cbf2..30fd79ea 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ You can develop UhooiPicBook-iOS. ### Environment -- Xcode: 11.6 -- Swift: 5.2.4 +- Xcode: 12.0 +- Swift: 5.3 - Bundler: 2.1.4 - Mint: 0.14.2 From aebb73c2b283cb13a32936f5f8815cd990b75f3a Mon Sep 17 00:00:00 2001 From: uhooi Date: Thu, 17 Sep 2020 19:20:59 +0900 Subject: [PATCH 07/31] Change Spotlight logic --- .../Extensions/UIKit/UIImage+Resize.swift | 25 +++++++++++++++++++ .../Spotlight/SpotlightRepository.swift | 12 ++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 UhooiPicBook/Extensions/UIKit/UIImage+Resize.swift diff --git a/UhooiPicBook/Extensions/UIKit/UIImage+Resize.swift b/UhooiPicBook/Extensions/UIKit/UIImage+Resize.swift new file mode 100644 index 00000000..7f33a0fe --- /dev/null +++ b/UhooiPicBook/Extensions/UIKit/UIImage+Resize.swift @@ -0,0 +1,25 @@ +// +// UIImage+Resize.swift +// UhooiPicBook +// +// Created by uhooi on 2020/09/17. +// + +import UIKit + +extension UIImage { + func resize(_ afterSize: CGSize) -> UIImage? { + let widthRatio = afterSize.width / self.size.width + let heightRatio = afterSize.height / self.size.height + let ratio = widthRatio < heightRatio ? widthRatio : heightRatio + + let resizedSize = CGSize(width: self.size.width * ratio, height: self.size.height * ratio) + + UIGraphicsBeginImageContextWithOptions(resizedSize, false, 0.0) + draw(in: CGRect(origin: .zero, size: resizedSize)) + let resizedImage = UIGraphicsGetImageFromCurrentImageContext() + UIGraphicsEndImageContext() + + return resizedImage + } +} diff --git a/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift b/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift index 7d868d66..61f51531 100644 --- a/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift +++ b/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift @@ -6,8 +6,8 @@ // import CoreSpotlight -import Foundation import MobileCoreServices +import UIKit /// @mockable protocol SpotlightRepository: AnyObject { // swiftlint:disable:this file_types_order @@ -35,10 +35,11 @@ extension SpotlightClient: SpotlightRepository { self.imageCacheManager.cacheImage(imageUrl: monster.iconUrl) { result in switch result { case .success(let image): + let thumbnailData = image.resize(CGSize(width: 180.0, height: 180.0))?.pngData() let item = CSSearchableItem( uniqueIdentifier: key, domainIdentifier: Bundle.main.infoDictionary?[kCFBundleNameKey as String] as? String, - attributeSet: self.createAttributeSet(title: monster.name, contentDescription: monster.description, thumbnailData: image.pngData()) + attributeSet: self.createAttributeSet(title: monster.name, contentDescription: monster.description, thumbnailData: thumbnailData) ) self.searchableIndex.indexSearchableItems([item], completionHandler: nil) case .failure: @@ -49,7 +50,12 @@ extension SpotlightClient: SpotlightRepository { } private func createAttributeSet(title: String, contentDescription: String, thumbnailData: Data?) -> CSSearchableItemAttributeSet { - let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeData as String) + let attributeSet: CSSearchableItemAttributeSet + if #available(iOS 14.0, *) { + attributeSet = .init(contentType: .data) + } else { + attributeSet = .init(itemContentType: kUTTypeData as String) + } attributeSet.title = title attributeSet.contentDescription = contentDescription attributeSet.thumbnailData = thumbnailData From 7da4f943dac931449633d8a54c04a8d8ae2fe12a Mon Sep 17 00:00:00 2001 From: uhooi Date: Thu, 24 Sep 2020 22:24:09 +0900 Subject: [PATCH 08/31] make update-bundler --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e58ada01..8f106f03 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - algoliasearch (1.27.3) + algoliasearch (1.27.4) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) @@ -50,7 +50,7 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.7) escape (0.0.4) ethon (0.12.0) ffi (>= 1.3.0) @@ -71,7 +71,7 @@ GEM concurrent-ruby (~> 1.0) json (2.3.1) liquid (4.0.0) - minitest (5.14.1) + minitest (5.14.2) molinillo (0.6.6) nanaimo (0.3.0) nap (1.1.0) @@ -85,7 +85,7 @@ GEM ethon (>= 0.9.0) tzinfo (1.2.7) thread_safe (~> 0.1) - xcodeproj (1.17.1) + xcodeproj (1.18.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) From 787727ae8827d22ea5f1ae9327a0278874cb663a Mon Sep 17 00:00:00 2001 From: uhooi Date: Thu, 24 Sep 2020 23:12:11 +0900 Subject: [PATCH 09/31] Update Firebase binary --- Cartfile | 1 + Cartfile.resolved | 9 +++++---- project.yml | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cartfile b/Cartfile index c68717a1..dbbab578 100644 --- a/Cartfile +++ b/Cartfile @@ -2,4 +2,5 @@ binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.j binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseCrashlyticsBinary.json" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseProtobufBinary.json" diff --git a/Cartfile.resolved b/Cartfile.resolved index ab6f2551..ae74c951 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,5 @@ -binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" "6.18.0" -binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseCrashlyticsBinary.json" "6.18.0" -binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json" "6.18.0" -binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json" "6.18.0" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" "6.33.0" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseCrashlyticsBinary.json" "6.33.0" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json" "6.33.0" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json" "6.33.0" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseProtobufBinary.json" "6.33.0" diff --git a/project.yml b/project.yml index 47947a28..f457ba9b 100644 --- a/project.yml +++ b/project.yml @@ -73,8 +73,6 @@ targets: embed: false - framework: Carthage/Build/iOS/GoogleDataTransport.framework embed: false - - framework: Carthage/Build/iOS/GoogleDataTransportCCTSupport.framework - embed: false - framework: Carthage/Build/iOS/GoogleToolboxForMac.framework embed: false - framework: Carthage/Build/iOS/GoogleUtilities.framework From 32e4ce5fe8ae325929f90e80aa5642d3e9885193 Mon Sep 17 00:00:00 2001 From: macneko-ayu Date: Fri, 25 Sep 2020 02:13:55 +0900 Subject: [PATCH 10/31] Update Mintfile --- Mintfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mintfile b/Mintfile index c1880a4d..77441cd3 100644 --- a/Mintfile +++ b/Mintfile @@ -1,4 +1,4 @@ -Carthage/Carthage@0.35.0 +Carthage/Carthage@0.36.0 yonaskolb/xcodegen@2.16.0 realm/SwiftLint@0.39.2 fromkk/SpellChecker@0.0.3 From f3a8fa05704ab5342115ea167c09f4eb53584e39 Mon Sep 17 00:00:00 2001 From: macneko-ayu Date: Fri, 25 Sep 2020 02:14:57 +0900 Subject: [PATCH 11/31] Update project.yml --- project.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/project.yml b/project.yml index f457ba9b..5f011188 100644 --- a/project.yml +++ b/project.yml @@ -63,8 +63,6 @@ targets: embed: false - framework: Carthage/Build/iOS/FirebaseInstallations.framework embed: false - - framework: Carthage/Build/iOS/FirebaseInstanceID.framework - embed: false - framework: Carthage/Build/iOS/FirebasePerformance.framework embed: false - framework: Carthage/Build/iOS/FirebaseRemoteConfig.framework From 635ebdb7402bfae82f5b35f06a22be8460fff37b Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 09:46:03 +0900 Subject: [PATCH 12/31] Fix trigger --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c382a7a..c1f5e0ed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ on: - Rambafile pull_request: branches: - - develop + - !master paths-ignore: - Docs/** - README.md From e7bf775ecba1e4c4f2bee41b538822ca226875d0 Mon Sep 17 00:00:00 2001 From: Swapnil Jha Date: Fri, 25 Sep 2020 06:33:13 +0530 Subject: [PATCH 13/31] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66397934..ddb34d4f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ on: - Rambafile env: - DEVELOPER_DIR: /Applications/Xcode_11.6.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_12.app jobs: test: From 8b117613c8868378d5e13ed32f4bf43eef164617 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 10:22:34 +0900 Subject: [PATCH 14/31] Fix CocoaPods warning --- Podfile | 8 ++++++++ Podfile.lock | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Podfile b/Podfile index 703cac86..4b981ebd 100644 --- a/Podfile +++ b/Podfile @@ -21,3 +21,11 @@ target 'UhooiPicBook' do end +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' + end + end +end + diff --git a/Podfile.lock b/Podfile.lock index 99225dc1..a82e1f83 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -23,6 +23,6 @@ SPEC CHECKSUMS: R.swift.Library: 5ba4f1631300caf9a4d890186930da85d540769d SwiftPrettyPrint: 02010eb68c416300eb9d0d0dccafa82b5856466a -PODFILE CHECKSUM: 8736f02f2c9ee6c21a8d66b07287d51f6d13f861 +PODFILE CHECKSUM: f92e6c357c9b893d9426f0541709ddda78acbb01 COCOAPODS: 1.9.3 From f16406087babd64c30253eebd0a51ae85ffc7e47 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 10:30:21 +0900 Subject: [PATCH 15/31] Change trigger --- .github/workflows/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c1f5e0ed..00a84ecf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,8 @@ on: - Rambafile pull_request: branches: - - !master + # - !master + - develop paths-ignore: - Docs/** - README.md From 9fef6a9ef1597c1823d92ade9da5f80a32970896 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 10:39:01 +0900 Subject: [PATCH 16/31] Update XcodeGen --- Mintfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mintfile b/Mintfile index 77441cd3..32501665 100644 --- a/Mintfile +++ b/Mintfile @@ -1,5 +1,5 @@ Carthage/Carthage@0.36.0 -yonaskolb/xcodegen@2.16.0 +yonaskolb/xcodegen@2.17.0 realm/SwiftLint@0.39.2 fromkk/SpellChecker@0.0.3 uber/mockolo@1.2.8 From 24a433fe64e94cfe561435421d6d3d6af0060232 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 10:56:03 +0900 Subject: [PATCH 17/31] Update SwiftLint --- Mintfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mintfile b/Mintfile index 32501665..992b4086 100644 --- a/Mintfile +++ b/Mintfile @@ -1,6 +1,6 @@ Carthage/Carthage@0.36.0 yonaskolb/xcodegen@2.17.0 -realm/SwiftLint@0.39.2 +realm/SwiftLint@0.40.3 fromkk/SpellChecker@0.0.3 uber/mockolo@1.2.8 mono0926/LicensePlist@2.16.0 From 483b044d54f56f24bdab7d702dd2eedbd9451df7 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 10:59:54 +0900 Subject: [PATCH 18/31] Fix import --- UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift b/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift index 61f51531..50c52b62 100644 --- a/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift +++ b/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift @@ -7,7 +7,7 @@ import CoreSpotlight import MobileCoreServices -import UIKit +import UIKit.UIImage /// @mockable protocol SpotlightRepository: AnyObject { // swiftlint:disable:this file_types_order From 8f1a8f12e28dbe3407f0277c146e7487891711ef Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 11:04:08 +0900 Subject: [PATCH 19/31] Fix import --- UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift b/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift index 50c52b62..e435a9be 100644 --- a/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift +++ b/UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift @@ -5,9 +5,9 @@ // Created by Tomosuke Okada on 2020/05/11. // +import CoreGraphics.CGGeometry import CoreSpotlight import MobileCoreServices -import UIKit.UIImage /// @mockable protocol SpotlightRepository: AnyObject { // swiftlint:disable:this file_types_order From c3f14ee409d30301b1e592b63fc811687dfb4ff3 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 12:10:51 +0900 Subject: [PATCH 20/31] Fix Carthage build error --- Configs/Carthage.xcconfig | 12 ++++++++++++ Makefile | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 Configs/Carthage.xcconfig diff --git a/Configs/Carthage.xcconfig b/Configs/Carthage.xcconfig new file mode 100644 index 00000000..4db1356d --- /dev/null +++ b/Configs/Carthage.xcconfig @@ -0,0 +1,12 @@ +// +// Carthage.xcconfig +// UhooiPicBook +// +// Created by uhooi on 2020/09/25. +// + +// Configuration settings file format documentation can be found at: +// https://help.apple.com/xcode/#/dev745c5c974 + +EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 +EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)) diff --git a/Makefile b/Makefile index 83458626..9de4475f 100644 --- a/Makefile +++ b/Makefile @@ -55,19 +55,25 @@ update-cocoapods: # Update CocoaPods dependencies and generate workspace .PHONY: install-carthage install-carthage: # Install Carthage dependencies + @$(MAKE) export-carthage-config mint run carthage carthage bootstrap --platform iOS --cache-builds - $(MAKE) show-carthage-dependencies + @$(MAKE) show-carthage-dependencies .PHONY: update-carthage update-carthage: # Update Carthage dependencies + @$(MAKE) export-carthage-config mint run carthage carthage update --platform iOS - $(MAKE) show-carthage-dependencies + @$(MAKE) show-carthage-dependencies .PHONY: show-carthage-dependencies show-carthage-dependencies: @echo '*** Resolved dependencies:' @cat 'Cartfile.resolved' +.PHONY: export-carthage-config +export-carthage-config: + export XCODE_XCCONFIG_FILE=Configs/Carthage.xcconfig + .PHONY: install-templates install-templates: # Install Generamba templates bundle exec generamba template install From e3cc9cbfc4027c0dbaa00d16cec15e4f8ee40a1c Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 12:30:32 +0900 Subject: [PATCH 21/31] Add XCODE_XCCONFIG_FILE to workflow --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 00a84ecf..1b9d542f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,7 @@ jobs: env: MINT_PATH: mint/lib MINT_LINK_PATH: mint/bin + XCODE_XCCONFIG_FILE: Configs/Carthage.xcconfig steps: # チェックアウト From 3960efe6846ff4994d0e3cab3093e23b4a24553d Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Fri, 25 Sep 2020 14:03:08 +0900 Subject: [PATCH 22/31] Bump Ruby to 2.7.0 https://www.ruby-lang.org/ja/news/2019/12/25/ruby-2-7-0-released/ --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 7ee07b84..24ba9a38 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.0-preview1 +2.7.0 From 2c519bbf95d28404b6eecf3862e086b657fb50e2 Mon Sep 17 00:00:00 2001 From: 417-72KI <417.72ki@gmail.com> Date: Fri, 25 Sep 2020 14:03:14 +0900 Subject: [PATCH 23/31] Bump Ruby to 2.7.1 https://www.ruby-lang.org/ja/news/2020/03/31/ruby-2-7-1-released/ --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 24ba9a38..860487ca 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.0 +2.7.1 From 27ab2b0f2a138f03e6f1fe4d6bef34aeae0aa056 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 22:17:02 +0900 Subject: [PATCH 24/31] Add Push Notifications --- UhooiPicBook/UhooiPicBook.entitlements | 8 ++++++++ project.yml | 1 + 2 files changed, 9 insertions(+) create mode 100644 UhooiPicBook/UhooiPicBook.entitlements diff --git a/UhooiPicBook/UhooiPicBook.entitlements b/UhooiPicBook/UhooiPicBook.entitlements new file mode 100644 index 00000000..903def2a --- /dev/null +++ b/UhooiPicBook/UhooiPicBook.entitlements @@ -0,0 +1,8 @@ + + + + + aps-environment + development + + diff --git a/project.yml b/project.yml index 5f011188..29797a85 100644 --- a/project.yml +++ b/project.yml @@ -31,6 +31,7 @@ targets: CURRENT_PROJECT_VERSION: 9 DEVELOPMENT_TEAM: 47E56DYP3N INFOPLIST_FILE: UhooiPicBook/Info.plist + CODE_SIGN_ENTITLEMENTS: UhooiPicBook/UhooiPicBook.entitlements OTHER_LDFLAGS: $(inherited) $(OTHER_LDFLAGS) -ObjC DEVELOPMENT_LANGUAGE: jp dependencies: From d614158ff818cd02aaa5d1d3106ff33ef4e9f307 Mon Sep 17 00:00:00 2001 From: uhooi Date: Fri, 25 Sep 2020 23:34:34 +0900 Subject: [PATCH 25/31] Add FirebaseMessaging framework --- Cartfile | 1 + Cartfile.resolved | 1 + project.yml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Cartfile b/Cartfile index dbbab578..d987b093 100644 --- a/Cartfile +++ b/Cartfile @@ -1,6 +1,7 @@ binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseCrashlyticsBinary.json" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMessagingBinary.json" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseProtobufBinary.json" diff --git a/Cartfile.resolved b/Cartfile.resolved index ae74c951..20ac2890 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,5 +1,6 @@ binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json" "6.33.0" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseCrashlyticsBinary.json" "6.33.0" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json" "6.33.0" +binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMessagingBinary.json" "6.33.0" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json" "6.33.0" binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseProtobufBinary.json" "6.33.0" diff --git a/project.yml b/project.yml index 29797a85..db29e0d7 100644 --- a/project.yml +++ b/project.yml @@ -64,6 +64,8 @@ targets: embed: false - framework: Carthage/Build/iOS/FirebaseInstallations.framework embed: false + - framework: Carthage/Build/iOS/FirebaseMessaging.framework + embed: false - framework: Carthage/Build/iOS/FirebasePerformance.framework embed: false - framework: Carthage/Build/iOS/FirebaseRemoteConfig.framework From d917db0aea858dbe5fead62e0a89f6d9ab8670f5 Mon Sep 17 00:00:00 2001 From: uhooi Date: Sat, 26 Sep 2020 01:56:03 +0900 Subject: [PATCH 26/31] Impl FCM --- UhooiPicBook/AppDelegate.swift | 42 +++++++++++++++++++++++++++++++++- project.yml | 3 --- spell-checker.yml | 1 + 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/UhooiPicBook/AppDelegate.swift b/UhooiPicBook/AppDelegate.swift index 2f71f18e..0ab76a10 100644 --- a/UhooiPicBook/AppDelegate.swift +++ b/UhooiPicBook/AppDelegate.swift @@ -7,7 +7,8 @@ // import UIKit -import Firebase +import FirebaseCore +import FirebaseMessaging #if canImport(Gedatsu) import Gedatsu #endif @@ -20,7 +21,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { #if canImport(Gedatsu) Gedatsu.open() #endif + FirebaseApp.configure() + configurePushNotifications(application: application) + Messaging.messaging().delegate = self + return true } @@ -38,4 +43,39 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } + // MARK: Other Private Methods + + private func configurePushNotifications(application: UIApplication) { + UNUserNotificationCenter.current().delegate = self + let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] + UNUserNotificationCenter.current().requestAuthorization( + options: authOptions + ) {_, _ in + } + application.registerForRemoteNotifications() + } + +} + +extension AppDelegate: UNUserNotificationCenterDelegate { + func userNotificationCenter( + _ center: UNUserNotificationCenter, + willPresent notification: UNNotification, + withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { + completionHandler([[.alert, .sound]]) + } + + func userNotificationCenter( + _ center: UNUserNotificationCenter, + didReceive response: UNNotificationResponse, + withCompletionHandler completionHandler: @escaping () -> Void) { + completionHandler() + } +} + +extension AppDelegate: MessagingDelegate { + func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) { + let dataDict: [String: String] = ["token": fcmToken] + NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict) + } } diff --git a/project.yml b/project.yml index db29e0d7..f9755fdd 100644 --- a/project.yml +++ b/project.yml @@ -41,9 +41,6 @@ targets: buildPhase: copyFiles: destination: plugins - - framework: Carthage/Build/iOS/Firebase.framework - embed: false - link: false - framework: Carthage/Build/iOS/abseil.framework embed: false - framework: Carthage/Build/iOS/BoringSSL-GRPC.framework diff --git a/spell-checker.yml b/spell-checker.yml index 83b8e51b..f3187176 100644 --- a/spell-checker.yml +++ b/spell-checker.yml @@ -8,6 +8,7 @@ whiteList: - swiftlint - gedatsu - json + - fcm # Uhooi - theuhooi From 6b8fd14a3f2ac25e257fc9f6057bc15fb5c9aa12 Mon Sep 17 00:00:00 2001 From: uhooi Date: Sat, 26 Sep 2020 11:01:03 +0900 Subject: [PATCH 27/31] Add FirebaseInstanceID.framework --- project.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project.yml b/project.yml index f9755fdd..d1126bfa 100644 --- a/project.yml +++ b/project.yml @@ -61,6 +61,8 @@ targets: embed: false - framework: Carthage/Build/iOS/FirebaseInstallations.framework embed: false + - framework: Carthage/Build/iOS/FirebaseInstanceID.framework + embed: false - framework: Carthage/Build/iOS/FirebaseMessaging.framework embed: false - framework: Carthage/Build/iOS/FirebasePerformance.framework From d84e790497a708b6ff2c6451c7d477948a4f5df8 Mon Sep 17 00:00:00 2001 From: uhooi Date: Sat, 26 Sep 2020 12:55:36 +0900 Subject: [PATCH 28/31] Fix notification handler --- UhooiPicBook/AppDelegate.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UhooiPicBook/AppDelegate.swift b/UhooiPicBook/AppDelegate.swift index 0ab76a10..7b960265 100644 --- a/UhooiPicBook/AppDelegate.swift +++ b/UhooiPicBook/AppDelegate.swift @@ -62,7 +62,11 @@ extension AppDelegate: UNUserNotificationCenterDelegate { _ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { - completionHandler([[.alert, .sound]]) + if #available(iOS 14.0, *) { + completionHandler([[.banner, .list, .sound]]) + } else { + completionHandler([[.alert, .sound]]) + } } func userNotificationCenter( From 3b7f8942c9d584ffbdb2fe2d44a899d52405f076 Mon Sep 17 00:00:00 2001 From: uhooi Date: Sat, 26 Sep 2020 13:19:22 +0900 Subject: [PATCH 29/31] Refactor AppDelegate --- UhooiPicBook/AppDelegate.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/UhooiPicBook/AppDelegate.swift b/UhooiPicBook/AppDelegate.swift index 7b960265..31b5c502 100644 --- a/UhooiPicBook/AppDelegate.swift +++ b/UhooiPicBook/AppDelegate.swift @@ -23,7 +23,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { #endif FirebaseApp.configure() - configurePushNotifications(application: application) + configureNotifications(application: application) Messaging.messaging().delegate = self return true @@ -45,13 +45,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // MARK: Other Private Methods - private func configurePushNotifications(application: UIApplication) { - UNUserNotificationCenter.current().delegate = self - let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound] - UNUserNotificationCenter.current().requestAuthorization( - options: authOptions - ) {_, _ in - } + private func configureNotifications(application: UIApplication) { + let center = UNUserNotificationCenter.current() + center.delegate = self + center.requestAuthorization( + options: [.alert, .badge, .sound] + ) { _, _ in } + application.registerForRemoteNotifications() } From 9c26ae3b2130524da6f0f817ecd73621c310b232 Mon Sep 17 00:00:00 2001 From: uhooi Date: Sat, 26 Sep 2020 13:31:35 +0900 Subject: [PATCH 30/31] Remove icon badge with sceneWillEnterForeground --- UhooiPicBook/SceneDelegate.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/UhooiPicBook/SceneDelegate.swift b/UhooiPicBook/SceneDelegate.swift index b023120c..5ca53a25 100644 --- a/UhooiPicBook/SceneDelegate.swift +++ b/UhooiPicBook/SceneDelegate.swift @@ -51,6 +51,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. + UIApplication.shared.applicationIconBadgeNumber = 0 } func sceneDidEnterBackground(_ scene: UIScene) { From 9edf7809f3b20ac85ee6616124b689fb1560bf49 Mon Sep 17 00:00:00 2001 From: uhooi Date: Sat, 26 Sep 2020 14:50:50 +0900 Subject: [PATCH 31/31] Increment version --- project.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/project.yml b/project.yml index d1126bfa..ed44fb84 100644 --- a/project.yml +++ b/project.yml @@ -5,7 +5,7 @@ options: deploymentTarget: iOS: 13.0 developmentLanguage: ja - xcodeVersion: "11.6" + xcodeVersion: "12.0" carthageExecutablePath: unset SDKROOT && mint run Carthage/Carthage carthage settings: @@ -27,8 +27,8 @@ targets: type: file settings: base: - MARKETING_VERSION: 1.1.0 - CURRENT_PROJECT_VERSION: 9 + MARKETING_VERSION: 1.2.0 + CURRENT_PROJECT_VERSION: 10 DEVELOPMENT_TEAM: 47E56DYP3N INFOPLIST_FILE: UhooiPicBook/Info.plist CODE_SIGN_ENTITLEMENTS: UhooiPicBook/UhooiPicBook.entitlements @@ -181,7 +181,7 @@ targets: CLANG_ENABLE_OBJC_WEAK: YES CODE_SIGN_IDENTITY: "iPhone Developer" CODE_SIGN_STYLE: Automatic - CURRENT_PROJECT_VERSION: 9 + CURRENT_PROJECT_VERSION: 10 DEBUG_INFORMATION_FORMAT: dwarf DEVELOPMENT_TEAM: 47E56DYP3N GCC_PREPROCESSOR_DEFINITIONS: @@ -190,7 +190,7 @@ targets: INFOPLIST_FILE: UhooiPicBookStickers/Info.plist IPHONEOS_DEPLOYMENT_TARGET: 11.0 LD_RUNPATH_SEARCH_PATHS: "" - MARKETING_VERSION: 1.1.0 + MARKETING_VERSION: 1.2.0 MTL_ENABLE_DEBUG_INFO: INCLUDE_SOURCE MTL_FAST_MATH: YES PRODUCT_BUNDLE_IDENTIFIER: com.theuhooi.UhooiPicBook.Stickers