Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
/.build
/.index-build
/Packages
/*.xcodeproj
xcuserdata/
Expand Down
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/amplify-ui-swift-liveness.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions AmplifyUILiveness.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Pod::Spec.new do |s|
s.name = 'AmplifyUILiveness'
s.version = '1.0.0'
s.summary = 'AWS Amplify UI Liveness module'
s.homepage = 'https://github.com/aws-amplify/amplify-ui-swift-liveness'
s.license = { :type => 'Apache 2.0', :file => 'LICENSE' }
s.author = { 'AWS Amplify' => '[email protected]' }
s.source = { :git => 'https://github.com/aws-amplify/amplify-ui-swift-liveness.git', :branch => 'main' }
s.ios.deployment_target = '13.0'
s.source_files = 'Sources/**/*.{swift,h,m}'
s.swift_version = '5.0'
end
21 changes: 21 additions & 0 deletions HostApp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#amplify-do-not-edit-begin
amplify/\#current-cloud-backend
amplify/.config/local-*
amplify/logs
amplify/mock-data
amplify/mock-api-resources
amplify/backend/amplify-meta.json
amplify/backend/.temp
build/
dist/
node_modules/
aws-exports.js
awsconfiguration.json
amplifyconfiguration.json
amplifyconfiguration.dart
amplify-build-config.json
amplify-gradle-config.json
amplifytools.xcconfig
.secret-*
**.sample
#amplify-do-not-edit-end
30 changes: 28 additions & 2 deletions HostApp/HostApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
87BCB9652D67C0A40055559D /* CredsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87BCB9642D67C09D0055559D /* CredsProvider.swift */; };
90236C77299D6D41009FD1A7 /* HostAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90236C76299D6D40009FD1A7 /* HostAppApp.swift */; };
90493F822992D64000CFE674 /* LivenessResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90493F812992D64000CFE674 /* LivenessResult.swift */; };
904CC73D2996E650002E0753 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 904CC73C2996E650002E0753 /* RootView.swift */; };
Expand Down Expand Up @@ -54,6 +55,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
87BCB9642D67C09D0055559D /* CredsProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredsProvider.swift; sourceTree = "<group>"; };
900129D4298ACA9100AE3524 /* HostApp.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HostApp.entitlements; sourceTree = "<group>"; };
90236C76299D6D40009FD1A7 /* HostAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostAppApp.swift; sourceTree = "<group>"; };
90493F812992D64000CFE674 /* LivenessResult.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LivenessResult.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -131,6 +133,7 @@
9070FFBD285112B5009867D5 /* HostAppUITests */,
9070FFA1285112B4009867D5 /* Products */,
90215EED291E9FB60050F2AD /* Frameworks */,
A5A9AF5054D0FF13505B212A /* AmplifyConfig */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -179,6 +182,7 @@
909308C8297DC4CA00F3CC6E /* Views */ = {
isa = PBXGroup;
children = (
87BCB9642D67C09D0055559D /* CredsProvider.swift */,
904CC73C2996E650002E0753 /* RootView.swift */,
906AB82329E9F48C007FFC81 /* StartSessionView.swift */,
906AB82B29EA0BFD007FFC81 /* StartSessionViewModel.swift */,
Expand Down Expand Up @@ -213,6 +217,13 @@
path = Model;
sourceTree = "<group>";
};
A5A9AF5054D0FF13505B212A /* AmplifyConfig */ = {
isa = PBXGroup;
children = (
);
name = AmplifyConfig;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -307,6 +318,9 @@
Base,
);
mainGroup = 9070FF97285112B4009867D5;
packageReferences = (
8704823D2D6CE3FE00DF249F /* XCRemoteSwiftPackageReference "amplify-ui-swift-liveness" */,
);
productRefGroup = 9070FFA1285112B4009867D5 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -353,6 +367,7 @@
files = (
906AB82829EA04B5007FFC81 /* ExampleLivenessViewModel.swift in Sources */,
906AB83029EA0DC5007FFC81 /* LivenessResultContentView+Result.swift in Sources */,
87BCB9652D67C0A40055559D /* CredsProvider.swift in Sources */,
909308CD297DC4E700F3CC6E /* UIColor+Hex.swift in Sources */,
90493F822992D64000CFE674 /* LivenessResult.swift in Sources */,
906AB82229E9F432007FFC81 /* View+Background.swift in Sources */,
Expand Down Expand Up @@ -526,7 +541,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"HostApp/Preview Content\"";
DEVELOPMENT_TEAM = W3DRXD72QU;
DEVELOPMENT_TEAM = RP2SA7L4ZN;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = HostApp/Info.plist;
Expand Down Expand Up @@ -560,7 +575,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"HostApp/Preview Content\"";
DEVELOPMENT_TEAM = W3DRXD72QU;
DEVELOPMENT_TEAM = RP2SA7L4ZN;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = HostApp/Info.plist;
Expand Down Expand Up @@ -701,6 +716,17 @@
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
8704823D2D6CE3FE00DF249F /* XCRemoteSwiftPackageReference "amplify-ui-swift-liveness" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/aws-amplify/amplify-ui-swift-liveness";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.3.4;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
973619212BA378200003A590 /* FaceLiveness */ = {
isa = XCSwiftPackageProductDependency;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion HostApp/HostApp/HostAppApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct HostAppApp: App {
let auth = AWSCognitoAuthPlugin()
let api = AWSAPIPlugin()
try Amplify.add(plugin: auth)
try Amplify.add(plugin: api)
//try Amplify.add(plugin: api)
try Amplify.configure()
} catch {
print("Error configuring Amplify", error)
Expand Down
22 changes: 22 additions & 0 deletions HostApp/HostApp/Views/CredsProvider.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// CredsProvider.swift
// HostApp
//
// Created by victor julio on 20/02/25.
//

//import Amplify
//import AWSPluginsCore
//import AwsCommonRuntimeKit
//
//
//struct CredsProvider: AWSCredentialsProvider {
// func fetchAWSCredentials() async throws -> AWSCredentials {
// // Fetch the credentials
// let provider = try CredentialsProvider(source: .static(accessKey: accessKey,
// secret: secret,
// sessionToken: sessionToken))
// return provider
//
// }
//}
23 changes: 15 additions & 8 deletions HostApp/HostApp/Views/ExampleLivenessViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@ class ExampleLivenessViewModel: ObservableObject {
}

func fetchLivenessResult() async throws -> LivenessResultContentView.Result {
let request = RESTRequest(
apiName: "liveness",
path: "/liveness/\(sessionID)"
)

let data = try await Amplify.API.get(request: request)
let result = try JSONDecoder().decode(LivenessResult.self, from: data)
let score = LivenessResultContentView.Result(livenessResult: result)
guard let url = URL(string: "https://c18b-181-236-137-100.ngrok-free.app/liveness/result/\(sessionID)") else {
throw URLError(.badURL)
}

// Configura la petición GET
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

// Realiza la llamada asíncrona al endpoint
let (data, _) = try await URLSession.shared.data(for: request)

// Decodifica la respuesta en el modelo LivenessResultContentView.Result
let livenessResult = try JSONDecoder().decode(LivenessResult.self, from: data)
let score = LivenessResultContentView.Result(livenessResult: livenessResult)
return score
}

Expand Down
2 changes: 1 addition & 1 deletion HostApp/HostApp/Views/StartSessionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct StartSessionView: View {
showAlert = err != nil
}
},
enabled: viewModel.isSignedIn
enabled: true
)
.alert(isPresented: $showAlert) {
Alert(
Expand Down
Loading
Loading