Skip to content

Commit

Permalink
Updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
borut-t committed Jun 5, 2024
1 parent 096945c commit 47afb12
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
63 changes: 46 additions & 17 deletions Demo/PovioKitAuthDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
990EB5A12BEDF02B00EFA308 /* PovioKitAuthDemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 990EB5A02BEDF02B00EFA308 /* PovioKitAuthDemoApp.swift */; };
990EB5A12BEDF02B00EFA308 /* DemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 990EB5A02BEDF02B00EFA308 /* DemoApp.swift */; };
990EB5A32BEDF02B00EFA308 /* SignInView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 990EB5A22BEDF02B00EFA308 /* SignInView.swift */; };
990EB5A52BEDF02D00EFA308 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 990EB5A42BEDF02D00EFA308 /* Assets.xcassets */; };
990EB5A92BEDF02D00EFA308 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 990EB5A82BEDF02D00EFA308 /* Preview Assets.xcassets */; };
Expand All @@ -18,11 +18,12 @@
9964BD0B2BEDF2810065CBC2 /* PovioKitAuthFacebook in Frameworks */ = {isa = PBXBuildFile; productRef = 9964BD0A2BEDF2810065CBC2 /* PovioKitAuthFacebook */; };
9964BD0D2BEDF2810065CBC2 /* PovioKitAuthGoogle in Frameworks */ = {isa = PBXBuildFile; productRef = 9964BD0C2BEDF2810065CBC2 /* PovioKitAuthGoogle */; };
9964BD0F2BEDF2810065CBC2 /* PovioKitAuthLinkedIn in Frameworks */ = {isa = PBXBuildFile; productRef = 9964BD0E2BEDF2810065CBC2 /* PovioKitAuthLinkedIn */; };
999C56EB2C046BF50093AD37 /* PovioKitCore in Frameworks */ = {isa = PBXBuildFile; productRef = 999C56EA2C046BF50093AD37 /* PovioKitCore */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
990EB59D2BEDF02B00EFA308 /* PovioKitAuthDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PovioKitAuthDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
990EB5A02BEDF02B00EFA308 /* PovioKitAuthDemoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PovioKitAuthDemoApp.swift; sourceTree = "<group>"; };
990EB5A02BEDF02B00EFA308 /* DemoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoApp.swift; sourceTree = "<group>"; };
990EB5A22BEDF02B00EFA308 /* SignInView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInView.swift; sourceTree = "<group>"; };
990EB5A42BEDF02D00EFA308 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
990EB5A62BEDF02D00EFA308 /* PovioKitAuthDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PovioKitAuthDemo.entitlements; sourceTree = "<group>"; };
Expand All @@ -40,6 +41,7 @@
9964BD072BEDF2810065CBC2 /* PovioKitAuthApple in Frameworks */,
9964BD0F2BEDF2810065CBC2 /* PovioKitAuthLinkedIn in Frameworks */,
9964BD0D2BEDF2810065CBC2 /* PovioKitAuthGoogle in Frameworks */,
999C56EB2C046BF50093AD37 /* PovioKitCore in Frameworks */,
9964BD0B2BEDF2810065CBC2 /* PovioKitAuthFacebook in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -68,7 +70,7 @@
990EB59F2BEDF02B00EFA308 /* PovioKitAuthDemo */ = {
isa = PBXGroup;
children = (
990EB5A02BEDF02B00EFA308 /* PovioKitAuthDemoApp.swift */,
990EB5A02BEDF02B00EFA308 /* DemoApp.swift */,
990EB5A22BEDF02B00EFA308 /* SignInView.swift */,
9964BCFE2BEDF1180065CBC2 /* SignInViewModel.swift */,
990EB5A42BEDF02D00EFA308 /* Assets.xcassets */,
Expand Down Expand Up @@ -123,6 +125,7 @@
9964BD0A2BEDF2810065CBC2 /* PovioKitAuthFacebook */,
9964BD0C2BEDF2810065CBC2 /* PovioKitAuthGoogle */,
9964BD0E2BEDF2810065CBC2 /* PovioKitAuthLinkedIn */,
999C56EA2C046BF50093AD37 /* PovioKitCore */,
);
productName = PovioKitAuthDemo;
productReference = 990EB59D2BEDF02B00EFA308 /* PovioKitAuthDemo.app */;
Expand All @@ -136,7 +139,8 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1530;
LastUpgradeCheck = 1530;
LastUpgradeCheck = 1540;
ORGANIZATIONNAME = "Povio Inc.";
TargetAttributes = {
990EB59C2BEDF02B00EFA308 = {
CreatedOnToolsVersion = 15.3;
Expand All @@ -152,6 +156,9 @@
Base,
);
mainGroup = 990EB5942BEDF02B00EFA308;
packageReferences = (
999C56E92C046BF50093AD37 /* XCRemoteSwiftPackageReference "PovioKit" */,
);
productRefGroup = 990EB59E2BEDF02B00EFA308 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -180,7 +187,7 @@
buildActionMask = 2147483647;
files = (
990EB5A32BEDF02B00EFA308 /* SignInView.swift in Sources */,
990EB5A12BEDF02B00EFA308 /* PovioKitAuthDemoApp.swift in Sources */,
990EB5A12BEDF02B00EFA308 /* DemoApp.swift in Sources */,
9964BCFF2BEDF1180065CBC2 /* SignInViewModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -222,6 +229,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -283,6 +291,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -310,6 +319,7 @@
CODE_SIGN_ENTITLEMENTS = PovioKitAuthDemo/PovioKitAuthDemo.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"PovioKitAuthDemo/Preview Content\"";
DEVELOPMENT_TEAM = 7G58AP3AJX;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -323,20 +333,21 @@
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.povio.poviokitauth.demo.PovioKitAuthDemo;
PRODUCT_BUNDLE_IDENTIFIER = com.povio.poviokitauth.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
Expand All @@ -348,6 +359,7 @@
CODE_SIGN_ENTITLEMENTS = PovioKitAuthDemo/PovioKitAuthDemo.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"PovioKitAuthDemo/Preview Content\"";
DEVELOPMENT_TEAM = 7G58AP3AJX;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -361,20 +373,21 @@
"INFOPLIST_KEY_UILaunchScreen_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphoneos*]" = UIStatusBarStyleDefault;
"INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.4;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.povio.poviokitauth.demo.PovioKitAuthDemo;
PRODUCT_BUNDLE_IDENTIFIER = com.povio.poviokitauth.demo;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
Expand All @@ -401,6 +414,17 @@
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
999C56E92C046BF50093AD37 /* XCRemoteSwiftPackageReference "PovioKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/poviolabs/PovioKit";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 4.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
9964BD062BEDF2810065CBC2 /* PovioKitAuthApple */ = {
isa = XCSwiftPackageProductDependency;
Expand All @@ -422,6 +446,11 @@
isa = XCSwiftPackageProductDependency;
productName = PovioKitAuthLinkedIn;
};
999C56EA2C046BF50093AD37 /* PovioKitCore */ = {
isa = XCSwiftPackageProductDependency;
package = 999C56E92C046BF50093AD37 /* XCRemoteSwiftPackageReference "PovioKit" */;
productName = PovioKitCore;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 990EB5952BEDF02B00EFA308 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/poviolabs/PovioKit",
"state" : {
"revision" : "95371aebca733fa67be58c0239e12a97d1fcf163",
"version" : "3.3.1"
"revision" : "96fa97cffa12ff644f10008133da062bec463ff8",
"version" : "4.0.0"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
//
// PovioKitAuthDemoApp.swift
// DemoApp.swift
// PovioKitAuthDemo
//
// Created by Borut Tomazin on 10/05/2024.
// Copyright © 2024 Povio Inc. All rights reserved.
//

import SwiftUI

@main
struct PovioKitAuthDemoApp: App {
struct DemoApp: App {
var body: some Scene {
WindowGroup {
SignInView(viewModel: .init())
Expand Down
9 changes: 7 additions & 2 deletions Demo/PovioKitAuthDemo/SignInView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
// PovioKitAuthDemo
//
// Created by Borut Tomazin on 10/05/2024.
// Copyright © 2024 Povio Inc. All rights reserved.
//

import SwiftUI

struct SignInView: View {
@ObservedObject var viewModel: SignInViewModel
let viewModel: SignInViewModel
@State private var showErrorAlert: Bool = false
@State private var showSuccessAlert: Bool = false

var body: some View {
VStack(spacing: 20) {
Expand Down Expand Up @@ -37,12 +39,15 @@ struct SignInView: View {
.onChange(of: viewModel.error) { oldValue, newValue in
showErrorAlert = true
}
.onChange(of: viewModel.success) { oldValue, newValue in
showSuccessAlert = true
}
.alert("Error", isPresented: $showErrorAlert) {
Button("Ok", action: {})
} message: {
Text(viewModel.error)
}
.alert("Success", isPresented: $showErrorAlert) {
.alert("Success", isPresented: $showSuccessAlert) {
Button("Ok", action: {})
} message: {
Text(viewModel.success)
Expand Down
34 changes: 24 additions & 10 deletions Demo/PovioKitAuthDemo/SignInViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
// PovioKitAuthDemo
//
// Created by Borut Tomazin on 10/05/2024.
// Copyright © 2024 Povio Inc. All rights reserved.
//

import UIKit
import SwiftUI
import PovioKitCore
import PovioKitAuthCore
import PovioKitAuthApple
import PovioKitAuthGoogle
import PovioKitAuthFacebook
import PovioKitAuthLinkedIn
import Observation

final class SignInViewModel: ObservableObject {
private var isSigningInWithApple: Bool = false
private var isSigningInWithLinkedIn: Bool = false

@Observable
final class SignInViewModel {
private let socialAuthManager: SocialAuthenticationManager

@Published private(set) var error: String = ""
@Published private(set) var success: String = ""
var error: String = ""
var success: String = ""

init() {
socialAuthManager = SocialAuthenticationManager(authenticators: [
Expand All @@ -37,8 +38,6 @@ extension SignInViewModel {
guard let auth = socialAuthManager.authenticator(for: AppleAuthenticator.self) else { return }

Task { @MainActor in
isSigningInWithApple = true

do {
_ = try await auth.signIn(from: UIViewController())
self.success = "SignIn with Apple succeeded."
Expand All @@ -48,11 +47,10 @@ extension SignInViewModel {
Logger.error(error.localizedDescription)
self.error = error.localizedDescription
}

isSigningInWithApple = false
}
}

// TODO: provide `GoogleService-Info.plist` configuration file
func signInWithGoogle() {
guard let auth = socialAuthManager.authenticator(for: GoogleAuthenticator.self) else { return }

Expand All @@ -69,6 +67,7 @@ extension SignInViewModel {
}
}

// TODO: provide `FacebookAppID` to the `Info.plist`
func signInWithFacebook() {
guard let auth = socialAuthManager.authenticator(for: FacebookAuthenticator.self) else { return }

Expand All @@ -85,7 +84,22 @@ extension SignInViewModel {
}
}

// TODO: provide configuration details
func signInWithLinkedIn() {
guard let auth = socialAuthManager.authenticator(for: LinkedInAuthenticator.self) else { return }

Task { @MainActor in
do {
_ = try await auth.signIn(authCode: "...", configuration: .init(
clientId: "...",
clientSecret: "...",
permissions: "email profile openid offline_access",
redirectUrl: "..."))
self.success = "SignIn with LinkedIn succeeded."
} catch {
Logger.error(error.localizedDescription)
self.error = error.localizedDescription
}
}
}
}

0 comments on commit 47afb12

Please sign in to comment.