From 031d507bb5693e9a2eec9e2d44143e54000fd85d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EB=8F=99=EC=98=81=28=EB=AA=A8=EB=B0=94=EC=9D=BC?= =?UTF-8?q?=29?= Date: Sat, 9 Jan 2021 08:36:53 +0900 Subject: [PATCH] :wrench: Firebase Distribution Setup (#33) --- .../Dear-World.xcodeproj/project.pbxproj | 99 +++++++++++++++- .../xcshareddata/swiftpm/Package.resolved | 72 ++++++++++++ .../xcschemes/Dear-World.xcscheme | 98 ++++++++++++++++ .../Dear-World/GoogleService-Info.plist | 34 ++++++ .../Dear-World/Source/Core/AppDelegate.swift | 19 ++- .../Send Message/SendMessageReactor.swift | 6 +- .../SendMessageViewController.swift | 19 +++ .../View/CountrySelectController.swift | 9 ++ Dear-World/Dear-World/Support File/Info.plist | 110 +++++++++--------- 9 files changed, 403 insertions(+), 63 deletions(-) create mode 100644 Dear-World/Dear-World.xcodeproj/xcshareddata/xcschemes/Dear-World.xcscheme create mode 100644 Dear-World/Dear-World/GoogleService-Info.plist diff --git a/Dear-World/Dear-World.xcodeproj/project.pbxproj b/Dear-World/Dear-World.xcodeproj/project.pbxproj index 4775556..1aac33c 100644 --- a/Dear-World/Dear-World.xcodeproj/project.pbxproj +++ b/Dear-World/Dear-World.xcodeproj/project.pbxproj @@ -33,6 +33,12 @@ 393E0D5725A2BE3C000DB3B9 /* AboutTeamViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 393E0D5625A2BE3C000DB3B9 /* AboutTeamViewController.swift */; }; 393E0D5F25A2CEB6000DB3B9 /* AboutTeamReactor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 393E0D5E25A2CEB6000DB3B9 /* AboutTeamReactor.swift */; }; 393E0F3225A6EA4C000DB3B9 /* DWAlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 393E0F3125A6EA4C000DB3B9 /* DWAlertViewController.swift */; }; + 39518C7725A8FA2400F777D1 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 39518C7625A8FA2400F777D1 /* GoogleService-Info.plist */; }; + 39518C7D25A8FB9D00F777D1 /* FirebaseInstallations in Frameworks */ = {isa = PBXBuildFile; productRef = 39518C7C25A8FB9D00F777D1 /* FirebaseInstallations */; }; + 39518C7F25A8FB9D00F777D1 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 39518C7E25A8FB9D00F777D1 /* FirebaseAnalytics */; }; + 39518C8125A8FB9D00F777D1 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = 39518C8025A8FB9D00F777D1 /* FirebaseCrashlytics */; }; + 39518C8325A8FB9D00F777D1 /* FirebaseRemoteConfig in Frameworks */ = {isa = PBXBuildFile; productRef = 39518C8225A8FB9D00F777D1 /* FirebaseRemoteConfig */; }; + 39518C8525A8FB9D00F777D1 /* FirebaseAuth in Frameworks */ = {isa = PBXBuildFile; productRef = 39518C8425A8FB9D00F777D1 /* FirebaseAuth */; }; 3958257B25948E41007325AB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3958257A25948E41007325AB /* AppDelegate.swift */; }; 3958258425948E43007325AB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3958258325948E43007325AB /* Assets.xcassets */; }; 3958258725948E43007325AB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3958258525948E43007325AB /* LaunchScreen.storyboard */; }; @@ -131,6 +137,7 @@ 393E0D5625A2BE3C000DB3B9 /* AboutTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTeamViewController.swift; sourceTree = ""; }; 393E0D5E25A2CEB6000DB3B9 /* AboutTeamReactor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutTeamReactor.swift; sourceTree = ""; }; 393E0F3125A6EA4C000DB3B9 /* DWAlertViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DWAlertViewController.swift; sourceTree = ""; }; + 39518C7625A8FA2400F777D1 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 3958257725948E41007325AB /* Dear-World.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Dear-World.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 3958257A25948E41007325AB /* AppDelegate.swift */ = {isa = PBXFileReference; indentWidth = 2; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; tabWidth = 2; }; 3958258325948E43007325AB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -184,16 +191,21 @@ buildActionMask = 2147483647; files = ( 39658F9B259ADB130050D180 /* Lottie in Frameworks */, + 39518C7D25A8FB9D00F777D1 /* FirebaseInstallations in Frameworks */, 39672DBC2598E803001D7E69 /* UITextView+Placeholder in Frameworks */, 3971EB0C259A682C0084E6DC /* RxKeyboard in Frameworks */, + 39518C8325A8FB9D00F777D1 /* FirebaseRemoteConfig in Frameworks */, 39C8322A2597651F00236DDF /* RxSwift in Frameworks */, 39C832282597651F00236DDF /* RxRelay in Frameworks */, 39F4657D25977DB300621327 /* RxGesture in Frameworks */, 395826212596D0B0007325AB /* Alamofire in Frameworks */, + 39518C7F25A8FB9D00F777D1 /* FirebaseAnalytics in Frameworks */, 39C8322C2597651F00236DDF /* RxCocoa in Frameworks */, 39F465CC2597919700621327 /* RxOptional in Frameworks */, 395826272596D225007325AB /* SnapKit in Frameworks */, + 39518C8525A8FB9D00F777D1 /* FirebaseAuth in Frameworks */, 3971EB32259A8BC90084E6DC /* SwiftRichString in Frameworks */, + 39518C8125A8FB9D00F777D1 /* FirebaseCrashlytics in Frameworks */, 395825F0259494B1007325AB /* ReactorKit in Frameworks */, 3958261B2596D06C007325AB /* Then in Frameworks */, ); @@ -320,6 +332,7 @@ 3958257925948E41007325AB /* Dear-World */ = { isa = PBXGroup; children = ( + 39518C7625A8FA2400F777D1 /* GoogleService-Info.plist */, 395825AD25948E5B007325AB /* Source */, 395825AE25948E66007325AB /* Resource */, 395825AF25948E6D007325AB /* Support File */, @@ -594,6 +607,8 @@ 3958257325948E41007325AB /* Sources */, 3958257425948E41007325AB /* Frameworks */, 3958257525948E41007325AB /* Resources */, + 39518C8C25A8FC2C00F777D1 /* Firebase Crashlytics */, + 39518C9325A900ED00F777D1 /* Firebase Distribution */, ); buildRules = ( ); @@ -614,6 +629,11 @@ 3971EB0B259A682C0084E6DC /* RxKeyboard */, 3971EB31259A8BC90084E6DC /* SwiftRichString */, 39658F9A259ADB130050D180 /* Lottie */, + 39518C7C25A8FB9D00F777D1 /* FirebaseInstallations */, + 39518C7E25A8FB9D00F777D1 /* FirebaseAnalytics */, + 39518C8025A8FB9D00F777D1 /* FirebaseCrashlytics */, + 39518C8225A8FB9D00F777D1 /* FirebaseRemoteConfig */, + 39518C8425A8FB9D00F777D1 /* FirebaseAuth */, ); productName = "Dear-World"; productReference = 3958257725948E41007325AB /* Dear-World.app */; @@ -698,6 +718,7 @@ 3971EB0A259A682C0084E6DC /* XCRemoteSwiftPackageReference "RxKeyboard" */, 3971EB30259A8BC90084E6DC /* XCRemoteSwiftPackageReference "SwiftRichString" */, 39658F99259ADB130050D180 /* XCRemoteSwiftPackageReference "lottie-ios" */, + 39518C7B25A8FB9D00F777D1 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, ); productRefGroup = 3958257825948E41007325AB /* Products */; projectDirPath = ""; @@ -717,6 +738,7 @@ files = ( 3958258725948E43007325AB /* LaunchScreen.storyboard in Resources */, 39658FA0259ADE770050D180 /* splash_1x.json in Resources */, + 39518C7725A8FA2400F777D1 /* GoogleService-Info.plist in Resources */, 395825B725948EE4007325AB /* Colors.xcassets in Resources */, 3958258425948E43007325AB /* Assets.xcassets in Resources */, ); @@ -739,6 +761,42 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 39518C8C25A8FC2C00F777D1 /* Firebase Crashlytics */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Firebase Crashlytics"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\n"; + }; + 39518C9325A900ED00F777D1 /* Firebase Distribution */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Firebase Distribution"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "APP_PATH=\"${TARGET_BUILD_DIR}/${WRAPPER_NAME}\"\n\nfind \"$APP_PATH\" -name '*.framework' -type d | while read -r FRAMEWORK\ndo\nFRAMEWORK_EXECUTABLE_NAME=$(defaults read \"$FRAMEWORK/Info.plist\" CFBundleExecutable)\nFRAMEWORK_EXECUTABLE_PATH=\"$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME\"\necho \"Executable is $FRAMEWORK_EXECUTABLE_PATH\"\necho $(lipo -info \"$FRAMEWORK_EXECUTABLE_PATH\")\n\nFRAMEWORK_TMP_PATH=\"$FRAMEWORK_EXECUTABLE_PATH-tmp\"\n\ncase \"${TARGET_BUILD_DIR}\" in\n*\"iphonesimulator\")\n echo \"No need to remove archs\"\n ;;\n*)\n if $(lipo \"$FRAMEWORK_EXECUTABLE_PATH\" -verify_arch \"i386\") ; then\n lipo -output \"$FRAMEWORK_TMP_PATH\" -remove \"i386\" \"$FRAMEWORK_EXECUTABLE_PATH\"\n echo \"i386 architecture removed\"\n rm \"$FRAMEWORK_EXECUTABLE_PATH\"\n mv \"$FRAMEWORK_TMP_PATH\" \"$FRAMEWORK_EXECUTABLE_PATH\"\n fi\n if $(lipo \"$FRAMEWORK_EXECUTABLE_PATH\" -verify_arch \"x86_64\") ; then\n lipo -output \"$FRAMEWORK_TMP_PATH\" -remove \"x86_64\" \"$FRAMEWORK_EXECUTABLE_PATH\"\n echo \"x86_64 architecture removed\"\n rm \"$FRAMEWORK_EXECUTABLE_PATH\"\n mv \"$FRAMEWORK_TMP_PATH\" \"$FRAMEWORK_EXECUTABLE_PATH\"\n fi\n ;;\nesac\n\necho \"Completed for executable $FRAMEWORK_EXECUTABLE_PATH\"\necho $(lipo -info \"$FRAMEWORK_EXECUTABLE_PATH\")\n\ndone\n"; + }; 3958262B2596D7B6007325AB /* Swift Lint */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -991,6 +1049,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 8BQHKQSA4Y; INFOPLIST_FILE = "Dear-World/Support File/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -998,7 +1057,8 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "developer.o.o.wl.Dear-World"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.OFU.Dear-World"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1011,6 +1071,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 8BQHKQSA4Y; INFOPLIST_FILE = "Dear-World/Support File/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1018,7 +1079,8 @@ "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = "developer.o.o.wl.Dear-World"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.OFU.Dear-World"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -1151,6 +1213,14 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ + 39518C7B25A8FB9D00F777D1 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 7.3.1; + }; + }; 395825EE259494B1007325AB /* XCRemoteSwiftPackageReference "ReactorKit" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/ReactorKit/ReactorKit"; @@ -1242,6 +1312,31 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + 39518C7C25A8FB9D00F777D1 /* FirebaseInstallations */ = { + isa = XCSwiftPackageProductDependency; + package = 39518C7B25A8FB9D00F777D1 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseInstallations; + }; + 39518C7E25A8FB9D00F777D1 /* FirebaseAnalytics */ = { + isa = XCSwiftPackageProductDependency; + package = 39518C7B25A8FB9D00F777D1 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalytics; + }; + 39518C8025A8FB9D00F777D1 /* FirebaseCrashlytics */ = { + isa = XCSwiftPackageProductDependency; + package = 39518C7B25A8FB9D00F777D1 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseCrashlytics; + }; + 39518C8225A8FB9D00F777D1 /* FirebaseRemoteConfig */ = { + isa = XCSwiftPackageProductDependency; + package = 39518C7B25A8FB9D00F777D1 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseRemoteConfig; + }; + 39518C8425A8FB9D00F777D1 /* FirebaseAuth */ = { + isa = XCSwiftPackageProductDependency; + package = 39518C7B25A8FB9D00F777D1 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAuth; + }; 395825EF259494B1007325AB /* ReactorKit */ = { isa = XCSwiftPackageProductDependency; package = 395825EE259494B1007325AB /* XCRemoteSwiftPackageReference "ReactorKit" */; diff --git a/Dear-World/Dear-World.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Dear-World/Dear-World.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 0e49401..96bc02f 100644 --- a/Dear-World/Dear-World.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Dear-World/Dear-World.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,6 +1,15 @@ { "object": { "pins": [ + { + "package": "abseil", + "repositoryURL": "https://github.com/firebase/abseil-cpp-SwiftPM.git", + "state": { + "branch": null, + "revision": "05d8107f2971a37e6c77245b7c4c6b0a7e97bc99", + "version": "0.20200225.0" + } + }, { "package": "Alamofire", "repositoryURL": "https://github.com/Alamofire/Alamofire", @@ -10,6 +19,51 @@ "version": "5.4.1" } }, + { + "package": "BoringSSL-GRPC", + "repositoryURL": "https://github.com/firebase/boringssl-SwiftPM.git", + "state": { + "branch": null, + "revision": "7bcafa2660bc58715c39637494550d1ed7cd7229", + "version": "0.0.7" + } + }, + { + "package": "Firebase", + "repositoryURL": "https://github.com/firebase/firebase-ios-sdk.git", + "state": { + "branch": null, + "revision": "c67d97dc802aafe5474042156dce828e1c4145ca", + "version": "7.3.1" + } + }, + { + "package": "gRPC", + "repositoryURL": "https://github.com/firebase/grpc-SwiftPM.git", + "state": { + "branch": null, + "revision": "91b62619e6c83bc5f1b99d9d60fe46b2862d3a5a", + "version": "1.28.2" + } + }, + { + "package": "GTMSessionFetcher", + "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", + "state": { + "branch": null, + "revision": "91ed3d188eb95705fef3c249453b81f32dc557d1", + "version": "1.5.0" + } + }, + { + "package": "leveldb", + "repositoryURL": "https://github.com/firebase/leveldb.git", + "state": { + "branch": null, + "revision": "fa1f25f296a766e5a789c4dacd4798dea798b2c2", + "version": "1.22.1" + } + }, { "package": "Logger", "repositoryURL": "https://github.com/f-meloni/Logger", @@ -28,6 +82,15 @@ "version": "3.1.9" } }, + { + "package": "nanopb", + "repositoryURL": "https://github.com/firebase/nanopb.git", + "state": { + "branch": null, + "revision": "8119dfe5631f2616d11e50ead95448d12e816062", + "version": "2.30906.0" + } + }, { "package": "Nimble", "repositoryURL": "https://github.com/Quick/Nimble.git", @@ -46,6 +109,15 @@ "version": "0.13.0" } }, + { + "package": "Promises", + "repositoryURL": "https://github.com/google/promises.git", + "state": { + "branch": null, + "revision": "afa9a1ace74e116848d4f743599ab83e584ff8cb", + "version": "1.2.12" + } + }, { "package": "Quick", "repositoryURL": "https://github.com/Quick/Quick.git", diff --git a/Dear-World/Dear-World.xcodeproj/xcshareddata/xcschemes/Dear-World.xcscheme b/Dear-World/Dear-World.xcodeproj/xcshareddata/xcschemes/Dear-World.xcscheme new file mode 100644 index 0000000..18113d8 --- /dev/null +++ b/Dear-World/Dear-World.xcodeproj/xcshareddata/xcschemes/Dear-World.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Dear-World/Dear-World/GoogleService-Info.plist b/Dear-World/Dear-World/GoogleService-Info.plist new file mode 100644 index 0000000..0e7d448 --- /dev/null +++ b/Dear-World/Dear-World/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 562294189406-90phjidei0fv8f3r6g4cfsnmi6q0vb82.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.562294189406-90phjidei0fv8f3r6g4cfsnmi6q0vb82 + API_KEY + AIzaSyCcFRScqvkC1zuaSC9Fx542P9bqCUezZ6I + GCM_SENDER_ID + 562294189406 + PLIST_VERSION + 1 + BUNDLE_ID + com.OFU.Dear-World + PROJECT_ID + dear-world-684b8 + STORAGE_BUCKET + dear-world-684b8.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:562294189406:ios:0adf63bb9839e5e61733cf + + \ No newline at end of file diff --git a/Dear-World/Dear-World/Source/Core/AppDelegate.swift b/Dear-World/Dear-World/Source/Core/AppDelegate.swift index 7c187ab..63acfb2 100644 --- a/Dear-World/Dear-World/Source/Core/AppDelegate.swift +++ b/Dear-World/Dear-World/Source/Core/AppDelegate.swift @@ -8,6 +8,7 @@ import RxSwift import SnapKit import Then import UIKit +import Firebase @main final class AppDelegate: UIResponder, UIApplicationDelegate { @@ -17,11 +18,19 @@ final class AppDelegate: UIResponder, UIApplicationDelegate { _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - - let mainWindow: UIWindow = UIWindow() - window = mainWindow - mainWindow.rootViewController = MainTabBarController() - mainWindow.makeKeyAndVisible() + setupFirebase() + setupInitialScene() return true } + + private func setupFirebase() { + FirebaseApp.configure() + } + + private func setupInitialScene() { + let mainWindow: UIWindow = UIWindow() + window = mainWindow + mainWindow.rootViewController = MainTabBarController() + mainWindow.makeKeyAndVisible() + } } diff --git a/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageReactor.swift b/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageReactor.swift index 455cf70..982f8d0 100644 --- a/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageReactor.swift +++ b/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageReactor.swift @@ -23,6 +23,7 @@ final class SendMessageReactor: Reactor { case typeMessage(String) case tapSendMessage case confirmAlert + case countryDidChange(Model.Country) } enum Mutation { @@ -45,7 +46,7 @@ final class SendMessageReactor: Reactor { var nameStatusMessage: NSAttributedString = NSAttributedString(string: "0/15") var messageLimitGauge: Float = 0.0 var messageStatusMessage: NSAttributedString = NSAttributedString(string: "0/300") - var selectedCountry: Model.Country? + @Revision var selectedCountry: Model.Country? fileprivate var emojiId: Int = 21 fileprivate let nameCountLimit: Int = 15 fileprivate let messageCountLimit: Int = 300 @@ -110,6 +111,9 @@ final class SendMessageReactor: Reactor { .flatMap { _ in Observable.empty() }, .just(.setPresent(false)) ) + + case .countryDidChange(let country): + return .just(.setCountry(country)) } } diff --git a/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageViewController.swift b/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageViewController.swift index ec02e1a..e2c019c 100644 --- a/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageViewController.swift +++ b/Dear-World/Dear-World/Source/Presentation/Scene/Send Message/SendMessageViewController.swift @@ -84,6 +84,25 @@ final class SendMessageViewController: UIViewController, View { .bind(to: reactor.action) .disposed(by: disposeBag) + selectCountryView.rx.tapGesture() + .throttle(.milliseconds(300), scheduler: MainScheduler.instance) + .skip(1) + .flatMap { [weak self] _ -> Observable in + guard let self = self else { return .empty() } + return CountrySelectController.selectCountry( + presenting: self, + disposeBag: self.disposeBag, + selected: nil) + } + .map { Action.countryDidChange($0) } + .bind(to: reactor.action) + .disposed(by: disposeBag) + + reactor.state.distinctUntilChanged(\.$selectedCountry) + .map { $0.selectedCountry?.fullName } + .bind(to: selectCountryView.titleLabel.rx.text) + .disposed(by: disposeBag) + reactor.state.map(\.isPresented) .map { !$0 } .subscribe(onNext: { [weak self] willDismiss in diff --git a/Dear-World/Dear-World/Source/Presentation/View/CountrySelectController.swift b/Dear-World/Dear-World/Source/Presentation/View/CountrySelectController.swift index 3a43b2d..5d8b52a 100644 --- a/Dear-World/Dear-World/Source/Presentation/View/CountrySelectController.swift +++ b/Dear-World/Dear-World/Source/Presentation/View/CountrySelectController.swift @@ -215,6 +215,15 @@ extension CountrySelectController { return Disposables.create() } } + + static func selectCountry( + presenting: UIViewController, + disposeBag: DisposeBag, + selected: Message.Model.Country? + ) -> Observable { + + return .empty() + } } public class AllCountries { diff --git a/Dear-World/Dear-World/Support File/Info.plist b/Dear-World/Dear-World/Support File/Info.plist index 9e23dad..587e8fe 100644 --- a/Dear-World/Dear-World/Support File/Info.plist +++ b/Dear-World/Dear-World/Support File/Info.plist @@ -1,59 +1,59 @@ - - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - - UIUserInterfaceStyle - Light - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleDisplayName - Dear World, 🌏 - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UIApplicationSceneManifest - - UIApplicationSupportsMultipleScenes - - - UIApplicationSupportsIndirectInputEvents - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Dear World, 🌏 + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIUserInterfaceStyle + Light +