From 5c0b01df32ad26e78173680302a7fb36f34ba978 Mon Sep 17 00:00:00 2001 From: Yue Wang Date: Tue, 5 Mar 2019 20:40:53 -0800 Subject: [PATCH] Add OAuth provider to FirebaseUI. Add Microsoft sign in to sample app. --- FirebaseUI.h | 3 +- FirebaseUI.podspec | 11 + .../FirebaseOAuthUI.xcodeproj/project.pbxproj | 481 ++++++++++++++++++ OAuth/FirebaseOAuthUI/FUIOAuth.h | 78 +++ OAuth/FirebaseOAuthUI/FUIOAuth.m | 209 ++++++++ OAuth/FirebaseOAuthUI/FirebaseOAuthUI.h | 27 + OAuth/FirebaseOAuthUI/Info.plist | 26 + .../FirebaseOAuthUITests.m | 77 +++ OAuth/FirebaseOAuthUITests/Info.plist | 24 + OAuth/Podfile | 13 + OAuth/Podfile.lock | 56 ++ .../project.pbxproj | 20 + .../Resources/Main.storyboard | 35 +- .../Resources/Resources/mssymbol.png | Bin 0 -> 162 bytes .../Samples/Auth/FUIAuthViewController.m | 24 +- 15 files changed, 1072 insertions(+), 12 deletions(-) create mode 100644 OAuth/FirebaseOAuthUI.xcodeproj/project.pbxproj create mode 100644 OAuth/FirebaseOAuthUI/FUIOAuth.h create mode 100644 OAuth/FirebaseOAuthUI/FUIOAuth.m create mode 100644 OAuth/FirebaseOAuthUI/FirebaseOAuthUI.h create mode 100644 OAuth/FirebaseOAuthUI/Info.plist create mode 100644 OAuth/FirebaseOAuthUITests/FirebaseOAuthUITests.m create mode 100644 OAuth/FirebaseOAuthUITests/Info.plist create mode 100644 OAuth/Podfile create mode 100644 OAuth/Podfile.lock create mode 100644 samples/objc/FirebaseUI-demo-objc/Resources/Resources/mssymbol.png diff --git a/FirebaseUI.h b/FirebaseUI.h index 255f428f24c..66ec626003a 100644 --- a/FirebaseUI.h +++ b/FirebaseUI.h @@ -29,6 +29,7 @@ FOUNDATION_EXPORT const unsigned char FirebaseUIVersionString[]; #import #import #import -#import +#import #import +#import #import diff --git a/FirebaseUI.podspec b/FirebaseUI.podspec index a65c2f06307..2158c70cf9b 100644 --- a/FirebaseUI.podspec +++ b/FirebaseUI.podspec @@ -127,6 +127,17 @@ Pod::Spec.new do |s| google.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/FirebaseUI/FirebaseGoogleAuthUI' } end + s.subspec 'OAuth' do |oauth| + oauth.platform = :ios, '8.0' + oauth.public_header_files = 'OAuth/FirebaseOAuthUI/*.h' + oauth.source_files = 'OAuth/FirebaseOAuthUI/*.{h,m}' + oauth.dependency 'FirebaseUI/Auth' + oauth.resource_bundle = { + 'FirebaseOAuthUI' => ['OAuth/FirebaseOAuthUI/**/*.{png,lproj}'] + } + oauth.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/FirebaseUI/FirebaseOAuthUI' } + end + s.subspec 'Phone' do |phone| phone.platform = :ios, '8.0' phone.public_header_files = ['PhoneAuth/FirebasePhoneAuthUI/FirebasePhoneAuthUI.h', diff --git a/OAuth/FirebaseOAuthUI.xcodeproj/project.pbxproj b/OAuth/FirebaseOAuthUI.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..68450661e48 --- /dev/null +++ b/OAuth/FirebaseOAuthUI.xcodeproj/project.pbxproj @@ -0,0 +1,481 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 8D69E22721DD476D00CFA49B /* FirebaseOAuthUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D69E21D21DD476C00CFA49B /* FirebaseOAuthUI.framework */; }; + 8D69E22C21DD476D00CFA49B /* FirebaseOAuthUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D69E22B21DD476D00CFA49B /* FirebaseOAuthUITests.m */; }; + 8D69E22E21DD476D00CFA49B /* FirebaseOAuthUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D69E22021DD476D00CFA49B /* FirebaseOAuthUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8D69E23921DD47B400CFA49B /* FUIOAuth.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D69E23721DD47B400CFA49B /* FUIOAuth.m */; }; + 8D69E23A21DD47B400CFA49B /* FUIOAuth.h in Headers */ = {isa = PBXBuildFile; fileRef = 8D69E23821DD47B400CFA49B /* FUIOAuth.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 8D69E22821DD476D00CFA49B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 8D69E21421DD476C00CFA49B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8D69E21C21DD476C00CFA49B; + remoteInfo = FirebaseOAuthUI; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 8D69E21D21DD476C00CFA49B /* FirebaseOAuthUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FirebaseOAuthUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D69E22021DD476D00CFA49B /* FirebaseOAuthUI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FirebaseOAuthUI.h; sourceTree = ""; }; + 8D69E22121DD476D00CFA49B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D69E22621DD476D00CFA49B /* FirebaseOAuthUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FirebaseOAuthUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 8D69E22B21DD476D00CFA49B /* FirebaseOAuthUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FirebaseOAuthUITests.m; sourceTree = ""; }; + 8D69E22D21DD476D00CFA49B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8D69E23721DD47B400CFA49B /* FUIOAuth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FUIOAuth.m; sourceTree = ""; }; + 8D69E23821DD47B400CFA49B /* FUIOAuth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FUIOAuth.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D69E21A21DD476C00CFA49B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8D69E22321DD476D00CFA49B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D69E22721DD476D00CFA49B /* FirebaseOAuthUI.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5763488F2FEC8FD187D3A6FB /* Pods */ = { + isa = PBXGroup; + children = ( + ); + path = Pods; + sourceTree = ""; + }; + 8D69E21321DD476C00CFA49B = { + isa = PBXGroup; + children = ( + 8D69E21F21DD476C00CFA49B /* FirebaseOAuthUI */, + 8D69E22A21DD476D00CFA49B /* FirebaseOAuthUITests */, + 8D69E21E21DD476C00CFA49B /* Products */, + 5763488F2FEC8FD187D3A6FB /* Pods */, + ); + sourceTree = ""; + }; + 8D69E21E21DD476C00CFA49B /* Products */ = { + isa = PBXGroup; + children = ( + 8D69E21D21DD476C00CFA49B /* FirebaseOAuthUI.framework */, + 8D69E22621DD476D00CFA49B /* FirebaseOAuthUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 8D69E21F21DD476C00CFA49B /* FirebaseOAuthUI */ = { + isa = PBXGroup; + children = ( + 8D69E22021DD476D00CFA49B /* FirebaseOAuthUI.h */, + 8D69E23821DD47B400CFA49B /* FUIOAuth.h */, + 8D69E23721DD47B400CFA49B /* FUIOAuth.m */, + 8D69E22121DD476D00CFA49B /* Info.plist */, + ); + path = FirebaseOAuthUI; + sourceTree = ""; + }; + 8D69E22A21DD476D00CFA49B /* FirebaseOAuthUITests */ = { + isa = PBXGroup; + children = ( + 8D69E22B21DD476D00CFA49B /* FirebaseOAuthUITests.m */, + 8D69E22D21DD476D00CFA49B /* Info.plist */, + ); + path = FirebaseOAuthUITests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8D69E21821DD476C00CFA49B /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D69E22E21DD476D00CFA49B /* FirebaseOAuthUI.h in Headers */, + 8D69E23A21DD47B400CFA49B /* FUIOAuth.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8D69E21C21DD476C00CFA49B /* FirebaseOAuthUI */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8D69E23121DD476D00CFA49B /* Build configuration list for PBXNativeTarget "FirebaseOAuthUI" */; + buildPhases = ( + 8D69E21821DD476C00CFA49B /* Headers */, + 8D69E21921DD476C00CFA49B /* Sources */, + 8D69E21A21DD476C00CFA49B /* Frameworks */, + 8D69E21B21DD476C00CFA49B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = FirebaseOAuthUI; + productName = FirebaseOAuthUI; + productReference = 8D69E21D21DD476C00CFA49B /* FirebaseOAuthUI.framework */; + productType = "com.apple.product-type.framework"; + }; + 8D69E22521DD476D00CFA49B /* FirebaseOAuthUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8D69E23421DD476D00CFA49B /* Build configuration list for PBXNativeTarget "FirebaseOAuthUITests" */; + buildPhases = ( + 8D69E22221DD476D00CFA49B /* Sources */, + 8D69E22321DD476D00CFA49B /* Frameworks */, + 8D69E22421DD476D00CFA49B /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 8D69E22921DD476D00CFA49B /* PBXTargetDependency */, + ); + name = FirebaseOAuthUITests; + productName = FirebaseOAuthUITests; + productReference = 8D69E22621DD476D00CFA49B /* FirebaseOAuthUITests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8D69E21421DD476C00CFA49B /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1010; + ORGANIZATIONNAME = Firebase; + TargetAttributes = { + 8D69E21C21DD476C00CFA49B = { + CreatedOnToolsVersion = 10.1; + }; + 8D69E22521DD476D00CFA49B = { + CreatedOnToolsVersion = 10.1; + }; + }; + }; + buildConfigurationList = 8D69E21721DD476C00CFA49B /* Build configuration list for PBXProject "FirebaseOAuthUI" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 8D69E21321DD476C00CFA49B; + productRefGroup = 8D69E21E21DD476C00CFA49B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D69E21C21DD476C00CFA49B /* FirebaseOAuthUI */, + 8D69E22521DD476D00CFA49B /* FirebaseOAuthUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8D69E21B21DD476C00CFA49B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8D69E22421DD476D00CFA49B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D69E21921DD476C00CFA49B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D69E23921DD47B400CFA49B /* FUIOAuth.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8D69E22221DD476D00CFA49B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D69E22C21DD476D00CFA49B /* FirebaseOAuthUITests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 8D69E22921DD476D00CFA49B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8D69E21C21DD476C00CFA49B /* FirebaseOAuthUI */; + targetProxy = 8D69E22821DD476D00CFA49B /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 8D69E22F21DD476D00CFA49B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 8D69E23021DD476D00CFA49B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 8D69E23221DD476D00CFA49B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = FirebaseOAuthUI/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.firebase.FirebaseOAuthUI; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 8D69E23321DD476D00CFA49B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = FirebaseOAuthUI/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.firebase.FirebaseOAuthUI; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 8D69E23521DD476D00CFA49B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = FirebaseOAuthUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + OTHER_LDFLAGS = ( + "-ObjC", + "-framework", + "\"GTMSessionFetcher\"", + "-framework", + "\"GoogleUtilities\"", + "-framework", + "\"OCMock\"", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.firebase.FirebaseOAuthUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 8D69E23621DD476D00CFA49B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = FirebaseOAuthUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + OTHER_LDFLAGS = ( + "-ObjC", + "-framework", + "\"GTMSessionFetcher\"", + "-framework", + "\"GoogleUtilities\"", + "-framework", + "\"OCMock\"", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.firebase.FirebaseOAuthUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8D69E21721DD476C00CFA49B /* Build configuration list for PBXProject "FirebaseOAuthUI" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8D69E22F21DD476D00CFA49B /* Debug */, + 8D69E23021DD476D00CFA49B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8D69E23121DD476D00CFA49B /* Build configuration list for PBXNativeTarget "FirebaseOAuthUI" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8D69E23221DD476D00CFA49B /* Debug */, + 8D69E23321DD476D00CFA49B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8D69E23421DD476D00CFA49B /* Build configuration list for PBXNativeTarget "FirebaseOAuthUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8D69E23521DD476D00CFA49B /* Debug */, + 8D69E23621DD476D00CFA49B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8D69E21421DD476C00CFA49B /* Project object */; +} diff --git a/OAuth/FirebaseOAuthUI/FUIOAuth.h b/OAuth/FirebaseOAuthUI/FUIOAuth.h new file mode 100644 index 00000000000..b3f095fa84e --- /dev/null +++ b/OAuth/FirebaseOAuthUI/FUIOAuth.h @@ -0,0 +1,78 @@ +// +// Copyright (c) 2019 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. +// +@class FUIAuth; +#import + +NS_ASSUME_NONNULL_BEGIN + +/** @class FUIOAuth + @brief AuthUI components for OAuth Sign In. + */ +@interface FUIOAuth : NSObject + +/** @fn init + @brief Please use `initWithAuthUI:providerID:providerName:buttonColor:iconImage:scopes: + customParameters:` instead. + */ +- (instancetype)init NS_UNAVAILABLE; + +/** @fn init + @brief Please use `initWithAuthUI:providerID:providerName:buttonColor:iconImage:scopes: + customParameters:` instead. + */ +- (instancetype)initWithAuthUI:(FUIAuth *)authUI NS_UNAVAILABLE; + +/** @fn initWithAuthUI:providerID:buttonLabelText:buttonColor:iconImage:scopes:customParameters: + @brief AuthUI components for OAuth Sign In. + @param authUI The @c FUIAuth instance that manages controllers of this provider. + @param providerID The unique identifier for the provider. + @param buttonLabelText The text label for the sign in button. + @param buttonColor The background color that should be used for the sign in button of the + provider. + @param iconImage The icon image of the provider. + @param scopes Array used to configure the OAuth scopes. + @param customParameters Dictionary used to configure the OAuth custom parameters. + */ +- (instancetype)initWithAuthUI:(FUIAuth *)authUI + providerID:(NSString *)providerID + buttonLabelText:(NSString *)buttonLabelText + buttonColor:(UIColor *)buttonColor + iconImage:(UIImage *)iconImage + scopes:(nullable NSArray *)scopes + customParameters:(nullable NSDictionary *)customParameters + NS_DESIGNATED_INITIALIZER; + +/** @fn providerID:buttonLabelText:buttonColor:iconImage:scopes:customParameters: + @brief Initialize the class instance with the default AuthUI. + + @param providerID The unique identifier for the provider. + @param buttonLabelText The text label for the sign in button. + @param buttonColor The background color that should be used for the sign in button of the + provider. + @param iconImage The icon image of the provider. + @param scopes Array used to configure the OAuth scopes. + @param customParameters Dictionary used to configure the OAuth custom parameters. + */ +- (instancetype)initWithProviderID:(NSString *)providerID + buttonLabelText:(NSString *)buttonLabelText + buttonColor:(UIColor *)buttonColor + iconImage:(UIImage *)iconImage + scopes:(nullable NSArray *)scopes + customParameters:(nullable NSDictionary *)customParameters; + +@end + +NS_ASSUME_NONNULL_END diff --git a/OAuth/FirebaseOAuthUI/FUIOAuth.m b/OAuth/FirebaseOAuthUI/FUIOAuth.m new file mode 100644 index 00000000000..d0fbab8f5b0 --- /dev/null +++ b/OAuth/FirebaseOAuthUI/FUIOAuth.m @@ -0,0 +1,209 @@ +// +// Copyright (c) 2019 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 + +#import "FUIOAuth.h" +#import +#import +#import "FUIAuthErrorUtils.h" + +/** @var kTableName + @brief The name of the strings table to search for localized strings. + */ +static NSString *const kTableName = @"FirebaseOAuthUI"; + +/** @var kBundleName + @brief The name of the bundle to search for resources. + */ +static NSString *const kBundleName = @"FirebaseOAuthUI"; + +/** @var kSignInAsGuest + @brief The string key for localized button text. + */ +static NSString *const kSignInAsGuest = @"SignInAsGuest"; + +NS_ASSUME_NONNULL_BEGIN + +@interface FUIOAuth () + +/** @property authUI + @brief FUIAuth instance of the application. + */ +@property(nonatomic, strong) FUIAuth *authUI; + +/** @property presentingViewController + @brief The presenting view controller for interactive sign-in. + */ +@property(nonatomic, strong) UIViewController *presentingViewController; + +/** @property providerID + @brief A unique identifier for the provider. + */ +@property(nonatomic, copy, nullable) NSString *providerID; + +/** @property signInLabel + @brief A localized label for the provider's sign-in button. + */ +@property(nonatomic, copy) NSString *signInLabel; + +/** @property icon + @brief The icon image of the provider. + */ +@property(nonatomic, strong) UIImage *icon; + +/** @property buttonBackgroundColor + @brief The background color that should be used for the sign in button of the provider. + */ +@property(nonatomic, strong) UIColor *buttonBackgroundColor; + +/** @property scopes + @brief Array used to configure the OAuth scopes. + */ +@property(nonatomic, copy, nullable) NSArray *scopes; + +/** @property customParameters + @brief Dictionary used to configure the OAuth custom parameters. + */ +@property(nonatomic, copy, nullable) NSDictionary *customParameters; + +/** @property provider + @brief The OAuth provider that does the actual sign in. + */ +@property(nonatomic, strong) FIROAuthProvider *provider; + +@end + +@implementation FUIOAuth + +- (instancetype)initWithAuthUI:(FUIAuth *)authUI + providerID:(NSString *)providerID + buttonLabelText:(NSString *)buttonLabelText + buttonColor:(UIColor *)buttonColor + iconImage:(UIImage *)iconImage + scopes:(nullable NSArray *)scopes + customParameters:(nullable NSDictionary *)customParameters { + if (self = [super init]) { + _authUI = authUI; + _providerID = providerID; + _signInLabel = buttonLabelText; + _buttonBackgroundColor = buttonColor; + _icon = iconImage; + _scopes = scopes; + _customParameters = customParameters; + _provider = [FIROAuthProvider providerWithProviderID:self.providerID]; + _provider.customParameters = self.customParameters; + _provider.scopes = self.scopes; + } + return self; +} + +- (instancetype)initWithProviderID:(NSString *)providerID + buttonLabelText:(NSString *)buttonLabelText + buttonColor:(UIColor *)buttonColor + iconImage:(UIImage *)iconImage + scopes:(nullable NSArray *)scopes + customParameters:(nullable NSDictionary *)customParameters { + return [self initWithAuthUI:[FUIAuth defaultAuthUI] + providerID:providerID + buttonLabelText:buttonLabelText + buttonColor:buttonColor + iconImage:iconImage + scopes:scopes + customParameters:customParameters]; +} + +#pragma mark - FUIAuthProvider + +/** @fn accessToken: + @brief OAuth token is matched by FirebaseUI User Access Token + */ +- (nullable NSString *)accessToken { + return nil; +} + +/** @fn idToken: + @brief OAuth Token Secret is matched by FirebaseUI User Id Token + */ +- (nullable NSString *)idToken { + return nil; +} + +- (NSString *)shortName { + return @"OAuth"; +} + +- (UIColor *)buttonTextColor { + return [UIColor whiteColor]; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +- (void)signInWithEmail:(nullable NSString *)email + presentingViewController:(nullable UIViewController *)presentingViewController + completion:(nullable FUIAuthProviderSignInCompletionBlock)completion { + [self signInWithDefaultValue:email + presentingViewController:presentingViewController + completion:completion]; +} +#pragma clang diagnostic pop + +- (void)signInWithDefaultValue:(nullable NSString *)defaultValue + presentingViewController:(nullable UIViewController *)presentingViewController + completion:(nullable FUIAuthProviderSignInCompletionBlock)completion { + self.presentingViewController = presentingViewController; + + [self.provider getCredentialWithUIDelegate:nil + completion:^(FIRAuthCredential *_Nullable credential, + NSError *_Nullable error) { + if (error) { + [FUIAuthBaseViewController showAlertWithMessage:error.localizedDescription + presentingViewController:presentingViewController]; + if (completion) { + completion(nil, error, nil, nil); + } + return; + } + if (completion) { + UIActivityIndicatorView *activityView = + [FUIAuthBaseViewController addActivityIndicator:presentingViewController.view]; + [activityView startAnimating]; + FIRAuthResultCallback result = ^(FIRUser *_Nullable user, + NSError *_Nullable error) { + [activityView stopAnimating]; + [activityView removeFromSuperview]; + }; + completion(credential, nil, result, nil); + } + }]; +} + +- (void)signOut { + FIRUser *user = _authUI.auth.currentUser; + __weak UIViewController *weakController = self.presentingViewController; + [user deleteWithCompletion:^(NSError * _Nullable error) { + if (error) { + __strong UIViewController *presentingViewController = weakController; + [FUIAuthBaseViewController showAlertWithMessage:error.localizedDescription + presentingViewController:presentingViewController]; + return; + } + }]; +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/OAuth/FirebaseOAuthUI/FirebaseOAuthUI.h b/OAuth/FirebaseOAuthUI/FirebaseOAuthUI.h new file mode 100644 index 00000000000..3d5aa8aacfd --- /dev/null +++ b/OAuth/FirebaseOAuthUI/FirebaseOAuthUI.h @@ -0,0 +1,27 @@ +// +// Copyright (c) 2019 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 + +//! Project version number for FirebaseOAuthUI. +FOUNDATION_EXPORT double FirebaseOAuthUIVersionNumber; + +//! Project version string for FirebaseOAuthUI. +FOUNDATION_EXPORT const unsigned char FirebaseOAuthUIVersionString[]; + +#import "FUIOAuth.h" + + diff --git a/OAuth/FirebaseOAuthUI/Info.plist b/OAuth/FirebaseOAuthUI/Info.plist new file mode 100644 index 00000000000..d3de8eefb69 --- /dev/null +++ b/OAuth/FirebaseOAuthUI/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/OAuth/FirebaseOAuthUITests/FirebaseOAuthUITests.m b/OAuth/FirebaseOAuthUITests/FirebaseOAuthUITests.m new file mode 100644 index 00000000000..ec4db55259b --- /dev/null +++ b/OAuth/FirebaseOAuthUITests/FirebaseOAuthUITests.m @@ -0,0 +1,77 @@ +// +// Copyright (c) 2019 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 +#import + +#import +#import + +#import "FUIOAuth.h" + +@interface FirebaseOAuthUITests : XCTestCase +@property (nonatomic, strong) FUIOAuth *provider; +@end + +@implementation FirebaseOAuthUITests + +- (void)setUp { + [super setUp]; + + id mockUtilsClass = OCMClassMock([FUIAuthUtils class]); + OCMStub(ClassMethod([mockUtilsClass bundleNamed:OCMOCK_ANY])). + andReturn([NSBundle bundleForClass:[FUIOAuth class]]); + + id authUIClass = OCMClassMock([FUIAuth class]); + id providerIDClass = OCMClassMock([NSString class]); + OCMStub(ClassMethod([authUIClass authUIWithAuth:OCMOCK_ANY])). + andReturn(authUIClass); + + id authClass = OCMClassMock([FIRAuth class]); + OCMStub(ClassMethod([authClass auth])). + andReturn(authClass); + + FIRAuth *auth = [FIRAuth auth]; + FUIAuth *authUI = [FUIAuth authUIWithAuth:auth]; + + self.provider = [[FUIOAuth alloc] initWithAuthUI:authUI + providerID:@"dummy" + buttonLabelText:@"Sign in with dummy" + buttonColor:[UIColor clearColor] + iconImage:[UIImage imageNamed:@""] + scopes:@[] + customParameters:@{}]; +} + +- (void)tearDown { + self.provider = nil; + [super tearDown]; +} + +- (void)testProviderValidity { + XCTAssertNotNil(self.provider); + XCTAssertNotNil(self.provider.icon); + XCTAssertNotNil(self.provider.signInLabel); + XCTAssertNotNil(self.provider.buttonBackgroundColor); + XCTAssertNotNil(self.provider.buttonTextColor); + XCTAssertNil(self.provider.providerID); + XCTAssertNotNil(self.provider.shortName); + XCTAssertTrue(self.provider.signInLabel.length != 0); + XCTAssertNil(self.provider.accessToken); + XCTAssertNil(self.provider.idToken); +} + +@end diff --git a/OAuth/FirebaseOAuthUITests/Info.plist b/OAuth/FirebaseOAuthUITests/Info.plist new file mode 100644 index 00000000000..ba72822e872 --- /dev/null +++ b/OAuth/FirebaseOAuthUITests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/OAuth/Podfile b/OAuth/Podfile new file mode 100644 index 00000000000..06eb7a2d637 --- /dev/null +++ b/OAuth/Podfile @@ -0,0 +1,13 @@ +platform :ios, '8.0' + +target 'FirebaseOAuthUI' do + use_frameworks! + + pod 'FirebaseUI/Auth', :path => '../' + + target 'FirebaseOAuthUITests' do + inherit! :search_paths + pod 'OCMock' + end + +end diff --git a/OAuth/Podfile.lock b/OAuth/Podfile.lock new file mode 100644 index 00000000000..656dfb03ea3 --- /dev/null +++ b/OAuth/Podfile.lock @@ -0,0 +1,56 @@ +PODS: + - Firebase/Auth (5.18.0): + - Firebase/CoreOnly + - FirebaseAuth (= 5.4.0) + - Firebase/CoreOnly (5.18.0): + - FirebaseCore (= 5.3.1) + - FirebaseAuth (5.4.0): + - FirebaseAuthInterop (~> 1.0) + - FirebaseCore (~> 5.2) + - GoogleUtilities/Environment (~> 5.2) + - GTMSessionFetcher/Core (~> 1.1) + - FirebaseAuthInterop (1.0.0) + - FirebaseCore (5.3.1): + - GoogleUtilities/Logger (~> 5.2) + - FirebaseUI/Auth (6.1.1): + - Firebase/Auth (~> 5.0) + - GoogleUtilities/UserDefaults + - GoogleUtilities/Environment (5.3.7) + - GoogleUtilities/Logger (5.3.7): + - GoogleUtilities/Environment + - GoogleUtilities/UserDefaults (5.3.7): + - GoogleUtilities/Logger + - GTMSessionFetcher/Core (1.2.1) + - OCMock (3.4.3) + +DEPENDENCIES: + - FirebaseUI/Auth (from `../`) + - OCMock + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - Firebase + - FirebaseAuth + - FirebaseAuthInterop + - FirebaseCore + - GoogleUtilities + - GTMSessionFetcher + - OCMock + +EXTERNAL SOURCES: + FirebaseUI: + :path: "../" + +SPEC CHECKSUMS: + Firebase: 02f3281965c075426141a0ce1277e9de6649cab9 + FirebaseAuth: d85d052354447f30b4b2a805ab91b511458b56a6 + FirebaseAuthInterop: 0ffa57668be100582bb7643d4fcb7615496c41fc + FirebaseCore: 52f851b30e11360f1e67cf04b1edfebf0a47a2d3 + FirebaseUI: fc3584df29e96959d895677274681939fa30dbe5 + GoogleUtilities: 111a012f4c3a29c9e7c954c082fafd6ee3c999c0 + GTMSessionFetcher: 32aeca0aa144acea523e1c8e053089dec2cb98ca + OCMock: 43565190abc78977ad44a61c0d20d7f0784d35ab + +PODFILE CHECKSUM: f595cdb63c8188389342a5860e9ce02ff7bb0e8c + +COCOAPODS: 1.6.1 diff --git a/samples/objc/FirebaseUI-demo-objc.xcodeproj/project.pbxproj b/samples/objc/FirebaseUI-demo-objc.xcodeproj/project.pbxproj index fc40f57514b..48db5ab76a6 100644 --- a/samples/objc/FirebaseUI-demo-objc.xcodeproj/project.pbxproj +++ b/samples/objc/FirebaseUI-demo-objc.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 896400F7222F583100CEF7D7 /* mssymbol.png in Resources */ = {isa = PBXBuildFile; fileRef = 896400F6222F583100CEF7D7 /* mssymbol.png */; }; 8D7D5DC11D9D9536006C1857 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8D7D5DC01D9D9536006C1857 /* GoogleService-Info.plist */; }; 8D7F86B51D9DAA0100C2A122 /* FUIStorageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7F86B41D9DAA0100C2A122 /* FUIStorageViewController.m */; }; C30AEB0A1ED610740084E328 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C30AEB071ED610740084E328 /* Main.storyboard */; }; @@ -38,6 +39,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 896400F6222F583100CEF7D7 /* mssymbol.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mssymbol.png; sourceTree = ""; }; 8D7D5DC01D9D9536006C1857 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 8D7F86B31D9DAA0100C2A122 /* FUIStorageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FUIStorageViewController.h; path = Storage/FUIStorageViewController.h; sourceTree = ""; }; 8D7F86B41D9DAA0100C2A122 /* FUIStorageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FUIStorageViewController.m; path = Storage/FUIStorageViewController.m; sourceTree = ""; }; @@ -181,6 +183,21 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 54B9F7E49B62231ABC826A36 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + path = Pods; + sourceTree = ""; + }; + 896400F5222F580400CEF7D7 /* Resources */ = { + isa = PBXGroup; + children = ( + 896400F6222F583100CEF7D7 /* mssymbol.png */, + ); + path = Resources; + sourceTree = ""; + }; 8D7D5DC51D9DA075006C1857 /* Storage */ = { isa = PBXGroup; children = ( @@ -193,6 +210,7 @@ C30AEB041ED610740084E328 /* Resources */ = { isa = PBXGroup; children = ( + 896400F5222F580400CEF7D7 /* Resources */, C30AEB0D1ED610780084E328 /* Localizable.strings */, C30AEB071ED610740084E328 /* Main.storyboard */, ); @@ -260,6 +278,7 @@ 8D7D5DC01D9D9536006C1857 /* GoogleService-Info.plist */, D81A05F21B86A78700498183 /* FirebaseUI-demo-objc */, D81A05F11B86A78700498183 /* Products */, + 54B9F7E49B62231ABC826A36 /* Pods */, ); sourceTree = ""; }; @@ -447,6 +466,7 @@ buildActionMask = 2147483647; files = ( C3A8B7C21DAF073400CDF0ED /* FUICustomPasswordSignInViewController.xib in Resources */, + 896400F7222F583100CEF7D7 /* mssymbol.png in Resources */, C30AEB0B1ED610780084E328 /* Localizable.strings in Resources */, C30AEB0A1ED610740084E328 /* Main.storyboard in Resources */, C34FC1FF1DB17C8B009ED69A /* FUICustomPasswordVerificationViewController.xib in Resources */, diff --git a/samples/objc/FirebaseUI-demo-objc/Resources/Main.storyboard b/samples/objc/FirebaseUI-demo-objc/Resources/Main.storyboard index 36702cf8de4..f04a82e8276 100644 --- a/samples/objc/FirebaseUI-demo-objc/Resources/Main.storyboard +++ b/samples/objc/FirebaseUI-demo-objc/Resources/Main.storyboard @@ -1,11 +1,11 @@ - + - + @@ -329,12 +329,29 @@ + + + + + + + + + + + - + @@ -355,7 +372,7 @@ - + @@ -367,7 +384,7 @@ - + @@ -379,7 +396,7 @@ - + @@ -391,7 +408,7 @@ - + @@ -403,7 +420,7 @@ - + @@ -424,7 +441,7 @@ - + diff --git a/samples/objc/FirebaseUI-demo-objc/Resources/Resources/mssymbol.png b/samples/objc/FirebaseUI-demo-objc/Resources/Resources/mssymbol.png new file mode 100644 index 0000000000000000000000000000000000000000..9e5e2bcb5529a157626f83a9222be3b8259c364c GIT binary patch literal 162 zcmeAS@N?(olHy`uVBq!ia0vp^q9Dw{1|(OCFP#RYI14-?iy0WWg+Q3`(%rg0K*11C z7sn8b-sC_3|JyTfW#m4w=X~QS7T;&F_0u;dnkze&@~-$e=)0sWSQW(K%TtCmRVOWEKJn+S}elM%*>F|C!svG^v-^u`3#<}elF{r G5}E*=$2BMb literal 0 HcmV?d00001 diff --git a/samples/objc/FirebaseUI-demo-objc/Samples/Auth/FUIAuthViewController.m b/samples/objc/FirebaseUI-demo-objc/Samples/Auth/FUIAuthViewController.m index ee63c328594..08bf728dcdc 100644 --- a/samples/objc/FirebaseUI-demo-objc/Samples/Auth/FUIAuthViewController.m +++ b/samples/objc/FirebaseUI-demo-objc/Samples/Auth/FUIAuthViewController.m @@ -43,7 +43,8 @@ kIDPFacebook, kIDPTwitter, kIDPPhone, - kIDPAnonymous + kIDPAnonymous, + kIDPMicrosoft }; static NSString *const kFirebaseTermsOfService = @"https://firebase.google.com/terms/"; @@ -121,6 +122,10 @@ - (void)viewDidLoad { inSection:kSectionsProviders] animated:NO scrollPosition:UITableViewScrollPositionNone]; + [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:kIDPMicrosoft + inSection:kSectionsProviders] + animated:NO + scrollPosition:UITableViewScrollPositionNone]; // Disable twitter provider if token is not set. if (!kTwitterConsumerKey.length || !kTwitterConsumerSecret.length) { NSIndexPath *twitterRow = [NSIndexPath indexPathForRow:kIDPTwitter @@ -410,7 +415,22 @@ + (NSArray *)getListOfIDPs:(NSArray *)selectedRows case kIDPAnonymous: provider = [[FUIAnonymousAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]]; break; - + case kIDPMicrosoft: + { + UIColor *buttonColor = [UIColor colorWithRed:.18 green:.18 blue:.18 alpha:1.0]; + NSString *iconPath = [[NSBundle mainBundle] pathForResource:@"mssymbol" ofType:@"png"]; + if (!iconPath) { + NSLog(@"Warning: Unable to find microsoft icon."); + } + provider = [[FUIOAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI] + providerID:@"hotmail.com" + buttonLabelText:@"Sign in with Microsoft" + buttonColor:buttonColor + iconImage:[UIImage imageWithContentsOfFile:iconPath] + scopes:@[@"user.readwrite"] + customParameters:@{@"prompt" : @"consent"}]; + } + break; default: break; }