aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2017-05-19 11:31:48 -0700
committerGravatar GitHub <noreply@github.com>2017-05-19 11:31:48 -0700
commitf2765ff914968c417955fb2a84cd7bf33d274da1 (patch)
tree7153ee59aadd916fed557a29163a078b865cd786
parented1b6098528f62b75c1d085299d02ace49df208e (diff)
Auth jazzy fixes and Swift sample updates (#19)
* Removes the '@c' that would cause Jazzy issue down the road.
-rw-r--r--AuthSamples/SwiftSample/Main.storyboard336
-rw-r--r--AuthSamples/SwiftSample/Sample.entitlements10
-rw-r--r--AuthSamples/SwiftSample/ViewController.swift126
-rw-r--r--Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.h16
-rw-r--r--Firebase/Auth/Source/FIRAuth.h12
-rw-r--r--Firebase/Auth/Source/FIRAuthErrorUtils.m13
-rw-r--r--Firebase/Auth/Source/FIRAuthErrors.h12
7 files changed, 347 insertions, 178 deletions
diff --git a/AuthSamples/SwiftSample/Main.storyboard b/AuthSamples/SwiftSample/Main.storyboard
index 6c60d61..f9ff985 100644
--- a/AuthSamples/SwiftSample/Main.storyboard
+++ b/AuthSamples/SwiftSample/Main.storyboard
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12118" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12086"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -22,160 +22,200 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="f0Y-rP-2xL">
- <rect key="frame" x="16" y="20" width="100" height="100"/>
+ <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6HK-es-gyf">
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+ <subviews>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Phone" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="c6m-cS-hAh">
+ <rect key="frame" x="185" y="426" width="164" height="30"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Password" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sTr-Hf-KVD">
+ <rect key="frame" x="185" y="366" width="164" height="30"/>
+ <fontDescription key="fontDescription" type="system" pointSize="20"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="zIt-Mq-gk3">
+ <rect key="frame" x="185" y="336" width="164" height="30"/>
+ <nil key="textColor"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits"/>
+ </textField>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ria-OG-Nbj">
+ <rect key="frame" x="105" y="98" width="264" height="25"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ObY-8p-vcQ">
+ <rect key="frame" x="105" y="48" width="264" height="25"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QOn-3b-keq">
+ <rect key="frame" x="99" y="131" width="250" height="167"/>
+ <connections>
+ <outlet property="dataSource" destination="BYZ-38-t0r" id="2Mt-EE-jxl"/>
+ <outlet property="delegate" destination="BYZ-38-t0r" id="qCy-Bt-yNL"/>
+ </connections>
+ </pickerView>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cWW-O4-BEO">
+ <rect key="frame" x="105" y="23" width="264" height="25"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="31t-pr-Jxe">
+ <rect key="frame" x="121" y="565" width="132" height="53"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="132" id="Qvn-OR-BdF"/>
+ <constraint firstAttribute="height" constant="53" id="ST0-u0-dQ9"/>
+ </constraints>
+ <fontDescription key="fontDescription" type="system" pointSize="24"/>
+ <state key="normal" title="Execute"/>
+ <connections>
+ <action selector="execute:" destination="BYZ-38-t0r" eventType="touchUpInside" id="wnf-4v-z5f"/>
+ </connections>
+ </button>
+ <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="D0S-Sb-YNu">
+ <rect key="frame" x="5" y="23" width="100" height="100"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="100" id="3vv-V5-uVt"/>
+ <constraint firstAttribute="width" constant="100" id="Co2-YK-P0d"/>
+ </constraints>
+ </imageView>
+ <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cpy-NT-JJH">
+ <rect key="frame" x="5" y="131" width="86" height="167"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="167" id="3Pc-9v-A6F"/>
+ <constraint firstAttribute="width" constant="86" id="l7M-4A-dOO"/>
+ </constraints>
+ <connections>
+ <outlet property="dataSource" destination="BYZ-38-t0r" id="of7-wI-QNH"/>
+ <outlet property="delegate" destination="BYZ-38-t0r" id="Pfb-UW-zEF"/>
+ </connections>
+ </pickerView>
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="gB8-2Z-VH6">
+ <rect key="frame" x="185" y="454" width="164" height="30"/>
+ <nil key="textColor"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits" keyboardType="phonePad"/>
+ </textField>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Email" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EQe-sz-7yJ">
+ <rect key="frame" x="185" y="306" width="164" height="30"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="164" id="rEx-eC-W8w"/>
+ </constraints>
+ <fontDescription key="fontDescription" type="system" pointSize="20"/>
+ <nil key="textColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QFf-6f-e46">
+ <rect key="frame" x="5" y="306" width="164" height="216"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="164" id="T6v-LA-XU8"/>
+ </constraints>
+ <connections>
+ <outlet property="dataSource" destination="BYZ-38-t0r" id="ZEt-kl-Eml"/>
+ <outlet property="delegate" destination="BYZ-38-t0r" id="Bl0-Bi-SdS"/>
+ </connections>
+ </pickerView>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZxB-fU-vRm">
+ <rect key="frame" x="105" y="73" width="264" height="25"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="sTA-Ti-DZm">
+ <rect key="frame" x="185" y="396" width="164" height="30"/>
+ <nil key="textColor"/>
+ <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <textInputTraits key="textInputTraits"/>
+ </textField>
+ </subviews>
<constraints>
- <constraint firstAttribute="height" constant="100" id="1z8-5e-1FT"/>
- <constraint firstAttribute="width" constant="100" id="dtU-ZR-yuk"/>
+ <constraint firstItem="ObY-8p-vcQ" firstAttribute="centerX" secondItem="cWW-O4-BEO" secondAttribute="centerX" id="0ib-aj-WX2"/>
+ <constraint firstItem="sTr-Hf-KVD" firstAttribute="width" secondItem="sTA-Ti-DZm" secondAttribute="width" id="2D7-Mj-W0C"/>
+ <constraint firstItem="zIt-Mq-gk3" firstAttribute="leading" secondItem="sTr-Hf-KVD" secondAttribute="leading" id="2NF-el-Jrp"/>
+ <constraint firstItem="sTA-Ti-DZm" firstAttribute="top" secondItem="sTr-Hf-KVD" secondAttribute="bottom" id="5Pb-vj-i2t"/>
+ <constraint firstItem="zIt-Mq-gk3" firstAttribute="width" secondItem="sTr-Hf-KVD" secondAttribute="width" id="5cR-Eg-Mok"/>
+ <constraint firstItem="c6m-cS-hAh" firstAttribute="height" secondItem="gB8-2Z-VH6" secondAttribute="height" id="5jm-To-vnO"/>
+ <constraint firstItem="gB8-2Z-VH6" firstAttribute="top" secondItem="sTA-Ti-DZm" secondAttribute="bottom" constant="28" id="8X6-in-hde"/>
+ <constraint firstItem="sTA-Ti-DZm" firstAttribute="width" secondItem="c6m-cS-hAh" secondAttribute="width" id="9C4-yu-4ce"/>
+ <constraint firstItem="c6m-cS-hAh" firstAttribute="width" secondItem="gB8-2Z-VH6" secondAttribute="width" id="9HL-oU-ywU"/>
+ <constraint firstItem="EQe-sz-7yJ" firstAttribute="height" secondItem="zIt-Mq-gk3" secondAttribute="height" id="AvD-fF-buO"/>
+ <constraint firstItem="EQe-sz-7yJ" firstAttribute="leading" secondItem="zIt-Mq-gk3" secondAttribute="leading" id="Ava-E1-SS0"/>
+ <constraint firstItem="sTr-Hf-KVD" firstAttribute="leading" secondItem="sTA-Ti-DZm" secondAttribute="leading" id="BMW-DF-S5S"/>
+ <constraint firstItem="31t-pr-Jxe" firstAttribute="top" secondItem="QFf-6f-e46" secondAttribute="bottom" constant="43" id="Em1-jR-L4v"/>
+ <constraint firstItem="ZxB-fU-vRm" firstAttribute="top" secondItem="ObY-8p-vcQ" secondAttribute="bottom" id="F0f-ea-9iX"/>
+ <constraint firstItem="D0S-Sb-YNu" firstAttribute="leading" secondItem="cpy-NT-JJH" secondAttribute="leading" id="FUv-hM-9eb"/>
+ <constraint firstAttribute="trailing" secondItem="QOn-3b-keq" secondAttribute="trailing" constant="26" id="GWC-2P-5UF"/>
+ <constraint firstItem="EQe-sz-7yJ" firstAttribute="top" secondItem="QFf-6f-e46" secondAttribute="top" id="Gsq-E6-6wg"/>
+ <constraint firstItem="zIt-Mq-gk3" firstAttribute="top" secondItem="EQe-sz-7yJ" secondAttribute="bottom" id="HER-e5-sOc"/>
+ <constraint firstItem="EQe-sz-7yJ" firstAttribute="width" secondItem="zIt-Mq-gk3" secondAttribute="width" id="IWr-QC-GQL"/>
+ <constraint firstItem="QOn-3b-keq" firstAttribute="trailing" secondItem="EQe-sz-7yJ" secondAttribute="trailing" id="JWT-sJ-Xwy"/>
+ <constraint firstItem="QOn-3b-keq" firstAttribute="leading" secondItem="cpy-NT-JJH" secondAttribute="trailing" constant="8" id="QIa-72-bhH"/>
+ <constraint firstItem="c6m-cS-hAh" firstAttribute="centerX" secondItem="gB8-2Z-VH6" secondAttribute="centerX" id="QKW-7H-lfO"/>
+ <constraint firstItem="ria-OG-Nbj" firstAttribute="centerX" secondItem="ZxB-fU-vRm" secondAttribute="centerX" id="RGq-CF-6Ca"/>
+ <constraint firstItem="QFf-6f-e46" firstAttribute="top" secondItem="QOn-3b-keq" secondAttribute="bottom" constant="8" id="RGv-Ix-KP5"/>
+ <constraint firstItem="D0S-Sb-YNu" firstAttribute="top" secondItem="6HK-es-gyf" secondAttribute="topMargin" constant="15" id="S58-uf-nql"/>
+ <constraint firstItem="ria-OG-Nbj" firstAttribute="height" secondItem="ZxB-fU-vRm" secondAttribute="height" id="S8E-ed-GlT"/>
+ <constraint firstItem="sTA-Ti-DZm" firstAttribute="height" secondItem="c6m-cS-hAh" secondAttribute="height" id="UpF-XL-ZNe"/>
+ <constraint firstItem="QOn-3b-keq" firstAttribute="top" secondItem="D0S-Sb-YNu" secondAttribute="bottom" constant="8" id="VTf-55-gwC"/>
+ <constraint firstItem="c6m-cS-hAh" firstAttribute="top" secondItem="sTA-Ti-DZm" secondAttribute="bottom" id="VZF-fX-C3a"/>
+ <constraint firstItem="sTr-Hf-KVD" firstAttribute="top" secondItem="zIt-Mq-gk3" secondAttribute="bottom" id="Vm8-Fh-aXe"/>
+ <constraint firstItem="cWW-O4-BEO" firstAttribute="leading" secondItem="D0S-Sb-YNu" secondAttribute="trailing" id="YLB-S5-D80"/>
+ <constraint firstItem="ZxB-fU-vRm" firstAttribute="width" secondItem="ObY-8p-vcQ" secondAttribute="width" id="b1Y-MS-gng"/>
+ <constraint firstItem="sTr-Hf-KVD" firstAttribute="height" secondItem="sTA-Ti-DZm" secondAttribute="height" id="bNv-hH-Noc"/>
+ <constraint firstItem="cpy-NT-JJH" firstAttribute="centerY" secondItem="QOn-3b-keq" secondAttribute="centerY" id="cQ7-Bu-P8o"/>
+ <constraint firstAttribute="trailing" secondItem="cWW-O4-BEO" secondAttribute="trailing" constant="6" id="d3V-Nv-JAE"/>
+ <constraint firstItem="zIt-Mq-gk3" firstAttribute="height" secondItem="sTr-Hf-KVD" secondAttribute="height" id="eEX-vS-Ado"/>
+ <constraint firstItem="ria-OG-Nbj" firstAttribute="width" secondItem="ZxB-fU-vRm" secondAttribute="width" id="fqd-aO-UVU"/>
+ <constraint firstItem="ZxB-fU-vRm" firstAttribute="height" secondItem="ObY-8p-vcQ" secondAttribute="height" id="ghn-WL-o6u"/>
+ <constraint firstItem="ZxB-fU-vRm" firstAttribute="centerX" secondItem="ObY-8p-vcQ" secondAttribute="centerX" id="in5-Lv-vIw"/>
+ <constraint firstItem="cpy-NT-JJH" firstAttribute="leading" secondItem="QFf-6f-e46" secondAttribute="leading" id="kF3-HN-LbD"/>
+ <constraint firstItem="sTA-Ti-DZm" firstAttribute="centerX" secondItem="c6m-cS-hAh" secondAttribute="centerX" id="kiI-Xh-5xo"/>
+ <constraint firstItem="cWW-O4-BEO" firstAttribute="height" secondItem="D0S-Sb-YNu" secondAttribute="height" multiplier="0.25" id="mKj-fA-ORq"/>
+ <constraint firstItem="D0S-Sb-YNu" firstAttribute="leading" secondItem="6HK-es-gyf" secondAttribute="leading" constant="5" id="nBQ-cr-fzi"/>
+ <constraint firstItem="ria-OG-Nbj" firstAttribute="top" secondItem="ZxB-fU-vRm" secondAttribute="bottom" id="pa9-NP-Hfc"/>
+ <constraint firstItem="gB8-2Z-VH6" firstAttribute="top" secondItem="c6m-cS-hAh" secondAttribute="bottom" constant="-2" id="qyL-2s-Bk6"/>
+ <constraint firstItem="cWW-O4-BEO" firstAttribute="top" secondItem="D0S-Sb-YNu" secondAttribute="top" id="r4K-Xo-2Xj"/>
+ <constraint firstItem="ObY-8p-vcQ" firstAttribute="top" secondItem="cWW-O4-BEO" secondAttribute="bottom" id="sSS-aL-VRW"/>
+ <constraint firstItem="ObY-8p-vcQ" firstAttribute="width" secondItem="cWW-O4-BEO" secondAttribute="width" id="vme-8e-MMM"/>
+ <constraint firstItem="EQe-sz-7yJ" firstAttribute="leading" secondItem="QFf-6f-e46" secondAttribute="trailing" constant="16" id="wnz-FV-4IK"/>
+ <constraint firstAttribute="bottom" secondItem="31t-pr-Jxe" secondAttribute="bottom" constant="64" id="yf5-EU-fUm"/>
+ <constraint firstItem="31t-pr-Jxe" firstAttribute="centerX" secondItem="6HK-es-gyf" secondAttribute="centerX" id="ypm-hz-NtG"/>
+ <constraint firstItem="cpy-NT-JJH" firstAttribute="height" secondItem="QOn-3b-keq" secondAttribute="height" id="zEO-wC-OTJ"/>
+ <constraint firstItem="ObY-8p-vcQ" firstAttribute="height" secondItem="cWW-O4-BEO" secondAttribute="height" id="zgf-ji-Ou6"/>
</constraints>
- </imageView>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lWp-nO-ZaW">
- <rect key="frame" x="116" y="20" width="263" height="25"/>
- <fontDescription key="fontDescription" type="system" pointSize="17"/>
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
- <nil key="highlightedColor"/>
- </label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Dql-K9-Pb8">
- <rect key="frame" x="116" y="45" width="263" height="25"/>
- <fontDescription key="fontDescription" type="system" pointSize="17"/>
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
- <nil key="highlightedColor"/>
- </label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="8" adjustsLetterSpacingToFitWidth="YES" translatesAutoresizingMaskIntoConstraints="NO" id="x6V-xc-ti7">
- <rect key="frame" x="116" y="70" width="263" height="25"/>
- <fontDescription key="fontDescription" type="system" pointSize="17"/>
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
- <nil key="highlightedColor"/>
- </label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="26Z-WM-zPg">
- <rect key="frame" x="116" y="95" width="263" height="25"/>
- <fontDescription key="fontDescription" type="system" pointSize="17"/>
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
- <nil key="highlightedColor"/>
- </label>
- <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pbc-lK-fyt">
- <rect key="frame" x="110" y="128" width="249" height="167"/>
- <connections>
- <outlet property="dataSource" destination="BYZ-38-t0r" id="UQZ-I6-nrk"/>
- <outlet property="delegate" destination="BYZ-38-t0r" id="TUP-ja-Ewo"/>
- </connections>
- </pickerView>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UCG-40-lyD">
- <rect key="frame" x="121" y="478" width="132" height="53"/>
- <constraints>
- <constraint firstAttribute="width" constant="132" id="6tv-Vh-n1Q"/>
- <constraint firstAttribute="height" constant="53" id="OTC-oP-oh6"/>
- </constraints>
- <fontDescription key="fontDescription" type="system" pointSize="24"/>
- <state key="normal" title="Execute"/>
- <connections>
- <action selector="execute:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Y7t-ah-5za"/>
- </connections>
- </button>
- <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eNd-jh-yrb">
- <rect key="frame" x="16" y="303" width="163.5" height="167"/>
- <connections>
- <outlet property="dataSource" destination="BYZ-38-t0r" id="XZ2-uf-4BE"/>
- <outlet property="delegate" destination="BYZ-38-t0r" id="brP-1Q-rxy"/>
- </connections>
- </pickerView>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Email" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MZv-Jr-rbJ">
- <rect key="frame" x="195.5" y="303" width="163.5" height="42"/>
- <fontDescription key="fontDescription" type="system" pointSize="20"/>
- <nil key="textColor"/>
- <nil key="highlightedColor"/>
- </label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Password" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cJs-WA-Zoh">
- <rect key="frame" x="195.5" y="387" width="163.5" height="41.5"/>
- <fontDescription key="fontDescription" type="system" pointSize="20"/>
- <nil key="textColor"/>
- <nil key="highlightedColor"/>
- </label>
- <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="wEw-yN-DT4">
- <rect key="frame" x="195.5" y="345" width="163.5" height="42"/>
- <nil key="textColor"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
- <textInputTraits key="textInputTraits"/>
- </textField>
- <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="kph-aS-EnS">
- <rect key="frame" x="195.5" y="428.5" width="163.5" height="41.5"/>
- <nil key="textColor"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
- <textInputTraits key="textInputTraits"/>
- </textField>
- <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="p1i-PA-aCy">
- <rect key="frame" x="16" y="128" width="86" height="167"/>
- <connections>
- <outlet property="dataSource" destination="BYZ-38-t0r" id="DRb-wg-dEY"/>
- <outlet property="delegate" destination="BYZ-38-t0r" id="mZd-1x-Tz0"/>
- </connections>
- </pickerView>
+ </scrollView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
- <constraint firstItem="pbc-lK-fyt" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="3/4" constant="-32" id="0zH-Sz-NAW"/>
- <constraint firstItem="lWp-nO-ZaW" firstAttribute="leading" secondItem="f0Y-rP-2xL" secondAttribute="trailing" id="8gd-NX-K1r"/>
- <constraint firstItem="cJs-WA-Zoh" firstAttribute="top" secondItem="wEw-yN-DT4" secondAttribute="bottom" id="CFl-wo-Ta4"/>
- <constraint firstItem="kph-aS-EnS" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="DqA-5n-kgu"/>
- <constraint firstItem="pbc-lK-fyt" firstAttribute="top" secondItem="f0Y-rP-2xL" secondAttribute="bottom" constant="8" id="EfK-6i-xV4"/>
- <constraint firstItem="wEw-yN-DT4" firstAttribute="height" secondItem="cJs-WA-Zoh" secondAttribute="height" id="FgK-9k-ah5"/>
- <constraint firstItem="wEw-yN-DT4" firstAttribute="width" secondItem="cJs-WA-Zoh" secondAttribute="width" id="G1D-hB-bvJ"/>
- <constraint firstItem="MZv-Jr-rbJ" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="1/2" constant="-24" id="GaI-EN-daq"/>
- <constraint firstItem="26Z-WM-zPg" firstAttribute="centerX" secondItem="x6V-xc-ti7" secondAttribute="centerX" id="HuK-J8-Fpz"/>
- <constraint firstItem="eNd-jh-yrb" firstAttribute="top" secondItem="pbc-lK-fyt" secondAttribute="bottom" constant="8" id="LVJ-D1-3Vd"/>
- <constraint firstItem="Dql-K9-Pb8" firstAttribute="centerX" secondItem="lWp-nO-ZaW" secondAttribute="centerX" id="Ne8-Rv-TLV"/>
- <constraint firstItem="f0Y-rP-2xL" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" id="PEc-mF-DfU"/>
- <constraint firstItem="26Z-WM-zPg" firstAttribute="top" secondItem="x6V-xc-ti7" secondAttribute="bottom" id="PvE-LR-R3h"/>
- <constraint firstItem="cJs-WA-Zoh" firstAttribute="height" secondItem="kph-aS-EnS" secondAttribute="height" id="SW6-bi-RqF"/>
- <constraint firstItem="cJs-WA-Zoh" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="SiE-1X-xmu"/>
- <constraint firstItem="p1i-PA-aCy" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="UFI-LW-2pG"/>
- <constraint firstItem="Dql-K9-Pb8" firstAttribute="height" secondItem="lWp-nO-ZaW" secondAttribute="height" id="UFa-1x-biN"/>
- <constraint firstItem="UCG-40-lyD" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="UJ5-Yk-u6Z"/>
- <constraint firstAttribute="trailingMargin" secondItem="lWp-nO-ZaW" secondAttribute="trailing" constant="-20" id="V6f-WE-gEK"/>
- <constraint firstItem="x6V-xc-ti7" firstAttribute="height" secondItem="Dql-K9-Pb8" secondAttribute="height" id="VrF-29-yZ6"/>
- <constraint firstItem="pbc-lK-fyt" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="0.25" id="a0i-ba-sYb"/>
- <constraint firstItem="MZv-Jr-rbJ" firstAttribute="top" secondItem="eNd-jh-yrb" secondAttribute="top" id="aC6-BD-zI0"/>
- <constraint firstItem="x6V-xc-ti7" firstAttribute="centerX" secondItem="Dql-K9-Pb8" secondAttribute="centerX" id="cIk-ax-zhs"/>
- <constraint firstItem="MZv-Jr-rbJ" firstAttribute="width" secondItem="wEw-yN-DT4" secondAttribute="width" id="crF-HH-d4y"/>
- <constraint firstItem="26Z-WM-zPg" firstAttribute="width" secondItem="x6V-xc-ti7" secondAttribute="width" id="evU-m7-CI6"/>
- <constraint firstItem="cJs-WA-Zoh" firstAttribute="width" secondItem="kph-aS-EnS" secondAttribute="width" id="fDS-yd-RnX"/>
- <constraint firstItem="wEw-yN-DT4" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="fLC-np-N5n"/>
- <constraint firstItem="kph-aS-EnS" firstAttribute="top" secondItem="cJs-WA-Zoh" secondAttribute="bottom" id="fQZ-1s-seC"/>
- <constraint firstItem="MZv-Jr-rbJ" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="fuk-vI-lWD"/>
- <constraint firstItem="eNd-jh-yrb" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="1/4" id="gGV-2A-Djo"/>
- <constraint firstItem="x6V-xc-ti7" firstAttribute="width" secondItem="Dql-K9-Pb8" secondAttribute="width" id="gnn-hK-Tev"/>
- <constraint firstItem="MZv-Jr-rbJ" firstAttribute="height" secondItem="wEw-yN-DT4" secondAttribute="height" id="iy8-Im-XOx"/>
- <constraint firstItem="p1i-PA-aCy" firstAttribute="height" secondItem="pbc-lK-fyt" secondAttribute="height" id="kBZ-fH-wyv"/>
- <constraint firstItem="pbc-lK-fyt" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="trailingMargin" id="kPG-I5-PXU"/>
- <constraint firstItem="p1i-PA-aCy" firstAttribute="centerY" secondItem="pbc-lK-fyt" secondAttribute="centerY" id="mYj-of-8sB"/>
- <constraint firstItem="eNd-jh-yrb" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="mvG-uN-2NO"/>
- <constraint firstItem="26Z-WM-zPg" firstAttribute="height" secondItem="x6V-xc-ti7" secondAttribute="height" id="o9Q-eA-Mgg"/>
- <constraint firstItem="pbc-lK-fyt" firstAttribute="leading" secondItem="p1i-PA-aCy" secondAttribute="trailing" constant="8" id="ocO-I3-JB4"/>
- <constraint firstItem="x6V-xc-ti7" firstAttribute="top" secondItem="Dql-K9-Pb8" secondAttribute="bottom" id="p2W-xj-wNc"/>
- <constraint firstItem="wEw-yN-DT4" firstAttribute="top" secondItem="MZv-Jr-rbJ" secondAttribute="bottom" id="p57-vW-AI1"/>
- <constraint firstItem="kph-aS-EnS" firstAttribute="bottom" secondItem="eNd-jh-yrb" secondAttribute="bottom" id="pMo-uD-Ium"/>
- <constraint firstItem="Dql-K9-Pb8" firstAttribute="width" secondItem="lWp-nO-ZaW" secondAttribute="width" id="qIA-Vy-0Ts"/>
- <constraint firstItem="UCG-40-lyD" firstAttribute="top" secondItem="eNd-jh-yrb" secondAttribute="bottom" constant="8" id="qLA-FE-fz7"/>
- <constraint firstItem="lWp-nO-ZaW" firstAttribute="height" secondItem="f0Y-rP-2xL" secondAttribute="height" multiplier="0.25" id="s9E-w5-zQ2"/>
- <constraint firstItem="f0Y-rP-2xL" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" id="sFw-Yh-RRZ"/>
- <constraint firstItem="eNd-jh-yrb" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="1/2" constant="-24" id="sdf-aZ-Z6h"/>
- <constraint firstItem="Dql-K9-Pb8" firstAttribute="top" secondItem="lWp-nO-ZaW" secondAttribute="bottom" id="zo6-AD-yBu"/>
- <constraint firstItem="lWp-nO-ZaW" firstAttribute="top" secondItem="f0Y-rP-2xL" secondAttribute="top" id="ztC-x1-RUf"/>
+ <constraint firstItem="6HK-es-gyf" firstAttribute="bottom" secondItem="wfy-db-euE" secondAttribute="top" id="bTX-8p-mgN"/>
+ <constraint firstItem="6HK-es-gyf" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="cRU-eQ-2SG"/>
+ <constraint firstItem="6HK-es-gyf" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="lgq-Qc-p06"/>
+ <constraint firstAttribute="trailing" secondItem="6HK-es-gyf" secondAttribute="trailing" id="ugY-4G-3fl"/>
</constraints>
</view>
<connections>
- <outlet property="actionPicker" destination="pbc-lK-fyt" id="C5u-X6-0sb"/>
- <outlet property="actionTypePicker" destination="p1i-PA-aCy" id="EXj-7M-WaM"/>
- <outlet property="credentialTypePicker" destination="eNd-jh-yrb" id="J4Z-9q-X2Q"/>
- <outlet property="displayNameLabel" destination="lWp-nO-ZaW" id="4Kn-aZ-lS4"/>
- <outlet property="emailField" destination="wEw-yN-DT4" id="3dQ-Dt-Vev"/>
- <outlet property="emailInputLabel" destination="MZv-Jr-rbJ" id="jFy-DW-9Af"/>
- <outlet property="emailLabel" destination="Dql-K9-Pb8" id="Ap8-hR-VyQ"/>
- <outlet property="passwordField" destination="kph-aS-EnS" id="clH-Ac-p5S"/>
- <outlet property="passwordInputLabel" destination="cJs-WA-Zoh" id="QbJ-ri-FOY"/>
- <outlet property="profileImage" destination="f0Y-rP-2xL" id="Y14-pW-FuW"/>
- <outlet property="providerListLabel" destination="26Z-WM-zPg" id="dJq-hC-Dw8"/>
- <outlet property="userIDLabel" destination="x6V-xc-ti7" id="Cqb-bH-R8C"/>
+ <outlet property="actionPicker" destination="QOn-3b-keq" id="PFo-aS-Wld"/>
+ <outlet property="actionTypePicker" destination="cpy-NT-JJH" id="zve-OZ-Zfa"/>
+ <outlet property="credentialTypePicker" destination="QFf-6f-e46" id="JP6-KS-WlB"/>
+ <outlet property="displayNameLabel" destination="cWW-O4-BEO" id="7Yf-D1-gbW"/>
+ <outlet property="emailField" destination="zIt-Mq-gk3" id="3wb-SN-KxQ"/>
+ <outlet property="emailInputLabel" destination="EQe-sz-7yJ" id="ARJ-Sl-Hy5"/>
+ <outlet property="emailLabel" destination="ObY-8p-vcQ" id="7LH-QE-OZ3"/>
+ <outlet property="passwordField" destination="sTA-Ti-DZm" id="vGb-gH-1BI"/>
+ <outlet property="passwordInputLabel" destination="sTr-Hf-KVD" id="8uU-J5-Y2Z"/>
+ <outlet property="phoneField" destination="gB8-2Z-VH6" id="nUb-F7-u3i"/>
+ <outlet property="profileImage" destination="D0S-Sb-YNu" id="goh-E4-oQW"/>
+ <outlet property="providerListLabel" destination="ria-OG-Nbj" id="j0I-72-FH7"/>
+ <outlet property="scrollView" destination="6HK-es-gyf" id="lA9-BY-R9E"/>
+ <outlet property="userIDLabel" destination="ZxB-fU-vRm" id="eyR-59-0Os"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
diff --git a/AuthSamples/SwiftSample/Sample.entitlements b/AuthSamples/SwiftSample/Sample.entitlements
new file mode 100644
index 0000000..9199dae
--- /dev/null
+++ b/AuthSamples/SwiftSample/Sample.entitlements
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>application-identifier</key>
+ <string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
+ <key>aps-environment</key>
+ <string>development</string>
+</dict>
+</plist>
diff --git a/AuthSamples/SwiftSample/ViewController.swift b/AuthSamples/SwiftSample/ViewController.swift
index 0b7481a..718f6bc 100644
--- a/AuthSamples/SwiftSample/ViewController.swift
+++ b/AuthSamples/SwiftSample/ViewController.swift
@@ -19,7 +19,7 @@ import UIKit
import FirebaseDev // FirebaseAuth
import GoogleSignIn // GoogleSignIn
-final class ViewController: UIViewController {
+final class ViewController: UIViewController, UITextFieldDelegate {
/// The profile image for the currently signed-in user.
@IBOutlet weak var profileImage: UIImageView!
@@ -56,6 +56,15 @@ final class ViewController: UIViewController {
/// The "password" text field.
@IBOutlet weak var passwordField: UITextField!
+ /// The "phone" text field.
+ @IBOutlet weak var phoneField: UITextField!
+
+ /// The scroll view holding all content.
+ @IBOutlet weak var scrollView: UIScrollView!
+
+ // The active keyboard input field.
+ var activeField: UITextField?
+
/// The currently selected action type.
fileprivate var actionType = ActionType(rawValue: 0)! {
didSet {
@@ -86,6 +95,67 @@ final class ViewController: UIViewController {
}
}
+ func registerForKeyboardNotifications() {
+ NotificationCenter.default.addObserver(self,
+ selector:
+ #selector(keyboardWillBeShown(notification:)),
+ name: NSNotification.Name.UIKeyboardWillShow,
+ object: nil)
+ NotificationCenter.default.addObserver(self,
+ selector: #selector(keyboardWillBeHidden(notification:)),
+ name: NSNotification.Name.UIKeyboardWillHide,
+ object: nil)
+ }
+
+ func deregisterFromKeyboardNotifications() {
+ NotificationCenter.default.removeObserver(self,
+ name: NSNotification.Name.UIKeyboardWillShow,
+ object: nil)
+ NotificationCenter.default.removeObserver(self,
+ name: NSNotification.Name.UIKeyboardWillHide,
+ object: nil)
+ }
+
+ func keyboardWillBeShown(notification: NSNotification) {
+ scrollView.isScrollEnabled = true
+ let info = notification.userInfo!
+ let keyboardSize = (info[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue.size
+ let contentInsets : UIEdgeInsets = UIEdgeInsetsMake(0.0, 0.0, keyboardSize!.height, 0.0)
+
+ scrollView.contentInset = contentInsets
+ scrollView.scrollIndicatorInsets = contentInsets
+
+ var aRect = self.view.frame
+ aRect.size.height -= keyboardSize!.height
+ if let activeField = activeField {
+ if (!aRect.contains(activeField.frame.origin)) {
+ scrollView.scrollRectToVisible(activeField.frame, animated: true)
+ }
+ }
+ }
+
+ func keyboardWillBeHidden(notification: NSNotification){
+ let info = notification.userInfo!
+ let keyboardSize = (info[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue.size
+ let contentInsets : UIEdgeInsets = UIEdgeInsetsMake(0.0, 0.0, -keyboardSize!.height, 0.0)
+ scrollView.contentInset = contentInsets
+ scrollView.scrollIndicatorInsets = contentInsets
+ self.view.endEditing(true)
+ scrollView.isScrollEnabled = false
+ }
+
+ func textFieldDidBeginEditing(_ textField: UITextField) {
+ activeField = textField
+ }
+
+ func textFieldDidEndEditing(_ textField: UITextField) {
+ activeField = nil
+ }
+
+ func dismissKeyboard() {
+ view.endEditing(true)
+ }
+
/// The user's photo URL used by the last network request for its contents.
fileprivate var lastPhotoURL: URL? = nil
@@ -96,6 +166,15 @@ final class ViewController: UIViewController {
object: Auth.auth(), queue: nil) { notification in
self.updateUserInfo(notification.object as? Auth)
}
+ phoneField.delegate = self
+ registerForKeyboardNotifications()
+
+ let tap = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
+ scrollView.addGestureRecognizer(tap)
+ }
+
+ override func viewWillDisappear(_ animated: Bool) {
+ deregisterFromKeyboardNotifications()
}
/// Executes the action designated by the operator on the UI.
@@ -200,7 +279,34 @@ final class ViewController: UIViewController {
GIDSignIn.sharedInstance().signIn()
case .password:
completion(EmailAuthProvider.credential(withEmail: emailField.text!,
- password: passwordField.text!))
+ password: passwordField.text!))
+ case .phone:
+ if #available(iOS 8.0, *) {
+ let phoneNumber = phoneField.text
+ PhoneAuthProvider.provider().verifyPhoneNumber(phoneNumber!) { verificationID, error in
+ guard error == nil else {
+ self.showAlert(title: "Error", message: error!.localizedDescription)
+ return
+ }
+
+ let codeAlertController =
+ UIAlertController(title: "Enter Code", message: nil, preferredStyle: .alert)
+ codeAlertController.addTextField { (textfield) in
+ textfield.placeholder = "SMS Codde"
+ textfield.keyboardType = UIKeyboardType.numberPad
+ }
+ codeAlertController.addAction(UIAlertAction(title: "OK",
+ style: .default,
+ handler: { (UIAlertAction) in
+ let code = codeAlertController.textFields!.first!.text!
+ let phoneCredential =
+ PhoneAuthProvider.provider().credential(withVerificationID: verificationID ?? "",
+ verificationCode: code)
+ completion(phoneCredential)
+ }))
+ self.present(codeAlertController, animated: true, completion: nil)
+ }
+ }
}
}
@@ -250,6 +356,7 @@ final class ViewController: UIViewController {
action.requiresPassword
passwordInputLabel.alpha = isPasswordEnabled ? 1.0 : 0.6
passwordField.isEnabled = isPasswordEnabled
+ phoneField.isEnabled = credentialType.requiresPhone
}
fileprivate func showAlert(title: String, message: String? = "") {
@@ -486,11 +593,11 @@ fileprivate enum UserAction: Int, Action {
/// The list of all possible credential types the operator can use to sign in or link.
fileprivate enum CredentialType: Int {
- case google, password
+ case google, password, phone
/// Total number of enum values.
static var count: Int {
- return CredentialType.password.rawValue + 1
+ return CredentialType.phone.rawValue + 1
}
/// The text description for a particular enum value.
@@ -500,6 +607,12 @@ fileprivate enum CredentialType: Int {
return "Google"
case .password:
return "Password ➡️️"
+ case .phone:
+ if #available(iOS 8.0, *) {
+ return "Phone ➡️️"
+ } else {
+ return "-"
+ }
}
}
@@ -512,6 +625,11 @@ fileprivate enum CredentialType: Int {
var requiresPassword : Bool {
return self == .password
}
+
+ /// Whether or not the credential requires phone.
+ var requiresPhone : Bool {
+ return self == .phone
+ }
}
fileprivate extension User {
diff --git a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.h b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.h
index bc12b43..6102822 100644
--- a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.h
+++ b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.h
@@ -16,9 +16,9 @@
#import <Foundation/Foundation.h>
-#import "FIRAuth.h"
#import "FIRAuthSwiftNameSupport.h"
+@class FIRAuth;
@class FIRPhoneAuthCredential;
NS_ASSUME_NONNULL_BEGIN
@@ -38,8 +38,8 @@ typedef void (^FIRVerificationResultCallback)(NSString *_Nullable verificationID
NSError *_Nullable error)
FIR_SWIFT_NAME(VerificationResultCallback);
-/** @class FIRPhoneNumberProvider
- @brief A concrete implementation of @c FIRAuthProvider for Phone Auth Providers.
+/** @class FIRPhoneAuthProvider
+ @brief A concrete implementation of @c FIRAuthProvider for phone auth providers.
*/
FIR_SWIFT_NAME(PhoneAuthProvider)
@interface FIRPhoneAuthProvider : NSObject
@@ -52,7 +52,7 @@ FIR_SWIFT_NAME(PhoneAuthProvider)
/** @fn providerWithAuth:
@brief Returns an instance of @c FIRPhoneAuthProvider for the provided @c FIRAuth object.
- @param auth The auth object to associate with the @c PhoneauthProvider instance.
+ @param auth The auth object to associate with the phone auth provider instance.
*/
+ (instancetype)providerWithAuth:(FIRAuth *)auth FIR_SWIFT_NAME(provider(auth:));
@@ -70,18 +70,18 @@ FIR_SWIFT_NAME(PhoneAuthProvider)
@brief Creates an @c FIRAuthCredential for the phone number provider identified by the
verification ID and verification code.
- @param verificationID The verification ID obtained from invoking @c
+ @param verificationID The verification ID obtained from invoking
verifyPhoneNumber:completion:
@param verificationCode The verification code obtained from the user.
- @return The corresponding @c FIRAuthCredential for the verification ID and verification code
+ @return The corresponding phone auth credential for the verification ID and verification code
provided.
*/
- (FIRPhoneAuthCredential *)credentialWithVerificationID:(NSString *)verificationID
verificationCode:(NSString *)verificationCode;
/** @fn init
- @brief Please use the @c provider or @providerWithAuth: methods to obtain an instance of @c
- FIRPhoneAuthProvider.
+ @brief Please use the @c provider or @c providerWithAuth: methods to obtain an instance of
+ @c FIRPhoneAuthProvider.
*/
- (instancetype)init NS_UNAVAILABLE;
diff --git a/Firebase/Auth/Source/FIRAuth.h b/Firebase/Auth/Source/FIRAuth.h
index b913380..6e59e86 100644
--- a/Firebase/Auth/Source/FIRAuth.h
+++ b/Firebase/Auth/Source/FIRAuth.h
@@ -62,8 +62,8 @@ typedef void(^FIRIDTokenDidChangeListenerBlock)(FIRAuth *auth, FIRUser *_Nullabl
/** @typedef FIRAuthDataResultCallback
@brief The type of block invoked when sign-in related events complete.
- @param authResult Optionally; Result of sign-in request containing @c FIRUser and
- @c FIRAdditionalUserInfo.
+ @param authResult Optionally; Result of sign-in request containing both the user and
+ the additional user info.
@param error Optionally; the error which occurred - or nil if the request was successful.
*/
typedef void (^FIRAuthDataResultCallback)(FIRAuthDataResult *_Nullable authResult,
@@ -151,8 +151,8 @@ typedef void (^FIRApplyActionCodeCallback)(NSError *_Nullable error)
FIR_SWIFT_NAME(ApplyActionCodeCallback);
/**
- @brief Keys used to retrieve operation data from a @c FIRActionCodeInfo object by the @c
- dataForKey method.
+ @brief Keys used to retrieve operation data from a @c FIRActionCodeInfo object by the
+ @c dataForKey method.
*/
typedef NS_ENUM(NSInteger, FIRActionDataKey) {
/**
@@ -598,8 +598,8 @@ FIR_SWIFT_NAME(Auth)
@brief Whether the specific remote notification is handled by @c FIRAuth .
@param userInfo A dictionary that contains information related to the
notification in question.
- @return Whether or the notification is handled. @c YES means the notification is for @c FIRAuth
- so the caller should ignore the notification from further processing, and @c NO means the
+ @return Whether or the notification is handled. YES means the notification is for Firebase Auth
+ so the caller should ignore the notification from further processing, and NO means the
the notification is for the app (or another libaray) so the caller should continue handling
this notification as usual.
@remarks If swizzling is disabled, related remote notifications must be forwarded to this method
diff --git a/Firebase/Auth/Source/FIRAuthErrorUtils.m b/Firebase/Auth/Source/FIRAuthErrorUtils.m
index 8179d02..dbeb5d1 100644
--- a/Firebase/Auth/Source/FIRAuthErrorUtils.m
+++ b/Firebase/Auth/Source/FIRAuthErrorUtils.m
@@ -241,20 +241,20 @@ static NSString *const kFIRAuthErrorMessageInvalidPhoneNumber =
@brief Message for @c FIRAuthErrorCodeMissingVerificationCode error code.
*/
static NSString *const kFIRAuthErrorMessageMissingVerificationCode =
- @"The Phone Auth Credential was created with an empty SMS verification Code.";
+ @"The phone auth credential was created with an empty SMS verification Code.";
/** @var kFIRAuthErrorMessageInvalidVerificationCode
@brief Message for @c FIRAuthErrorCodeInvalidVerificationCode error code.
*/
static NSString *const kFIRAuthErrorMessageInvalidVerificationCode =
@"The SMS verification code used to create the phone auth credential is invalid. Please resend "
- "the verification code sms and be sure use the verification code provided by the user.";
+ "the verification code SMS and be sure to use the verification code provided by the user.";
/** @var kFIRAuthErrorMessageMissingVerificationID
@brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code.
*/
static NSString *const kFIRAuthErrorMessageMissingVerificationID =
- @"The Phone Auth Credential was created with an empty verification ID.";
+ @"The phone auth credential was created with an empty verification ID.";
/** @var kFIRAuthErrorMessageInvalidVerificationID
@brief Message for @c FIRAuthErrorCodeInvalidVerificationID error code.
@@ -280,13 +280,14 @@ static NSString *const kFIRAuthErrorMessageMissingAppCredential = @"The phone ve
@brief Message for @c FIRAuthErrorCodeInvalidAppCredential error code.
*/
static NSString *const kFIRAuthErrorMessageInvalidAppCredential = @"The APNs device token provided "
- "may be incorrect or does not match the private certificate uploaded to the Firebase Console.";
+ "is either incorrect or does not match the private certificate uploaded to the Firebase "
+ "Console.";
/** @var kFIRAuthErrorMessageQuotaExceeded
@brief Message for @c FIRAuthErrorCodeQuotaExceeded error code.
*/
-static NSString *const kFIRAuthErrorMessageQuotaExceeded = @"The SMS quota for this project has "
- "been exceeded.";
+static NSString *const kFIRAuthErrorMessageQuotaExceeded = @"The phone verification quota for this "
+ "project has been exceeded.";
/** @var kFIRAuthErrorMessageMissingAppToken
@brief Message for @c FIRAuthErrorCodeMissingAppToken error code.
diff --git a/Firebase/Auth/Source/FIRAuthErrors.h b/Firebase/Auth/Source/FIRAuthErrors.h
index c1e7900..8a35ff5 100644
--- a/Firebase/Auth/Source/FIRAuthErrors.h
+++ b/Firebase/Auth/Source/FIRAuthErrors.h
@@ -128,8 +128,8 @@ typedef NS_ENUM(NSInteger, FIRAuthErrorCode) {
FIRAuthErrorCodeInvalidUserToken = 17017,
/** Indicates a network error occurred (such as a timeout, interrupted connection, or
- unreachable host). These types of errors are often recoverable with a retry. The @c
- NSUnderlyingError field in the @c NSError.userInfo dictionary will contain the error
+ unreachable host). These types of errors are often recoverable with a retry. The
+ @c NSUnderlyingError field in the @c NSError.userInfo dictionary will contain the error
encountered.
*/
FIRAuthErrorCodeNetworkError = 17020,
@@ -187,13 +187,13 @@ typedef NS_ENUM(NSInteger, FIRAuthErrorCode) {
// The enum values between 17033 and 17041 are reserved and should NOT be used for new error
// codes.
- /** Indicates that a phone number was not provided in a call to @c
- verifyPhoneNumber:completion:.
+ /** Indicates that a phone number was not provided in a call to
+ @c verifyPhoneNumber:completion:.
*/
FIRAuthErrorCodeMissingPhoneNumber = 17041,
- /** Indicates that an invalid phone number was provided in a call to @c
- verifyPhoneNumber:completion:.
+ /** Indicates that an invalid phone number was provided in a call to
+ @c verifyPhoneNumber:completion:.
*/
FIRAuthErrorCodeInvalidPhoneNumber = 17042,