Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔄 synced file(s) with circlefin/w3s-ios-sample-app-wallets-internal #16

Merged
Merged
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
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, Circle Technologies, LLC. All rights reserved.
Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.

This file is licensed to you 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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@

END OF TERMS AND CONDITIONS

© Circle Technologies, LLC 2023. All rights reserved.
© 2024, Circle Internet Financial, LTD. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,17 @@ $ brew
![image](readme_images/screenshot_4.png)
- Set the `endPoint` in the `ContentView.swift`
- Set the `appId` in the `ContentView.swift`

5. (Optional) SSO configs setup
- If you want to use SSO for test , please change the flag `addSSOSignInView` value to *true* in the `w3s_ios_sample_app_walletsApp.swift`
![image](readme_images/screenshot_5.png)

Just set up the SSO you want to use below:
- [Apple] Update the App's Bundle Identifier to yours
![image](readme_images/screenshot_6.png)
- [Google] Update `Info.plist` file to add your OAuth client ID and a custom URL scheme based on the reversed client ID.
Reference: [Get started with Google Sign-In for iOS](https://developers.google.com/identity/sign-in/ios/start-integrating#configure_app_project)
![image](readme_images/screenshot_7.png)
- [Facebook] Replace the *APP-ID*, *CLIENT-TOKEN* and *APP-NAME* of `Info.plist` with your Facebook application configurations.
Reference: [Facebook Login for iOS - Quickstart](https://developers.facebook.com/docs/facebook-login/ios/#4--configure-your-project)
![image](readme_images/screenshot_8.png)
16 changes: 14 additions & 2 deletions Sample App/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Copyright (c) 2023, Circle Technologies, LLC. All rights reserved.
# Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,16 +20,26 @@ platform :ios, '13.0'

target 'w3s-ios-sample-app-wallets' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks! :linkage => :static
use_frameworks!

# Applicable before CircleProgrammableWalletSDK version 1.0.12
# use_frameworks! :linkage => :static

pod 'CircleProgrammableWalletSDK'

# SSO SDK
pod 'GoogleSignIn'
pod 'FBSDKLoginKit'

end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'

# See this: https://developer.apple.com/forums/thread/725300
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
58 changes: 58 additions & 0 deletions Sample App/w3s-ios-sample-app-wallets.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
B3BEDEDF2A5064E800861533 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3BEDEDD2A5064E800861533 /* ContentView.swift */; };
B3BEDEE62A50651700861533 /* UserDefault.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3BEDEE32A50651700861533 /* UserDefault.swift */; };
B3BEDEE82A50651700861533 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3BEDEE52A50651700861533 /* Toast.swift */; };
BA285C102B625BD600F317EF /* ToggleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA285C0F2B625BD600F317EF /* ToggleType.swift */; };
BADB71432B4E7E43000AA7ED /* GoogleAuthViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BADB71422B4E7E43000AA7ED /* GoogleAuthViewModel.swift */; };
BADB71452B4E90AF000AA7ED /* SSOSignInView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BADB71442B4E90AF000AA7ED /* SSOSignInView.swift */; };
BADB71472B4FD11B000AA7ED /* AppleAuthViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BADB71462B4FD11B000AA7ED /* AppleAuthViewModel.swift */; };
BADB714A2B54DDF7000AA7ED /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BADB71492B54DDF7000AA7ED /* AppDelegate.swift */; };
BADB714C2B54E33B000AA7ED /* FacebookAuthViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BADB714B2B54E33B000AA7ED /* FacebookAuthViewModel.swift */; };
BAE182562AF36AD3004D6494 /* ChallengeResultView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE182552AF36AD3004D6494 /* ChallengeResultView.swift */; };
/* End PBXBuildFile section */

