diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f5ab0991f55b06135fe2c801fef37ed383ea3f3e --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ + +Pods/ + +Ippon Amplify Test.xcworkspace/xcuserdata/ + +Ippon Amplify Test.xcodeproj/xcuserdata/ diff --git a/Ippon Amplify Test.xcodeproj/project.pbxproj b/Ippon Amplify Test.xcodeproj/project.pbxproj index 476229b70e83b429aae4ddffadf96c60f2cdb308..2a73b916584ed28be06a29f75572cc664a1fc8b8 100644 --- a/Ippon Amplify Test.xcodeproj/project.pbxproj +++ b/Ippon Amplify Test.xcodeproj/project.pbxproj @@ -3,27 +3,50 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 51; objects = { /* Begin PBXBuildFile section */ + 10BAC9C912E8DA2BA2488942 /* Pods_Ippon_Amplify_Test.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03D53C6A0F831EE60C174C49 /* Pods_Ippon_Amplify_Test.framework */; }; 71CCFA7023F2A6F500FCB99D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA6F23F2A6F500FCB99D /* AppDelegate.swift */; }; 71CCFA7223F2A6F500FCB99D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA7123F2A6F500FCB99D /* SceneDelegate.swift */; }; - 71CCFA7423F2A6F500FCB99D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA7323F2A6F500FCB99D /* ViewController.swift */; }; 71CCFA7723F2A6F500FCB99D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71CCFA7523F2A6F500FCB99D /* Main.storyboard */; }; 71CCFA7923F2A6F700FCB99D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 71CCFA7823F2A6F700FCB99D /* Assets.xcassets */; }; 71CCFA7C23F2A6F700FCB99D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71CCFA7A23F2A6F700FCB99D /* LaunchScreen.storyboard */; }; + 71CCFA8423F2A7E800FCB99D /* awsconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 71CCFA8323F2A7E800FCB99D /* awsconfiguration.json */; }; + 71CCFA8623F2A80A00FCB99D /* amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 71CCFA8523F2A80A00FCB99D /* amplifyconfiguration.json */; }; + 71CCFA8923F2AD8200FCB99D /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA8823F2AD8200FCB99D /* LoginViewController.swift */; }; + 71CCFA8C23F2B39200FCB99D /* AuthentificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA8B23F2B39200FCB99D /* AuthentificationService.swift */; }; + 71CCFA8E23F2B41100FCB99D /* ForgotPasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA8D23F2B41100FCB99D /* ForgotPasswordViewController.swift */; }; + 71CCFA9023F2B45000FCB99D /* CreateAccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA8F23F2B45000FCB99D /* CreateAccountViewController.swift */; }; + 71CCFA9223F2B4DB00FCB99D /* ChangePasswordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA9123F2B4DB00FCB99D /* ChangePasswordViewController.swift */; }; + 71CCFA9523F415BF00FCB99D /* amplify in Resources */ = {isa = PBXBuildFile; fileRef = 71CCFA9423F415BF00FCB99D /* amplify */; }; + 71CCFA9723F440F400FCB99D /* NewPasswordRequiredViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA9623F440F400FCB99D /* NewPasswordRequiredViewController.swift */; }; + 71CCFA9923F4505900FCB99D /* Storyboarded.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71CCFA9823F4505900FCB99D /* Storyboarded.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 03D53C6A0F831EE60C174C49 /* Pods_Ippon_Amplify_Test.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Ippon_Amplify_Test.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 71CCFA6C23F2A6F500FCB99D /* Ippon Amplify Test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Ippon Amplify Test.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 71CCFA6F23F2A6F500FCB99D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 71CCFA7123F2A6F500FCB99D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; - 71CCFA7323F2A6F500FCB99D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 71CCFA7623F2A6F500FCB99D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; 71CCFA7823F2A6F700FCB99D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 71CCFA7B23F2A6F700FCB99D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 71CCFA7D23F2A6F700FCB99D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 71CCFA8323F2A7E800FCB99D /* awsconfiguration.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = awsconfiguration.json; sourceTree = "<group>"; }; + 71CCFA8523F2A80A00FCB99D /* amplifyconfiguration.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = amplifyconfiguration.json; sourceTree = "<group>"; }; + 71CCFA8823F2AD8200FCB99D /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; }; + 71CCFA8B23F2B39200FCB99D /* AuthentificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthentificationService.swift; sourceTree = "<group>"; }; + 71CCFA8D23F2B41100FCB99D /* ForgotPasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForgotPasswordViewController.swift; sourceTree = "<group>"; }; + 71CCFA8F23F2B45000FCB99D /* CreateAccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateAccountViewController.swift; sourceTree = "<group>"; }; + 71CCFA9123F2B4DB00FCB99D /* ChangePasswordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangePasswordViewController.swift; sourceTree = "<group>"; }; + 71CCFA9323F4158900FCB99D /* amplifyxc.config */ = {isa = PBXFileReference; lastKnownFileType = text; name = amplifyxc.config; path = "/Users/rberthome/Documents/Ippon/Ippon Amplify Test/amplifyxc.config"; sourceTree = "<absolute>"; }; + 71CCFA9423F415BF00FCB99D /* amplify */ = {isa = PBXFileReference; lastKnownFileType = text; path = amplify; sourceTree = "<group>"; }; + 71CCFA9623F440F400FCB99D /* NewPasswordRequiredViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewPasswordRequiredViewController.swift; sourceTree = "<group>"; }; + 71CCFA9823F4505900FCB99D /* Storyboarded.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storyboarded.swift; sourceTree = "<group>"; }; + E16C160004E4BE8C371B4525 /* Pods-Ippon Amplify Test.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Ippon Amplify Test.release.xcconfig"; path = "Target Support Files/Pods-Ippon Amplify Test/Pods-Ippon Amplify Test.release.xcconfig"; sourceTree = "<group>"; }; + F48A5D4C906C5143B33B697A /* Pods-Ippon Amplify Test.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Ippon Amplify Test.debug.xcconfig"; path = "Target Support Files/Pods-Ippon Amplify Test/Pods-Ippon Amplify Test.debug.xcconfig"; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -31,6 +54,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 10BAC9C912E8DA2BA2488942 /* Pods_Ippon_Amplify_Test.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -40,8 +64,14 @@ 71CCFA6323F2A6F500FCB99D = { isa = PBXGroup; children = ( + 71CCFA9423F415BF00FCB99D /* amplify */, + 71CCFA9323F4158900FCB99D /* amplifyxc.config */, + 71CCFA8523F2A80A00FCB99D /* amplifyconfiguration.json */, + 71CCFA8323F2A7E800FCB99D /* awsconfiguration.json */, 71CCFA6E23F2A6F500FCB99D /* Ippon Amplify Test */, 71CCFA6D23F2A6F500FCB99D /* Products */, + 768A61811FF9E5785FC04A7B /* Pods */, + 9E899CA20324E3DA4A4D8FF9 /* Frameworks */, ); sourceTree = "<group>"; }; @@ -56,9 +86,10 @@ 71CCFA6E23F2A6F500FCB99D /* Ippon Amplify Test */ = { isa = PBXGroup; children = ( + 71CCFA8A23F2B37500FCB99D /* Services */, + 71CCFA8723F2AD6800FCB99D /* Controllers */, 71CCFA6F23F2A6F500FCB99D /* AppDelegate.swift */, 71CCFA7123F2A6F500FCB99D /* SceneDelegate.swift */, - 71CCFA7323F2A6F500FCB99D /* ViewController.swift */, 71CCFA7523F2A6F500FCB99D /* Main.storyboard */, 71CCFA7823F2A6F700FCB99D /* Assets.xcassets */, 71CCFA7A23F2A6F700FCB99D /* LaunchScreen.storyboard */, @@ -67,6 +98,44 @@ path = "Ippon Amplify Test"; sourceTree = "<group>"; }; + 71CCFA8723F2AD6800FCB99D /* Controllers */ = { + isa = PBXGroup; + children = ( + 71CCFA8823F2AD8200FCB99D /* LoginViewController.swift */, + 71CCFA8D23F2B41100FCB99D /* ForgotPasswordViewController.swift */, + 71CCFA8F23F2B45000FCB99D /* CreateAccountViewController.swift */, + 71CCFA9123F2B4DB00FCB99D /* ChangePasswordViewController.swift */, + 71CCFA9623F440F400FCB99D /* NewPasswordRequiredViewController.swift */, + 71CCFA9823F4505900FCB99D /* Storyboarded.swift */, + ); + path = Controllers; + sourceTree = "<group>"; + }; + 71CCFA8A23F2B37500FCB99D /* Services */ = { + isa = PBXGroup; + children = ( + 71CCFA8B23F2B39200FCB99D /* AuthentificationService.swift */, + ); + path = Services; + sourceTree = "<group>"; + }; + 768A61811FF9E5785FC04A7B /* Pods */ = { + isa = PBXGroup; + children = ( + F48A5D4C906C5143B33B697A /* Pods-Ippon Amplify Test.debug.xcconfig */, + E16C160004E4BE8C371B4525 /* Pods-Ippon Amplify Test.release.xcconfig */, + ); + path = Pods; + sourceTree = "<group>"; + }; + 9E899CA20324E3DA4A4D8FF9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 03D53C6A0F831EE60C174C49 /* Pods_Ippon_Amplify_Test.framework */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -74,9 +143,11 @@ isa = PBXNativeTarget; buildConfigurationList = 71CCFA8023F2A6F700FCB99D /* Build configuration list for PBXNativeTarget "Ippon Amplify Test" */; buildPhases = ( + 2CA73473423726E648F926EC /* [CP] Check Pods Manifest.lock */, 71CCFA6823F2A6F500FCB99D /* Sources */, 71CCFA6923F2A6F500FCB99D /* Frameworks */, 71CCFA6A23F2A6F500FCB99D /* Resources */, + E8ED83FA47CAE979001A1865 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -125,7 +196,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 71CCFA8423F2A7E800FCB99D /* awsconfiguration.json in Resources */, 71CCFA7C23F2A6F700FCB99D /* LaunchScreen.storyboard in Resources */, + 71CCFA8623F2A80A00FCB99D /* amplifyconfiguration.json in Resources */, + 71CCFA9523F415BF00FCB99D /* amplify in Resources */, 71CCFA7923F2A6F700FCB99D /* Assets.xcassets in Resources */, 71CCFA7723F2A6F500FCB99D /* Main.storyboard in Resources */, ); @@ -133,14 +207,62 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 2CA73473423726E648F926EC /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Ippon Amplify Test-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + E8ED83FA47CAE979001A1865 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Ippon Amplify Test/Pods-Ippon Amplify Test-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Ippon Amplify Test/Pods-Ippon Amplify Test-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Ippon Amplify Test/Pods-Ippon Amplify Test-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 71CCFA6823F2A6F500FCB99D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 71CCFA7423F2A6F500FCB99D /* ViewController.swift in Sources */, + 71CCFA9023F2B45000FCB99D /* CreateAccountViewController.swift in Sources */, + 71CCFA8923F2AD8200FCB99D /* LoginViewController.swift in Sources */, + 71CCFA8E23F2B41100FCB99D /* ForgotPasswordViewController.swift in Sources */, 71CCFA7023F2A6F500FCB99D /* AppDelegate.swift in Sources */, + 71CCFA8C23F2B39200FCB99D /* AuthentificationService.swift in Sources */, + 71CCFA9923F4505900FCB99D /* Storyboarded.swift in Sources */, 71CCFA7223F2A6F500FCB99D /* SceneDelegate.swift in Sources */, + 71CCFA9723F440F400FCB99D /* NewPasswordRequiredViewController.swift in Sources */, + 71CCFA9223F2B4DB00FCB99D /* ChangePasswordViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -282,6 +404,7 @@ }; 71CCFA8123F2A6F700FCB99D /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = F48A5D4C906C5143B33B697A /* Pods-Ippon Amplify Test.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -294,12 +417,13 @@ PRODUCT_BUNDLE_IDENTIFIER = "fr.ippon.amplify.test.Ippon-Amplify-Test"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; 71CCFA8223F2A6F700FCB99D /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = E16C160004E4BE8C371B4525 /* Pods-Ippon Amplify Test.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; @@ -312,7 +436,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "fr.ippon.amplify.test.Ippon-Amplify-Test"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; + TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; diff --git a/Ippon Amplify Test.xcworkspace/contents.xcworkspacedata b/Ippon Amplify Test.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000000000000000000000000000000000..04e3a3b7aebf48b936e18b9be0bf37ea669ad8d2 --- /dev/null +++ b/Ippon Amplify Test.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "group:Ippon Amplify Test.xcodeproj"> + </FileRef> + <FileRef + location = "group:Pods/Pods.xcodeproj"> + </FileRef> +</Workspace> diff --git a/Ippon Amplify Test.xcodeproj/xcuserdata/rberthome.xcuserdatad/xcschemes/xcschememanagement.plist b/Ippon Amplify Test.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 53% rename from Ippon Amplify Test.xcodeproj/xcuserdata/rberthome.xcuserdatad/xcschemes/xcschememanagement.plist rename to Ippon Amplify Test.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist index 03b7d9c220a88f1babc637ed7e4803aeb7e1107d..18d981003d68d0546c4804ac2ff47dd97c6e7921 100644 --- a/Ippon Amplify Test.xcodeproj/xcuserdata/rberthome.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Ippon Amplify Test.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -2,13 +2,7 @@ <!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>Ippon Amplify Test.xcscheme_^#shared#^_</key> - <dict> - <key>orderHint</key> - <integer>0</integer> - </dict> - </dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> </dict> </plist> diff --git a/Ippon Amplify Test/AppDelegate.swift b/Ippon Amplify Test/AppDelegate.swift index f7af7bceb40f252c9ff8117bb44db6e1e5f6e9d2..d369f4226be8cb87fd6b063008594d18bd074185 100644 --- a/Ippon Amplify Test/AppDelegate.swift +++ b/Ippon Amplify Test/AppDelegate.swift @@ -7,6 +7,8 @@ // import UIKit +import AmplifyPlugins +import Amplify @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { @@ -14,6 +16,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + let apiPlugin = AWSAPIPlugin() + try! Amplify.add(plugin: apiPlugin) + try! Amplify.configure() // Override point for customization after application launch. return true } diff --git a/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Contents.json b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..c39ef17aa620c25d0515a97ee5ebe1a646591387 --- /dev/null +++ b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Logo_Ippon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Logo_ippon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Logo_ippon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon.png b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon.png new file mode 100644 index 0000000000000000000000000000000000000000..1e071a106fa3a64477066a4642f9b5a839aa5f04 Binary files /dev/null and b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon.png differ diff --git a/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon@2x.png b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..397fe6920abda97901a766e4a82168f473cccd51 Binary files /dev/null and b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon@2x.png differ diff --git a/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon@3x.png b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..bf54b5bb29a34cfe8c5988bf38e7e6b40678ca00 Binary files /dev/null and b/Ippon Amplify Test/Assets.xcassets/Logo_ippon.imageset/Logo_ippon@3x.png differ diff --git a/Ippon Amplify Test/Assets.xcassets/amplify.imageset/Contents.json b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..4cb7f1777401fbcb8de640496aff7e84cbc43620 --- /dev/null +++ b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "aws-amplify-logo.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "aws-amplify-logo@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "aws-amplify-logo@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo.png b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..793f93bac715a432df63fd667fa6ab3976052236 Binary files /dev/null and b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo.png differ diff --git a/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo@2x.png b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3791c050bdf7ea59577706551ac936de3e69b2b8 Binary files /dev/null and b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo@2x.png differ diff --git a/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo@3x.png b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..bc884a8f9999e4c3eeedfe0218c2bb97e6f63a50 Binary files /dev/null and b/Ippon Amplify Test/Assets.xcassets/amplify.imageset/aws-amplify-logo@3x.png differ diff --git a/Ippon Amplify Test/Base.lproj/LaunchScreen.storyboard b/Ippon Amplify Test/Base.lproj/LaunchScreen.storyboard index 865e9329f3767a7c1dd66294b8025bf81dee7d2c..e5e374150d449e1c8c36f8040e34a8d3df3ec21a 100644 --- a/Ippon Amplify Test/Base.lproj/LaunchScreen.storyboard +++ b/Ippon Amplify Test/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,10 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="Stack View standard spacing" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> @@ -11,9 +13,29 @@ <objects> <viewController id="01J-lp-oVM" sceneMemberID="viewController"> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <subviews> + <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" alignment="center" spacingType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="VP8-ia-OEU"> + <rect key="frame" x="60" y="80" width="294" height="702"/> + <subviews> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" image="Logo_ippon" translatesAutoresizingMaskIntoConstraints="NO" id="jc3-Cn-gCj"> + <rect key="frame" x="0.0" y="0.0" width="294" height="347"/> + </imageView> + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="amplify" translatesAutoresizingMaskIntoConstraints="NO" id="Wru-tj-bpZ"> + <rect key="frame" x="0.0" y="355" width="294" height="347"/> + </imageView> + </subviews> + </stackView> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <constraints> + <constraint firstItem="VP8-ia-OEU" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" constant="80" id="bD6-05-DpI"/> + <constraint firstItem="VP8-ia-OEU" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="doE-zt-DW3"/> + <constraint firstItem="VP8-ia-OEU" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="60" id="nsJ-Ca-BU6"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="VP8-ia-OEU" secondAttribute="bottom" constant="80" id="tRu-qC-IeS"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="VP8-ia-OEU" secondAttribute="trailing" constant="60" id="vEX-3h-JOz"/> + </constraints> <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> </view> </viewController> @@ -22,4 +44,8 @@ <point key="canvasLocation" x="53" y="375"/> </scene> </scenes> + <resources> + <image name="Logo_ippon" width="400" height="157.5"/> + <image name="amplify" width="400" height="400"/> + </resources> </document> diff --git a/Ippon Amplify Test/Base.lproj/Main.storyboard b/Ippon Amplify Test/Base.lproj/Main.storyboard index 25a763858ecdbea5c897a9fd8fa2225d7223d2ad..03c629d9391154aa4d55bba6def53bba5fdfabd4 100644 --- a/Ippon Amplify Test/Base.lproj/Main.storyboard +++ b/Ippon Amplify Test/Base.lproj/Main.storyboard @@ -1,24 +1,318 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="K9d-AP-1Hp"> + <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> - <!--View Controller--> + <!--Navigation Controller--> + <scene sceneID="pNK-aF-OSL"> + <objects> + <navigationController id="K9d-AP-1Hp" sceneMemberID="viewController"> + <navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="TWx-R6-IMk"> + <rect key="frame" x="0.0" y="44" width="414" height="44"/> + <autoresizingMask key="autoresizingMask"/> + </navigationBar> + <connections> + <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="UIj-Pl-jer"/> + </connections> + </navigationController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dj1-QU-v8K" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-893" y="-512"/> + </scene> + <!--Login View Controller--> <scene sceneID="tne-QT-ifu"> <objects> - <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController"> + <viewController id="BYZ-38-t0r" customClass="LoginViewController" customModule="Ippon_Amplify_Test" customModuleProvider="target" sceneMemberID="viewController"> <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <subviews> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Authentification" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6SR-3B-0yf"> + <rect key="frame" x="60" y="330" width="294" height="41"/> + <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="34"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AUr-Kc-es5"> + <rect key="frame" x="60" y="587" width="294" height="30"/> + <state key="normal" title="Login"/> + <connections> + <action selector="loginButtonTapped:" destination="BYZ-38-t0r" eventType="touchUpInside" id="fc6-L2-p93"/> + </connections> + </button> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Login" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="fRx-en-68H"> + <rect key="frame" x="20" y="431" width="374" height="34"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits"/> + </textField> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="PRQ-uo-sHj"> + <rect key="frame" x="20" y="473" width="374" height="34"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="password"/> + </textField> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bIf-eh-vXg"> + <rect key="frame" x="80" y="840" width="254" height="30"/> + <state key="normal" title="Create account"/> + <connections> + <segue destination="BqF-Q5-eKR" kind="show" identifier="gotoCreateAccount" id="91Q-Zp-w5o"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5OD-g8-ngs"> + <rect key="frame" x="80" y="802" width="254" height="30"/> + <state key="normal" title="Forgot password"/> + <connections> + <segue destination="BJl-LU-N3B" kind="show" identifier="gotoForgotPassword" id="zWp-WO-heY"/> + </connections> + </button> + <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="15W-vd-9g5"> + <rect key="frame" x="20" y="515" width="374" height="20.5"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + <activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="jbh-B8-lG7"> + <rect key="frame" x="197" y="592" width="20" height="20"/> + </activityIndicatorView> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <constraints> + <constraint firstItem="AUr-Kc-es5" firstAttribute="top" secondItem="PRQ-uo-sHj" secondAttribute="bottom" constant="80" id="4p8-U4-6IB"/> + <constraint firstItem="bIf-eh-vXg" firstAttribute="top" secondItem="5OD-g8-ngs" secondAttribute="bottom" constant="8" id="54u-WX-7R2"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="bIf-eh-vXg" secondAttribute="trailing" constant="80" id="DNh-4d-ZMa"/> + <constraint firstItem="jbh-B8-lG7" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="EXR-JX-Mq7"/> + <constraint firstItem="fRx-en-68H" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="FOP-wp-5SP"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="AUr-Kc-es5" secondAttribute="trailing" constant="60" id="JHl-tL-eur"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="5OD-g8-ngs" secondAttribute="trailing" constant="80" id="KJz-7d-1xK"/> + <constraint firstItem="bIf-eh-vXg" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="80" id="KUW-BZ-hf7"/> + <constraint firstItem="AUr-Kc-es5" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="60" id="MbV-N4-6ye"/> + <constraint firstItem="jbh-B8-lG7" firstAttribute="centerY" secondItem="AUr-Kc-es5" secondAttribute="centerY" id="QQa-fr-6go"/> + <constraint firstItem="6SR-3B-0yf" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="60" id="XVw-Cs-0St"/> + <constraint firstItem="5OD-g8-ngs" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="80" id="Z0O-sQ-Xsh"/> + <constraint firstItem="15W-vd-9g5" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="eMx-uD-nNn"/> + <constraint firstItem="bIf-eh-vXg" firstAttribute="bottom" secondItem="6Tk-OE-BBY" secondAttribute="bottom" constant="8" id="fgd-M8-Cj1"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="fRx-en-68H" secondAttribute="trailing" constant="20" id="gRM-lp-Dda"/> + <constraint firstItem="15W-vd-9g5" firstAttribute="top" secondItem="PRQ-uo-sHj" secondAttribute="bottom" constant="8" id="hke-OP-Q1v"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="6SR-3B-0yf" secondAttribute="trailing" constant="60" id="ibf-A0-2CQ"/> + <constraint firstItem="fRx-en-68H" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="mVK-Jg-atk"/> + <constraint firstItem="PRQ-uo-sHj" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="ofC-cf-spy"/> + <constraint firstItem="PRQ-uo-sHj" firstAttribute="top" secondItem="fRx-en-68H" secondAttribute="bottom" constant="8" id="rEC-5k-N00"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="PRQ-uo-sHj" secondAttribute="trailing" constant="20" id="rMv-wy-ODL"/> + <constraint firstItem="fRx-en-68H" firstAttribute="top" secondItem="6SR-3B-0yf" secondAttribute="bottom" priority="250" constant="60" id="usL-BM-Izk"/> + <constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="15W-vd-9g5" secondAttribute="trailing" constant="20" id="zmx-p2-HEW"/> + </constraints> <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> </view> + <navigationItem key="navigationItem" id="USu-EO-JVx"/> + <connections> + <outlet property="createAccountButton" destination="bIf-eh-vXg" id="uo1-wK-dcS"/> + <outlet property="errorMessageLabel" destination="15W-vd-9g5" id="EsE-g3-EQy"/> + <outlet property="forgotPasswordButton" destination="5OD-g8-ngs" id="slA-ax-F9G"/> + <outlet property="loginActivityIndicator" destination="jbh-B8-lG7" id="2WL-CN-pi6"/> + <outlet property="loginButton" destination="AUr-Kc-es5" id="vJQ-QZ-5ad"/> + <outlet property="loginTextField" destination="fRx-en-68H" id="Gen-VQ-hYe"/> + <outlet property="passwordTextField" destination="PRQ-uo-sHj" id="UR6-rZ-9Hk"/> + </connections> </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> </objects> + <point key="canvasLocation" x="-74" y="-512"/> + </scene> + <!--Create Account View Controller--> + <scene sceneID="mtj-Dm-mkc"> + <objects> + <viewController storyboardIdentifier="CreateAccountViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="BqF-Q5-eKR" customClass="CreateAccountViewController" customModule="Ippon_Amplify_Test" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="f2e-lb-Ahh"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <viewLayoutGuide key="safeArea" id="Rmj-WK-deC"/> + </view> + <navigationItem key="navigationItem" id="jWm-1J-87G"/> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="DVu-WP-fGg" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="843" y="-512"/> + </scene> + <!--Forgot Password View Controller--> + <scene sceneID="Hc2-ec-dUG"> + <objects> + <viewController storyboardIdentifier="ForgotPasswordViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="BJl-LU-N3B" customClass="ForgotPasswordViewController" customModule="Ippon_Amplify_Test" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="hdK-mC-6oh"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <viewLayoutGuide key="safeArea" id="u71-aZ-2t9"/> + </view> + <navigationItem key="navigationItem" id="USJ-3v-5Yo"/> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="gKL-S0-5b3" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="842" y="218"/> + </scene> + <!--Change Password View Controller--> + <scene sceneID="7ez-88-Vto"> + <objects> + <viewController storyboardIdentifier="ChangePasswordViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="Q2i-e2-18I" customClass="ChangePasswordViewController" customModule="Ippon_Amplify_Test" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="QAV-HF-l2k"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="fmD-2F-N03"> + <rect key="frame" x="20" y="431" width="374" height="34"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="password"/> + </textField> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Retape password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="zRM-OE-eJw"> + <rect key="frame" x="20" y="473" width="374" height="34"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="password"/> + </textField> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Change password" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dU5-au-hKc"> + <rect key="frame" x="40" y="276" width="334" height="41"/> + <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="34"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="X9q-Zw-bEY"> + <rect key="frame" x="40" y="587" width="334" height="30"/> + <state key="normal" title="Send"/> + <connections> + <action selector="sendButtonTapped:" destination="Q2i-e2-18I" eventType="touchUpInside" id="Q7f-BP-MoV"/> + </connections> + </button> + <activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="B8u-ip-49i"> + <rect key="frame" x="197" y="592" width="20" height="20"/> + </activityIndicatorView> + <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5qt-pq-4fr"> + <rect key="frame" x="20" y="515" width="374" height="20.5"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Actual password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Iau-eG-nzL"> + <rect key="frame" x="20" y="365" width="374" height="34"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="password"/> + </textField> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <constraints> + <constraint firstItem="Izq-Sx-YSw" firstAttribute="trailing" secondItem="X9q-Zw-bEY" secondAttribute="trailing" constant="40" id="32E-or-u5N"/> + <constraint firstItem="5qt-pq-4fr" firstAttribute="top" secondItem="zRM-OE-eJw" secondAttribute="bottom" constant="8" id="Dgv-8j-Gxl"/> + <constraint firstItem="zRM-OE-eJw" firstAttribute="leading" secondItem="Izq-Sx-YSw" secondAttribute="leading" constant="20" id="GBo-pz-PbM"/> + <constraint firstItem="fmD-2F-N03" firstAttribute="centerY" secondItem="QAV-HF-l2k" secondAttribute="centerY" id="PTA-2G-JOZ"/> + <constraint firstItem="Izq-Sx-YSw" firstAttribute="trailing" secondItem="fmD-2F-N03" secondAttribute="trailing" constant="20" id="Pih-kz-0N9"/> + <constraint firstItem="5qt-pq-4fr" firstAttribute="leading" secondItem="Izq-Sx-YSw" secondAttribute="leading" constant="20" id="RQC-Ay-tw9"/> + <constraint firstItem="Izq-Sx-YSw" firstAttribute="trailing" secondItem="Iau-eG-nzL" secondAttribute="trailing" constant="20" id="Tc8-7F-X19"/> + <constraint firstItem="Iau-eG-nzL" firstAttribute="top" secondItem="dU5-au-hKc" secondAttribute="bottom" constant="48" id="U0l-9d-VRK"/> + <constraint firstItem="Izq-Sx-YSw" firstAttribute="trailing" secondItem="zRM-OE-eJw" secondAttribute="trailing" constant="20" id="XIt-2a-Itl"/> + <constraint firstItem="X9q-Zw-bEY" firstAttribute="leading" secondItem="Izq-Sx-YSw" secondAttribute="leading" constant="40" id="fF8-1B-hig"/> + <constraint firstItem="dU5-au-hKc" firstAttribute="leading" secondItem="Izq-Sx-YSw" secondAttribute="leading" constant="40" id="hPM-RG-pcV"/> + <constraint firstItem="fmD-2F-N03" firstAttribute="top" secondItem="Iau-eG-nzL" secondAttribute="bottom" constant="32" id="iMc-iG-XlP"/> + <constraint firstItem="Izq-Sx-YSw" firstAttribute="trailing" secondItem="dU5-au-hKc" secondAttribute="trailing" constant="40" id="jDg-2O-dN7"/> + <constraint firstItem="X9q-Zw-bEY" firstAttribute="top" secondItem="zRM-OE-eJw" secondAttribute="bottom" constant="80" id="ou0-G4-S3O"/> + <constraint firstItem="Iau-eG-nzL" firstAttribute="leading" secondItem="Izq-Sx-YSw" secondAttribute="leading" constant="20" id="psz-M0-oqU"/> + <constraint firstItem="B8u-ip-49i" firstAttribute="centerX" secondItem="Izq-Sx-YSw" secondAttribute="centerX" id="rSz-uM-Ulv"/> + <constraint firstItem="B8u-ip-49i" firstAttribute="centerY" secondItem="X9q-Zw-bEY" secondAttribute="centerY" id="s7g-KL-27Y"/> + <constraint firstItem="fmD-2F-N03" firstAttribute="leading" secondItem="Izq-Sx-YSw" secondAttribute="leading" constant="20" id="tHr-Vv-oQ0"/> + <constraint firstItem="Izq-Sx-YSw" firstAttribute="trailing" secondItem="5qt-pq-4fr" secondAttribute="trailing" constant="20" id="tT2-7i-nWy"/> + <constraint firstItem="zRM-OE-eJw" firstAttribute="top" secondItem="fmD-2F-N03" secondAttribute="bottom" constant="8" id="xut-Sm-IAD"/> + </constraints> + <viewLayoutGuide key="safeArea" id="Izq-Sx-YSw"/> + </view> + <navigationItem key="navigationItem" id="dx4-w4-iZR"/> + <connections> + <outlet property="activityIndicator" destination="B8u-ip-49i" id="zdB-TN-y41"/> + <outlet property="actualPasswordTextField" destination="Iau-eG-nzL" id="HxH-qV-lsJ"/> + <outlet property="errorMessageLabel" destination="5qt-pq-4fr" id="8cC-mL-poP"/> + <outlet property="passwordTextField" destination="fmD-2F-N03" id="hhp-P8-6bt"/> + <outlet property="retapedPasswordTextField" destination="zRM-OE-eJw" id="nA0-5G-Rlc"/> + <outlet property="sendButton" destination="X9q-Zw-bEY" id="IrY-ZC-NSf"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="3f8-Di-XYo" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="840.57971014492762" y="-1199.3303571428571"/> + </scene> + <!--New Password Required View Controller--> + <scene sceneID="0fu-GB-H4Q"> + <objects> + <viewController storyboardIdentifier="NewPasswordRequiredViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="XoF-Qp-ABq" customClass="NewPasswordRequiredViewController" customModule="Ippon_Amplify_Test" customModuleProvider="target" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="eUG-W5-BkP"> + <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HsS-3P-6eG"> + <rect key="frame" x="20" y="431" width="374" height="34"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="password"/> + </textField> + <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Retape password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="HkB-Pd-psw"> + <rect key="frame" x="20" y="473" width="374" height="34"/> + <fontDescription key="fontDescription" type="system" pointSize="14"/> + <textInputTraits key="textInputTraits" secureTextEntry="YES" textContentType="password"/> + </textField> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="New password" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mzg-fi-meg"> + <rect key="frame" x="40" y="276" width="334" height="41"/> + <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="34"/> + <nil key="textColor"/> + <nil key="highlightedColor"/> + </label> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="T10-UL-W1Q"> + <rect key="frame" x="40" y="587" width="334" height="30"/> + <state key="normal" title="Send"/> + <connections> + <action selector="sendButtonTapped:" destination="XoF-Qp-ABq" eventType="touchUpInside" id="yGz-gY-uRR"/> + </connections> + </button> + <activityIndicatorView hidden="YES" opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="NjM-W4-PZ3"> + <rect key="frame" x="197" y="592" width="20" height="20"/> + </activityIndicatorView> + <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nrw-5v-Rwq"> + <rect key="frame" x="20" y="515" width="374" height="20.5"/> + <fontDescription key="fontDescription" type="system" pointSize="17"/> + <color key="textColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + </subviews> + <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <constraints> + <constraint firstItem="mzg-fi-meg" firstAttribute="leading" secondItem="dZc-cj-Pw6" secondAttribute="leading" constant="40" id="2DH-g5-p7e"/> + <constraint firstItem="T10-UL-W1Q" firstAttribute="top" secondItem="HkB-Pd-psw" secondAttribute="bottom" constant="80" id="8X6-rZ-aiz"/> + <constraint firstItem="HkB-Pd-psw" firstAttribute="top" secondItem="HsS-3P-6eG" secondAttribute="bottom" constant="8" id="9VO-XC-suk"/> + <constraint firstItem="T10-UL-W1Q" firstAttribute="leading" secondItem="dZc-cj-Pw6" secondAttribute="leading" constant="40" id="A0J-nD-VWa"/> + <constraint firstItem="HsS-3P-6eG" firstAttribute="top" secondItem="mzg-fi-meg" secondAttribute="bottom" constant="114" id="IKm-di-hB8"/> + <constraint firstItem="dZc-cj-Pw6" firstAttribute="trailing" secondItem="nrw-5v-Rwq" secondAttribute="trailing" constant="20" id="KNQ-xf-KDc"/> + <constraint firstItem="dZc-cj-Pw6" firstAttribute="trailing" secondItem="HkB-Pd-psw" secondAttribute="trailing" constant="20" id="ZXl-iu-bey"/> + <constraint firstItem="NjM-W4-PZ3" firstAttribute="centerX" secondItem="dZc-cj-Pw6" secondAttribute="centerX" id="dNq-jm-yKi"/> + <constraint firstItem="HkB-Pd-psw" firstAttribute="leading" secondItem="dZc-cj-Pw6" secondAttribute="leading" constant="20" id="fDP-bl-Xas"/> + <constraint firstItem="dZc-cj-Pw6" firstAttribute="trailing" secondItem="HsS-3P-6eG" secondAttribute="trailing" constant="20" id="h1c-Ve-fj7"/> + <constraint firstItem="dZc-cj-Pw6" firstAttribute="trailing" secondItem="mzg-fi-meg" secondAttribute="trailing" constant="40" id="huV-gO-kdA"/> + <constraint firstItem="nrw-5v-Rwq" firstAttribute="leading" secondItem="dZc-cj-Pw6" secondAttribute="leading" constant="20" id="knP-fX-WhP"/> + <constraint firstItem="HsS-3P-6eG" firstAttribute="leading" secondItem="dZc-cj-Pw6" secondAttribute="leading" constant="20" id="nKH-Ct-ool"/> + <constraint firstItem="dZc-cj-Pw6" firstAttribute="trailing" secondItem="T10-UL-W1Q" secondAttribute="trailing" constant="40" id="pWc-ny-5X7"/> + <constraint firstItem="nrw-5v-Rwq" firstAttribute="top" secondItem="HkB-Pd-psw" secondAttribute="bottom" constant="8" id="pY9-D7-VnK"/> + <constraint firstItem="NjM-W4-PZ3" firstAttribute="centerY" secondItem="T10-UL-W1Q" secondAttribute="centerY" id="qJf-xY-l0z"/> + <constraint firstItem="HsS-3P-6eG" firstAttribute="centerY" secondItem="eUG-W5-BkP" secondAttribute="centerY" id="rz7-7d-EJP"/> + </constraints> + <viewLayoutGuide key="safeArea" id="dZc-cj-Pw6"/> + </view> + <navigationItem key="navigationItem" id="Pqz-oh-jgV"/> + <connections> + <outlet property="activityIndicator" destination="NjM-W4-PZ3" id="OH0-kN-aG2"/> + <outlet property="errorMessageLabel" destination="nrw-5v-Rwq" id="Ejk-gs-Y7v"/> + <outlet property="passwordTextField" destination="HsS-3P-6eG" id="us0-CY-1l6"/> + <outlet property="retapedPasswordTextField" destination="HkB-Pd-psw" id="T38-m0-Rbt"/> + <outlet property="sendButton" destination="T10-UL-W1Q" id="3Tq-Tk-RJH"/> + </connections> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="MMh-Uy-86o" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-75" y="-1199"/> </scene> </scenes> </document> diff --git a/Ippon Amplify Test/Controllers/ChangePasswordViewController.swift b/Ippon Amplify Test/Controllers/ChangePasswordViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..d4757b3af9a5bab11f389755fd80a5986d7c8753 --- /dev/null +++ b/Ippon Amplify Test/Controllers/ChangePasswordViewController.swift @@ -0,0 +1,69 @@ +// +// ChangePasswordViewController.swift +// Ippon Amplify Test +// +// Created by Raphaël Berthomé on 11/02/2020. +// Copyright © 2020 fr.ippon.amplify.test. All rights reserved. +// + +import Foundation +import UIKit + +class ChangePasswordViewController: UIViewController, Storyboarded { + + @IBOutlet weak var actualPasswordTextField: UITextField! + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var retapedPasswordTextField: UITextField! + @IBOutlet weak var sendButton: UIButton! + @IBOutlet weak var activityIndicator: UIActivityIndicatorView! + @IBOutlet weak var errorMessageLabel: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + } + @IBAction func sendButtonTapped(_ sender: Any) { + if let password = passwordTextField.text, + let retapedPassword = retapedPasswordTextField.text, + let actualPassword = actualPasswordTextField.text { + if password != retapedPassword { + errorMessageLabel.text = "Passwords not identicals !" + } else { + self.activityIndicator.startAnimating() + self.sendButton.isHidden = true + AuthentificationService.changePassword(self, actualPassword: actualPassword, newPassword: password) + } + } else { + errorMessageLabel.text = "Passwords needed !" + } + } +} + +extension ChangePasswordViewController: AuthentificationResultDelegate { + func onSuccess(_ status: CustomStatus) { + DispatchQueue.main.async { [weak self] in + if let self = self { + self.activityIndicator.stopAnimating() + self.sendButton.isHidden = false + switch status as! ChangePasswordCustomStatus { + case .done: + self.passwordTextField.text = "" + self.actualPasswordTextField.text = "" + self.retapedPasswordTextField.text = "" + let alert = UIAlertController(title: "Password Changed", message: "Your password was successfully changed.", preferredStyle: .alert) + self.present(alert, animated: true, completion: nil) + } + } + } + } + + func onError(error: Error?) { + DispatchQueue.main.async { [weak self] in + if let self = self { + self.activityIndicator.stopAnimating() + self.sendButton.isHidden = false + self.errorMessageLabel.text = error?.localizedDescription + self.errorMessageLabel.isHidden = false + } + } + } +} diff --git a/Ippon Amplify Test/ViewController.swift b/Ippon Amplify Test/Controllers/CreateAccountViewController.swift similarity index 64% rename from Ippon Amplify Test/ViewController.swift rename to Ippon Amplify Test/Controllers/CreateAccountViewController.swift index dfef06de1f9d9d47886d60b05177b61fe47bd6b7..70e6ed53f7fd75fdcfb818e83e5ff358469f3e39 100644 --- a/Ippon Amplify Test/ViewController.swift +++ b/Ippon Amplify Test/Controllers/CreateAccountViewController.swift @@ -1,20 +1,17 @@ // -// ViewController.swift +// CreateAccountViewController.swift // Ippon Amplify Test // // Created by Raphaël Berthomé on 11/02/2020. // Copyright © 2020 fr.ippon.amplify.test. All rights reserved. // +import Foundation import UIKit -class ViewController: UIViewController { +class CreateAccountViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view. } - - } - diff --git a/Ippon Amplify Test/Controllers/ForgotPasswordViewController.swift b/Ippon Amplify Test/Controllers/ForgotPasswordViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..b23614014bcf0efbaa63d27d7afee775f4d4d7e5 --- /dev/null +++ b/Ippon Amplify Test/Controllers/ForgotPasswordViewController.swift @@ -0,0 +1,17 @@ +// +// ForgotPasswordViewController.swift +// Ippon Amplify Test +// +// Created by Raphaël Berthomé on 11/02/2020. +// Copyright © 2020 fr.ippon.amplify.test. All rights reserved. +// + +import Foundation +import UIKit + +class ForgotPasswordViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + } +} diff --git a/Ippon Amplify Test/Controllers/LoginViewController.swift b/Ippon Amplify Test/Controllers/LoginViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..15583802ef03f14a6da290095c678dd7a6bcb699 --- /dev/null +++ b/Ippon Amplify Test/Controllers/LoginViewController.swift @@ -0,0 +1,111 @@ +// +// LoginViewController.swift +// Ippon Amplify Test +// +// Created by Raphaël Berthomé on 11/02/2020. +// Copyright © 2020 fr.ippon.amplify.test. All rights reserved. +// + +import Foundation +import UIKit + +// Login management +class LoginViewController: UIViewController { + + @IBOutlet weak var loginTextField: UITextField! + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var loginButton: UIButton! + @IBOutlet weak var errorMessageLabel: UILabel! + @IBOutlet weak var forgotPasswordButton: UIButton! + @IBOutlet weak var createAccountButton: UIButton! + @IBOutlet weak var loginActivityIndicator: UIActivityIndicatorView! + + override func viewDidLoad() { + super.viewDidLoad() + } + + @IBAction func loginButtonTapped(_ sender: Any) { + disableButtons() + self.errorMessageLabel.isHidden = true + errorMessageLabel.text = "Need login and password" + if let username = loginTextField.text , let password = passwordTextField.text { + if username.isEmpty && password.isEmpty { + self.errorMessageLabel.isHidden = false + enableButtons() + } else { + loginActivityIndicator.startAnimating() + loginButton.isHidden = true + AuthentificationService.login(self, username: username, password: password) + } + } else { + self.errorMessageLabel.isHidden = false + enableButtons() + } + + } + + private func disableButtons() { + self.loginButton.isEnabled = false + self.createAccountButton.isEnabled = false + self.forgotPasswordButton.isEnabled = false + } + + private func enableButtons() { + self.loginButton.isEnabled = true + self.createAccountButton.isEnabled = true + self.forgotPasswordButton.isEnabled = true + } + + private func gotoNewPassword(message: String, isReset: Bool) { + let alert = UIAlertController(title: "Need new password", message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in + + self.present( + isReset ? ChangePasswordViewController.instantiate() : + NewPasswordRequiredViewController.instantiate(), animated: true, completion: nil) + })) + self.present(alert, animated: true, completion: nil) + } + +} + +// Manage responses from Cognito +extension LoginViewController: AuthentificationResultDelegate { + func onSuccess(_ status: CustomStatus) { + DispatchQueue.main.async { [weak self] in + if let self = self { + self.loginActivityIndicator.stopAnimating() + switch status as! SignInCustomStatus { + case .newPasswordRequired(let message): + self.gotoNewPassword(message: message, isReset : false) + case .signedIn(let message) : + let alert = UIAlertController(title: "Signed In", message: message, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in + // TODO : go to main page + })) + self.present(alert, animated: true, completion: nil) + } + self.enableButtons() + } + } + } + + func onError(error: Error?) { + DispatchQueue.main.async { [weak self] in + if let self = self, let error = error as? SignInError { + self.enableButtons() + self.loginActivityIndicator.stopAnimating() + self.loginButton.isHidden = false + switch error { + case .newPasswordRequired(let message): + self.gotoNewPassword(message: message, isReset : true) + default : + self.errorMessageLabel.text = error.localizedDescription + self.errorMessageLabel.isHidden = false + } + } + } + } + + +} diff --git a/Ippon Amplify Test/Controllers/NewPasswordRequiredViewController.swift b/Ippon Amplify Test/Controllers/NewPasswordRequiredViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..a4a21b3e17a38ae5f6961799fabfceb4f692aa5c --- /dev/null +++ b/Ippon Amplify Test/Controllers/NewPasswordRequiredViewController.swift @@ -0,0 +1,71 @@ +// +// NewPasswordViewController.swift +// Ippon Amplify Test +// +// Created by Raphaël Berthomé on 12/02/2020. +// Copyright © 2020 fr.ippon.amplify.test. All rights reserved. +// + +import UIKit + +class NewPasswordRequiredViewController: UIViewController, Storyboarded { + + @IBOutlet weak var retapedPasswordTextField: UITextField! + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var errorMessageLabel: UILabel! + @IBOutlet weak var sendButton: UIButton! + @IBOutlet weak var activityIndicator: UIActivityIndicatorView! + + override func viewDidLoad() { + super.viewDidLoad() + } + + @IBAction func sendButtonTapped(_ sender: Any) { + errorMessageLabel.isHidden = true + if let password = passwordTextField.text, + let retapedPassword = retapedPasswordTextField.text { + if password != retapedPassword { + errorMessageLabel.text = "Passwords are not identicals !" + errorMessageLabel.isHidden = false + } else { + self.activityIndicator.startAnimating() + self.sendButton.isHidden = true + AuthentificationService.confirmLogin(self, challengeResponse: password) + } + } else { + errorMessageLabel.text = "Passwords needed !" + errorMessageLabel.isHidden = false + } + } +} + +extension NewPasswordRequiredViewController: AuthentificationResultDelegate { + func onSuccess(_ status: CustomStatus) { + DispatchQueue.main.async { + if let status = status as? SignInCustomStatus { + switch status { + case .newPasswordRequired(_): + break + case .signedIn(_) : + let alert = UIAlertController(title: "Password changed", message: "Your password has been changed.", preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in + // TODO : go to main page + })) + self.present(alert, animated: true, completion: nil) + } + } + } + } + + func onError(error: Error?) { + DispatchQueue.main.async { [weak self] in + if let self = self { + self.activityIndicator.stopAnimating() + self.sendButton.isHidden = false + self.errorMessageLabel.text = error?.localizedDescription + self.errorMessageLabel.isHidden = false + } + } + } + +} diff --git a/Ippon Amplify Test/Controllers/Storyboarded.swift b/Ippon Amplify Test/Controllers/Storyboarded.swift new file mode 100644 index 0000000000000000000000000000000000000000..345219f2f4c6576e5a97c423c3db35a62c3a4328 --- /dev/null +++ b/Ippon Amplify Test/Controllers/Storyboarded.swift @@ -0,0 +1,31 @@ +// +// Storyboarded.swift +// Ippon Amplify Test +// +// Created by Raphaël Berthomé on 12/02/2020. +// Copyright © 2020 fr.ippon.amplify.test. All rights reserved. +// + +import Foundation +import UIKit + +protocol Storyboarded { + static func instantiate(_ storyboard: String) -> Self +} + +extension Storyboarded where Self: UIViewController { + static func instantiate(_ storyboard: String = "Main") -> Self { + // this pulls out "MyApp.MyViewController" + let fullName = NSStringFromClass(self) + + // this splits by the dot and uses everything after, giving "MyViewController" + let className = fullName.components(separatedBy: ".")[1] + + // load our storyboard + let storyboard = UIStoryboard(name: storyboard, bundle: Bundle.main) + // swiftlint:disable force_cast + // instantiate a view controller with that identifier, and force cast as the type that was requested + return storyboard.instantiateViewController(withIdentifier: className) as! Self + // swiftlint:enable force_cast + } +} diff --git a/Ippon Amplify Test/Info.plist b/Ippon Amplify Test/Info.plist index 2a3483c0d2ba679db55e66b185bfd79b44b0cf07..b5f9c0796bc609f08b75d46e6f3fabf6f6c63fff 100644 --- a/Ippon Amplify Test/Info.plist +++ b/Ippon Amplify Test/Info.plist @@ -50,8 +50,6 @@ <key>UISupportedInterfaceOrientations</key> <array> <string>UIInterfaceOrientationPortrait</string> - <string>UIInterfaceOrientationLandscapeLeft</string> - <string>UIInterfaceOrientationLandscapeRight</string> </array> <key>UISupportedInterfaceOrientations~ipad</key> <array> diff --git a/Ippon Amplify Test/Services/AuthentificationService.swift b/Ippon Amplify Test/Services/AuthentificationService.swift new file mode 100644 index 0000000000000000000000000000000000000000..af54888bf7d768b3a6a625bb1e51831b4206865d --- /dev/null +++ b/Ippon Amplify Test/Services/AuthentificationService.swift @@ -0,0 +1,187 @@ +// +// AuthentificationService.swift +// Ippon Amplify Test +// +// Created by Raphaël Berthomé on 11/02/2020. +// Copyright © 2020 fr.ippon.amplify.test. All rights reserved. +// + +import Foundation +import AWSMobileClient + +// Manage returns from any authentification requests +protocol AuthentificationResultDelegate: class { + func onSuccess(_ status: CustomStatus) + func onError(error: Error?) +} + +protocol CustomStatus { +} + +enum SignUpCustomStatus: CustomStatus { + case signUpConfirmed(String) + case signUpUnconfirmed(String) +} + +enum SignInCustomStatus: CustomStatus { + case signedIn(String) + case newPasswordRequired(String) +} + +enum ForgotPasswordCustomStatus: CustomStatus { + case confirmationCodeSent(String) + case done +} + +enum ChangePasswordCustomStatus: CustomStatus { + case done +} + +// enum for Signup Error +enum SignUpError: Error { + case signupUnknown(String) +} + +// enum for Signin Error +enum SignInError: Error { + case signInUnknown(String) + case newPasswordRequired(String) +} + +// Manage authentification to Cognito +class AuthentificationService { + + // Sign up + static func signUp(_ sender: AuthentificationResultDelegate, username: String, password: String) { + AWSMobileClient.default().signUp(username: username, password: password, userAttributes: [:]) + { signUpResult, error in + self.manageSignUp(sender, signUpResult: signUpResult, error: error) + } + } + + static func confirmSignUp(_ sender: AuthentificationResultDelegate, username: String, confirmationCode: String) { + AWSMobileClient.default().confirmSignUp(username: username, confirmationCode: confirmationCode) + { signUpResult, error in + self.manageSignUp(sender, signUpResult: signUpResult, error: error) + } + } + + static func resendConfirmationCode(_ sender: AuthentificationResultDelegate, username: String) { + AWSMobileClient.default().resendSignUpCode(username: username) + { signUpResult, error in + self.manageSignUp(sender, signUpResult: signUpResult, error: error) + } + } + + private static func manageSignUp(_ sender: AuthentificationResultDelegate, signUpResult: SignUpResult?, error: Error?) { + if let signUpResult = signUpResult { + switch(signUpResult.signUpConfirmationState) { + case .confirmed: + sender.onSuccess(SignUpCustomStatus.signUpConfirmed("User is signed up and confirmed.")) + case .unconfirmed: + sender.onSuccess(SignUpCustomStatus.signUpUnconfirmed( + "User is not confirmed and needs verification via " + + "\(signUpResult.codeDeliveryDetails!.deliveryMedium) sent at " + + "\(signUpResult.codeDeliveryDetails!.destination!)") + ) + case .unknown: + sender.onError(error: SignUpError.signupUnknown("Unexpected case")) + } + } else if let error = error { + sender.onError(error: error) + } + } + + // Sign in + static func login(_ sender: AuthentificationResultDelegate, username: String, password: String) { + AWSMobileClient.default().signIn(username: username, password: password) + { signInResult, error in + self.manageSignIn(sender, signInResult: signInResult, error: error) + } + } + + // Confirm sign in + static func confirmLogin(_ sender: AuthentificationResultDelegate, challengeResponse: String) { + AWSMobileClient.default().confirmSignIn(challengeResponse: challengeResponse) + { signInResult, error in + self.manageSignIn(sender, signInResult: signInResult, error: error) + } + } + + private static func manageSignIn(_ sender: AuthentificationResultDelegate, signInResult: SignInResult?, error: Error?) { + if let signInResult = signInResult { + switch(signInResult.signInState) { + case .signedIn: + sender.onSuccess(SignInCustomStatus.signedIn("User is signed in.")) + case .newPasswordRequired: + sender.onSuccess(SignInCustomStatus.newPasswordRequired("New Password required")) + default: + sender.onError(error: SignInError.signInUnknown("Unexpected case")) + } + } else if let error = error as? AWSMobileClientError { + switch error { + case .passwordResetRequired(let message): + sender.onError(error: SignInError.newPasswordRequired(message)) + default: + // You can manage a multiple type of error here to know exactly what happened + sender.onError(error: error) + } + } + } + + static func forgotPassword(_ sender: AuthentificationResultDelegate, username: String) { + AWSMobileClient.default().forgotPassword(username: username) + { forgotPasswordResult, error in + self.manageForgotPassword(sender, forgotPasswordResult: forgotPasswordResult, error: error) + } + } + + static func confirmForgotPassword(_ sender: AuthentificationResultDelegate, username: String, newPassword: String, + confirmationCode: String) { + AWSMobileClient.default().confirmForgotPassword(username: username, + newPassword: newPassword, + confirmationCode: confirmationCode) + { forgotPasswordResult, error in + self.manageForgotPassword(sender, forgotPasswordResult: forgotPasswordResult, error: error) + } + } + + private static func manageForgotPassword(_ sender: AuthentificationResultDelegate, + forgotPasswordResult: ForgotPasswordResult?, + error: Error?) { + if let forgotPasswordResult = forgotPasswordResult { + switch(forgotPasswordResult.forgotPasswordState) { + case .confirmationCodeSent: + sender.onSuccess(ForgotPasswordCustomStatus.confirmationCodeSent( + "Confirmation code sent via " + + "\(forgotPasswordResult.codeDeliveryDetails!.deliveryMedium)" + + " to: \(forgotPasswordResult.codeDeliveryDetails!.destination!)") + ) + case .done: + sender.onSuccess(ForgotPasswordCustomStatus.done) + } + } else if let error = error { + sender.onError(error: error) + } + } + + static func changePassword(_ sender: AuthentificationResultDelegate, + actualPassword: String, + newPassword: String) { + AWSMobileClient.default() + .changePassword(currentPassword: actualPassword, + proposedPassword: newPassword) { (error) in + if let error = error { + sender.onError(error: error) + } else { + sender.onSuccess(ChangePasswordCustomStatus.done) + } + + } + } + + static func logout() { + AWSMobileClient.default().signOut() + } + +} diff --git a/Podfile b/Podfile new file mode 100644 index 0000000000000000000000000000000000000000..51fb71f932bcf47af4003e5d87cb6c855e8be290 --- /dev/null +++ b/Podfile @@ -0,0 +1,14 @@ +# Uncomment the next line to define a global platform for your project +platform :ios, '11.0' + +target 'Ippon Amplify Test' do + # Comment the next line if you don't want to use dynamic frameworks + use_frameworks! + + # Pods for Ippon Amplify Test + pod 'amplify-tools' + pod 'Amplify' + pod 'AWSPluginsCore' + pod 'AmplifyPlugins/AWSAPIPlugin' + +end diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000000000000000000000000000000000000..c2ac671db349490e93b33aa3b15920cb7a68bea7 --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,59 @@ +PODS: + - Amplify (0.10.0) + - amplify-tools (0.2.0) + - AmplifyPlugins/AWSAPIPlugin (0.10.0): + - AWSPluginsCore (= 0.10.0) + - ReachabilitySwift (~> 5.0.0) + - Starscream (~> 3.0.2) + - AWSAuthCore (2.12.6): + - AWSCore (= 2.12.6) + - AWSCognitoIdentityProvider (2.12.6): + - AWSCognitoIdentityProviderASF (= 1.0.1) + - AWSCore (= 2.12.6) + - AWSCognitoIdentityProviderASF (1.0.1) + - AWSCore (2.12.6) + - AWSMobileClient (2.12.6): + - AWSAuthCore (= 2.12.6) + - AWSCognitoIdentityProvider (= 2.12.6) + - AWSPluginsCore (0.10.0): + - Amplify (= 0.10.0) + - AWSMobileClient (~> 2.12.2) + - ReachabilitySwift (5.0.0) + - Starscream (3.0.6) + +DEPENDENCIES: + - Amplify + - amplify-tools + - AmplifyPlugins/AWSAPIPlugin + - AWSPluginsCore + +SPEC REPOS: + trunk: + - Amplify + - amplify-tools + - AmplifyPlugins + - AWSAuthCore + - AWSCognitoIdentityProvider + - AWSCognitoIdentityProviderASF + - AWSCore + - AWSMobileClient + - AWSPluginsCore + - ReachabilitySwift + - Starscream + +SPEC CHECKSUMS: + Amplify: 786ae0a91656086c74de41c8821a869095fa6a6d + amplify-tools: 2304ea0782b61fdb15c7a1e6bf5e0410b02b4f46 + AmplifyPlugins: 5531c6c13242f40a8c057aad64cb3b915559b65e + AWSAuthCore: d981abe8fb987a1caa7ac6c76c428de12387dcf4 + AWSCognitoIdentityProvider: 9502438e528185a2c61b97baf66e2fd2ac6833f3 + AWSCognitoIdentityProviderASF: f94f1a502e72ef3d0a1de93e10bf7a79c8698118 + AWSCore: 48bb8d477d8137377e86b2ade9eb34a761f42df5 + AWSMobileClient: d752ed540a75d45516c8d5b2054b3f3b6b9e7e65 + AWSPluginsCore: 7d7f8cd3fc5664b1eeb67b1a9aa312f78cf09cb9 + ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 + Starscream: ef3ece99d765eeccb67de105bfa143f929026cf5 + +PODFILE CHECKSUM: 617eb1ecde1c114e0c3426a7ff3712082be33244 + +COCOAPODS: 1.8.4 diff --git a/amplify b/amplify new file mode 100755 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/amplifyconfiguration.json b/amplifyconfiguration.json new file mode 100755 index 0000000000000000000000000000000000000000..ea441b8b7b319d332c6a0fb4d8371e971b8da3e4 --- /dev/null +++ b/amplifyconfiguration.json @@ -0,0 +1,39 @@ +{ + "UserAgent": "aws-amplify-cli/2.0", + "Version": "1.0", + "api" : { + "plugins" : { + "awsAPIPlugin" : { + "dev" : { + "region": "eu-west-1", + "name": "dev", + "endpoint": "https://94esg56dlk.execute-api.eu-west-1.amazonaws.com/dev", + "authorizationType" : "AWS_IAM", + "endpointType" : "REST" + }, + "rec-androird" : { + "region": "eu-west-1", + "name": "rec-androird", + "endpoint": "https://x4al513g2e.execute-api.eu-west-1.amazonaws.com/rec-androird", + "authorizationType" : "AWS_IAM", + "endpointType" : "REST" + }, + "recette" : { + "region": "eu-west-1", + "name": "recette", + "endpoint": "https://o8zblc1oe7.execute-api.eu-west-1.amazonaws.com/recette", + "authorizationType" : "AWS_IAM", + "endpointType" : "REST" + }, + "dev-geoloc" : { + "region": "eu-west-1", + "name": "dev-geoloc", + "endpoint": "https://y18l7deao3.execute-api.eu-west-1.amazonaws.com/dev-geoloc", + "authorizationType" : "AWS_IAM", + "endpointType" : "REST" + } + + } + } + } +} diff --git a/amplifyxc.config b/amplifyxc.config new file mode 100755 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/awsconfiguration.json b/awsconfiguration.json new file mode 100755 index 0000000000000000000000000000000000000000..577cb1eace16d9ac395d1e92c3d8e83755dd4711 --- /dev/null +++ b/awsconfiguration.json @@ -0,0 +1,22 @@ +{ + "UserAgent": "aws-amplify-cli/2.0", + "Version": "0.1.0", + "IdentityManager": { + "Default": {} + }, + "CredentialsProvider": { + "CognitoIdentity": { + "Default": { + "PoolId": "eu-west-1:980623a9-1cd5-44ac-89b8-0fb357422738", + "Region": "eu-west-1" + } + } + }, + "CognitoUserPool": { + "Default": { + "AppClientId": "7b9jetjb7majhn3fv87vegpurs", + "PoolId": "eu-west-1_KorMYctrA", + "Region": "eu-west-1" + } + } +}