Skip to content

Commit b95f5e6

Browse files
Add github login to demo app (#702)
1 parent 52be88a commit b95f5e6

File tree

4 files changed

+57
-11
lines changed

4 files changed

+57
-11
lines changed

samples/objc/FirebaseUI-demo-objc.xcodeproj/project.pbxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
896400F7222F583100CEF7D7 /* mssymbol.png in Resources */ = {isa = PBXBuildFile; fileRef = 896400F6222F583100CEF7D7 /* mssymbol.png */; };
1111
89B822042256838500CEF7D7 /* twtrsymbol.png in Resources */ = {isa = PBXBuildFile; fileRef = 89B822032256838500CEF7D7 /* twtrsymbol.png */; };
12+
89D6278022AB14FD00CEF7D7 /* githubsymbol.png in Resources */ = {isa = PBXBuildFile; fileRef = 89D6277F22AB14FD00CEF7D7 /* githubsymbol.png */; };
1213
8D7D5DC11D9D9536006C1857 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8D7D5DC01D9D9536006C1857 /* GoogleService-Info.plist */; };
1314
8D7F86B51D9DAA0100C2A122 /* FUIStorageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7F86B41D9DAA0100C2A122 /* FUIStorageViewController.m */; };
1415
C30AEB0A1ED610740084E328 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C30AEB071ED610740084E328 /* Main.storyboard */; };
@@ -42,6 +43,7 @@
4243
/* Begin PBXFileReference section */
4344
896400F6222F583100CEF7D7 /* mssymbol.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mssymbol.png; sourceTree = "<group>"; };
4445
89B822032256838500CEF7D7 /* twtrsymbol.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = twtrsymbol.png; sourceTree = "<group>"; };
46+
89D6277F22AB14FD00CEF7D7 /* githubsymbol.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = githubsymbol.png; sourceTree = "<group>"; };
4547
8D7D5DC01D9D9536006C1857 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
4648
8D7F86B31D9DAA0100C2A122 /* FUIStorageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FUIStorageViewController.h; path = Storage/FUIStorageViewController.h; sourceTree = "<group>"; };
4749
8D7F86B41D9DAA0100C2A122 /* FUIStorageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FUIStorageViewController.m; path = Storage/FUIStorageViewController.m; sourceTree = "<group>"; };
@@ -195,6 +197,7 @@
195197
896400F5222F580400CEF7D7 /* Resources */ = {
196198
isa = PBXGroup;
197199
children = (
200+
89D6277F22AB14FD00CEF7D7 /* githubsymbol.png */,
198201
89B822032256838500CEF7D7 /* twtrsymbol.png */,
199202
896400F6222F583100CEF7D7 /* mssymbol.png */,
200203
);
@@ -368,6 +371,7 @@
368371
developmentRegion = English;
369372
hasScannedForEncodings = 0;
370373
knownRegions = (
374+
English,
371375
en,
372376
ar,
373377
"zh-Hans",
@@ -469,6 +473,7 @@
469473
buildActionMask = 2147483647;
470474
files = (
471475
C3A8B7C21DAF073400CDF0ED /* FUICustomPasswordSignInViewController.xib in Resources */,
476+
89D6278022AB14FD00CEF7D7 /* githubsymbol.png in Resources */,
472477
896400F7222F583100CEF7D7 /* mssymbol.png in Resources */,
473478
C30AEB0B1ED610780084E328 /* Localizable.strings in Resources */,
474479
C30AEB0A1ED610740084E328 /* Main.storyboard in Resources */,

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

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="7RW-VL-qNI">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="7RW-VL-qNI">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1010
</dependencies>
1111
<scenes>
@@ -346,19 +346,36 @@
346346
</subviews>
347347
</tableViewCellContentView>
348348
</tableViewCell>
349+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" textLabel="Jeg-DB-qq2" style="IBUITableViewCellStyleDefault" id="cjf-Li-LSE">
350+
<rect key="frame" x="0.0" y="551.5" width="375" height="44"/>
351+
<autoresizingMask key="autoresizingMask"/>
352+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="cjf-Li-LSE" id="Xgi-wv-3p0">
353+
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
354+
<autoresizingMask key="autoresizingMask"/>
355+
<subviews>
356+
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="GitHub" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Jeg-DB-qq2">
357+
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
358+
<autoresizingMask key="autoresizingMask"/>
359+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
360+
<nil key="textColor"/>
361+
<nil key="highlightedColor"/>
362+
</label>
363+
</subviews>
364+
</tableViewCellContentView>
365+
</tableViewCell>
349366
</cells>
350367
</tableViewSection>
351368
<tableViewSection headerTitle="Sign In Anonymously" id="81M-Ya-hwv">
352369
<cells>
353370
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" indentationWidth="10" textLabel="WOn-MV-deD" style="IBUITableViewCellStyleDefault" id="5W7-Jx-Eqe">
354-
<rect key="frame" x="0.0" y="607.5" width="375" height="44"/>
371+
<rect key="frame" x="0.0" y="651.5" width="375" height="44"/>
355372
<autoresizingMask key="autoresizingMask"/>
356373
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5W7-Jx-Eqe" id="xMI-90-b7h">
357374
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
358375
<autoresizingMask key="autoresizingMask"/>
359376
<subviews>
360377
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Anonymous Sign In" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="WOn-MV-deD">
361-
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
378+
<rect key="frame" x="15" y="0.0" width="345" height="43.5"/>
362379
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
363380
<fontDescription key="fontDescription" type="system" pointSize="16"/>
364381
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -372,7 +389,7 @@
372389
<tableViewSection headerTitle="Name" id="0YA-IY-hOV">
373390
<cells>
374391
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="kCl-ip-jc2">
375-
<rect key="frame" x="0.0" y="707.5" width="375" height="44"/>
392+
<rect key="frame" x="0.0" y="751.5" width="375" height="44"/>
376393
<autoresizingMask key="autoresizingMask"/>
377394
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="kCl-ip-jc2" id="dm4-D7-IWN">
378395
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
@@ -384,7 +401,7 @@
384401
<tableViewSection headerTitle="Email" id="Y94-bQ-cWH">
385402
<cells>
386403
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="MCw-zF-UTn">
387-
<rect key="frame" x="0.0" y="807.5" width="375" height="44"/>
404+
<rect key="frame" x="0.0" y="851.5" width="375" height="44"/>
388405
<autoresizingMask key="autoresizingMask"/>
389406
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="MCw-zF-UTn" id="ea1-oT-1Py">
390407
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
@@ -396,7 +413,7 @@
396413
<tableViewSection headerTitle="Phone number" id="F6q-xI-bQc">
397414
<cells>
398415
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="qvP-WR-vZC">
399-
<rect key="frame" x="0.0" y="907.5" width="375" height="44"/>
416+
<rect key="frame" x="0.0" y="951.5" width="375" height="44"/>
400417
<autoresizingMask key="autoresizingMask"/>
401418
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="qvP-WR-vZC" id="s8s-Ko-B7y">
402419
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
@@ -408,7 +425,7 @@
408425
<tableViewSection headerTitle="UID" id="Yxe-jV-t3o">
409426
<cells>
410427
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" id="EWm-GE-IZV">
411-
<rect key="frame" x="0.0" y="1007.5" width="375" height="44"/>
428+
<rect key="frame" x="0.0" y="1051.5" width="375" height="44"/>
412429
<autoresizingMask key="autoresizingMask"/>
413430
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="EWm-GE-IZV" id="ISG-G9-H8V">
414431
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
@@ -420,7 +437,7 @@
420437
<tableViewSection headerTitle="Provider Access Token" id="E31-4c-QDa">
421438
<cells>
422439
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" textLabel="k9f-GH-UBQ" style="IBUITableViewCellStyleDefault" id="mdj-SS-dqJ">
423-
<rect key="frame" x="0.0" y="1107.5" width="375" height="44"/>
440+
<rect key="frame" x="0.0" y="1151.5" width="375" height="44"/>
424441
<autoresizingMask key="autoresizingMask"/>
425442
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="mdj-SS-dqJ" id="oCT-Ra-9l7">
426443
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
@@ -441,7 +458,7 @@
441458
<tableViewSection headerTitle="Provider ID Token" id="GaU-wa-aFK">
442459
<cells>
443460
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" textLabel="M61-v5-jhZ" style="IBUITableViewCellStyleDefault" id="b45-X5-eC9">
444-
<rect key="frame" x="0.0" y="1207.5" width="375" height="44"/>
461+
<rect key="frame" x="0.0" y="1251.5" width="375" height="44"/>
445462
<autoresizingMask key="autoresizingMask"/>
446463
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="b45-X5-eC9" id="ofC-qT-5cz">
447464
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
1.53 KB
Loading

samples/objc/FirebaseUI-demo-objc/Samples/Auth/FUIAuthViewController.m

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
kIDPTwitter,
4545
kIDPPhone,
4646
kIDPAnonymous,
47-
kIDPMicrosoft
47+
kIDPMicrosoft,
48+
kIDPGitHub,
4849
};
4950

5051
static NSString *const kFirebaseTermsOfService = @"https://firebase.google.com/terms/";
@@ -126,6 +127,10 @@ - (void)viewDidLoad {
126127
inSection:kSectionsProviders]
127128
animated:NO
128129
scrollPosition:UITableViewScrollPositionNone];
130+
[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:kIDPGitHub
131+
inSection:kSectionsProviders]
132+
animated:NO
133+
scrollPosition:UITableViewScrollPositionNone];
129134
}
130135

131136
- (void)viewWillAppear:(BOOL)animated {
@@ -451,6 +456,25 @@ + (NSArray *)getListOfIDPs:(NSArray<NSIndexPath *> *)selectedRows
451456
loginHintKey:@"login_hint"];
452457
}
453458
break;
459+
case kIDPGitHub:
460+
{
461+
UIColor *buttonColor = [UIColor colorWithRed:.2 green:.2 blue:.2 alpha:1.0];
462+
NSString *iconPath = [[NSBundle mainBundle] pathForResource:@"githubsymbol"
463+
ofType:@"png"];
464+
if (!iconPath) {
465+
NSLog(@"Warning: Unable to find GitHub icon.");
466+
}
467+
provider = [[FUIOAuth alloc] initWithAuthUI:[FUIAuth defaultAuthUI]
468+
providerID:@"github.com"
469+
buttonLabelText:@"Sign in with GitHub"
470+
shortName:@"GitHub"
471+
buttonColor:buttonColor
472+
iconImage:[UIImage imageWithContentsOfFile:iconPath]
473+
scopes:nil
474+
customParameters:nil
475+
loginHintKey:nil];
476+
}
477+
break;
454478
default:
455479
break;
456480
}

0 commit comments

Comments
 (0)