Skip to content

Commit

Permalink
The first version of our implemented liveness detection demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
justin200914 committed Apr 14, 2023
1 parent ed87ab0 commit ff6722b
Show file tree
Hide file tree
Showing 62 changed files with 3,323 additions and 0 deletions.
4 changes: 4 additions & 0 deletions FaceLivenessDetection-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "facesdk/facesdk.h"
694 changes: 694 additions & 0 deletions FaceLivenessDetection.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "5B371976-1C96-4648-9E9A-4297DC477197"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "AC1D430A-7658-4F56-9D03-095AFEAC2B34"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "FaceLivenessDetection/SceneDelegate.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1"
endingLineNumber = "1"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>FaceLivenessDetection.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Binary file added FaceLivenessDetection/.DS_Store
Binary file not shown.
70 changes: 70 additions & 0 deletions FaceLivenessDetection/AboutViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import UIKit
import AVFoundation

class AboutViewController: UIViewController{

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}


@IBAction func done_clicked(_ sender: Any) {
if let vc = self.presentingViewController as? ViewController {
self.dismiss(animated: true, completion: nil)
}
}


@IBAction func mail_clicked(_ sender: Any) {
let appURL = URL(string: "mailto:contact@kby-ai.com") // URL scheme for Mail app

if let appURL = appURL, UIApplication.shared.canOpenURL(appURL) {
// If Mail app is installed, open it with a pre-filled email
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
} else {
// If Mail app is not installed, show an alert indicating that Mail app is not available
let alert = UIAlertController(title: "Mail App Not Available", message: "The Mail app is not installed on this device.", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alert.addAction(okAction)
UIApplication.shared.keyWindow?.rootViewController?.present(alert, animated: true, completion: nil)
}
}


@IBAction func skype_clicked(_ sender: Any) {

}

@IBAction func telegram_clicked(_ sender: Any) {
let appURL = URL(string: "tg://resolve?domain=kbyai") // URL scheme for Telegram app

if let appURL = appURL, UIApplication.shared.canOpenURL(appURL) {
// If Telegram app is installed, open it to the "Add Contact" screen
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
} else {
let username = "kbyai"
let telegramURL = URL(string: "https://t.me/\(username)")!
UIApplication.shared.open(telegramURL, options: [:], completionHandler: nil)
}
}

@IBAction func whatsapp_clicked(_ sender: Any) {
let appURL = URL(string: "whatsapp://send?phone=+19092802609") // URL scheme for Telegram app

if let appURL = appURL, UIApplication.shared.canOpenURL(appURL) {
// If Telegram app is installed, open it to the "Add Contact" screen
UIApplication.shared.open(appURL, options: [:], completionHandler: nil)
} else {
let username = "+19092802609"
let telegramURL = URL(string: "https://wa.me/\(username)")!
UIApplication.shared.open(telegramURL, options: [:], completionHandler: nil)
}
}

@IBAction func github_clicked(_ sender: Any) {
let telegramURL = URL(string: "https://github.com/kby-ai")!
UIApplication.shared.open(telegramURL, options: [:], completionHandler: nil)
}
}

75 changes: 75 additions & 0 deletions FaceLivenessDetection/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@

import UIKit
import CoreData

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}

// MARK: - Core Data stack

lazy var persistentContainer: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
application to it. This property is optional since there are legitimate
error conditions that could cause the creation of the store to fail.
*/
let container = NSPersistentContainer(name: "FaceLivenessDetection")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.

/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()

// MARK: - Core Data Saving support

func saveContext () {
let context = persistentContainer.viewContext
if context.hasChanges {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
}
}

}

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,14 @@
{
"images" : [
{
"filename" : "appstore.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"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.
6 changes: 6 additions & 0 deletions FaceLivenessDetection/Assets.xcassets/Contents.json
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,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x8B",
"green" : "0x37",
"red" : "0x4F"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x8B",
"green" : "0x37",
"red" : "0x4F"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.867",
"red" : "0.918"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.867",
"red" : "0.918"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "ic_github.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_github 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_github 2.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" : "ic_kby.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_kby 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_kby 2.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" : "ic_skype.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_skype 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_skype 2.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

0 comments on commit ff6722b

Please sign in to comment.