Skip to content

Commit

Permalink
Merge pull request #89 from uhooi/release/1.2.0
Browse files Browse the repository at this point in the history
Release/1.2.0
  • Loading branch information
uhooi authored Sep 29, 2020
2 parents 4c49705 + 9edf780 commit 76de2c3
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 50 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- Rambafile
pull_request:
branches:
# - !master
- develop
paths-ignore:
- Docs/**
Expand All @@ -20,14 +21,15 @@ on:
- Rambafile

env:
DEVELOPER_DIR: /Applications/Xcode_11.6.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_12.app

jobs:
test:
runs-on: macOS-latest
env:
MINT_PATH: mint/lib
MINT_LINK_PATH: mint/bin
XCODE_XCCONFIG_FILE: Configs/Carthage.xcconfig

steps:
# チェックアウト
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.0-preview1
2.7.1
2 changes: 2 additions & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,5 +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"

10 changes: 6 additions & 4 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
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/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"
12 changes: 12 additions & 0 deletions Configs/Carthage.xcconfig
Original file line number Diff line number Diff line change
@@ -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))
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -102,8 +108,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} \
Expand All @@ -113,8 +119,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} \
Expand Down
8 changes: 4 additions & 4 deletions Mintfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Carthage/Carthage@0.35.0
yonaskolb/xcodegen@2.16.0
realm/SwiftLint@0.39.2
Carthage/Carthage@0.36.0
yonaskolb/xcodegen@2.17.0
realm/SwiftLint@0.40.3
fromkk/[email protected]
uber/[email protected].4
uber/[email protected].8
mono0926/[email protected]

8 changes: 8 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ SPEC CHECKSUMS:
R.swift.Library: 5ba4f1631300caf9a4d890186930da85d540769d
SwiftPrettyPrint: 02010eb68c416300eb9d0d0dccafa82b5856466a

PODFILE CHECKSUM: 8736f02f2c9ee6c21a8d66b07287d51f6d13f861
PODFILE CHECKSUM: f92e6c357c9b893d9426f0541709ddda78acbb01

COCOAPODS: 1.9.3
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
46 changes: 45 additions & 1 deletion UhooiPicBook/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
//

import UIKit
import Firebase
import FirebaseCore
import FirebaseMessaging
#if canImport(Gedatsu)
import Gedatsu
#endif
Expand All @@ -20,7 +21,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
#if canImport(Gedatsu)
Gedatsu.open()
#endif

FirebaseApp.configure()
configureNotifications(application: application)
Messaging.messaging().delegate = self

return true
}

Expand All @@ -38,4 +43,43 @@ 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 configureNotifications(application: UIApplication) {
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(
options: [.alert, .badge, .sound]
) { _, _ in }

application.registerForRemoteNotifications()
}

}

extension AppDelegate: UNUserNotificationCenterDelegate {
func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
if #available(iOS 14.0, *) {
completionHandler([[.banner, .list, .sound]])
} else {
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)
}
}
25 changes: 25 additions & 0 deletions UhooiPicBook/Extensions/UIKit/UIImage+Resize.swift
Original file line number Diff line number Diff line change
@@ -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
}
}
12 changes: 6 additions & 6 deletions UhooiPicBook/Repository/Monsters/MonstersRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
12 changes: 9 additions & 3 deletions UhooiPicBook/Repository/Spotlight/SpotlightRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// Created by Tomosuke Okada on 2020/05/11.
//

import CoreGraphics.CGGeometry
import CoreSpotlight
import Foundation
import MobileCoreServices

/// @mockable
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions UhooiPicBook/Repository/Temp/UserDefaultsClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 4 additions & 3 deletions UhooiPicBook/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -80,9 +81,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)
Expand Down
8 changes: 8 additions & 0 deletions UhooiPicBook/UhooiPicBook.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>aps-environment</key>
<string>development</string>
</dict>
</plist>
Loading

0 comments on commit 76de2c3

Please sign in to comment.