Skip to content

Commit 1ffbd9d

Browse files
committed
Add Facebook Limited Login to Swift demo app.
1 parent 18f04f6 commit 1ffbd9d

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

samples/swift/FirebaseUI-demo-swift/Resources/Main.storyboard

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="jBB-7b-HHb">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="jBB-7b-HHb">
33
<device id="retina4_7" orientation="portrait" appearance="light"/>
44
<dependencies>
55
<deployment identifier="iOS"/>
6-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15703"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
7+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
78
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
89
</dependencies>
910
<scenes>
@@ -21,7 +22,7 @@
2122
<subviews>
2223
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="60" sectionHeaderHeight="1" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="EMf-5k-tRY">
2324
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
24-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
25+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
2526
<prototypes>
2627
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="SamplesViewControllerCell" id="mwf-Pe-7Xw" customClass="SampleCell" customModule="FirebaseUI_demo_swift">
2728
<rect key="frame" x="0.0" y="28" width="375" height="60"/>
@@ -31,13 +32,13 @@
3132
<autoresizingMask key="autoresizingMask"/>
3233
<subviews>
3334
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalCompressionResistancePriority="999" text="Subtitle" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="g6W-Ri-8K4">
34-
<rect key="frame" x="15" y="41" width="345" height="0.0"/>
35+
<rect key="frame" x="16" y="41" width="343" height="0.0"/>
3536
<fontDescription key="fontDescription" type="system" weight="light" pointSize="12"/>
3637
<nil key="textColor"/>
3738
<nil key="highlightedColor"/>
3839
</label>
3940
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="1000" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BZB-4J-Sp6">
40-
<rect key="frame" x="15" y="19" width="345" height="14"/>
41+
<rect key="frame" x="16" y="19" width="343" height="14"/>
4142
<fontDescription key="fontDescription" type="system" pointSize="17"/>
4243
<nil key="textColor"/>
4344
<nil key="highlightedColor"/>
@@ -61,7 +62,7 @@
6162
</prototypes>
6263
</tableView>
6364
</subviews>
64-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
65+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
6566
<constraints>
6667
<constraint firstItem="EMf-5k-tRY" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="7h5-Xl-YsU"/>
6768
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="EMf-5k-tRY" secondAttribute="bottom" id="rqn-rQ-uLD"/>
@@ -151,7 +152,7 @@
151152
<fontDescription key="fontDescription" type="system" pointSize="14"/>
152153
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
153154
</textView>
154-
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="999" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dNa-u5-dnp">
155+
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="999" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dNa-u5-dnp">
155156
<rect key="frame" x="331" y="0.0" width="36" height="30"/>
156157
<state key="normal" title="Send"/>
157158
</button>
@@ -197,7 +198,7 @@
197198
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" allowsMultipleSelection="YES" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="1" id="inr-RJ-pbo">
198199
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
199200
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
200-
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
201+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
201202
<sections>
202203
<tableViewSection headerTitle="Settings" id="0Pr-Kf-qkL">
203204
<cells>
@@ -313,6 +314,17 @@
313314
<nil key="textColor"/>
314315
<nil key="highlightedColor"/>
315316
</label>
317+
<label opaque="NO" userInteractionEnabled="NO" alpha="0.80000000000000004" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Limited" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="acU-fh-9rC" userLabel="Limited">
318+
<rect key="frame" x="244" y="11.5" width="48" height="21"/>
319+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
320+
<fontDescription key="fontDescription" type="system" pointSize="12"/>
321+
<nil key="textColor"/>
322+
<nil key="highlightedColor"/>
323+
</label>
324+
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ySC-ib-kGl" userLabel="Facebook Switch">
325+
<rect key="frame" x="310" y="6.5" width="49" height="31"/>
326+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
327+
</switch>
316328
</subviews>
317329
</tableViewCellContentView>
318330
</tableViewCell>
@@ -508,6 +520,7 @@
508520
<outlet property="cellUid" destination="S6s-Qd-Z3i" id="exG-YI-qfx"/>
509521
<outlet property="customAuthorizationSwitch" destination="VRw-wD-ISl" id="yWY-Tz-wLP"/>
510522
<outlet property="customScopesSwitch" destination="S27-fl-DfX" id="XkZ-5Z-dXj"/>
523+
<outlet property="facebookSwitch" destination="ySC-ib-kGl" id="uiE-zS-pv1"/>
511524
</connections>
512525
</tableViewController>
513526
<placeholder placeholderIdentifier="IBFirstResponder" id="24p-6G-GD4" userLabel="First Responder" sceneMemberID="firstResponder"/>
@@ -534,7 +547,7 @@
534547
<fontDescription key="fontDescription" type="system" pointSize="14"/>
535548
<textInputTraits key="textInputTraits" returnKeyType="done"/>
536549
</textField>
537-
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="500" horizontalCompressionResistancePriority="1000" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kgm-uQ-qTg">
550+
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="500" horizontalCompressionResistancePriority="1000" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kgm-uQ-qTg">
538551
<rect key="frame" x="325" y="16" width="34" height="30"/>
539552
<state key="normal" title="Load"/>
540553
<connections>
@@ -597,4 +610,9 @@
597610
<point key="canvasLocation" x="334" y="1023"/>
598611
</scene>
599612
</scenes>
613+
<resources>
614+
<systemColor name="systemBackgroundColor">
615+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
616+
</systemColor>
617+
</resources>
600618
</document>

samples/swift/FirebaseUI-demo-swift/Samples/Auth/FUIAuthViewController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class FUIAuthViewController: UITableViewController {
7474
@IBOutlet weak var authorizationButton: UIBarButtonItem!
7575
@IBOutlet weak var customAuthorizationSwitch: UISwitch!
7676
@IBOutlet weak var customScopesSwitch: UISwitch!
77+
@IBOutlet weak var facebookSwitch: UISwitch!
7778

7879

7980
override func viewDidLoad() {
@@ -313,6 +314,8 @@ class FUIAuthViewController: UITableViewController {
313314
"user_friends",
314315
"ads_read"])
315316
: FUIFacebookAuth(authUI: self.authUI!)
317+
let facebookProvider = provider as! FUIFacebookAuth
318+
facebookProvider.useLimitedLogin = self.facebookSwitch.isOn
316319
case Providers.Apple.rawValue:
317320
if #available(iOS 13.0, *) {
318321
provider = FUIOAuth.appleAuthProvider()

0 commit comments

Comments
 (0)