From 57ae0f4900b6b29052435913fe10b756b869d85c Mon Sep 17 00:00:00 2001 From: Wicked Worlok Date: Fri, 20 Sep 2019 20:14:41 -0500 Subject: [PATCH] setup simple example of signOut not updating authState The user sees the content as if they are signed in no matter how many times they press a button that calls Auth.signOut(). Using Greetings Sign Out however does redirect the User to SignIn since that component has direct access to the authState --- .buckconfig | 6 + .eslintrc.js | 4 + .flowconfig | 99 + .gitattributes | 1 + .gitignore | 65 + .prettierrc.js | 6 + .watchmanconfig | 1 + App.js | 52 + DevMenuTrigger.js | 20 + __tests__/App-test.js | 14 + android/app/BUCK | 55 + android/app/build.gradle | 210 + android/app/build_defs.bzl | 19 + android/app/proguard-rules.pro | 10 + android/app/src/debug/AndroidManifest.xml | 8 + android/app/src/main/AndroidManifest.xml | 26 + .../com/amplify_auth_test/MainActivity.java | 15 + .../amplify_auth_test/MainApplication.java | 49 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3056 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5024 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2096 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2858 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4569 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7098 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6464 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10676 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9250 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15523 bytes android/app/src/main/res/values/strings.xml | 3 + android/app/src/main/res/values/styles.xml | 9 + android/build.gradle | 38 + android/gradle.properties | 21 + android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 55616 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + android/gradlew | 188 + android/gradlew.bat | 100 + android/settings.gradle | 3 + app.json | 4 + babel.config.js | 3 + index.js | 9 + ios/Amplify_Auth_Test-tvOS/Info.plist | 53 + ios/Amplify_Auth_Test-tvOSTests/Info.plist | 24 + .../project.pbxproj | 966 +++ .../xcschemes/Amplify_Auth_Test-tvOS.xcscheme | 129 + .../xcschemes/Amplify_Auth_Test.xcscheme | 129 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + ios/Amplify_Auth_Test/AppDelegate.h | 15 + ios/Amplify_Auth_Test/AppDelegate.m | 42 + .../Base.lproj/LaunchScreen.xib | 42 + .../AppIcon.appiconset/Contents.json | 38 + .../Images.xcassets/Contents.json | 6 + ios/Amplify_Auth_Test/Info.plist | 57 + ios/Amplify_Auth_Test/main.m | 16 + .../Amplify_Auth_TestTests.m | 68 + ios/Amplify_Auth_TestTests/Info.plist | 24 + ios/Podfile | 48 + ios/Podfile.lock | 191 + metro.config.js | 17 + package.json | 27 + yarn.lock | 7196 +++++++++++++++++ 61 files changed, 10149 insertions(+) create mode 100644 .buckconfig create mode 100644 .eslintrc.js create mode 100644 .flowconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .prettierrc.js create mode 100644 .watchmanconfig create mode 100644 App.js create mode 100644 DevMenuTrigger.js create mode 100644 __tests__/App-test.js create mode 100644 android/app/BUCK create mode 100644 android/app/build.gradle create mode 100644 android/app/build_defs.bzl create mode 100644 android/app/proguard-rules.pro create mode 100644 android/app/src/debug/AndroidManifest.xml create mode 100644 android/app/src/main/AndroidManifest.xml create mode 100644 android/app/src/main/java/com/amplify_auth_test/MainActivity.java create mode 100644 android/app/src/main/java/com/amplify_auth_test/MainApplication.java create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 android/app/src/main/res/values/strings.xml create mode 100644 android/app/src/main/res/values/styles.xml create mode 100644 android/build.gradle create mode 100644 android/gradle.properties create mode 100644 android/gradle/wrapper/gradle-wrapper.jar create mode 100644 android/gradle/wrapper/gradle-wrapper.properties create mode 100755 android/gradlew create mode 100644 android/gradlew.bat create mode 100644 android/settings.gradle create mode 100644 app.json create mode 100644 babel.config.js create mode 100644 index.js create mode 100644 ios/Amplify_Auth_Test-tvOS/Info.plist create mode 100644 ios/Amplify_Auth_Test-tvOSTests/Info.plist create mode 100644 ios/Amplify_Auth_Test.xcodeproj/project.pbxproj create mode 100644 ios/Amplify_Auth_Test.xcodeproj/xcshareddata/xcschemes/Amplify_Auth_Test-tvOS.xcscheme create mode 100644 ios/Amplify_Auth_Test.xcodeproj/xcshareddata/xcschemes/Amplify_Auth_Test.xcscheme create mode 100644 ios/Amplify_Auth_Test.xcworkspace/contents.xcworkspacedata create mode 100644 ios/Amplify_Auth_Test.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 ios/Amplify_Auth_Test/AppDelegate.h create mode 100644 ios/Amplify_Auth_Test/AppDelegate.m create mode 100644 ios/Amplify_Auth_Test/Base.lproj/LaunchScreen.xib create mode 100644 ios/Amplify_Auth_Test/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 ios/Amplify_Auth_Test/Images.xcassets/Contents.json create mode 100644 ios/Amplify_Auth_Test/Info.plist create mode 100644 ios/Amplify_Auth_Test/main.m create mode 100644 ios/Amplify_Auth_TestTests/Amplify_Auth_TestTests.m create mode 100644 ios/Amplify_Auth_TestTests/Info.plist create mode 100644 ios/Podfile create mode 100644 ios/Podfile.lock create mode 100644 metro.config.js create mode 100644 package.json create mode 100644 yarn.lock diff --git a/.buckconfig b/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..40c6dcd --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,4 @@ +module.exports = { + root: true, + extends: '@react-native-community', +}; diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000..1319ea1 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,99 @@ +[ignore] +; We fork some components by platform +.*/*[.]android.js + +; Ignore "BUCK" generated dirs +/\.buckd/ + +; Ignore unexpected extra "@providesModule" +.*/node_modules/.*/node_modules/fbjs/.* + +; Ignore duplicate module providers +; For RN Apps installed via npm, "Libraries" folder is inside +; "node_modules/react-native" but in the source repo it is in the root +node_modules/react-native/Libraries/react-native/React.js + +; Ignore polyfills +node_modules/react-native/Libraries/polyfills/.* + +; These should not be required directly +; require from fbjs/lib instead: require('fbjs/lib/warning') +node_modules/warning/.* + +; Flow doesn't support platforms +.*/Libraries/Utilities/HMRLoadingView.js + +[untyped] +.*/node_modules/@react-native-community/cli/.*/.* + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow/ + +[options] +emoji=true + +esproposal.optional_chaining=enable +esproposal.nullish_coalescing=enable + +module.file_ext=.js +module.file_ext=.json +module.file_ext=.ios.js + +module.system=haste +module.system.haste.use_name_reducers=true +# get basename +module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' +# strip .js or .js.flow suffix +module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' +# strip .ios suffix +module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' +module.system.haste.paths.blacklist=.*/__tests__/.* +module.system.haste.paths.blacklist=.*/__mocks__/.* +module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* +module.system.haste.paths.whitelist=/node_modules/react-native/RNTester/.* +module.system.haste.paths.whitelist=/node_modules/react-native/IntegrationTests/.* +module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/react-native/react-native-implementation.js +module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* + +munge_underscores=true + +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError + +[lints] +sketchy-null-number=warn +sketchy-null-mixed=warn +sketchy-number=warn +untyped-type-import=warn +nonstrict-import=warn +deprecated-type=warn +unsafe-getters-setters=warn +inexact-spread=warn +unnecessary-invariant=warn +signature-verification-failure=warn +deprecated-utility=error + +[strict] +deprecated-type +nonstrict-import +sketchy-null +unclear-type +unsafe-getters-setters +untyped-import +untyped-type-import + +[version] +^0.98.0 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d42ff18 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.pbxproj -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f7a7abc --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +# env +.env.js + +# OSX +# +.DS_Store + +# vscode +.vscode/ + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots + +# Bundle artifact +*.jsbundle + +# CocoaPods +/ios/Pods/ diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..5c4de1a --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,6 @@ +module.exports = { + bracketSpacing: false, + jsxBracketSameLine: true, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/.watchmanconfig b/.watchmanconfig new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/App.js b/App.js new file mode 100644 index 0000000..14f5be2 --- /dev/null +++ b/App.js @@ -0,0 +1,52 @@ +import React, {Fragment} from 'react'; +import { + SafeAreaView, + StyleSheet, + ScrollView, + View, + Text, + StatusBar, + Button, +} from 'react-native'; +import {withAuthenticator} from 'aws-amplify-react-native'; +import Amplify, {Auth} from 'aws-amplify'; + +import DevMenuTrigger from './DevMenuTrigger'; +import './.env'; + +Amplify.Logger.LOG_LEVEL = 'DEBUG'; + +const { + AWS_IDENTITY_POOL_ID, + AWS_USER_POOL_ID, + AWS_USER_POOL_CLIENT_ID, + AWS_REGION, +} = process.env; + +Amplify.configure({ + Auth: { + identityPoolId: AWS_IDENTITY_POOL_ID, + region: AWS_REGION, + userPoolId: AWS_USER_POOL_ID, + userPoolWebClientId: AWS_USER_POOL_CLIENT_ID, + }, +}); + +function App() { + function signOut() { + Auth.signOut() + .then(console.log) + .catch(console.error); + } + + return ( + + +