This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AuthViewController.swift | |
// | |
// Created by Hills, Dennis on 12/13/2018. | |
// Copyright © 2018 Hills, Dennis. All rights reserved. | |
// | |
// About: Using AWS Amplify Framework for iOS 2.7.0+ to implement Basic Auth via Cognito User Pools with example Facebook option | |
// This sample includes the userState listener and AWSMobileClient implementation changes added to iOS SDK for AWS v.2.7.0+ | |
// | |
// AWS Amplify Documentation: https://aws-amplify.github.io/docs/ios/authentication |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rekognitionObject?.recognizeCelebrities(celebRequest!){ | |
(result, error) in | |
if error != nil{ | |
print(error!) | |
return | |
} | |
if result != nil{ | |
print(result!) | |
} | |
else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rekognitionObject?.recognizeCelebrities(celebRequest!){ | |
(result, error) in | |
if error != nil{ | |
print(error!) | |
return | |
} | |
//1. First we check if there are any celebrities in the response | |
if ((result!.celebrityFaces?.count)! > 0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rekognitionObject = AWSRekognition.default() | |
let celebImageAWS = AWSRekognitionImage() | |
celebImageAWS?.bytes = celebImageData | |
let celebRequest = AWSRekognitionRecognizeCelebritiesRequest() | |
celebRequest?.image = celebImageAWS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize Identity Provider | |
let credentialsProvider = AWSCognitoCredentialsProvider( | |
regionType: .USWest2, | |
identityPoolId: "us-east-1:12345678-d9ba-4bdc-9a79-085e9f20c1ai") | |
let configuration = AWSServiceConfiguration( | |
region: .USWest2, | |
credentialsProvider: credentialsProvider) | |
AWSServiceManager.default().defaultServiceConfiguration = configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Description: "This template is used by the master organizations account to provision a new IAM User, assign an IAM Policy, and get credentials to build apps using AWS Amplify" | |
Resources: | |
# This will create a new IAM User with enough privileges for an AWS Amplify developer to build cloud-enabled apps using the Amplify CLI, Amplify Console, AppSync, APIGW, Lambda, Pinpoint, and DynamoDB | |
AWSAmplifyDeveloperIAMUser: | |
Type: "AWS::IAM::User" | |
Properties: | |
LoginProfile: | |
Password: "AmplifyH@ck$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Mobile App CICD Demo | |
Parameters: | |
DeviceFarmProjectName: | |
Type: String | |
Default: demo-app-devicefarm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Settings { | |
theme: String | |
displayName: String | |
signature: String | |
requestAlert: Boolean | |
} | |
type Query { | |
getSettings: Settings! | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func pushNotificationHandler(userInfo: Dictionary<AnyHashable,Any>) { | |
// Parse the aps payload | |
let apsPayload = userInfo["aps"] as! [String: AnyObject] | |
// Play custom push notification sound (if exists) by parsing out the "sound" key and playing the audio file specified | |
// For example, if the incoming payload is: { "sound":"tarzanwut.aiff" } the app will look for the tarzanwut.aiff file in the app bundle and play it | |
if let mySoundFile : String = apsPayload["sound"] as? String { | |
playSound(fileName: mySoundFile) | |
} | |
} |
NewerOlder