From ac84d495000abcbc328fa0d0c9dd39f7f3f72f05 Mon Sep 17 00:00:00 2001 From: Sangjoon-Moon Date: Mon, 4 Jul 2016 17:20:45 +0900 Subject: [PATCH 1/3] Add podspec for local dev --- FirebaseUI/FirebaseUI.podspec | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 FirebaseUI/FirebaseUI.podspec diff --git a/FirebaseUI/FirebaseUI.podspec b/FirebaseUI/FirebaseUI.podspec new file mode 100644 index 00000000000..25e9f5a6d4d --- /dev/null +++ b/FirebaseUI/FirebaseUI.podspec @@ -0,0 +1,52 @@ +Pod::Spec.new do |s| + s.name = 'FirebaseUI' + s.version = '0.4.0' + s.summary = 'UI binding libraries for Firebase.' + s.homepage = 'https://github.com/firebase/FirebaseUI-iOS' + s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' } + s.author = 'Firebase' + s.source = { :git => 'https://github.com/firebase/FirebaseUI-iOS.git', :tag => s.version } + s.platform = :ios + s.ios.deployment_target = '7.0' + s.ios.framework = 'UIKit' + s.requires_arc = true + s.default_subspecs = 'All' + + s.subspec 'All' do |all| + all.dependency 'FirebaseUI/Database' + all.dependency 'FirebaseUI/Auth' + end + + s.subspec 'Database' do |database| + database.source_files = 'Database/**/*.{h,m}' + database.dependency 'Firebase/Database', '~> 3.0' + end + + s.subspec 'Auth' do |auth| + auth.dependency 'FirebaseUI/AuthBase' + auth.dependency 'FirebaseUI/Facebook' + auth.dependency 'FirebaseUI/Google' + end + + s.subspec 'AuthBase' do |authbase| + authbase.source_files = 'Auth/AuthUI/Source/*.{h,m}' + authbase.resource_bundles = {'FirebaseAuthUIBundle' => ['Auth/AuthUI/Resources/*.png', 'Auth/AuthUI/Strings/**/*.strings', 'Auth/AuthUI/Source/*.xib']} + authbase.dependency 'Firebase/Analytics', '~> 3.0' + authbase.dependency 'Firebase/Auth', '~> 3.0' + end + + s.subspec 'Facebook' do |facebook| + facebook.source_files = 'Auth/AuthProviderUI/Facebook/Source/*.{h,m}' + facebook.resource_bundles = {'FirebaseFacebookAuthUIBundle' => ['Auth/AuthProviderUI/Facebook/Resources/*.png', 'Auth/AuthProviderUI/Facebook/Strings/**/*.strings'] } + facebook.dependency 'FirebaseUI/AuthBase' + facebook.dependency 'FBSDKLoginKit', '~> 4.0' + end + + s.subspec 'Google' do |google| + google.source_files = 'Auth/AuthProviderUI/Google/Source/*.{h,m}' + google.resource_bundles = {'FirebaseGoogleAuthUIBundle' => ['Auth/AuthProviderUI/Google/Resources/*.png', 'Auth/AuthProviderUI/Google/Strings/**/*.strings'] } + google.dependency 'FirebaseUI/AuthBase' + google.dependency 'GoogleSignIn', '~> 4.0' + end + +end From e14dba887e781ec11d66925af20dc242b05551bd Mon Sep 17 00:00:00 2001 From: Sangjoon-Moon Date: Mon, 4 Jul 2016 17:45:21 +0900 Subject: [PATCH 2/3] Create new sample project --- .../Database/Implementation/FirebaseArray.m | 3 +- .../FirebaseCollectionViewDataSource.m | 3 +- .../FirebaseTableViewDataSource.m | 3 +- .../FirebaseUIChat.xcodeproj/project.pbxproj | 99 ++++++++--- .../FirebaseUIChat/AppDelegate.m | 8 + .../FirebaseUIChat/Base.lproj/Main.storyboard | 96 +++++----- .../FirebaseUIChat/FirebaseUIChat/Message.h | 26 --- .../FirebaseUIChat/FirebaseUIChat/Message.m | 34 ---- .../FirebaseUIChat/MessageDataSource.h | 21 --- .../FirebaseUIChat/MessageDataSource.m | 33 ---- .../FirebaseUIChat/MessageTableViewCell.h | 26 --- .../FirebaseUIChat/MessageTableViewCell.m | 25 --- .../FirebaseUIChat/MessageTableViewCell.xib | 74 -------- .../FirebaseUIChat/ViewController.h | 13 +- .../FirebaseUIChat/ViewController.m | 165 ++++++++---------- examples/FirebaseUIChat/Podfile | 6 +- 16 files changed, 215 insertions(+), 420 deletions(-) delete mode 100644 examples/FirebaseUIChat/FirebaseUIChat/Message.h delete mode 100644 examples/FirebaseUIChat/FirebaseUIChat/Message.m delete mode 100644 examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.h delete mode 100644 examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.m delete mode 100644 examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.h delete mode 100644 examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.m delete mode 100644 examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.xib diff --git a/FirebaseUI/Database/Implementation/FirebaseArray.m b/FirebaseUI/Database/Implementation/FirebaseArray.m index e566d642f2c..d7fccf864ca 100755 --- a/FirebaseUI/Database/Implementation/FirebaseArray.m +++ b/FirebaseUI/Database/Implementation/FirebaseArray.m @@ -19,8 +19,7 @@ // clang-format on #import "FirebaseArray.h" - -@import FirebaseDatabase; +#import @implementation FirebaseArray diff --git a/FirebaseUI/Database/Implementation/FirebaseCollectionViewDataSource.m b/FirebaseUI/Database/Implementation/FirebaseCollectionViewDataSource.m index 3b64ab41de9..5d562709a90 100644 --- a/FirebaseUI/Database/Implementation/FirebaseCollectionViewDataSource.m +++ b/FirebaseUI/Database/Implementation/FirebaseCollectionViewDataSource.m @@ -19,8 +19,7 @@ // clang-format on #import "FirebaseCollectionViewDataSource.h" - -@import FirebaseDatabase; +#import @implementation FirebaseCollectionViewDataSource diff --git a/FirebaseUI/Database/Implementation/FirebaseTableViewDataSource.m b/FirebaseUI/Database/Implementation/FirebaseTableViewDataSource.m index 2dd65cd4c96..0af58bf2217 100644 --- a/FirebaseUI/Database/Implementation/FirebaseTableViewDataSource.m +++ b/FirebaseUI/Database/Implementation/FirebaseTableViewDataSource.m @@ -19,8 +19,7 @@ // clang-format on #import "FirebaseTableViewDataSource.h" - -@import FirebaseDatabase; +#import @implementation FirebaseTableViewDataSource diff --git a/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj b/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj index 3633cbc634c..13377d71fcc 100644 --- a/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj +++ b/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj @@ -7,19 +7,19 @@ objects = { /* Begin PBXBuildFile section */ + C887CB2F78EAA58DC354FAFB /* libPods-FirebaseUIChat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 585EBE168DE871301F5FA598 /* libPods-FirebaseUIChat.a */; }; D81A05F61B86A78700498183 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D81A05F51B86A78700498183 /* main.m */; }; D81A05F91B86A78700498183 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D81A05F81B86A78700498183 /* AppDelegate.m */; }; D81A05FC1B86A78700498183 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D81A05FB1B86A78700498183 /* ViewController.m */; }; D81A05FF1B86A78700498183 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D81A05FD1B86A78700498183 /* Main.storyboard */; }; D81A06011B86A78700498183 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D81A06001B86A78700498183 /* Images.xcassets */; }; D81A06041B86A78700498183 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = D81A06021B86A78700498183 /* LaunchScreen.xib */; }; - D81A061B1B86AE7100498183 /* Message.m in Sources */ = {isa = PBXBuildFile; fileRef = D81A061A1B86AE7100498183 /* Message.m */; }; - D852D9411B86DEA500C732E2 /* MessageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D852D9401B86DEA500C732E2 /* MessageTableViewCell.m */; }; - D852D9431B86DEB500C732E2 /* MessageTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D852D9421B86DEB500C732E2 /* MessageTableViewCell.xib */; }; - D852D9461B86E7A100C732E2 /* MessageDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = D852D9451B86E7A100C732E2 /* MessageDataSource.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 585EBE168DE871301F5FA598 /* libPods-FirebaseUIChat.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FirebaseUIChat.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 8A75EDEB82011E034E0FE0DB /* Pods-FirebaseUIChat.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FirebaseUIChat.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat.debug.xcconfig"; sourceTree = ""; }; + ADBAAD3F5B82BFF071DEB18B /* Pods-FirebaseUIChat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FirebaseUIChat.release.xcconfig"; path = "Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat.release.xcconfig"; sourceTree = ""; }; D81A05F01B86A78700498183 /* FirebaseUIChat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FirebaseUIChat.app; sourceTree = BUILT_PRODUCTS_DIR; }; D81A05F41B86A78700498183 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D81A05F51B86A78700498183 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -30,13 +30,6 @@ D81A05FE1B86A78700498183 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; D81A06001B86A78700498183 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; D81A06031B86A78700498183 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - D81A06191B86AE7100498183 /* Message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Message.h; sourceTree = ""; }; - D81A061A1B86AE7100498183 /* Message.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Message.m; sourceTree = ""; }; - D852D93F1B86DEA500C732E2 /* MessageTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageTableViewCell.h; sourceTree = ""; }; - D852D9401B86DEA500C732E2 /* MessageTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageTableViewCell.m; sourceTree = ""; }; - D852D9421B86DEB500C732E2 /* MessageTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MessageTableViewCell.xib; sourceTree = ""; }; - D852D9441B86E7A100C732E2 /* MessageDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageDataSource.h; sourceTree = ""; }; - D852D9451B86E7A100C732E2 /* MessageDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageDataSource.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -44,17 +37,28 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + C887CB2F78EAA58DC354FAFB /* libPods-FirebaseUIChat.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1B9B1754AE5895259E750F65 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 585EBE168DE871301F5FA598 /* libPods-FirebaseUIChat.a */, + ); + name = Frameworks; + sourceTree = ""; + }; D81A05E71B86A78700498183 = { isa = PBXGroup; children = ( D81A05F21B86A78700498183 /* FirebaseUIChat */, D81A05F11B86A78700498183 /* Products */, + E62CDC5AB5CBE329CCD74574 /* Pods */, + 1B9B1754AE5895259E750F65 /* Frameworks */, ); sourceTree = ""; }; @@ -77,13 +81,6 @@ D81A06001B86A78700498183 /* Images.xcassets */, D81A06021B86A78700498183 /* LaunchScreen.xib */, D81A05F31B86A78700498183 /* Supporting Files */, - D81A06191B86AE7100498183 /* Message.h */, - D81A061A1B86AE7100498183 /* Message.m */, - D852D93F1B86DEA500C732E2 /* MessageTableViewCell.h */, - D852D9401B86DEA500C732E2 /* MessageTableViewCell.m */, - D852D9421B86DEB500C732E2 /* MessageTableViewCell.xib */, - D852D9441B86E7A100C732E2 /* MessageDataSource.h */, - D852D9451B86E7A100C732E2 /* MessageDataSource.m */, ); path = FirebaseUIChat; sourceTree = ""; @@ -97,6 +94,15 @@ name = "Supporting Files"; sourceTree = ""; }; + E62CDC5AB5CBE329CCD74574 /* Pods */ = { + isa = PBXGroup; + children = ( + 8A75EDEB82011E034E0FE0DB /* Pods-FirebaseUIChat.debug.xcconfig */, + ADBAAD3F5B82BFF071DEB18B /* Pods-FirebaseUIChat.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -104,9 +110,12 @@ isa = PBXNativeTarget; buildConfigurationList = D81A06131B86A78700498183 /* Build configuration list for PBXNativeTarget "FirebaseUIChat" */; buildPhases = ( + 634CADC92C8BFACD70CC31DA /* 📦 Check Pods Manifest.lock */, D81A05EC1B86A78700498183 /* Sources */, D81A05ED1B86A78700498183 /* Frameworks */, D81A05EE1B86A78700498183 /* Resources */, + 026DCC4EA2371EF2DE13C32C /* 📦 Embed Pods Frameworks */, + 1DCF3E50D310B6D1FA4DD95D /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -155,7 +164,6 @@ buildActionMask = 2147483647; files = ( D81A05FF1B86A78700498183 /* Main.storyboard in Resources */, - D852D9431B86DEB500C732E2 /* MessageTableViewCell.xib in Resources */, D81A06041B86A78700498183 /* LaunchScreen.xib in Resources */, D81A06011B86A78700498183 /* Images.xcassets in Resources */, ); @@ -163,15 +171,60 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 026DCC4EA2371EF2DE13C32C /* 📦 Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 1DCF3E50D310B6D1FA4DD95D /* 📦 Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 634CADC92C8BFACD70CC31DA /* 📦 Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "📦 Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ D81A05EC1B86A78700498183 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( D81A05FC1B86A78700498183 /* ViewController.m in Sources */, - D81A061B1B86AE7100498183 /* Message.m in Sources */, - D852D9461B86E7A100C732E2 /* MessageDataSource.m in Sources */, - D852D9411B86DEA500C732E2 /* MessageTableViewCell.m in Sources */, D81A05F91B86A78700498183 /* AppDelegate.m in Sources */, D81A05F61B86A78700498183 /* main.m in Sources */, ); @@ -282,6 +335,7 @@ }; D81A06141B86A78700498183 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 8A75EDEB82011E034E0FE0DB /* Pods-FirebaseUIChat.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FirebaseUIChat/Info.plist; @@ -293,6 +347,7 @@ }; D81A06151B86A78700498183 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = ADBAAD3F5B82BFF071DEB18B /* Pods-FirebaseUIChat.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FirebaseUIChat/Info.plist; diff --git a/examples/FirebaseUIChat/FirebaseUIChat/AppDelegate.m b/examples/FirebaseUIChat/FirebaseUIChat/AppDelegate.m index 3bee4cb531b..201bfbe5539 100644 --- a/examples/FirebaseUIChat/FirebaseUIChat/AppDelegate.m +++ b/examples/FirebaseUIChat/FirebaseUIChat/AppDelegate.m @@ -16,6 +16,7 @@ #import "AppDelegate.h" @import Firebase; +#import @implementation AppDelegate @@ -24,4 +25,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( return YES; } +// You should implement this method to complete the authentication process +- (BOOL)application:(UIApplication *)app + openURL:(NSURL *)url + options:(NSDictionary *)options { + return [[FIRAuthUI authUI] handleOpenURL:url sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]]; +} + @end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/Base.lproj/Main.storyboard b/examples/FirebaseUIChat/FirebaseUIChat/Base.lproj/Main.storyboard index fb9d6f5199a..935658d318d 100644 --- a/examples/FirebaseUIChat/FirebaseUIChat/Base.lproj/Main.storyboard +++ b/examples/FirebaseUIChat/FirebaseUIChat/Base.lproj/Main.storyboard @@ -1,72 +1,72 @@ - + - - + + - - - - - - - - - - - - - - - - - + - - + + - + - + - - - - - - - - - + + - + - - - - - - - + + + + - + - - + + - + + + + + + + + + + + + + + + + + + + - + diff --git a/examples/FirebaseUIChat/FirebaseUIChat/Message.h b/examples/FirebaseUIChat/FirebaseUIChat/Message.h deleted file mode 100644 index 5108bdb178a..00000000000 --- a/examples/FirebaseUIChat/FirebaseUIChat/Message.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 2016 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import - -@interface Message : NSObject - -@property(strong, nonatomic) NSString *name; -@property(strong, nonatomic) NSString *text; - -- (instancetype)initWithName:(NSString *)name andText:(NSString *)text; - -@end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/Message.m b/examples/FirebaseUIChat/FirebaseUIChat/Message.m deleted file mode 100644 index c0cfc7238cc..00000000000 --- a/examples/FirebaseUIChat/FirebaseUIChat/Message.m +++ /dev/null @@ -1,34 +0,0 @@ -// -// Copyright (c) 2016 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "Message.h" - -@implementation Message - -- (instancetype)init { - return [self initWithName:@"" andText:@""]; -} - -- (instancetype)initWithName:(NSString *)name andText:(NSString *)text { - self = [super init]; - if (self) { - self.name = name; - self.text = text; - } - return self; -} - -@end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.h b/examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.h deleted file mode 100644 index 42f26fc8025..00000000000 --- a/examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (c) 2016 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "FirebaseUI/FirebaseTableViewDataSource.h" - -@interface MessageDataSource : FirebaseTableViewDataSource - -@end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.m b/examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.m deleted file mode 100644 index 263a04f6b80..00000000000 --- a/examples/FirebaseUIChat/FirebaseUIChat/MessageDataSource.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright (c) 2016 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "MessageDataSource.h" -@import FirebaseDatabase; - -@implementation MessageDataSource - -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { - return YES; } - -- (void)tableView:(UITableView *)tableView -commitEditingStyle:(UITableViewCellEditingStyle)editingStyle - forRowAtIndexPath:(NSIndexPath *)indexPath { - if (editingStyle == UITableViewCellEditingStyleDelete) { - [[self refForIndex:indexPath.row] removeValue]; - } -} - -@end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.h b/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.h deleted file mode 100644 index 8d23d7898a2..00000000000 --- a/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 2016 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import - -@interface MessageTableViewCell : UITableViewCell -@property(weak, nonatomic) IBOutlet UILabel *myMessageLabel; -@property(weak, nonatomic) IBOutlet UILabel *myNameLabel; - -@property(weak, nonatomic) IBOutlet UILabel *otherMessageLabel; -@property(weak, nonatomic) IBOutlet UILabel *otherNameLabel; - -@end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.m b/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.m deleted file mode 100644 index eea03736bf9..00000000000 --- a/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// Copyright (c) 2016 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "MessageTableViewCell.h" - -@implementation MessageTableViewCell - -- (instancetype)initWithFrame:(CGRect)frame { - return [super initWithFrame:frame]; -} - -@end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.xib b/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.xib deleted file mode 100644 index f34b434dabb..00000000000 --- a/examples/FirebaseUIChat/FirebaseUIChat/MessageTableViewCell.xib +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/FirebaseUIChat/FirebaseUIChat/ViewController.h b/examples/FirebaseUIChat/FirebaseUIChat/ViewController.h index 3f5269d1428..7552ada8812 100644 --- a/examples/FirebaseUIChat/FirebaseUIChat/ViewController.h +++ b/examples/FirebaseUIChat/FirebaseUIChat/ViewController.h @@ -15,16 +15,11 @@ // @import UIKit; -@import FirebaseDatabase; -#import +@import Firebase; +#import +#import -@interface ViewController : UIViewController - -@property (strong, nonatomic) FIRDatabaseReference *ref; -@property (strong, nonatomic) FirebaseTableViewDataSource *dataSource; - -@property (weak, nonatomic) IBOutlet UITableView *tableView; -@property (weak, nonatomic) IBOutlet UITextField *inputTextField; +@interface ViewController : UIViewController @end diff --git a/examples/FirebaseUIChat/FirebaseUIChat/ViewController.m b/examples/FirebaseUIChat/FirebaseUIChat/ViewController.m index 2b64d999579..d0897ffb59b 100644 --- a/examples/FirebaseUIChat/FirebaseUIChat/ViewController.m +++ b/examples/FirebaseUIChat/FirebaseUIChat/ViewController.m @@ -15,119 +15,94 @@ // #import "ViewController.h" -#import "Message.h" -#import "MessageTableViewCell.h" -#import "MessageDataSource.h" @interface ViewController () +@property (weak, nonatomic) IBOutlet UIButton *signInBtn; +@property (weak, nonatomic) IBOutlet UIButton *signOutBtn; +@property (nonatomic) FIRAuthStateDidChangeListenerHandle authStateListener; + @end -@implementation ViewController { -// FAuthData *_currentUser; -} +@implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; - self.ref = [FIRDatabase database].reference; - - self.dataSource = - [[MessageDataSource alloc] initWithRef:self.ref - modelClass:[Message class] - nibNamed:@"MessageTableViewCell" - cellReuseIdentifier:@"cellReuseIdentifier" - view:self.tableView]; - - [self.dataSource - populateCellWithBlock:^void(MessageTableViewCell *__nonnull cell, - Message *__nonnull message) { -// if ([message.name isEqualToString:[self usernameForProvider:[self.loginViewController currentUser].provider]]) { -// cell.myMessageLabel.text = message.text; -// cell.myNameLabel.text = message.name; -// cell.myNameLabel.textColor = [UIColor colorWithRed:52.0 / 255.0 -// green:170.0 / 255.0 -// blue:220.0 / 255.0 -// alpha:1.0]; -// [cell.otherMessageLabel setHidden:YES]; -// [cell.otherNameLabel setHidden:YES]; -// [cell.myMessageLabel setHidden:NO]; -// [cell.myNameLabel setHidden:NO]; -// } else { - cell.otherMessageLabel.text = message.text; - cell.otherNameLabel.text = message.name; - cell.otherNameLabel.textColor = [UIColor colorWithRed:164.0 / 255.0 - green:199.0 / 255.0 - blue:57.0 / 255.0 - alpha:1.0]; - [cell.otherMessageLabel setHidden:NO]; - [cell.otherNameLabel setHidden:NO]; - [cell.myMessageLabel setHidden:YES]; - [cell.myNameLabel setHidden:YES]; -// } - }]; - - self.tableView.dataSource = self.dataSource; - self.tableView.delegate = self; - -// self.loginViewController = [[FirebaseLoginViewController alloc] initWithRef:self.ref]; - // Only enable social providers that you've configured -// [self.loginViewController enableProvider:FAuthProviderFacebook]; -// [self.loginViewController enableProvider:FAuthProviderGoogle]; -// [self.loginViewController enableProvider:FAuthProviderTwitter]; -// [self.loginViewController enableProvider:FAuthProviderPassword]; - -// self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStylePlain target:self action:@selector(toggleAuth)]; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; +- (void)viewWillAppear:(BOOL)animated { + + [super viewWillAppear:animated]; + + __weak id weakSelf = self; + self.authStateListener = [[FIRAuth auth] + addAuthStateDidChangeListener:^(FIRAuth *_Nonnull auth, + FIRUser *_Nullable user) { + __strong id strongSelf = weakSelf; + if(strongSelf){ + if (user != nil) { + NSLog(@"User is signed in Listener, %@", user.providerID); + self.signInBtn.hidden = YES; + self.signOutBtn.hidden = NO; + } else { + NSLog(@"No user is signed in Listener"); + self.signInBtn.hidden = NO; + self.signOutBtn.hidden = YES; + } + } + }]; } -- (void)viewWillAppear:(BOOL)animated { -// _currentUser = [self.loginViewController currentUser]; -// self.title = [self usernameForProvider:[self.loginViewController currentUser].provider]; -// self.navigationItem.rightBarButtonItem.title = _currentUser ? @"Logout" : @"Login"; - [self.tableView reloadData]; +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + [[FIRAuth auth] removeAuthStateDidChangeListener:self.authStateListener]; } -//- (void)toggleAuth { -// if (_currentUser) { -// [self.loginViewController logout]; -// _currentUser = nil; -// self.title = @"iOS User"; -// [self.tableView reloadData]; -// } else { -// [self presentViewController:self.loginViewController animated:YES completion:nil]; -// } -// self.navigationItem.rightBarButtonItem.title = _currentUser ? @"Logout" : @"Login"; -//} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; +- (IBAction)signInBtnClicked:(id)sender { + + FIRAuthUI *authUI = [FIRAuthUI authUI]; + authUI.delegate = self; + + // Get client ID from [FIRApp defaultApp].options.clientID property + // clientID is the OAuth2 client ID for iOS application used to authenticate Google users + FIRGoogleAuthUI *googleAuthUI = [[FIRGoogleAuthUI alloc] initWithClientID: + [FIRApp defaultApp].options.clientID]; + + authUI.providers = @[ googleAuthUI ]; + + UIViewController *authViewController = [authUI authViewController]; + + [self presentViewController:authViewController animated:YES completion:nil]; + } -- (BOOL)textFieldShouldReturn:(UITextField *)textField { - [[self.ref childByAutoId] -// setValue:@{@"name" : [self usernameForProvider:[self.loginViewController currentUser].provider], @"text" : textField.text}]; - setValue:@{@"name" : @"iOS User", @"text" : textField.text}]; - [textField resignFirstResponder]; - textField.text = @""; - return YES; +- (IBAction)signOutBtnClicked:(id)sender { + + NSError *signOutError; + [[FIRAuthUI authUI].auth signOut:&signOutError]; + if (!signOutError) { + NSLog(@"Sign-out succeeded"); + self.signInBtn.hidden = NO; + self.signOutBtn.hidden = YES; + } } -//- (NSString *)usernameForProvider:(NSString *)provider { -// if ([provider isEqualToString:kGoogleAuthProvider]) { -// return _currentUser.providerData[@"displayName"]; -// } else if ([provider isEqualToString:kFacebookAuthProvider]) { -// return _currentUser.providerData[@"displayName"]; -// } else if ([provider isEqualToString:kTwitterAuthProvider]) { -// return [NSString stringWithFormat:@"@%@", _currentUser.providerData[@"username"]]; -// } else if ([provider isEqualToString:kPasswordAuthProvider]) { -// return _currentUser.providerData[@"email"]; -// } else { -// return @"iOS User"; -// } -//} + +- (void)authUI:(FIRAuthUI *)authUI +didSignInWithUser:(nullable FIRUser *)user +error:(nullable NSError *)error { + if (!error) { + NSLog(@"didSignIn"); + + self.signInBtn.hidden = YES; + self.signOutBtn.hidden = NO; + + } else { + + NSLog(@"authUI didSign error = %@", error.localizedDescription); + + } +} @end diff --git a/examples/FirebaseUIChat/Podfile b/examples/FirebaseUIChat/Podfile index 09bfc9911c1..96f52397379 100644 --- a/examples/FirebaseUIChat/Podfile +++ b/examples/FirebaseUIChat/Podfile @@ -1,6 +1,10 @@ platform :ios, '7.0' -pod 'FirebaseUI', :path => "../../FirebaseUI.podspec" +#use local pod +pod 'FirebaseUI', :path => "../../FirebaseUI" + +#use the lasted pod from git repo +#pod 'FirebaseUI' target 'FirebaseUIChat' do end From abbd45384375db8bf1fcdd059e61e1e9c447b9de Mon Sep 17 00:00:00 2001 From: Sangjoon-Moon Date: Tue, 5 Jul 2016 08:57:02 +0900 Subject: [PATCH 3/3] Run pod deintegrate --- .../FirebaseUIChat.xcodeproj/project.pbxproj | 77 ------------------- 1 file changed, 77 deletions(-) diff --git a/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj b/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj index 13377d71fcc..18eee350cb7 100644 --- a/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj +++ b/examples/FirebaseUIChat/FirebaseUIChat.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - C887CB2F78EAA58DC354FAFB /* libPods-FirebaseUIChat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 585EBE168DE871301F5FA598 /* libPods-FirebaseUIChat.a */; }; D81A05F61B86A78700498183 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D81A05F51B86A78700498183 /* main.m */; }; D81A05F91B86A78700498183 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D81A05F81B86A78700498183 /* AppDelegate.m */; }; D81A05FC1B86A78700498183 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D81A05FB1B86A78700498183 /* ViewController.m */; }; @@ -17,9 +16,6 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 585EBE168DE871301F5FA598 /* libPods-FirebaseUIChat.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FirebaseUIChat.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 8A75EDEB82011E034E0FE0DB /* Pods-FirebaseUIChat.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FirebaseUIChat.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat.debug.xcconfig"; sourceTree = ""; }; - ADBAAD3F5B82BFF071DEB18B /* Pods-FirebaseUIChat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FirebaseUIChat.release.xcconfig"; path = "Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat.release.xcconfig"; sourceTree = ""; }; D81A05F01B86A78700498183 /* FirebaseUIChat.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FirebaseUIChat.app; sourceTree = BUILT_PRODUCTS_DIR; }; D81A05F41B86A78700498183 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; D81A05F51B86A78700498183 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -37,28 +33,17 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C887CB2F78EAA58DC354FAFB /* libPods-FirebaseUIChat.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 1B9B1754AE5895259E750F65 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 585EBE168DE871301F5FA598 /* libPods-FirebaseUIChat.a */, - ); - name = Frameworks; - sourceTree = ""; - }; D81A05E71B86A78700498183 = { isa = PBXGroup; children = ( D81A05F21B86A78700498183 /* FirebaseUIChat */, D81A05F11B86A78700498183 /* Products */, - E62CDC5AB5CBE329CCD74574 /* Pods */, - 1B9B1754AE5895259E750F65 /* Frameworks */, ); sourceTree = ""; }; @@ -94,15 +79,6 @@ name = "Supporting Files"; sourceTree = ""; }; - E62CDC5AB5CBE329CCD74574 /* Pods */ = { - isa = PBXGroup; - children = ( - 8A75EDEB82011E034E0FE0DB /* Pods-FirebaseUIChat.debug.xcconfig */, - ADBAAD3F5B82BFF071DEB18B /* Pods-FirebaseUIChat.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -110,12 +86,9 @@ isa = PBXNativeTarget; buildConfigurationList = D81A06131B86A78700498183 /* Build configuration list for PBXNativeTarget "FirebaseUIChat" */; buildPhases = ( - 634CADC92C8BFACD70CC31DA /* 📦 Check Pods Manifest.lock */, D81A05EC1B86A78700498183 /* Sources */, D81A05ED1B86A78700498183 /* Frameworks */, D81A05EE1B86A78700498183 /* Resources */, - 026DCC4EA2371EF2DE13C32C /* 📦 Embed Pods Frameworks */, - 1DCF3E50D310B6D1FA4DD95D /* 📦 Copy Pods Resources */, ); buildRules = ( ); @@ -171,54 +144,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 026DCC4EA2371EF2DE13C32C /* 📦 Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 1DCF3E50D310B6D1FA4DD95D /* 📦 Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FirebaseUIChat/Pods-FirebaseUIChat-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 634CADC92C8BFACD70CC31DA /* 📦 Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "📦 Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ D81A05EC1B86A78700498183 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -335,7 +260,6 @@ }; D81A06141B86A78700498183 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8A75EDEB82011E034E0FE0DB /* Pods-FirebaseUIChat.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FirebaseUIChat/Info.plist; @@ -347,7 +271,6 @@ }; D81A06151B86A78700498183 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = ADBAAD3F5B82BFF071DEB18B /* Pods-FirebaseUIChat.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; INFOPLIST_FILE = FirebaseUIChat/Info.plist;