Expand All @@ -32,6 +38,14 @@
B3BEDEDD2A5064E800861533 /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
B3BEDEE32A50651700861533 /* UserDefault.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDefault.swift; sourceTree = "<group>"; };
B3BEDEE52A50651700861533 /* Toast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = "<group>"; };
BA285C0F2B625BD600F317EF /* ToggleType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToggleType.swift; sourceTree = "<group>"; };
BADB713D2B4E7567000AA7ED /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BADB71422B4E7E43000AA7ED /* GoogleAuthViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoogleAuthViewModel.swift; sourceTree = "<group>"; };
BADB71442B4E90AF000AA7ED /* SSOSignInView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSOSignInView.swift; sourceTree = "<group>"; };
BADB71462B4FD11B000AA7ED /* AppleAuthViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleAuthViewModel.swift; sourceTree = "<group>"; };
BADB71482B4FD2A4000AA7ED /* w3s-ios-sample-app-wallets.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "w3s-ios-sample-app-wallets.entitlements"; sourceTree = "<group>"; };
BADB71492B54DDF7000AA7ED /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
BADB714B2B54E33B000AA7ED /* FacebookAuthViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FacebookAuthViewModel.swift; sourceTree = "<group>"; };
BAE182552AF36AD3004D6494 /* ChallengeResultView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChallengeResultView.swift; sourceTree = "<group>"; };
ED19DFB9C55BB7A8A6609DD9 /* Pods-w3s-ios-sample-app-wallets.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-w3s-ios-sample-app-wallets.release.xcconfig"; path = "Target Support Files/Pods-w3s-ios-sample-app-wallets/Pods-w3s-ios-sample-app-wallets.release.xcconfig"; sourceTree = "<group>"; };
F095FAC15E5990E5728EEDA8 /* Pods_w3s_ios_sample_app_wallets.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_w3s_ios_sample_app_wallets.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -87,11 +101,15 @@
B3BEDECD2A50648300861533 /* w3s-ios-sample-app-wallets */ = {
isa = PBXGroup;
children = (
BADB71482B4FD2A4000AA7ED /* w3s-ios-sample-app-wallets.entitlements */,
BADB71412B4E7E23000AA7ED /* ViewModels */,
B3CD172C2A5DA09D000664EA /* Resources */,
BADB71492B54DDF7000AA7ED /* AppDelegate.swift */,
B3BEDECE2A50648300861533 /* w3s_ios_sample_app_walletsApp.swift */,
B3BEDEDD2A5064E800861533 /* ContentView.swift */,
BAE182552AF36AD3004D6494 /* ChallengeResultView.swift */,
B3BEDEDC2A5064E800861533 /* WalletSdkAdapter.swift */,
BADB71442B4E90AF000AA7ED /* SSOSignInView.swift */,
B3BEDEE22A50651700861533 /* Helpers */,
B3BEDED42A50648400861533 /* Preview Content */,
);
Expand All @@ -111,6 +129,7 @@
children = (
B3BEDEE32A50651700861533 /* UserDefault.swift */,
B3BEDEE52A50651700861533 /* Toast.swift */,
BA285C0F2B625BD600F317EF /* ToggleType.swift */,
);
path = Helpers;
sourceTree = "<group>";
Expand All @@ -121,10 +140,21 @@
B3A66CE62A5B03F200FB0B2E /* Assets.xcassets */,
B369BA8F2A8BF600007DEC09 /* CirclePWLocalizable.strings */,
B369BA8E2A8BF600007DEC09 /* CirclePWTheme.json */,
BADB713D2B4E7567000AA7ED /* Info.plist */,
);
path = Resources;
sourceTree = "<group>";
};
BADB71412B4E7E23000AA7ED /* ViewModels */ = {
isa = PBXGroup;
children = (
BADB71462B4FD11B000AA7ED /* AppleAuthViewModel.swift */,
BADB71422B4E7E43000AA7ED /* GoogleAuthViewModel.swift */,
BADB714B2B54E33B000AA7ED /* FacebookAuthViewModel.swift */,
);
path = ViewModels;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -137,6 +167,7 @@
B3BEDEC82A50648300861533 /* Frameworks */,
B3BEDEC92A50648300861533 /* Resources */,
A6C197F8D8C91907C988C29B /* [CP] Copy Pods Resources */,
402E39960CFD6974237CA94E /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -195,6 +226,23 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
402E39960CFD6974237CA94E /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-w3s-ios-sample-app-wallets/Pods-w3s-ios-sample-app-wallets-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-w3s-ios-sample-app-wallets/Pods-w3s-ios-sample-app-wallets-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-w3s-ios-sample-app-wallets/Pods-w3s-ios-sample-app-wallets-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
A6C197F8D8C91907C988C29B /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -241,12 +289,18 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BADB71472B4FD11B000AA7ED /* AppleAuthViewModel.swift in Sources */,
BADB714C2B54E33B000AA7ED /* FacebookAuthViewModel.swift in Sources */,
B3BEDEE82A50651700861533 /* Toast.swift in Sources */,
B3BEDEE62A50651700861533 /* UserDefault.swift in Sources */,
B3BEDECF2A50648300861533 /* w3s_ios_sample_app_walletsApp.swift in Sources */,
B3BEDEDE2A5064E800861533 /* WalletSdkAdapter.swift in Sources */,
BADB71432B4E7E43000AA7ED /* GoogleAuthViewModel.swift in Sources */,
B3BEDEDF2A5064E800861533 /* ContentView.swift in Sources */,
BADB71452B4E90AF000AA7ED /* SSOSignInView.swift in Sources */,
BADB714A2B54DDF7000AA7ED /* AppDelegate.swift in Sources */,
BAE182562AF36AD3004D6494 /* ChallengeResultView.swift in Sources */,
BA285C102B625BD600F317EF /* ToggleType.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -373,12 +427,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "w3s-ios-sample-app-wallets/w3s-ios-sample-app-wallets.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"w3s-ios-sample-app-wallets/Preview Content\"";
DEVELOPMENT_TEAM = 6R3336A52L;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "w3s-ios-sample-app-wallets/Resources/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "w3s-ios-sample";
INFOPLIST_KEY_NSFaceIDUsageDescription = "Enable Biometrics PIN";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down Expand Up @@ -406,12 +462,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "w3s-ios-sample-app-wallets/w3s-ios-sample-app-wallets.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"w3s-ios-sample-app-wallets/Preview Content\"";
DEVELOPMENT_TEAM = 6R3336A52L;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "w3s-ios-sample-app-wallets/Resources/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "w3s-ios-sample";
INFOPLIST_KEY_NSFaceIDUsageDescription = "Enable Biometrics PIN";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
Expand Down
45 changes: 45 additions & 0 deletions Sample App/w3s-ios-sample-app-wallets/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
// 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 GoogleSignIn
import FBSDKLoginKit

class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return addSSOSignInView ?
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions) : true
}

func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
guard addSSOSignInView else {
return false
}

if GIDSignIn.sharedInstance.handle(url) {
return true
}

if ApplicationDelegate.shared.application(app, open: url, options: options) {
return true
}

return false
}
}
15 changes: 12 additions & 3 deletions Sample App/w3s-ios-sample-app-wallets/ChallengeResultView.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
// Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
//
// ChallengeResultView.swift
// w3s-ios-sample-app-wallets
// SPDX-License-Identifier: Apache-2.0
//
// Created by CIRCLE on 2023/11/1.
// 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 CircleProgrammableWalletSDK
Expand Down
Loading
Loading