Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Copyright 2025 Google LLC
//
// 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 SwiftUI
import FirebaseAuth

enum AuthProvider: CaseIterable {
case google
case facebook
case twitter
case github
case email
case phone
case anonymous
case microsoft
case yahoo
case apple

var id: String {
switch self {
case .google: return GoogleAuthProvider.id
case .facebook: return FacebookAuthProvider.id
case .twitter: return TwitterAuthProvider.id
case .github: return GitHubAuthProvider.id
case .email: return EmailAuthProvider.id
case .phone: return PhoneAuthProvider.id
case .anonymous: return "anonymous"
case .microsoft: return "microsoft.com"
case .yahoo: return "yahoo.com"
case .apple: return "apple.com"
}
}

var buttonTitle: String {
switch self {
case .google:
return "Sign in with Google"
case .facebook:
return "Sign in with Facebook"
case .twitter:
return "Sign in with Twitter"
case .github:
return "Sign in with GitHub"
case .email:
return "Sign in with Email"
case .phone:
return "Sign in with Phone"
case .anonymous:
return "Sign in Anonymously"
case .microsoft:
return "Sign in with Microsoft"
case .yahoo:
return "Sign in with Yahoo"
case .apple:
return "Sign in with Apple"
}
}

var isSocialProvider: Bool {
switch self {
case .google, .facebook, .twitter, .github:
return true
default:
return false
}
}

static func from(id: String) -> AuthProvider? {
Self.allCases.first { $0.id == id }
}

var providerStyle: ProviderStyle {
switch self {
case .google:
return ProviderStyle(
icon: .fuiIcGoogleg,
backgroundColor: Color(hex: 0xFFFFFF),
contentColor: Color(hex: 0x757575)
)
case .facebook:
return ProviderStyle(
icon: .fuiIcFacebook,
backgroundColor: Color(hex: 0x3B5998),
contentColor: Color(hex: 0xFFFFFF)
)
case .twitter:
return ProviderStyle(
icon: .fuiIcTwitterBird,
backgroundColor: Color(hex: 0x5BAAF4),
contentColor: Color(hex: 0xFFFFFF)
)
case .github:
return ProviderStyle(
icon: .fuiIcGithub,
backgroundColor: Color(hex: 0x24292E),
contentColor: Color(hex: 0xFFFFFF)
)
case .email:
return ProviderStyle(
icon: .fuiIcMail,
backgroundColor: Color(hex: 0xD0021B),
contentColor: Color(hex: 0xFFFFFF)
)
case .phone:
return ProviderStyle(
icon: .fuiIcPhone,
backgroundColor: Color(hex: 0x43C5A5),
contentColor: Color(hex: 0xFFFFFF)
)
case .anonymous:
return ProviderStyle(
icon: .fuiIcAnonymous,
backgroundColor: Color(hex: 0xF4B400),
contentColor: Color(hex: 0xFFFFFF)
)
case .microsoft:
return ProviderStyle(
icon: .fuiIcMicrosoft,
backgroundColor: Color(hex: 0x2F2F2F),
contentColor: Color(hex: 0xFFFFFF)
)
case .yahoo:
return ProviderStyle(
icon: .fuiIcYahoo,
backgroundColor: Color(hex: 0x720E9E),
contentColor: Color(hex: 0xFFFFFF)
)
case .apple:
return ProviderStyle(
icon: .fuiIcApple,
backgroundColor: Color(hex: 0x000000),
contentColor: Color(hex: 0xFFFFFF)
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2025 Google LLC
//
// 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 SwiftUI

extension Color {
init(hex: Int, opacity: Double = 1.0) {
let red = Double((hex & 0xFF0000) >> 16) / 255.0
let green = Double((hex & 0xFF00) >> 8) / 255.0
let blue = Double((hex & 0xFF) >> 0) / 255.0
self.init(.sRGB, red: red, green: green, blue: blue, opacity: opacity)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "firebase_auth_120dp 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "firebase_auth_120dp 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "firebase_auth_120dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "fui_ic_anonymous_white_24dp 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fui_ic_anonymous_white_24dp 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fui_ic_anonymous_white_24dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "fui_ic_apple_white_24dp 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fui_ic_apple_white_24dp 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fui_ic_apple_white_24dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "fui_ic_facebook_white_22dp 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fui_ic_facebook_white_22dp 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fui_ic_facebook_white_22dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "fui_ic_github_white_24dp 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fui_ic_github_white_24dp 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fui_ic_github_white_24dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "fui_ic_googleg_color_24dp 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fui_ic_googleg_color_24dp 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fui_ic_googleg_color_24dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "fui_ic_mail_white_24dp 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "fui_ic_mail_white_24dp 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "fui_ic_mail_white_24dp.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading