From f7ba6aa346f0b8eabdacc46596765bd199eb4bb0 Mon Sep 17 00:00:00 2001 From: fpavkovic Date: Wed, 27 Mar 2024 15:52:09 +0100 Subject: [PATCH] first commit --- .gitignore | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.txt | 1 + README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ init.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 162 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100755 init.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7665a2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,58 @@ +# ignore common tempfiles +*~ + +# Folder view configuration files +.DS_Store +Desktop.ini + +# Thumbnail cache files +._* +Thumbs.db + +# Files that might appear on external disks +.Spotlight-V100 +.Trashes + +# Xcode ingores +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ +*.xccheckout +profile +*.moved-aside +DerivedData +*.hmap +*.ipa + +# Carthage ignores +# binaries +**/Carthage/Build/ +# external sources +**/Carthage/Checkouts/ +# XCFramework binaries +**/XCFramework/ + +# gradle ignores +.gradle/ +# eclipse related +.settings/ +.project + +# local ignores +repo/ + +# SPM ignores +**/Package.resolved + + +# Ignore credentials +**/Credentials.swift + +# end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..989eb08 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1 @@ +Copyright (C) 2013 - 2024 WebID Solutions GmbH | www.webid-solutions.de. All Rights Reserved diff --git a/README.md b/README.md new file mode 100644 index 0000000..2767a6d --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# MetaPlugin Demo iOS + +This project is a small example for how to implement the WebID Meta-Plugin. +The code of the used project is described with several comments on how to implement. + +## Tutorial + +Generate `Credentials.swift` file +```bash +./init.sh +``` + +To start the plugin inside this demo project, open the Credentials.swift file. +You will find a class.
+You should have been supplied with a username and an api-key for your environment. +Replace the placeholders in the Credentials class.
+ + +In order to run a video-ident process, you will need to create it first outside of the app. +From the process creation request to the server, you should have received an action-id, consisting of 9 numbers. +Insert this number in the Credentials class, by replacing the placeholder string with the action-id as a string.
+ +After that, start the demo app on an iOS device.
+Press the main button on the Main screen to start the plugin during runtime. + + +## Fastened Tutorial + +
    +
  1. Replace placeholder strings in Credentials.swift
  2. +
  3. Create process via mobile api
  4. +
  5. Replace placeholder string of action-id with action-id from process-creation response
  6. +
  7. Start plugin
  8. +
  9. Click main button of the Main Screen to start the plugin
  10. +
+ + +## Theming (Optional) + +The implemented version of the plugin in this project supports customized theming.
+To implement or experiment with different themes, navigate to the file CustomizedPluginTheme.swift and change the return value of the getLightVersion method.
+E.G. + +``` +internal static func getLightVersion() -> WebidAppTheme { + WebidAppTheme( + Background: UIColor.blue, + PrimaryColor: UI.Color.cyan + ) +} +``` + +Consult the theming guide to see what items can be manipulated.
+To change the Dark mode theming, change the getDarkVersion() method as well. diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..ab6f99d --- /dev/null +++ b/init.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +#set -euxo pipefail +set -euo pipefail + +# +# EXIT CODES +############ +DEFAULT_REQ_TOOL_EXIT_CODE=1 +DEFAULT_ARG_ERROR_EXIT_CODE=2 +DEFAULT_MAIN_ERROR_EXIT_CODE=10 + +# Define the file path +FILE_PATH="${BASH_SOURCE%/*}/MetaPluginDemo/Credentials.swift" + +# remove filename +TARGET_DIRECTORY="${FILE_PATH%/*}" + +mkdir -p "$TARGET_DIRECTORY" + +# Check if the file does not exist +if [[ ! -f $FILE_PATH ]]; then + # The file does not exist, create it with the specified content using a here document + cat << 'EOF' > "$FILE_PATH" +/* + * Created by WebID Solutions GmbH | www.webid-solutions.de. + * See the file "LICENSE" for the full license governing this code. + */ + + +import Foundation + +class Credentials { + + static let demoUsernameTest: String = "your demo user name for test" + static let demoApiKeyTest: String = "your demo api key for test" + + static let demoUsernameProduction: String = "your demo user name for production" + static let demoApiKeyProduction: String = "your demo api key for production" + + static let actionId: String = "your action-id here" + + static let environment : EWebIDEnv.WebIDEnv = EWebIDEnv.TEST +} + +EOF +else + echo "The file already exists." +fi