From c6da25fe2d50b20727c9d64b17a1a717cd819d39 Mon Sep 17 00:00:00 2001 From: Xavier3372 Date: Sun, 7 Jun 2020 16:39:21 +0800 Subject: [PATCH] Add Google Login --- App.tsx | 5 + ios/Podfile | 1 + ios/Podfile.lock | 191 +++++++++++++++++++---------- ios/lost.xcodeproj/project.pbxproj | 23 ++++ ios/lost/Info.plist | 11 ++ package.json | 3 + src/pages/AccountManage/index.tsx | 55 +++++++++ src/pages/Landing/index.tsx | 29 +++++ src/pages/Loading/index.tsx | 56 +++++++++ src/pages/Settings/index.tsx | 2 +- 10 files changed, 308 insertions(+), 68 deletions(-) create mode 100644 src/pages/AccountManage/index.tsx create mode 100644 src/pages/Loading/index.tsx diff --git a/App.tsx b/App.tsx index 1ce3770..f791d0a 100644 --- a/App.tsx +++ b/App.tsx @@ -29,6 +29,8 @@ import {SettingsThemePage} from './src/pages/SettingsTheme'; import {FindPage} from './src/pages/Find'; import {LandingPage} from './src/pages/Landing'; import {SettingsPeoplePage} from './src/pages/SettingsPeople'; +import {AccountLoadingPage} from './src/pages/Loading' +import {ManageAccountPage} from './src/pages/AccountManage' import {store} from './index.js'; @@ -41,6 +43,9 @@ const SettingsPageNest = () => { + + + ); }; diff --git a/ios/Podfile b/ios/Podfile index 5bfd27b..933e4c6 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -37,6 +37,7 @@ target 'lost' do pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' pod 'Firebase/Analytics' + pod 'GoogleSignIn', '~> 5.0.2' target 'lostTests' do inherit! :search_paths diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d1e63f8..cf7cccf 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,4 +1,9 @@ PODS: + - AppAuth (1.4.0): + - AppAuth/Core (= 1.4.0) + - AppAuth/ExternalUserAgent (= 1.4.0) + - AppAuth/Core (1.4.0) + - AppAuth/ExternalUserAgent (1.4.0) - boost-for-react-native (1.63.0) - DoubleConversion (1.1.6) - FBLazyVector (0.61.5) @@ -9,43 +14,49 @@ PODS: - React-Core (= 0.61.5) - React-jsi (= 0.61.5) - ReactCommon/turbomodule/core (= 0.61.5) - - Firebase/Analytics (6.16.0): + - Firebase/Analytics (6.25.0): - Firebase/Core - - Firebase/Core (6.16.0): + - Firebase/Auth (6.25.0): - Firebase/CoreOnly - - FirebaseAnalytics (= 6.2.2) - - Firebase/CoreOnly (6.16.0): - - FirebaseCore (= 6.6.1) - - FirebaseAnalytics (6.2.2): - - FirebaseCore (~> 6.6) - - FirebaseInstanceID (~> 4.3) - - GoogleAppMeasurement (= 6.2.2) + - FirebaseAuth (~> 6.5.3) + - Firebase/Core (6.25.0): + - Firebase/CoreOnly + - FirebaseAnalytics (= 6.5.1) + - Firebase/CoreOnly (6.25.0): + - FirebaseCore (= 6.7.1) + - FirebaseAnalytics (6.5.1): + - FirebaseCore (~> 6.7) + - FirebaseInstallations (~> 1.2) + - GoogleAppMeasurement (= 6.5.1) - GoogleUtilities/AppDelegateSwizzler (~> 6.0) - GoogleUtilities/MethodSwizzler (~> 6.0) - GoogleUtilities/Network (~> 6.0) - "GoogleUtilities/NSData+zlib (~> 6.0)" - - nanopb (= 0.3.9011) - - FirebaseCore (6.6.1): - - FirebaseCoreDiagnostics (~> 1.2) + - nanopb (~> 1.30905.0) + - FirebaseAuth (6.5.3): + - FirebaseAuthInterop (~> 1.0) + - FirebaseCore (~> 6.6) + - GoogleUtilities/AppDelegateSwizzler (~> 6.5) + - GoogleUtilities/Environment (~> 6.5) + - GTMSessionFetcher/Core (~> 1.1) + - FirebaseAuthInterop (1.1.0) + - FirebaseCore (6.7.1): + - FirebaseCoreDiagnostics (~> 1.3) - FirebaseCoreDiagnosticsInterop (~> 1.2) - GoogleUtilities/Environment (~> 6.5) - GoogleUtilities/Logger (~> 6.5) - - FirebaseCoreDiagnostics (1.2.0): + - FirebaseCoreDiagnostics (1.3.0): - FirebaseCoreDiagnosticsInterop (~> 1.2) - - GoogleDataTransportCCTSupport (~> 1.3) + - GoogleDataTransportCCTSupport (~> 3.1) - GoogleUtilities/Environment (~> 6.5) - GoogleUtilities/Logger (~> 6.5) - - nanopb (~> 0.3.901) + - nanopb (~> 1.30905.0) - FirebaseCoreDiagnosticsInterop (1.2.0) - - FirebaseInstallations (1.1.0): + - FirebaseInstallations (1.3.0): - FirebaseCore (~> 6.6) - - GoogleUtilities/UserDefaults (~> 6.5) + - GoogleUtilities/Environment (~> 6.6) + - GoogleUtilities/UserDefaults (~> 6.6) - PromisesObjC (~> 1.2) - - FirebaseInstanceID (4.3.0): - - FirebaseCore (~> 6.6) - - FirebaseInstallations (~> 1.0) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/UserDefaults (~> 6.5) - Folly (2018.10.22.00): - boost-for-react-native - DoubleConversion @@ -56,39 +67,52 @@ PODS: - DoubleConversion - glog - glog (0.3.5) - - GoogleAppMeasurement (6.2.2): + - GoogleAppMeasurement (6.5.1): - GoogleUtilities/AppDelegateSwizzler (~> 6.0) - GoogleUtilities/MethodSwizzler (~> 6.0) - GoogleUtilities/Network (~> 6.0) - "GoogleUtilities/NSData+zlib (~> 6.0)" - - nanopb (= 0.3.9011) - - GoogleDataTransport (3.3.1) - - GoogleDataTransportCCTSupport (1.3.1): - - GoogleDataTransport (~> 3.3) - - nanopb (~> 0.3.901) - - GoogleUtilities/AppDelegateSwizzler (6.5.1): + - nanopb (~> 1.30905.0) + - GoogleDataTransport (6.2.1) + - GoogleDataTransportCCTSupport (3.1.0): + - GoogleDataTransport (~> 6.1) + - nanopb (~> 1.30905.0) + - GoogleSignIn (5.0.2): + - AppAuth (~> 1.2) + - GTMAppAuth (~> 1.0) + - GTMSessionFetcher/Core (~> 1.1) + - GoogleUtilities/AppDelegateSwizzler (6.6.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - - GoogleUtilities/Environment (6.5.1) - - GoogleUtilities/Logger (6.5.1): + - GoogleUtilities/Environment (6.6.0): + - PromisesObjC (~> 1.2) + - GoogleUtilities/Logger (6.6.0): - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (6.5.1): + - GoogleUtilities/MethodSwizzler (6.6.0): - GoogleUtilities/Logger - - GoogleUtilities/Network (6.5.1): + - GoogleUtilities/Network (6.6.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (6.5.1)" - - GoogleUtilities/Reachability (6.5.1): + - "GoogleUtilities/NSData+zlib (6.6.0)" + - GoogleUtilities/Reachability (6.6.0): - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (6.5.1): + - GoogleUtilities/UserDefaults (6.6.0): - GoogleUtilities/Logger - - nanopb (0.3.9011): - - nanopb/decode (= 0.3.9011) - - nanopb/encode (= 0.3.9011) - - nanopb/decode (0.3.9011) - - nanopb/encode (0.3.9011) + - GTMAppAuth (1.0.0): + - AppAuth/Core (~> 1.0) + - GTMSessionFetcher (~> 1.1) + - GTMSessionFetcher (1.4.0): + - GTMSessionFetcher/Full (= 1.4.0) + - GTMSessionFetcher/Core (1.4.0) + - GTMSessionFetcher/Full (1.4.0): + - GTMSessionFetcher/Core (= 1.4.0) + - nanopb (1.30905.0): + - nanopb/decode (= 1.30905.0) + - nanopb/encode (= 1.30905.0) + - nanopb/decode (1.30905.0) + - nanopb/encode (1.30905.0) - PromisesObjC (1.2.8) - RCTRequired (0.61.5) - RCTTypeSafety (0.61.5): @@ -253,7 +277,7 @@ PODS: - React-cxxreact (= 0.61.5) - React-jsi (= 0.61.5) - React-jsinspector (0.61.5) - - react-native-appearance (0.3.3): + - react-native-appearance (0.3.4): - React - react-native-safe-area-context (0.7.3): - React @@ -292,15 +316,25 @@ PODS: - React-cxxreact (= 0.61.5) - React-jsi (= 0.61.5) - ReactCommon/jscallinvoker (= 0.61.5) - - RNCMaskedView (0.1.7): + - RNCMaskedView (0.1.10): + - React + - RNFBApp (7.1.0): + - Firebase/CoreOnly (~> 6.25.0) + - React + - RNFBAuth (7.1.0): + - Firebase/Auth (~> 6.25.0) + - React + - RNFBApp + - RNGestureHandler (1.6.1): - React - - RNGestureHandler (1.6.0): + - RNGoogleSignin (4.0.3): + - GoogleSignIn (~> 5.0.0) - React - - RNReanimated (1.7.0): + - RNReanimated (1.9.0): - React - - RNScreens (2.3.0): + - RNScreens (2.8.0): - React - - RNSVG (12.0.3): + - RNSVG (12.1.0): - React - RNVectorIcons (6.6.0): - React @@ -313,6 +347,7 @@ DEPENDENCIES: - Firebase/Analytics - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`) - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) + - GoogleSignIn (~> 5.0.2) - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) - React (from `../node_modules/react-native/`) @@ -338,7 +373,10 @@ DEPENDENCIES: - ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)" + - "RNFBApp (from `../node_modules/@react-native-firebase/app`)" + - "RNFBAuth (from `../node_modules/@react-native-firebase/auth`)" - RNGestureHandler (from `../node_modules/react-native-gesture-handler`) + - "RNGoogleSignin (from `../node_modules/@react-native-community/google-signin`)" - RNReanimated (from `../node_modules/react-native-reanimated`) - RNScreens (from `../node_modules/react-native-screens`) - RNSVG (from `../node_modules/react-native-svg`) @@ -347,18 +385,23 @@ DEPENDENCIES: SPEC REPOS: trunk: + - AppAuth - boost-for-react-native - Firebase - FirebaseAnalytics + - FirebaseAuth + - FirebaseAuthInterop - FirebaseCore - FirebaseCoreDiagnostics - FirebaseCoreDiagnosticsInterop - FirebaseInstallations - - FirebaseInstanceID - GoogleAppMeasurement - GoogleDataTransport - GoogleDataTransportCCTSupport + - GoogleSignIn - GoogleUtilities + - GTMAppAuth + - GTMSessionFetcher - nanopb - PromisesObjC @@ -417,8 +460,14 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon" RNCMaskedView: :path: "../node_modules/@react-native-community/masked-view" + RNFBApp: + :path: "../node_modules/@react-native-firebase/app" + RNFBAuth: + :path: "../node_modules/@react-native-firebase/auth" RNGestureHandler: :path: "../node_modules/react-native-gesture-handler" + RNGoogleSignin: + :path: "../node_modules/@react-native-community/google-signin" RNReanimated: :path: "../node_modules/react-native-reanimated" RNScreens: @@ -431,24 +480,29 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: + AppAuth: 31bcec809a638d7bd2f86ea8a52bd45f6e81e7c7 boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75 - Firebase: 497158b816d0a86fc31babbd05546fcd7e6083ff - FirebaseAnalytics: cf95d3aab897612783020fbd98401d5366f135ee - FirebaseCore: 85064903ed6c28e47fec9c7bd149d94ba1b6b6e7 - FirebaseCoreDiagnostics: 5e78803ab276bc5b50340e3c539c06c3de35c649 + Firebase: 5719b4f965f76643241a1bb8244483ff6117db39 + FirebaseAnalytics: 93565f3f0f0f50a5d8770850bfe6a82eaba5db27 + FirebaseAuth: 7047aec89c0b17ecd924a550c853f0c27ac6015e + FirebaseAuthInterop: a0f37ae05833af156e72028f648d313f7e7592e9 + FirebaseCore: 6023faeada5afa95a349fccafb40900e32e9ac42 + FirebaseCoreDiagnostics: 4a773a47bd83bbd5a9b1ccf1ce7caa8b2d535e67 FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850 - FirebaseInstallations: 575cd32f2aec0feeb0e44f5d0110a09e5e60b47b - FirebaseInstanceID: 6668efc1655a4052c083f287a7141f1ead12f9c2 + FirebaseInstallations: 6f5f680e65dc374397a483c32d1799ba822a395b Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51 glog: 1f3da668190260b06b429bb211bfbee5cd790c28 - GoogleAppMeasurement: d0560d915abf15e692e8538ba1d58442217b6aff - GoogleDataTransport: 0048df6388dab1c254799f2a30365b1dffe20422 - GoogleDataTransportCCTSupport: f880d70972efa2ed1be4e9173a0f4c5f3dc2d176 - GoogleUtilities: 06eb53bb579efe7099152735900dd04bf09e7275 - nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd + GoogleAppMeasurement: 137afe68bfa406c3f4221b9395253d9e5d4654cf + GoogleDataTransport: 9a8a16f79feffc7f42096743de2a7c4815e84020 + GoogleDataTransportCCTSupport: d70a561f7d236af529fee598835caad5e25f6d3d + GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213 + GoogleUtilities: 39530bc0ad980530298e9c4af8549e991fd033b1 + GTMAppAuth: 4deac854479704f348309e7b66189e604cf5e01e + GTMSessionFetcher: 6f5c8abbab8a9bce4bb3f057e317728ec6182b10 + nanopb: c43f40fadfe79e8b8db116583945847910cbabc9 PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6 RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1 RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320 @@ -459,7 +513,7 @@ SPEC CHECKSUMS: React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7 React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386 React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0 - react-native-appearance: ff12122b6456efc29b3a22a3731eb54f7c291e69 + react-native-appearance: fc2014516054585d531e07aa0b40ab0de1d2be85 react-native-safe-area-context: 8260e5157617df4b72865f44006797f895b2ada7 React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76 React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360 @@ -471,14 +525,17 @@ SPEC CHECKSUMS: React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd - RNCMaskedView: 90dd32f5b786bd562e876e1421ea77c700cbf71e - RNGestureHandler: dde546180bf24af0b5f737c8ad04b6f3fa51609a - RNReanimated: 031fe8d9ea93c2bd689a40f05320ef9d96f74d7f - RNScreens: 03bf608b92ac0acf323f47d8f5b63a8f829340c8 - RNSVG: 7e16ddfc6e00d5aa69c9eb83e699bcce5dcb85d4 + RNCMaskedView: f5c7d14d6847b7b44853f7acb6284c1da30a3459 + RNFBApp: 25a6476dfd7aac2bcbe984f569875bcea122895b + RNFBAuth: 52e7af4244e6adf39237ab8e94d6d51f2c1bf450 + RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38 + RNGoogleSignin: ccf71ee4b6cfd324fd788a41e457e2043838c0d9 + RNReanimated: b5ccb50650ba06f6e749c7c329a1bc3ae0c88b43 + RNScreens: 62211832af51e0aebcf6e8c36bcf7dd65592f244 + RNSVG: ce9d996113475209013317e48b05c21ee988d42e RNVectorIcons: 0bb4def82230be1333ddaeee9fcba45f0b288ed4 Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b -PODFILE CHECKSUM: 3b66506f86ae7486d8598d10121f4b20193bdd3a +PODFILE CHECKSUM: da226609beb238b8d56536ad24426a344d025a46 -COCOAPODS: 1.8.4 +COCOAPODS: 1.9.1 diff --git a/ios/lost.xcodeproj/project.pbxproj b/ios/lost.xcodeproj/project.pbxproj index 899f29a..1e7b547 100644 --- a/ios/lost.xcodeproj/project.pbxproj +++ b/ios/lost.xcodeproj/project.pbxproj @@ -13,6 +13,10 @@ 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 1A2183F4F402561E967B23EB /* libPods-lost.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F68B03CD8277D1EE90F734FE /* libPods-lost.a */; }; + 2507B627248CDBA9007CED7B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2507B626248CDBA9007CED7B /* GoogleService-Info.plist */; }; + 2507B628248CDBA9007CED7B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2507B626248CDBA9007CED7B /* GoogleService-Info.plist */; }; + 2507B629248CDBA9007CED7B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2507B626248CDBA9007CED7B /* GoogleService-Info.plist */; }; + 2507B62A248CDBA9007CED7B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2507B626248CDBA9007CED7B /* GoogleService-Info.plist */; }; 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; @@ -56,6 +60,7 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = lost/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = lost/main.m; sourceTree = ""; }; 1C7ECD7A5478A1C3DE79FBCD /* libPods-lost-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-lost-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 2507B626248CDBA9007CED7B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 2D02E47B1E0B4A5D006451C7 /* lost-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "lost-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 2D02E4901E0B4A5D006451C7 /* lost-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "lost-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 30F3B6651508E451181CAACD /* Pods-lost.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-lost.debug.xcconfig"; path = "Target Support Files/Pods-lost/Pods-lost.debug.xcconfig"; sourceTree = ""; }; @@ -137,6 +142,7 @@ 13B07FB51A68108700A75B9A /* Images.xcassets */, 13B07FB61A68108700A75B9A /* Info.plist */, 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, + 2507B626248CDBA9007CED7B /* GoogleService-Info.plist */, 13B07FB71A68108700A75B9A /* main.m */, ); name = lost; @@ -236,6 +242,7 @@ 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, BDAD6234F274F07A0B94F146 /* [CP] Copy Pods Resources */, + 3AAC5FD272BE0608EA4F80B3 /* [CP-User] [RNFB] Core Configuration */, ); buildRules = ( ); @@ -343,6 +350,7 @@ buildActionMask = 2147483647; files = ( AA476EDF242CDE6500D8ED74 /* GoogleService-Info.plist in Resources */, + 2507B628248CDBA9007CED7B /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -351,6 +359,7 @@ buildActionMask = 2147483647; files = ( 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, + 2507B627248CDBA9007CED7B /* GoogleService-Info.plist in Resources */, 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, AA476EDE242CDE6500D8ED74 /* GoogleService-Info.plist in Resources */, ); @@ -362,6 +371,7 @@ files = ( 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, AA476EE0242CDE6500D8ED74 /* GoogleService-Info.plist in Resources */, + 2507B629248CDBA9007CED7B /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -370,6 +380,7 @@ buildActionMask = 2147483647; files = ( AA476EE1242CDE6500D8ED74 /* GoogleService-Info.plist in Resources */, + 2507B62A248CDBA9007CED7B /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -404,6 +415,16 @@ shellPath = /bin/sh; shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; }; + 3AAC5FD272BE0608EA4F80B3 /* [CP-User] [RNFB] Core Configuration */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + name = "[CP-User] [RNFB] Core Configuration"; + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#!/usr/bin/env bash\n#\n# Copyright (c) 2016-present Invertase Limited & Contributors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this library except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nset -e\n\n_MAX_LOOKUPS=2;\n_SEARCH_RESULT=''\n_RN_ROOT_EXISTS=''\n_CURRENT_LOOKUPS=1\n_JSON_ROOT=\"'react-native'\"\n_JSON_FILE_NAME='firebase.json'\n_JSON_OUTPUT_BASE64='e30=' # { }\n_CURRENT_SEARCH_DIR=${PROJECT_DIR}\n_PLIST_BUDDY=/usr/libexec/PlistBuddy\n_TARGET_PLIST=\"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\n_DSYM_PLIST=\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist\"\n\n# plist arrays\n_PLIST_ENTRY_KEYS=()\n_PLIST_ENTRY_TYPES=()\n_PLIST_ENTRY_VALUES=()\n\nfunction setPlistValue {\n echo \"info: setting plist entry '$1' of type '$2' in file '$4'\"\n ${_PLIST_BUDDY} -c \"Add :$1 $2 '$3'\" $4 || echo \"info: '$1' already exists\"\n}\n\nfunction getFirebaseJsonKeyValue () {\n if [[ ${_RN_ROOT_EXISTS} ]]; then\n ruby -e \"require 'rubygems';require 'json'; output=JSON.parse('$1'); puts output[$_JSON_ROOT]['$2']\"\n else\n echo \"\"\n fi;\n}\n\nfunction jsonBoolToYesNo () {\n if [[ $1 == \"false\" ]]; then\n echo \"NO\"\n elif [[ $1 == \"true\" ]]; then\n echo \"YES\"\n else echo \"NO\"\n fi\n}\n\necho \"info: -> RNFB build script started\"\necho \"info: 1) Locating ${_JSON_FILE_NAME} file:\"\n\nif [[ -z ${_CURRENT_SEARCH_DIR} ]]; then\n _CURRENT_SEARCH_DIR=$(pwd)\nfi;\n\nwhile true; do\n _CURRENT_SEARCH_DIR=$(dirname \"$_CURRENT_SEARCH_DIR\")\n if [[ \"$_CURRENT_SEARCH_DIR\" == \"/\" ]] || [[ ${_CURRENT_LOOKUPS} -gt ${_MAX_LOOKUPS} ]]; then break; fi;\n echo \"info: ($_CURRENT_LOOKUPS of $_MAX_LOOKUPS) Searching in '$_CURRENT_SEARCH_DIR' for a ${_JSON_FILE_NAME} file.\"\n _SEARCH_RESULT=$(find \"$_CURRENT_SEARCH_DIR\" -maxdepth 2 -name ${_JSON_FILE_NAME} -print | head -n 1)\n if [[ ${_SEARCH_RESULT} ]]; then\n echo \"info: ${_JSON_FILE_NAME} found at $_SEARCH_RESULT\"\n break;\n fi;\n _CURRENT_LOOKUPS=$((_CURRENT_LOOKUPS+1))\ndone\n\nif [[ ${_SEARCH_RESULT} ]]; then\n _JSON_OUTPUT_RAW=$(cat \"${_SEARCH_RESULT}\")\n _RN_ROOT_EXISTS=$(ruby -e \"require 'rubygems';require 'json'; output=JSON.parse('$_JSON_OUTPUT_RAW'); puts output[$_JSON_ROOT]\" || echo '')\n\n if [[ ${_RN_ROOT_EXISTS} ]]; then\n _JSON_OUTPUT_BASE64=$(python -c 'import json,sys,base64;print(base64.b64encode(json.dumps(json.loads(open('\"'${_SEARCH_RESULT}'\"').read())['${_JSON_ROOT}'])))' || echo \"e30=\")\n fi\n\n _PLIST_ENTRY_KEYS+=(\"firebase_json_raw\")\n _PLIST_ENTRY_TYPES+=(\"string\")\n _PLIST_ENTRY_VALUES+=(\"$_JSON_OUTPUT_BASE64\")\n\n # config.messaging_auto_init_enabled\n _MESSAGING_AUTO_INIT=$(getFirebaseJsonKeyValue \"$_JSON_OUTPUT_RAW\" \"messaging_auto_init_enabled\")\n if [[ $_MESSAGING_AUTO_INIT ]]; then\n _PLIST_ENTRY_KEYS+=(\"FirebaseMessagingAutoInitEnabled\")\n _PLIST_ENTRY_TYPES+=(\"bool\")\n _PLIST_ENTRY_VALUES+=(\"$(jsonBoolToYesNo \"$_MESSAGING_AUTO_INIT\")\")\n fi\n\n # config.crashlytics_disable_auto_disabler - undocumented for now - mainly for debugging, document if becomes usful\n _CRASHLYTICS_AUTO_DISABLE_ENABLED=$(getFirebaseJsonKeyValue \"$_JSON_OUTPUT_RAW\" \"crashlytics_disable_auto_disabler\")\n if [[ $_CRASHLYTICS_AUTO_DISABLE_ENABLED == \"true\" ]]; then\n echo \"Disabled Crashlytics auto disabler.\" # do nothing\n else\n _PLIST_ENTRY_KEYS+=(\"firebase_crashlytics_collection_enabled\")\n _PLIST_ENTRY_TYPES+=(\"bool\")\n _PLIST_ENTRY_VALUES+=(\"NO\")\n fi\n\n # config.admob_delay_app_measurement_init\n _ADMOB_DELAY_APP_MEASUREMENT=$(getFirebaseJsonKeyValue \"$_JSON_OUTPUT_RAW\" \"admob_delay_app_measurement_init\")\n if [[ $_ADMOB_DELAY_APP_MEASUREMENT == \"true\" ]]; then\n _PLIST_ENTRY_KEYS+=(\"GADDelayAppMeasurementInit\")\n _PLIST_ENTRY_TYPES+=(\"bool\")\n _PLIST_ENTRY_VALUES+=(\"YES\")\n fi\n\n # config.admob_ios_app_id\n _ADMOB_IOS_APP_ID=$(getFirebaseJsonKeyValue \"$_JSON_OUTPUT_RAW\" \"admob_ios_app_id\")\n if [[ $_ADMOB_IOS_APP_ID ]]; then\n _PLIST_ENTRY_KEYS+=(\"GADApplicationIdentifier\")\n _PLIST_ENTRY_TYPES+=(\"string\")\n _PLIST_ENTRY_VALUES+=(\"$_ADMOB_IOS_APP_ID\")\n fi\nelse\n _PLIST_ENTRY_KEYS+=(\"firebase_json_raw\")\n _PLIST_ENTRY_TYPES+=(\"string\")\n _PLIST_ENTRY_VALUES+=(\"$_JSON_OUTPUT_BASE64\")\n echo \"warning: A firebase.json file was not found, whilst this file is optional it is recommended to include it to configure firebase services in React Native Firebase.\"\nfi;\n\necho \"info: 2) Injecting Info.plist entries: \"\n\n# Log out the keys we're adding\nfor i in \"${!_PLIST_ENTRY_KEYS[@]}\"; do\n echo \" -> $i) ${_PLIST_ENTRY_KEYS[$i]}\" \"${_PLIST_ENTRY_TYPES[$i]}\" \"${_PLIST_ENTRY_VALUES[$i]}\"\ndone\n\nfor plist in \"${_TARGET_PLIST}\" \"${_DSYM_PLIST}\" ; do\n if [[ -f \"${plist}\" ]]; then\n\n # paths with spaces break the call to setPlistValue. temporarily modify\n # the shell internal field separator variable (IFS), which normally \n # includes spaces, to consist only of line breaks\n oldifs=$IFS\n IFS=\"\n\"\n\n for i in \"${!_PLIST_ENTRY_KEYS[@]}\"; do\n setPlistValue \"${_PLIST_ENTRY_KEYS[$i]}\" \"${_PLIST_ENTRY_TYPES[$i]}\" \"${_PLIST_ENTRY_VALUES[$i]}\" \"${plist}\"\n done\n\n # restore the original internal field separator value\n IFS=$oldifs\n else\n echo \"warning: A Info.plist build output file was not found (${plist})\"\n fi\ndone\n\necho \"info: <- RNFB build script finished\"\n\n"; + }; 8656521E962E86F0342C709C /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -455,6 +476,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-lost/Pods-lost-resources.sh", + "${PODS_ROOT}/GoogleSignIn/Resources/GoogleSignIn.bundle", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Entypo.ttf", "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf", @@ -474,6 +496,7 @@ ); name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AntDesign.ttf", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Entypo.ttf", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EvilIcons.ttf", diff --git a/ios/lost/Info.plist b/ios/lost/Info.plist index 07d200c..f08313c 100644 --- a/ios/lost/Info.plist +++ b/ios/lost/Info.plist @@ -20,6 +20,17 @@ 1.0 CFBundleSignature ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + com.googleusercontent.apps.1016139682272-tcojfccg154tn2dfdat6mopfmhegm0l3 + + + CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/package.json b/package.json index 6a6f41f..74eae8b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,10 @@ "dependencies": { "@eva-design/eva": "^1.4.0", "@react-native-community/async-storage": "^2.0.0-rc.2", + "@react-native-community/google-signin": "^4.0.3", "@react-native-community/masked-view": "^0.1.7", + "@react-native-firebase/app": "^7.1.0", + "@react-native-firebase/auth": "^7.1.0", "@react-navigation/bottom-tabs": "^5.1.1", "@react-navigation/native": "^5.0.9", "@react-navigation/stack": "^5.2.1", diff --git a/src/pages/AccountManage/index.tsx b/src/pages/AccountManage/index.tsx new file mode 100644 index 0000000..97751a4 --- /dev/null +++ b/src/pages/AccountManage/index.tsx @@ -0,0 +1,55 @@ +import React, { useState, useEffect } from 'react'; +import { View, Text } from 'react-native'; +import auth from '@react-native-firebase/auth'; +import {connect} from 'react-redux'; +import {LoginButton} from '../../components/Button/Login'; +import {K} from '../../store/constants'; +import {PageHeader} from '../../components/Page/PageHeader'; +import {Layout} from '@ui-kitten/components'; +import firebase from '@react-native-firebase/app' + + + +const ManageAccountPageC = (props: any) => { + const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light; + + return ( + + props.navigation.navigate('Settings')} + style = {{zIndex: 10}} + /> + + Welcome! + auth().signOut()} + /> + + + ); + } + + + + +const mapStateToProps = (state: any) => { + return { + theme: state.theme, + }; +}; + +const mapDispatchToProps = (dispatch: any) => { + return {}; +}; + +export const ManageAccountPage = connect( + mapStateToProps, + mapDispatchToProps, +)(ManageAccountPageC); \ No newline at end of file diff --git a/src/pages/Landing/index.tsx b/src/pages/Landing/index.tsx index 6b4e2e4..412b2eb 100644 --- a/src/pages/Landing/index.tsx +++ b/src/pages/Landing/index.tsx @@ -7,11 +7,27 @@ import {PageHeader} from '../../components/Page/PageHeader'; import {K} from '../../store/constants'; import Svg, {Circle, G, Path, Defs} from 'react-native-svg'; import {View} from 'react-native'; +import auth from '@react-native-firebase/auth'; +import { GoogleSignin } from '@react-native-community/google-signin'; const LandingPageC = (props: any) => { const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light; console.log(props.deviceSize.width); + GoogleSignin.configure({ + webClientId: '1016139682272-62ol6b1c8phm74m4p059mmutov96prhu.apps.googleusercontent.com', + }); + async function onGoogleButtonPress() { + + const { idToken } = await GoogleSignin.signIn(); + + const googleCredential = auth.GoogleAuthProvider.credential(idToken); + + return auth().signInWithCredential(googleCredential); + + } + + const SvgBackgroundGraphic = (svgProps: {isLarge?: boolean}) => ( { return ( + props.navigation.navigate('Settings')} + style = {{zIndex: 10}} + /> @@ -55,18 +80,22 @@ const LandingPageC = (props: any) => { title="Login With Google" theme={props.theme} icon="google" + onPress={() => onGoogleButtonPress()} /> props.navigation.navigate('Settings')} /> ); }; + + const mapStateToProps = (state: any) => { return { theme: state.theme, diff --git a/src/pages/Loading/index.tsx b/src/pages/Loading/index.tsx new file mode 100644 index 0000000..35287d5 --- /dev/null +++ b/src/pages/Loading/index.tsx @@ -0,0 +1,56 @@ +import React, { useState, useEffect } from 'react'; +import { View, Text } from 'react-native'; +import auth from '@react-native-firebase/auth'; +import {connect} from 'react-redux'; +import {LoginButton} from '../../components/Button/Login'; +import {K} from '../../store/constants'; +import {PageHeader} from '../../components/Page/PageHeader'; +import {Layout} from '@ui-kitten/components'; +import firebase from '@react-native-firebase/app' + + + +const App = (props: any) => { + const themeColor = props.theme === 'dark' ? K.colors.dark : K.colors.light; + // Set an initializing state whilst Firebase connects + const [initializing, setInitializing] = useState(true); + const [user, setUser] = useState(); + + // Handle user state changes + function onAuthStateChanged(user) { + setUser(user); + if (initializing) setInitializing(false); + } + + useEffect(() => { + const subscriber = auth().onAuthStateChanged(onAuthStateChanged); + return subscriber; // unsubscribe on unmount + }, []); + + if (initializing) return null; + + if (!user) { + props.navigation.navigate('Signup'); + }else if (user){ + props.navigation.navigate('ManageAccount'); + } + return null; +} + + + + +const mapStateToProps = (state: any) => { + return { + theme: state.theme, + }; +}; + +const mapDispatchToProps = (dispatch: any) => { + return {}; +}; + +export const AccountLoadingPage = connect( + mapStateToProps, + mapDispatchToProps, +)(App); \ No newline at end of file diff --git a/src/pages/Settings/index.tsx b/src/pages/Settings/index.tsx index 818fa26..beb4a64 100644 --- a/src/pages/Settings/index.tsx +++ b/src/pages/Settings/index.tsx @@ -162,7 +162,7 @@ const SettingsPageC = (props: any) => { }, { title: 'Login', - onPress: () => {}, + onPress: () => {props.navigation.navigate('Account')}, } ];