parent
003561703c
commit
f2cacf9e26
71 changed files with 12721 additions and 1368 deletions
@ -0,0 +1,553 @@ |
||||
PODS: |
||||
- boost-for-react-native (1.63.0) |
||||
- CocoaAsyncSocket (7.6.5) |
||||
- DoubleConversion (1.1.6) |
||||
- FBLazyVector (0.65.1) |
||||
- FBReactNativeSpec (0.65.1): |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- RCTRequired (= 0.65.1) |
||||
- RCTTypeSafety (= 0.65.1) |
||||
- React-Core (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- Flipper (0.93.0): |
||||
- Flipper-Folly (~> 2.6) |
||||
- Flipper-RSocket (~> 1.4) |
||||
- Flipper-Boost-iOSX (1.76.0.1.11) |
||||
- Flipper-DoubleConversion (3.1.7) |
||||
- Flipper-Fmt (7.1.7) |
||||
- Flipper-Folly (2.6.7): |
||||
- Flipper-Boost-iOSX |
||||
- Flipper-DoubleConversion |
||||
- Flipper-Fmt (= 7.1.7) |
||||
- Flipper-Glog |
||||
- libevent (~> 2.1.12) |
||||
- OpenSSL-Universal (= 1.1.180) |
||||
- Flipper-Glog (0.3.6) |
||||
- Flipper-PeerTalk (0.0.4) |
||||
- Flipper-RSocket (1.4.3): |
||||
- Flipper-Folly (~> 2.6) |
||||
- FlipperKit (0.93.0): |
||||
- FlipperKit/Core (= 0.93.0) |
||||
- FlipperKit/Core (0.93.0): |
||||
- Flipper (~> 0.93.0) |
||||
- FlipperKit/CppBridge |
||||
- FlipperKit/FBCxxFollyDynamicConvert |
||||
- FlipperKit/FBDefines |
||||
- FlipperKit/FKPortForwarding |
||||
- FlipperKit/CppBridge (0.93.0): |
||||
- Flipper (~> 0.93.0) |
||||
- FlipperKit/FBCxxFollyDynamicConvert (0.93.0): |
||||
- Flipper-Folly (~> 2.6) |
||||
- FlipperKit/FBDefines (0.93.0) |
||||
- FlipperKit/FKPortForwarding (0.93.0): |
||||
- CocoaAsyncSocket (~> 7.6) |
||||
- Flipper-PeerTalk (~> 0.0.4) |
||||
- FlipperKit/FlipperKitHighlightOverlay (0.93.0) |
||||
- FlipperKit/FlipperKitLayoutHelpers (0.93.0): |
||||
- FlipperKit/Core |
||||
- FlipperKit/FlipperKitHighlightOverlay |
||||
- FlipperKit/FlipperKitLayoutTextSearchable |
||||
- FlipperKit/FlipperKitLayoutIOSDescriptors (0.93.0): |
||||
- FlipperKit/Core |
||||
- FlipperKit/FlipperKitHighlightOverlay |
||||
- FlipperKit/FlipperKitLayoutHelpers |
||||
- YogaKit (~> 1.18) |
||||
- FlipperKit/FlipperKitLayoutPlugin (0.93.0): |
||||
- FlipperKit/Core |
||||
- FlipperKit/FlipperKitHighlightOverlay |
||||
- FlipperKit/FlipperKitLayoutHelpers |
||||
- FlipperKit/FlipperKitLayoutIOSDescriptors |
||||
- FlipperKit/FlipperKitLayoutTextSearchable |
||||
- YogaKit (~> 1.18) |
||||
- FlipperKit/FlipperKitLayoutTextSearchable (0.93.0) |
||||
- FlipperKit/FlipperKitNetworkPlugin (0.93.0): |
||||
- FlipperKit/Core |
||||
- FlipperKit/FlipperKitReactPlugin (0.93.0): |
||||
- FlipperKit/Core |
||||
- FlipperKit/FlipperKitUserDefaultsPlugin (0.93.0): |
||||
- FlipperKit/Core |
||||
- FlipperKit/SKIOSNetworkPlugin (0.93.0): |
||||
- FlipperKit/Core |
||||
- FlipperKit/FlipperKitNetworkPlugin |
||||
- fmt (6.2.1) |
||||
- glog (0.3.5) |
||||
- libevent (2.1.12) |
||||
- OpenSSL-Universal (1.1.180) |
||||
- RCT-Folly (2021.04.26.00): |
||||
- boost-for-react-native |
||||
- DoubleConversion |
||||
- fmt (~> 6.2.1) |
||||
- glog |
||||
- RCT-Folly/Default (= 2021.04.26.00) |
||||
- RCT-Folly/Default (2021.04.26.00): |
||||
- boost-for-react-native |
||||
- DoubleConversion |
||||
- fmt (~> 6.2.1) |
||||
- glog |
||||
- RCTRequired (0.65.1) |
||||
- RCTTypeSafety (0.65.1): |
||||
- FBLazyVector (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- RCTRequired (= 0.65.1) |
||||
- React-Core (= 0.65.1) |
||||
- React (0.65.1): |
||||
- React-Core (= 0.65.1) |
||||
- React-Core/DevSupport (= 0.65.1) |
||||
- React-Core/RCTWebSocket (= 0.65.1) |
||||
- React-RCTActionSheet (= 0.65.1) |
||||
- React-RCTAnimation (= 0.65.1) |
||||
- React-RCTBlob (= 0.65.1) |
||||
- React-RCTImage (= 0.65.1) |
||||
- React-RCTLinking (= 0.65.1) |
||||
- React-RCTNetwork (= 0.65.1) |
||||
- React-RCTSettings (= 0.65.1) |
||||
- React-RCTText (= 0.65.1) |
||||
- React-RCTVibration (= 0.65.1) |
||||
- React-callinvoker (0.65.1) |
||||
- React-Core (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default (= 0.65.1) |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/CoreModulesHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/Default (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/DevSupport (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default (= 0.65.1) |
||||
- React-Core/RCTWebSocket (= 0.65.1) |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-jsinspector (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTActionSheetHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTAnimationHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTBlobHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTImageHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTLinkingHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTNetworkHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTSettingsHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTTextHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTVibrationHeaders (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-Core/RCTWebSocket (0.65.1): |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/Default (= 0.65.1) |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsiexecutor (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- Yoga |
||||
- React-CoreModules (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- RCTTypeSafety (= 0.65.1) |
||||
- React-Core/CoreModulesHeaders (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-RCTImage (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-cxxreact (0.65.1): |
||||
- boost-for-react-native (= 1.63.0) |
||||
- DoubleConversion |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-callinvoker (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-jsinspector (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- React-runtimeexecutor (= 0.65.1) |
||||
- React-jsi (0.65.1): |
||||
- boost-for-react-native (= 1.63.0) |
||||
- DoubleConversion |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-jsi/Default (= 0.65.1) |
||||
- React-jsi/Default (0.65.1): |
||||
- boost-for-react-native (= 1.63.0) |
||||
- DoubleConversion |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-jsiexecutor (0.65.1): |
||||
- DoubleConversion |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- React-jsinspector (0.65.1) |
||||
- react-native-restart (0.0.22): |
||||
- React-Core |
||||
- react-native-safe-area-context (3.3.2): |
||||
- React-Core |
||||
- React-perflogger (0.65.1) |
||||
- React-RCTActionSheet (0.65.1): |
||||
- React-Core/RCTActionSheetHeaders (= 0.65.1) |
||||
- React-RCTAnimation (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- RCTTypeSafety (= 0.65.1) |
||||
- React-Core/RCTAnimationHeaders (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-RCTBlob (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/RCTBlobHeaders (= 0.65.1) |
||||
- React-Core/RCTWebSocket (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-RCTNetwork (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-RCTImage (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- RCTTypeSafety (= 0.65.1) |
||||
- React-Core/RCTImageHeaders (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-RCTNetwork (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-RCTLinking (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- React-Core/RCTLinkingHeaders (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-RCTNetwork (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- RCTTypeSafety (= 0.65.1) |
||||
- React-Core/RCTNetworkHeaders (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-RCTSettings (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- RCTTypeSafety (= 0.65.1) |
||||
- React-Core/RCTSettingsHeaders (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-RCTText (0.65.1): |
||||
- React-Core/RCTTextHeaders (= 0.65.1) |
||||
- React-RCTVibration (0.65.1): |
||||
- FBReactNativeSpec (= 0.65.1) |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-Core/RCTVibrationHeaders (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (= 0.65.1) |
||||
- React-runtimeexecutor (0.65.1): |
||||
- React-jsi (= 0.65.1) |
||||
- ReactCommon/turbomodule/core (0.65.1): |
||||
- DoubleConversion |
||||
- glog |
||||
- RCT-Folly (= 2021.04.26.00) |
||||
- React-callinvoker (= 0.65.1) |
||||
- React-Core (= 0.65.1) |
||||
- React-cxxreact (= 0.65.1) |
||||
- React-jsi (= 0.65.1) |
||||
- React-perflogger (= 0.65.1) |
||||
- RNCAsyncStorage (1.12.1): |
||||
- React-Core |
||||
- RNDeviceInfo (8.4.0): |
||||
- React-Core |
||||
- RNGestureHandler (1.10.3): |
||||
- React-Core |
||||
- RNScreens (3.8.0): |
||||
- React-Core |
||||
- React-RCTImage |
||||
- Yoga (1.14.0) |
||||
- YogaKit (1.18.1): |
||||
- Yoga (~> 1.14) |
||||
|
||||
DEPENDENCIES: |
||||
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) |
||||
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) |
||||
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) |
||||
- Flipper (= 0.93.0) |
||||
- Flipper-Boost-iOSX (= 1.76.0.1.11) |
||||
- Flipper-DoubleConversion (= 3.1.7) |
||||
- Flipper-Fmt (= 7.1.7) |
||||
- Flipper-Folly (= 2.6.7) |
||||
- Flipper-Glog (= 0.3.6) |
||||
- Flipper-PeerTalk (= 0.0.4) |
||||
- Flipper-RSocket (= 1.4.3) |
||||
- FlipperKit (= 0.93.0) |
||||
- FlipperKit/Core (= 0.93.0) |
||||
- FlipperKit/CppBridge (= 0.93.0) |
||||
- FlipperKit/FBCxxFollyDynamicConvert (= 0.93.0) |
||||
- FlipperKit/FBDefines (= 0.93.0) |
||||
- FlipperKit/FKPortForwarding (= 0.93.0) |
||||
- FlipperKit/FlipperKitHighlightOverlay (= 0.93.0) |
||||
- FlipperKit/FlipperKitLayoutPlugin (= 0.93.0) |
||||
- FlipperKit/FlipperKitLayoutTextSearchable (= 0.93.0) |
||||
- FlipperKit/FlipperKitNetworkPlugin (= 0.93.0) |
||||
- FlipperKit/FlipperKitReactPlugin (= 0.93.0) |
||||
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.93.0) |
||||
- FlipperKit/SKIOSNetworkPlugin (= 0.93.0) |
||||
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) |
||||
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) |
||||
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) |
||||
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) |
||||
- React (from `../node_modules/react-native/`) |
||||
- React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) |
||||
- React-Core (from `../node_modules/react-native/`) |
||||
- React-Core/DevSupport (from `../node_modules/react-native/`) |
||||
- React-Core/RCTWebSocket (from `../node_modules/react-native/`) |
||||
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`) |
||||
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) |
||||
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) |
||||
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) |
||||
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) |
||||
- react-native-restart (from `../node_modules/react-native-restart`) |
||||
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) |
||||
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) |
||||
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) |
||||
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) |
||||
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) |
||||
- React-RCTImage (from `../node_modules/react-native/Libraries/Image`) |
||||
- React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) |
||||
- React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) |
||||
- React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) |
||||
- React-RCTText (from `../node_modules/react-native/Libraries/Text`) |
||||
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) |
||||
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) |
||||
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) |
||||
- "RNCAsyncStorage (from `../node_modules/@react-native-community/async-storage`)" |
||||
- RNDeviceInfo (from `../node_modules/react-native-device-info`) |
||||
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`) |
||||
- RNScreens (from `../node_modules/react-native-screens`) |
||||
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`) |
||||
|
||||
SPEC REPOS: |
||||
trunk: |
||||
- boost-for-react-native |
||||
- CocoaAsyncSocket |
||||
- Flipper |
||||
- Flipper-Boost-iOSX |
||||
- Flipper-DoubleConversion |
||||
- Flipper-Fmt |
||||
- Flipper-Folly |
||||
- Flipper-Glog |
||||
- Flipper-PeerTalk |
||||
- Flipper-RSocket |
||||
- FlipperKit |
||||
- fmt |
||||
- libevent |
||||
- OpenSSL-Universal |
||||
- YogaKit |
||||
|
||||
EXTERNAL SOURCES: |
||||
DoubleConversion: |
||||
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" |
||||
FBLazyVector: |
||||
:path: "../node_modules/react-native/Libraries/FBLazyVector" |
||||
FBReactNativeSpec: |
||||
:path: "../node_modules/react-native/React/FBReactNativeSpec" |
||||
glog: |
||||
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" |
||||
RCT-Folly: |
||||
:podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" |
||||
RCTRequired: |
||||
:path: "../node_modules/react-native/Libraries/RCTRequired" |
||||
RCTTypeSafety: |
||||
:path: "../node_modules/react-native/Libraries/TypeSafety" |
||||
React: |
||||
:path: "../node_modules/react-native/" |
||||
React-callinvoker: |
||||
:path: "../node_modules/react-native/ReactCommon/callinvoker" |
||||
React-Core: |
||||
:path: "../node_modules/react-native/" |
||||
React-CoreModules: |
||||
:path: "../node_modules/react-native/React/CoreModules" |
||||
React-cxxreact: |
||||
:path: "../node_modules/react-native/ReactCommon/cxxreact" |
||||
React-jsi: |
||||
:path: "../node_modules/react-native/ReactCommon/jsi" |
||||
React-jsiexecutor: |
||||
:path: "../node_modules/react-native/ReactCommon/jsiexecutor" |
||||
React-jsinspector: |
||||
:path: "../node_modules/react-native/ReactCommon/jsinspector" |
||||
react-native-restart: |
||||
:path: "../node_modules/react-native-restart" |
||||
react-native-safe-area-context: |
||||
:path: "../node_modules/react-native-safe-area-context" |
||||
React-perflogger: |
||||
:path: "../node_modules/react-native/ReactCommon/reactperflogger" |
||||
React-RCTActionSheet: |
||||
:path: "../node_modules/react-native/Libraries/ActionSheetIOS" |
||||
React-RCTAnimation: |
||||
:path: "../node_modules/react-native/Libraries/NativeAnimation" |
||||
React-RCTBlob: |
||||
:path: "../node_modules/react-native/Libraries/Blob" |
||||
React-RCTImage: |
||||
:path: "../node_modules/react-native/Libraries/Image" |
||||
React-RCTLinking: |
||||
:path: "../node_modules/react-native/Libraries/LinkingIOS" |
||||
React-RCTNetwork: |
||||
:path: "../node_modules/react-native/Libraries/Network" |
||||
React-RCTSettings: |
||||
:path: "../node_modules/react-native/Libraries/Settings" |
||||
React-RCTText: |
||||
:path: "../node_modules/react-native/Libraries/Text" |
||||
React-RCTVibration: |
||||
:path: "../node_modules/react-native/Libraries/Vibration" |
||||
React-runtimeexecutor: |
||||
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor" |
||||
ReactCommon: |
||||
:path: "../node_modules/react-native/ReactCommon" |
||||
RNCAsyncStorage: |
||||
:path: "../node_modules/@react-native-community/async-storage" |
||||
RNDeviceInfo: |
||||
:path: "../node_modules/react-native-device-info" |
||||
RNGestureHandler: |
||||
:path: "../node_modules/react-native-gesture-handler" |
||||
RNScreens: |
||||
:path: "../node_modules/react-native-screens" |
||||
Yoga: |
||||
:path: "../node_modules/react-native/ReactCommon/yoga" |
||||
|
||||
SPEC CHECKSUMS: |
||||
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c |
||||
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 |
||||
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 |
||||
FBLazyVector: 33c82491102f20ecddb6c6a2c273696ace3191e0 |
||||
FBReactNativeSpec: df8f81d2a7541ee6755a047b398a5cb5a72acd0e |
||||
Flipper: b1fddf9a17c32097b2b4c806ad158b2f36bb2692 |
||||
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c |
||||
Flipper-DoubleConversion: 57ffbe81ef95306cc9e69c4aa3aeeeeb58a6a28c |
||||
Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b |
||||
Flipper-Folly: 83af37379faa69497529e414bd43fbfc7cae259a |
||||
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6 |
||||
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 |
||||
Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 |
||||
FlipperKit: aec2d931adeee48a07bab1ea8bcc8a6bb87dfce4 |
||||
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 |
||||
glog: 5337263514dd6f09803962437687240c5dc39aa4 |
||||
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 |
||||
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b |
||||
RCT-Folly: 0dd9e1eb86348ecab5ba76f910b56f4b5fef3c46 |
||||
RCTRequired: 6cf071ab2adfd769014b3d94373744ee6e789530 |
||||
RCTTypeSafety: b829c59453478bb5b02487b8de3336386ab93ab1 |
||||
React: 29d8a785041b96a2754c25cc16ddea57b7a618ce |
||||
React-callinvoker: 2857b61132bd7878b736e282581f4b42fd93002b |
||||
React-Core: 001e21bad5ca41e59e9d90df5c0b53da04c3ce8e |
||||
React-CoreModules: 0a0410ab296a62ab38e2f8d321e822d1fcc2fe49 |
||||
React-cxxreact: 8d904967134ae8ff0119c5357c42eaae976806f8 |
||||
React-jsi: 12913c841713a15f64eabf5c9ad98592c0ec5940 |
||||
React-jsiexecutor: 43f2542aed3c26e42175b339f8d37fe3dd683765 |
||||
React-jsinspector: 41e58e5b8e3e0bf061fdf725b03f2144014a8fb0 |
||||
react-native-restart: d4ea7637e193da7558d229b3704d500ec0d75f9c |
||||
react-native-safe-area-context: 5cf05f49df9d17261e40e518481f2e334c6cd4b5 |
||||
React-perflogger: fd28ee1f2b5b150b00043f0301d96bd417fdc339 |
||||
React-RCTActionSheet: 7f3fa0855c346aa5d7c60f9ced16e067db6d29fa |
||||
React-RCTAnimation: 2119a18ee26159004b001bc56404ca5dbaae6077 |
||||
React-RCTBlob: a493cc306deeaba0c0efa8ecec2da154afd3a798 |
||||
React-RCTImage: 54999ddc896b7db6650af5760607aaebdf30425c |
||||
React-RCTLinking: 7fb3fa6397d3700c69c3d361870a299f04f1a2e6 |
||||
React-RCTNetwork: 329ee4f75bd2deb8cf6c4b14231b5bb272cbd9af |
||||
React-RCTSettings: 1a659d58e45719bc77c280dbebce6a5a5a2733f5 |
||||
React-RCTText: e12d7aae2a038be9ae72815436677a7c6549dd26 |
||||
React-RCTVibration: 92d41c2442e5328cc4d342cd7f78e5876b68bae5 |
||||
React-runtimeexecutor: 85187f19dd9c47a7c102f9994f9d14e4dc2110de |
||||
ReactCommon: eafed38eec7b591c31751bfa7494801618460459 |
||||
RNCAsyncStorage: cb9a623793918c6699586281f0b51cbc38f046f9 |
||||
RNDeviceInfo: 99b0a4fc191808e58e0a045640706100fc3d771c |
||||
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211 |
||||
RNScreens: 6e1ea5787989f92b0671049b808aef64fa1ef98c |
||||
Yoga: aa0cb45287ebe1004c02a13f279c55a95f1572f4 |
||||
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a |
||||
|
||||
PODFILE CHECKSUM: faba147f20a5b5186a4f2593154201ce5fd6d3db |
||||
|
||||
COCOAPODS: 1.11.2 |
@ -0,0 +1,10 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<Workspace |
||||
version = "1.0"> |
||||
<FileRef |
||||
location = "group:rn_danovin.xcodeproj"> |
||||
</FileRef> |
||||
<FileRef |
||||
location = "group:Pods/Pods.xcodeproj"> |
||||
</FileRef> |
||||
</Workspace> |
@ -0,0 +1,38 @@ |
||||
import * as React from 'react'; |
||||
import { NavigationContainer } from '@react-navigation/native'; |
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; |
||||
import Splash from './src/screens/Splash'; |
||||
import Home from './src/screens/Home'; |
||||
import Login from './src/screens/Login'; |
||||
import Otp from './src/screens/Otp'; |
||||
import { connect } from 'react-redux'; |
||||
|
||||
const mapStateToProps = state => { |
||||
return { |
||||
profile: state.profile |
||||
} |
||||
} |
||||
|
||||
const Stack = createNativeStackNavigator(); |
||||
|
||||
function Navigator(props) { |
||||
return ( |
||||
<NavigationContainer> |
||||
<Stack.Navigator> |
||||
<Stack.Screen options={{headerShown: false}} name="Splash" component={Splash} /> |
||||
{!props.profile.token ? ( |
||||
<> |
||||
<Stack.Screen name="Login" component={Login} /> |
||||
<Stack.Screen name="Otp" component={Otp} /> |
||||
</> |
||||
) : ( |
||||
<> |
||||
<Stack.Screen name="Home" component={Home} /> |
||||
</> |
||||
)} |
||||
</Stack.Navigator> |
||||
</NavigationContainer> |
||||
); |
||||
} |
||||
|
||||
export default connect(mapStateToProps)(Navigator); |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1 @@ |
||||
export const PROFILE_RECORD = 'PROFILE_RECORD'; |
@ -0,0 +1,137 @@ |
||||
import React, { useState } from "react" |
||||
import AwesomeAlert from 'react-native-awesome-alerts'; |
||||
const ReactNative = require('react-native'); |
||||
|
||||
const AlertModal = props => { |
||||
const [alert, setAlert] = useState({ |
||||
show: false, |
||||
showProgress: false, |
||||
title: "خطا", |
||||
message: "خطای ناشناخته", |
||||
closeOnTouchOutside: false, |
||||
closeOnHardwareBackPress: false, |
||||
showCancelButton: true, |
||||
showConfirmButton: true, |
||||
cancelText: "بیخیال", |
||||
confirmText: "باشه", |
||||
confirmButtonColor: "#2980b9", |
||||
onCancel: () => { |
||||
}, |
||||
onConfirm: () => { |
||||
|
||||
}, |
||||
}) |
||||
const [apiAlert, setApiAlert] = useState({ |
||||
show: false, |
||||
showProgress: false, |
||||
title: "خطا", |
||||
message: "خطای ناشناخته", |
||||
closeOnTouchOutside: false, |
||||
closeOnHardwareBackPress: false, |
||||
showCancelButton: true, |
||||
showConfirmButton: true, |
||||
cancelText: "بیخیال", |
||||
confirmText: "باشه", |
||||
confirmButtonColor: "#2980b9", |
||||
onCancel: () => { |
||||
}, |
||||
onConfirm: () => { |
||||
}, |
||||
}) |
||||
|
||||
global.globalAlert = (params) => { |
||||
setAlert({ |
||||
...alert, |
||||
...params |
||||
}) |
||||
} |
||||
global.globalApiAlert = (params) => { |
||||
|
||||
setApiAlert({ |
||||
...apiAlert, |
||||
...params |
||||
}) |
||||
} |
||||
|
||||
function hideAlert() { |
||||
setAlert({ ...alert, show: false }) |
||||
} |
||||
function onApiCancelPressed(){ |
||||
globalApiAlert({ show: false }) |
||||
|
||||
apiAlert.onCancel() |
||||
} |
||||
function onApiConfirmPressed(){ |
||||
globalApiAlert({ show: false }) |
||||
apiAlert.onConfirm() |
||||
} |
||||
function onCancelPressed(){ |
||||
hideAlert() |
||||
alert.onCancel() |
||||
} |
||||
function onConfirmPressed(){ |
||||
hideAlert() |
||||
alert.onConfirm() |
||||
} |
||||
return <> |
||||
<AwesomeAlert |
||||
show={alert.show} |
||||
progressColor="red" |
||||
showProgress={alert.showProgress} |
||||
title={alert.title} |
||||
message={alert.message} |
||||
closeOnTouchOutside={alert.closeOnTouchOutside} |
||||
closeOnHardwareBackPress={alert.closeOnHardwareBackPress} |
||||
showCancelButton={alert.showCancelButton} |
||||
showConfirmButton={alert.showConfirmButton} |
||||
cancelText={alert.cancelText} |
||||
confirmText={alert.confirmText} |
||||
confirmButtonColor={alert.confirmButtonColor} |
||||
onCancelPressed={onCancelPressed} |
||||
onConfirmPressed={(onConfirmPressed)} |
||||
contentStyle={{ |
||||
width: ReactNative.Dimensions.get('window').width / 1.5, |
||||
|
||||
}} |
||||
confirmButtonStyle={ |
||||
{ |
||||
width: ReactNative.Dimensions.get('window').width / 4, |
||||
alignItems: 'center', |
||||
justifyContent: 'center' |
||||
|
||||
} |
||||
} |
||||
useNativeDriver={true} |
||||
/> |
||||
<AwesomeAlert |
||||
show={apiAlert.show} |
||||
progressColor="red" |
||||
showProgress={apiAlert.showProgress} |
||||
title={apiAlert.title} |
||||
message={apiAlert.message} |
||||
closeOnTouchOutside={apiAlert.closeOnTouchOutside} |
||||
closeOnHardwareBackPress={apiAlert.closeOnHardwareBackPress} |
||||
showCancelButton={apiAlert.showCancelButton} |
||||
showConfirmButton={apiAlert.showConfirmButton} |
||||
cancelText={apiAlert.cancelText} |
||||
confirmText={apiAlert.confirmText} |
||||
confirmButtonColor={apiAlert.confirmButtonColor} |
||||
onCancelPressed={onApiCancelPressed} |
||||
onConfirmPressed={(onApiConfirmPressed)} |
||||
contentStyle={{ |
||||
width: ReactNative.Dimensions.get('window').width / 1.5 |
||||
}} |
||||
confirmButtonStyle={ |
||||
{ |
||||
width: ReactNative.Dimensions.get('window').width / 4, |
||||
alignItems: 'center', |
||||
justifyContent: 'center' |
||||
} |
||||
} |
||||
useNativeDriver={true} |
||||
/> |
||||
</> |
||||
|
||||
} |
||||
|
||||
export default AlertModal; |
@ -1,9 +0,0 @@ |
||||
export const ApiConfig = { |
||||
apiKey: "AIzaSyBBksq-Asxq2M4Ot-75X19IyrEYJqNBPcg", |
||||
authDomain: "dnvn.ir", |
||||
baseUrl: "https://dnvn.ir/api/v1/", |
||||
//baseUrl: 'http://localhost:3030/api/v1',
|
||||
loginURL: "user/login", |
||||
otploginURL: "user/otp/login", |
||||
logoutURL: "user/logout", |
||||
}; |
@ -1,25 +0,0 @@ |
||||
// In App.js in a new project
|
||||
|
||||
import * as React from 'react'; |
||||
import { NavigationContainer } from '@react-navigation/native'; |
||||
import { createNativeStackNavigator } from '@react-navigation/native-stack'; |
||||
import { Provider } from 'react-redux'; |
||||
import {store} from './states/store'; |
||||
import Home from './views/Home/index'; |
||||
|
||||
|
||||
const Stack = createNativeStackNavigator(); |
||||
|
||||
function Navigator() { |
||||
return ( |
||||
// <Provider store={store}>
|
||||
<NavigationContainer> |
||||
<Stack.Navigator> |
||||
<Stack.Screen name="Home" component={Home} /> |
||||
</Stack.Navigator> |
||||
</NavigationContainer> |
||||
// </Provider>
|
||||
); |
||||
} |
||||
|
||||
export default Navigator; |
@ -0,0 +1,29 @@ |
||||
export function DefaultReducer(key, initialState = {}) { |
||||
return (state = initialState, {type = '', payload = {}}) => { |
||||
switch (type) { |
||||
case key: |
||||
return {...state, ...payload}; |
||||
} |
||||
return state; |
||||
}; |
||||
} |
||||
|
||||
export function buildAction(id) { |
||||
return function(payload) { |
||||
return { |
||||
type: id, |
||||
payload: payload, |
||||
}; |
||||
}; |
||||
} |
||||
|
||||
export function buildActionForKey(id, key) { |
||||
return function(payload) { |
||||
let result = { |
||||
type: id, |
||||
payload: {}, |
||||
}; |
||||
result.payload[key] = payload; |
||||
return result; |
||||
}; |
||||
} |
@ -0,0 +1,11 @@ |
||||
import {combineReducers} from 'redux'; |
||||
import {DefaultReducer} from './DefaultReducer'; |
||||
import * as action from '../actions/actionTypes'; |
||||
|
||||
const allReducers = combineReducers({ |
||||
profile: DefaultReducer(action.PROFILE_RECORD, { |
||||
isLogin: false, |
||||
}), |
||||
}); |
||||
|
||||
export default allReducers; |
@ -1,14 +0,0 @@ |
||||
import { createStackNavigator } from '@react-navigation/stack'; |
||||
|
||||
const Stack = createStackNavigator(); |
||||
|
||||
function MyStack() { |
||||
return ( |
||||
<Stack.Navigator> |
||||
<Stack.Screen name="Home" component={Home} /> |
||||
<Stack.Screen name="Notifications" component={Notifications} /> |
||||
<Stack.Screen name="Profile" component={Profile} /> |
||||
<Stack.Screen name="Settings" component={Settings} /> |
||||
</Stack.Navigator> |
||||
); |
||||
} |
@ -0,0 +1,13 @@ |
||||
import React from 'react' |
||||
import { View, Text } from 'react-native'; |
||||
import {connect} from 'react-redux'; |
||||
|
||||
function Otp({}) { |
||||
return ( |
||||
<View> |
||||
<Text></Text> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default Otp; |
@ -0,0 +1,29 @@ |
||||
import React, {useEffect} from 'react' |
||||
import { View, Text } from 'react-native'; |
||||
import {connect} from 'react-redux'; |
||||
|
||||
const mapStateToProps = state => { |
||||
return { |
||||
profile: state.profile |
||||
} |
||||
} |
||||
|
||||
function Splash({navigation, profile}) { |
||||
|
||||
useEffect(() => { |
||||
setTimeout(() => { |
||||
!profile.token ? navigation.reset({ |
||||
index: 0, |
||||
routes: [{ name: 'Login' }], |
||||
}) : navigation.navigate('Home') |
||||
}, 2000) |
||||
}, []) |
||||
|
||||
return ( |
||||
<View style={{justifyContent: 'center', alignItems: 'center', flex: 1}}> |
||||
<Text>Splash</Text> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
export default connect(mapStateToProps)(Splash); |
@ -0,0 +1,4 @@ |
||||
export default { |
||||
dev: 'https://dnvn.ir/api/v1/', |
||||
splash: 'https://topsito.ir/api/v1.1', |
||||
}; |
@ -0,0 +1,118 @@ |
||||
'use strict'; |
||||
|
||||
module.exports = function (fetch, defaults) { |
||||
defaults = defaults || {}; |
||||
if (typeof fetch !== 'function') { |
||||
throw new ArgumentError('fetch must be a function'); |
||||
} |
||||
|
||||
if (typeof defaults !== 'object') { |
||||
throw new ArgumentError('defaults must be an object'); |
||||
} |
||||
|
||||
if (defaults.retries !== undefined && !isPositiveInteger(defaults.retries)) { |
||||
throw new ArgumentError('retries must be a positive integer'); |
||||
} |
||||
|
||||
if (defaults.retryDelay !== undefined && !isPositiveInteger(defaults.retryDelay) && typeof defaults.retryDelay !== 'function') { |
||||
throw new ArgumentError('retryDelay must be a positive integer or a function returning a positive integer'); |
||||
} |
||||
|
||||
if (defaults.retryOn !== undefined && !Array.isArray(defaults.retryOn) && typeof defaults.retryOn !== 'function') { |
||||
throw new ArgumentError('retryOn property expects an array or function'); |
||||
} |
||||
|
||||
var baseDefaults = { |
||||
retries: 3, |
||||
retryDelay: 1000, |
||||
retryOn: [500, 502, 503, 504], |
||||
}; |
||||
|
||||
defaults = Object.assign(baseDefaults, defaults); |
||||
|
||||
return function fetchRetry(input, init) { |
||||
var retries = defaults.retries; |
||||
var retryDelay = defaults.retryDelay; |
||||
var retryOn = defaults.retryOn; |
||||
|
||||
if (init && init.retries !== undefined) { |
||||
if (isPositiveInteger(init.retries)) { |
||||
retries = init.retries; |
||||
} else { |
||||
throw new ArgumentError('retries must be a positive integer'); |
||||
} |
||||
} |
||||
|
||||
if (init && init.retryDelay !== undefined) { |
||||
if (isPositiveInteger(init.retryDelay) || (typeof init.retryDelay === 'function')) { |
||||
retryDelay = init.retryDelay; |
||||
} else { |
||||
throw new ArgumentError('retryDelay must be a positive integer or a function returning a positive integer'); |
||||
} |
||||
} |
||||
|
||||
if (init && init.retryOn) { |
||||
if (Array.isArray(init.retryOn) || (typeof init.retryOn === 'function')) { |
||||
retryOn = init.retryOn; |
||||
} else { |
||||
throw new ArgumentError('retryOn property expects an array or function'); |
||||
} |
||||
} |
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
return new Promise(function (resolve, reject) { |
||||
var wrappedFetch = function (attempt) { |
||||
fetch(input, init) |
||||
.then(function (response) { |
||||
if (Array.isArray(retryOn) && retryOn.indexOf(response.status) === -1) { |
||||
resolve(response); |
||||
} else if (typeof retryOn === 'function') { |
||||
if (retryOn(attempt, null, response)) { |
||||
retry(attempt, null, response); |
||||
} else { |
||||
resolve(response); |
||||
} |
||||
} else { |
||||
if (attempt < retries) { |
||||
retry(attempt, null, response); |
||||
} else { |
||||
resolve(response); |
||||
} |
||||
} |
||||
}) |
||||
.catch(function (error) { |
||||
if (typeof retryOn === 'function') { |
||||
if (retryOn(attempt, error, null)) { |
||||
retry(attempt, error, null); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
} else if (attempt < retries) { |
||||
retry(attempt, error, null); |
||||
} else { |
||||
reject(error); |
||||
} |
||||
}); |
||||
}; |
||||
|
||||
function retry(attempt, error, response) { |
||||
var delay = (typeof retryDelay === 'function') ? |
||||
retryDelay(attempt, error, response) : retryDelay; |
||||
setTimeout(function () { |
||||
wrappedFetch(++attempt); |
||||
}, delay); |
||||
} |
||||
|
||||
wrappedFetch(0); |
||||
}); |
||||
}; |
||||
}; |
||||
|
||||
function isPositiveInteger(value) { |
||||
return Number.isInteger(value) && value >= 0; |
||||
} |
||||
|
||||
function ArgumentError(message) { |
||||
this.name = 'ArgumentError'; |
||||
this.message = message; |
||||
} |
@ -0,0 +1,139 @@ |
||||
import {Alert} from 'react-native'; |
||||
import {toastMessage} from '../../utils/message'; |
||||
import { |
||||
restartApp, |
||||
getToken, |
||||
deviceHeaders, |
||||
getUrl, |
||||
isUnexpected, |
||||
renewTokenHandler, |
||||
resetApp, |
||||
networkAlert, |
||||
unexpectedAlert, |
||||
} from './utils'; |
||||
import FetchRetry from './fetch-retry'; |
||||
import {asyncApiAwesomeAlert} from '../../utils/AsyncWrappers'; |
||||
|
||||
const fetchRetry = FetchRetry(fetch, {}); |
||||
let deviceInfo; |
||||
|
||||
export async function fetchApi( |
||||
endPoint, |
||||
payload = {}, |
||||
method = 'GET', |
||||
headers = {}, |
||||
isS = false, |
||||
splash = false, |
||||
dev = 'production', |
||||
) { |
||||
var timeout = setTimeout(() => { |
||||
console.log(endPoint, ' TIMEOUT '); |
||||
asyncApiAwesomeAlert('خطای ارتباط', '. لطفا اینترنت خود را بررسی کنید .').then( |
||||
async () => await fetchApi(endPoint, payload, method, headers, isS), |
||||
); |
||||
}, 30000); |
||||
if (!deviceInfo) { |
||||
deviceInfo = await deviceHeaders(); |
||||
if (!deviceInfo) { |
||||
deviceInfo = []; |
||||
} |
||||
} |
||||
let options = { |
||||
method, |
||||
headers: { |
||||
Accept: 'application/json;charset=utf-8', |
||||
'Content-Type': 'application/json;charset=utf-8', |
||||
Authorization: await getToken(), |
||||
...deviceInfo, |
||||
...headers, |
||||
}, |
||||
}; |
||||
if (['POST', 'PUT'].includes(method)) { |
||||
options.body = JSON.stringify(payload); |
||||
} |
||||
try { |
||||
// console.log('req', await getUrl(endPoint), options)
|
||||
let res = await fetchRetry(await getUrl(endPoint, dev), options); |
||||
clearTimeout(timeout); |
||||
let statusCode = res.status; |
||||
// console.log('RES', { statusCode, url: await getUrl(endPoint) })
|
||||
if (isUnexpected(statusCode)) { |
||||
console.log('unexpected', await res.json()); |
||||
console.log('RES-unexpected', {statusCode, url: await getUrl(endPoint)}); |
||||
let check = await unexpectedAlert(); |
||||
|
||||
return await fetchApi( |
||||
endPoint, |
||||
payload, |
||||
method, |
||||
headers, |
||||
isS, |
||||
false, |
||||
true, |
||||
); |
||||
} |
||||
let {data, error, status} = await res.json(); |
||||
if (res.ok) { |
||||
return data; |
||||
} |
||||
if (!res.ok) { |
||||
if (data.hasOwnProperty('message')) { |
||||
toastMessage(data.message); |
||||
} |
||||
if (statusCode === 403) { |
||||
console.log('req-401', await getUrl(endPoint), options); |
||||
|
||||
return resetApp(); |
||||
} |
||||
if (statusCode === 401) { |
||||
let checkRenew = await renewTokenHandler(); |
||||
if (!checkRenew.ok && checkRenew.restart) { |
||||
console.log('req-401', await getUrl(endPoint), options); |
||||
|
||||
resetApp(); |
||||
} else if (!checkRenew.ok) { |
||||
console.log('req-401', await getUrl(endPoint), options); |
||||
|
||||
restartApp(); |
||||
} |
||||
return await fetchApi(endPoint, payload, method, headers, isS, splash); |
||||
} |
||||
if (statusCode === 400) { |
||||
return error; |
||||
} |
||||
return data; |
||||
} |
||||
} catch (err) { |
||||
clearTimeout(timeout); |
||||
console.log('catch', endPoint, err); |
||||
// global.globalAlert({
|
||||
// show: true
|
||||
// })
|
||||
let check = await networkAlert(); |
||||
return await fetchApi(endPoint, payload, method, headers, isS); |
||||
} |
||||
} |
||||
/** |
||||
* next version of fetch API |
||||
* @param {String} endPoint |
||||
* @param {Object} options |
||||
* @param {string} options.method |
||||
* @param {string} options.payload |
||||
* @param {string} options.headers |
||||
* @param {Boolean} options.splash |
||||
*/ |
||||
export async function nextFetchApi(endPoint, options = {}) { |
||||
let {payload, method, headers, isS, splash} = options; |
||||
try { |
||||
let res = await fetchApi(endPoint, payload, method, headers, isS, splash); |
||||
return { |
||||
ok: true, |
||||
data: res, |
||||
}; |
||||
} catch (error) { |
||||
return { |
||||
ok: false, |
||||
data: error, |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,203 @@ |
||||
/* global fetch */ |
||||
|
||||
import apiConfig from './config'; |
||||
import { |
||||
AsyncStorage, |
||||
Alert, |
||||
AlertIOS, |
||||
Platform, |
||||
ToastAndroid, |
||||
} from 'react-native'; |
||||
import {toastMessage} from '../../utils/message'; |
||||
|
||||
import RNRestart from 'react-native-restart'; |
||||
import config from './config'; |
||||
import Refresh from './fetch-retry'; |
||||
import FetchRetry from './fetch-retry'; |
||||
let fetchRetry = FetchRetry(fetch, {}); |
||||
|
||||
function restartApp() { |
||||
AsyncStorage.setItem('UID_USER', JSON.stringify({}), () => { |
||||
RNRestart.Restart(); |
||||
}); |
||||
} |
||||
|
||||
export function fetchApi( |
||||
endPoint, |
||||
payload = {}, |
||||
method = 'GET', |
||||
headers = {}, |
||||
isS = false, |
||||
splash = false, |
||||
) { |
||||
return new Promise((resolve, reject) => { |
||||
var timeout = setTimeout(() => { |
||||
console.log(endPoint, ' TIMEOUT '); |
||||
Alert.alert('خطای ارتباط', 'خطایی ارتباط با سرور پیش امده .', [ |
||||
{ |
||||
text: 'تلاش مجدد', |
||||
onPress: () => |
||||
resolve(fetchApi(endPoint, payload, method, headers, isS)), |
||||
}, |
||||
]); |
||||
}, 10000); |
||||
|
||||
AsyncStorage.getItem('UID_USER', (err, result) => { |
||||
var tokens = ''; |
||||
var refreshTokens = ''; |
||||
var userDATA = JSON.parse(result); |
||||
var headrsRequest = {}; |
||||
|
||||
if ( |
||||
userDATA != null && |
||||
userDATA.token != null && |
||||
userDATA.token != '' && |
||||
isS |
||||
) { |
||||
tokens = userDATA.token; |
||||
|
||||
refreshTokens = userDATA.refresh_token; |
||||
headers = { |
||||
Authorization: 'Bearer ' + tokens, |
||||
}; |
||||
} |
||||
|
||||
if (method === 'POST' || method === 'PUT') { |
||||
headrsRequest = { |
||||
method: method, |
||||
headers: { |
||||
Accept: 'application/json;charset=utf-8', |
||||
'Content-Type': 'application/json;charset=utf-8', |
||||
...headers, |
||||
}, |
||||
body: JSON.stringify(payload), |
||||
}; |
||||
} else { |
||||
headrsRequest = { |
||||
method: method, |
||||
headers: { |
||||
Accept: 'application/json;charset=utf-8', |
||||
'Content-Type': 'application/json;charset=utf-8', |
||||
...headers, |
||||
}, |
||||
}; |
||||
} |
||||
|
||||
AsyncStorage.getItem('SPLASH_DATA', (err, result) => { |
||||
var splashDATA = JSON.parse(result); |
||||
|
||||
var baseUrl; |
||||
|
||||
if (endPoint.includes('splash')) { |
||||
baseUrl = apiConfig.splash; |
||||
} else { |
||||
var baseUrl = splashDATA.base_urls.backend + '/v1.1'; |
||||
} |
||||
|
||||
fetchRetry(`${baseUrl}${endPoint}`, headrsRequest) |
||||
.then(response => { |
||||
const statusCode = response.status; |
||||
const data = response.json(); |
||||
return Promise.all([statusCode, data]); |
||||
}) |
||||
.then(([statusCode, data]) => { |
||||
console.log(baseUrl + endPoint, statusCode, data); |
||||
if (data.hasOwnProperty('message')) { |
||||
toastMessage(data.message); |
||||
} |
||||
|
||||
if (statusCode === 403) { |
||||
clearTimeout(timeout); |
||||
restartApp(); |
||||
} |
||||
|
||||
if (statusCode === 401) { |
||||
clearTimeout(timeout); |
||||
|
||||
var dataaaaa = { |
||||
method: 'POST', |
||||
body: JSON.stringify({ |
||||
refresh_token: refreshTokens, |
||||
}), |
||||
headers: { |
||||
Accept: 'application/json;charset=utf-8', |
||||
'Content-Type': 'application/json;charset=utf-8', |
||||
}, |
||||
}; |
||||
|
||||
fetchRetry(`${baseUrl}/auth/renew-token`, dataaaaa) |
||||
.then(response1 => { |
||||
const statusCode1 = response1.status; |
||||
const data1 = response1.json(); |
||||
return Promise.all([statusCode1, data1]); |
||||
}) |
||||
.then(([statusCode1, data1]) => { |
||||
console.log( |
||||
'refresh token call and response is ', |
||||
statusCode1, |
||||
data1, |
||||
refreshTokens, |
||||
); |
||||
|
||||
if (statusCode1 == 200) { |
||||
userDATA.token = data1.data.token; |
||||
AsyncStorage.setItem( |
||||
'UID_USER', |
||||
JSON.stringify(userDATA), |
||||
() => { |
||||
resolve( |
||||
fetchApi(endPoint, payload, method, headers, isS), |
||||
); |
||||
}, |
||||
); |
||||
} else { |
||||
restartApp(); |
||||
} |
||||
}) |
||||
.catch(e => restartApp()); |
||||
} |
||||
|
||||
if (statusCode === 400) { |
||||
toastMessage(data.error.message); |
||||
clearTimeout(timeout); |
||||
|
||||
reject(data.error); |
||||
} |
||||
|
||||
if (statusCode === 200) { |
||||
clearTimeout(timeout); |
||||
resolve(data.data); |
||||
} |
||||
|
||||
if (statusCode === 201) { |
||||
clearTimeout(timeout); |
||||
resolve(data.data); |
||||
} |
||||
|
||||
return data; |
||||
}) |
||||
.catch(async e => { |
||||
console.log('e', error.message); |
||||
let res = await neto(); |
||||
if (e.networkError) { |
||||
toastMessage('اشکال در اتصال اینترنت دوباره تلاش کنید .'); |
||||
Alert.alert( |
||||
'اینترنت', |
||||
'اشکال در اتصال اینترنت دوباره تلاش کنید .', |
||||
[ |
||||
{ |
||||
text: 'تلاش مجدد', |
||||
onPress: () => |
||||
resolve( |
||||
fetchApi(endPoint, payload, method, headers, isS), |
||||
), |
||||
}, |
||||
{text: 'بیخیال', onPress: () => reject(e)}, |
||||
], |
||||
); |
||||
} |
||||
}); |
||||
}); |
||||
}); |
||||
}); |
||||
} |
@ -0,0 +1,147 @@ |
||||
import RNRestart from 'react-native-restart'; |
||||
import { toastMessage } from "../../utils/message" |
||||
import { asyncAlert, asyncAwesomeAlert, asyncApiAwesomeAlert } from "../../utils/AsyncWrappers"; |
||||
import AsyncStorage from '@react-native-community/async-storage' |
||||
import DeviceInfo from 'react-native-device-info'; |
||||
import { |
||||
ImageBackground, |
||||
Text, |
||||
Image, |
||||
View, |
||||
SafeAreaView, |
||||
StyleSheet, |
||||
BackHandler, |
||||
Platform |
||||
} from 'react-native'; |
||||
import apiConfig from './config'; |
||||
import FetchRetry from './fetch-retry' |
||||
import { nextFetchApi } from '.'; |
||||
|
||||
const fetchRetry = FetchRetry(fetch, {}) |
||||
|
||||
export const restartApp = () => { |
||||
RNRestart.Restart() |
||||
} |
||||
export const resetApp = () => { |
||||
AsyncStorage.setItem('UID_USER', JSON.stringify({}), () => { |
||||
RNRestart.Restart() |
||||
}); |
||||
} |
||||
export const networkAlert = async () => { |
||||
return await asyncApiAwesomeAlert("خطا", "خطا در اتصال به اینترنت", { |
||||
confirmText: "تلاش مجدد" |
||||
}) |
||||
} |
||||
export const unexpectedAlert = async () => { |
||||
return await asyncApiAwesomeAlert("خطا", "خطای داخلی سرور!", { |
||||
confirmText: "تلاش مجدد" |
||||
}) |
||||
// return await asyncAlert("خطا","خطای داخلی سرور!", [
|
||||
// { text: "تلاش مجدد", value: 'retry' },
|
||||
// // { text: "بیخیال", value: 'ignore' }
|
||||
// ])
|
||||
} |
||||
export const getToken = async () => { |
||||
let user = await AsyncStorage.getItem('UID_USER') |
||||
if (!user) return '' |
||||
let { token } = JSON.parse(user) |
||||
if (!token) { |
||||
return '' |
||||
} |
||||
return 'Bearer ' + token |
||||
} |
||||
export const deviceHeaders = async () => { |
||||
return { |
||||
'dev-os': Platform.OS, |
||||
'dev-app-version': '1.6.0', |
||||
'dev-os-version': Platform.Version + '', |
||||
'dev-phone-manufacturer': DeviceInfo.getBrand(), |
||||
'dev-phone-model': await DeviceInfo.getDeviceName(), |
||||
'dev-phone-hash': DeviceInfo.getUniqueId(), |
||||
} |
||||
} |
||||
export const getUrl = async (endpoint, dev) => { |
||||
if (endpoint.includes('splash')) { |
||||
if (dev === 'dev') { |
||||
return apiConfig.dev + endpoint |
||||
} |
||||
return apiConfig.splash + endpoint |
||||
} |
||||
let base_urls = await getBaseUrls() |
||||
return `${base_urls.backend}/v1.1${endpoint}` |
||||
} |
||||
|
||||
export const isUnexpected = (statusCode) => { |
||||
if (![200, 201, 400, 401, 403].includes(statusCode)) return true |
||||
return false |
||||
} |
||||
export const renewTokenHandler = async () => { |
||||
try { |
||||
let splashData = JSON.parse(await AsyncStorage.getItem('UID_USER')) |
||||
if (!splashData || !splashData.refresh_token) { |
||||
return { |
||||
ok: false, |
||||
restart: true |
||||
} |
||||
} |
||||
const options = { |
||||
method: 'POST', |
||||
body: JSON.stringify({ |
||||
refresh_token: splashData.refresh_token |
||||
}), |
||||
headers: { |
||||
Accept: 'application/json;charset=utf-8', |
||||
'Content-Type': 'application/json;charset=utf-8' |
||||
} |
||||
} |
||||
let res = await fetchRetry(await getUrl('/auth/renew-token'), options) |
||||
let { data } = await res.json() |
||||
const statusCode = res.status |
||||
if (statusCode == 200) { |
||||
splashData.token = data.token |
||||
await AsyncStorage.setItem('UID_USER', JSON.stringify(splashData)) |
||||
return { |
||||
ok: true |
||||
} |
||||
} |
||||
if (statusCode == 400) { |
||||
return { |
||||
ok: false, |
||||
restart: true |
||||
} |
||||
} |
||||
return { |
||||
ok: false |
||||
} |
||||
} catch (error) { |
||||
return { |
||||
ok: false |
||||
} |
||||
} |
||||
} |
||||
export const getBaseUrls = async () => { |
||||
let { base_urls } = JSON.parse((await AsyncStorage.getItem('SPLASH_DATA'))) |
||||
return base_urls |
||||
} |
||||
export const getCachedProfile = async () => { |
||||
return JSON.parse(await AsyncStorage.getItem('UID_USER')) |
||||
} |
||||
|
||||
export const cacheProfile = async () => { |
||||
let data = await getProfile() |
||||
let oldData = await getCachedProfile() |
||||
if (data) { |
||||
await AsyncStorage.removeItem('UID_USER') |
||||
|
||||
await AsyncStorage.setItem('UID_USER', JSON.stringify({ |
||||
...oldData, |
||||
...data |
||||
})) |
||||
} |
||||
|
||||
} |
||||
export const getProfile = async () => { |
||||
let { ok, data } = await nextFetchApi('/profile?with_details=1&no_cache=1') |
||||
if (!ok) return null |
||||
return data |
||||
} |
@ -1,31 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const activation = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("activation/list", data, { dispatch }), |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("activation/update", data); |
||||
await proxy.get("activation/list", data2, { dispatch }); |
||||
}, |
||||
updateStatus: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("activation/updateStatus", data, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("activation/add", data); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("activation/delete", data); |
||||
await proxy.get("activation/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default activation; |
@ -1,19 +0,0 @@ |
||||
import proxy from '../proxy'; |
||||
const blog = { |
||||
list: (data = {}) => async (dispatch) => |
||||
await proxy.get('blog/list', data, { dispatch }), |
||||
update: (data = {}, data2 = {}) => async (dispatch) => { |
||||
await proxy.put('blog/update', data); |
||||
await proxy.get('blog/list', data2, { dispatch }); |
||||
}, |
||||
add: (data = {}, data2 = {}) => async (dispatch) => { |
||||
await proxy.post('blog/add', data); |
||||
await proxy.get('blog/list', data2, { dispatch }); |
||||
}, |
||||
del: (data = {}, data2 = {}) => async (dispatch) => { |
||||
await proxy.delete('blog/delete', data); |
||||
await proxy.get('blog/list', data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default blog; |
@ -1,37 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const book = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("book/list", data, { dispatch }), |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("book/info", data, { dispatch }), |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("book/update", data); |
||||
await proxy.get("book/list", data2, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("book/add", data); |
||||
await proxy.get("book/list", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("book/delete", data); |
||||
await proxy.get("book/list", data2, { dispatch }); |
||||
}, |
||||
searchBook: (data) => async (dispatch) => { |
||||
dispatch({ type: "book/search", data: data }); |
||||
}, |
||||
filterBook: (data) => async (dispatch) => { |
||||
dispatch({ type: "book/filter", data: data }); |
||||
}, |
||||
}; |
||||
|
||||
export default book; |
@ -1,35 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const chat = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("chat/list", data, { dispatch }), |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("chat/info", data, { dispatch }), |
||||
bio: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("chat/bio", data, { dispatch }), |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("blog/update", data); |
||||
await proxy.get("blog/list", data2, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("blog/add", data); |
||||
await proxy.get("blog/list", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("blog/delete", data); |
||||
await proxy.get("blog/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default chat; |
@ -1,40 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const comment = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("comment/list", data, { dispatch }), |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.get("comment/info", data, { dispatch }); |
||||
}, |
||||
add: |
||||
( |
||||
data = {}, |
||||
data2 = { |
||||
id: window.location.pathname.slice( |
||||
window.location.pathname.lastIndexOf("/") + 1, |
||||
window.location.pathname.length |
||||
), |
||||
} |
||||
) => |
||||
async (dispatch) => { |
||||
await proxy.post("comment/add", data); |
||||
await proxy.get("book/info", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("ar/delete", data); |
||||
await proxy.get("ar/list", data2, { dispatch }); |
||||
}, |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("ar/update", data); |
||||
await proxy.get("ar/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default comment; |
@ -1,22 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const file = { |
||||
upload: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
var formData = new FormData(); |
||||
for (let key in data) formData.append(key, data[key]); |
||||
return await proxy.post( |
||||
"file/upload", |
||||
formData, |
||||
{ |
||||
dispatch, |
||||
headers: { |
||||
"Content-Type": "multipart/form-data", |
||||
}, |
||||
}, |
||||
data |
||||
); |
||||
}, |
||||
}; |
||||
|
||||
export default file; |
@ -1,14 +0,0 @@ |
||||
// @create-index
|
||||
|
||||
export { default as chat } from "./chat.js"; |
||||
// export { default as message } from './message.js';
|
||||
export { default as publicApi } from "./public.js"; |
||||
export { default as user } from "./user.js"; |
||||
export { default as qr } from "./qr.js"; |
||||
export { default as book } from "./book.js"; |
||||
export { default as userProduct } from "./userProduct.js"; |
||||
export { default as userFactor } from "./userFactor.js"; |
||||
export { default as transport } from "./transport.js"; |
||||
export { default as comment } from "./comment.js"; |
||||
export { default as activation } from "./activation.js"; |
||||
export { default as file } from "./file.js"; |
@ -1,13 +0,0 @@ |
||||
import proxy from '../proxy'; |
||||
export const list = |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
(await proxy.get('message/list', data)).dispatch(dispatch); |
||||
export const send = |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
(await proxy.post('message/send', data)).dispatch(dispatch); |
||||
export const sendKeys = |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
(await proxy.post('message/sendKeys', data)).dispatch(dispatch); |
@ -1,29 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const publicApi = { |
||||
getHomeData: (data, history) => async (dispatch) => |
||||
await proxy.get("public/homePage", data, { history, dispatch }), |
||||
getFaqList: (data, history) => async (dispatch) => |
||||
await proxy.get("faq/list", data, { history, dispatch }), |
||||
setFaqActive: (data) => async (dispatch) => |
||||
await dispatch({ type: "public/faq/activate", data: data }), |
||||
searchFaq: (data) => async (dispatch) => |
||||
await dispatch({ type: "public/faq/search", data: data }), |
||||
getContactData: |
||||
(data = {}, history) => |
||||
async (dispatch) => |
||||
await proxy.get("public/contact", data, { history, dispatch }), |
||||
getArList: (data, history) => async (dispatch) => |
||||
await proxy.get("public/ar", data, { history, dispatch }), |
||||
getBlogList: (data, history) => async (dispatch) => |
||||
await proxy.get("public/blogList", data, { history, dispatch }), |
||||
getBlogInfo: (data, history) => async (dispatch) => |
||||
await proxy.get("public/blogInfo", data, { history, dispatch }), |
||||
filterNewProducts: (data, history) => async (dispatch) => |
||||
await dispatch({ type: "public/filter", data }), |
||||
getProvince: (data, history) => async (dispatch) => |
||||
await proxy.get("public/province", data, { history, dispatch }), |
||||
getCity: (data, history) => async (dispatch) => |
||||
await proxy.get("public/city", data, { history, dispatch }), |
||||
}; |
||||
|
||||
export default publicApi; |
@ -1,32 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const qr = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("qr/list", data, { dispatch }), |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.get("qr/info", data, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("qr/add", data); |
||||
await proxy.get("qr/list", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("ar/delete", data); |
||||
await proxy.get("ar/list", data2, { dispatch }); |
||||
}, |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("ar/update", data); |
||||
await proxy.get("ar/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default qr; |
@ -1,37 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const transport = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("transport/list", data, { dispatch }), |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("transport/info", data, { dispatch }), |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("transport/update", data); |
||||
await proxy.get("transport/list", data2, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("transport/add", data); |
||||
await proxy.get("transport/list", data2, { dispatch }); |
||||
}, |
||||
setTransport: |
||||
(data = {}, data2 = {}, data3 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("transport/setTransport", data); |
||||
await proxy.get("userFactor/info", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("transport/delete", data); |
||||
await proxy.get("transport/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default transport; |
@ -1,61 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const user = { |
||||
otp: (data, history) => async (dispatch) => |
||||
await proxy.login("public/sendOTP", data, { history, dispatch }), |
||||
// otp:
|
||||
// (data = {}) =>
|
||||
// async (dispatch) =>
|
||||
// dispatch({ type: "public/sendOTP", payload: data }),
|
||||
otp_login: (data, history) => async (dispatch) => |
||||
await proxy.login("user/otp/login", data, { history, dispatch }), |
||||
// otp_login:
|
||||
// (data = {}) =>
|
||||
// async (dispatch) =>
|
||||
// dispatch({ type: "user/otp/login", payload: data }),
|
||||
register: (data, history) => async (dispatch) => |
||||
await proxy.login("user/register", data, { history, dispatch }), |
||||
switchRole: (data, history) => async (dispatch) => |
||||
await proxy.login("user/switchRole", data, { history, dispatch }), |
||||
logout: (data, history) => async (dispatch) => |
||||
await proxy.logout("user/logout", data, { history, dispatch }), |
||||
getUserRole: (data) => async (dispatch) => |
||||
await proxy.get("user/getUserRole", data, { dispatch }), |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("user/list", data, { dispatch }), |
||||
domains: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("user/domains", data, { dispatch }), |
||||
getmothers: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get2("mothers/list", data, { |
||||
dispatch, |
||||
}), |
||||
getProfile: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("user/getProfile", data, { dispatch }), |
||||
setProfile: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("user/setProfile", data, { dispatch }); |
||||
await proxy.get("user/getProfile", data2, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("user/add", data); |
||||
await proxy.get("user/list", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("user/delete", data); |
||||
await proxy.get("user/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default user; |
@ -1,41 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const userFactor = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("userFactor/list", data, { dispatch }), |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("userFactor/info", data, { dispatch }), |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("userFactor/update", data, { dispatch }); |
||||
await proxy.get("userFactor/info", data2, { dispatch }); |
||||
}, |
||||
payment: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("userFactor/payment", data, { dispatch }); |
||||
}, |
||||
verify: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("userFactor/verify", data, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("userFactor/add", data, { dispatch }); |
||||
await proxy.get("userFactor/list", data2, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("userFactor/delete", data, { dispatch }); |
||||
await proxy.get("userFactor/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default userFactor; |
@ -1,38 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
const userProduct = { |
||||
list: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.get("userProduct/list", data, { dispatch }); |
||||
}, |
||||
myList: |
||||
(data = {}) => |
||||
async (dispatch) => { |
||||
await proxy.get("userProduct/myList", data, { dispatch }); |
||||
}, |
||||
info: |
||||
(data = {}) => |
||||
async (dispatch) => |
||||
await proxy.get("userProduct/info", data, { dispatch }), |
||||
update: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.put("userProduct/update", data); |
||||
await proxy.get("userProduct/list", data2, { dispatch }); |
||||
}, |
||||
add: |
||||
(data = {}, data2 = {}, data3 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.post("userProduct/add", data, { dispatch }); |
||||
await proxy.get("userProduct/list", data2, { dispatch }); |
||||
await proxy.get("userFactor/info", data3, { dispatch }); |
||||
}, |
||||
del: |
||||
(data = {}, data2 = {}) => |
||||
async (dispatch) => { |
||||
await proxy.delete("userProduct/delete", data); |
||||
await proxy.get("userProduct/list", data2, { dispatch }); |
||||
}, |
||||
}; |
||||
|
||||
export default userProduct; |
@ -1,7 +0,0 @@ |
||||
// @create-index
|
||||
|
||||
export { default as actions } from './actions'; |
||||
export { default as proxy } from './proxy.js'; |
||||
export { default as reducers } from './reducers'; |
||||
export { default as store } from './store.js'; |
||||
|
@ -1,121 +0,0 @@ |
||||
import { ApiConfig } from "../constants/defaultValues"; |
||||
import axios from "axios"; |
||||
|
||||
let { baseUrl } = ApiConfig; |
||||
// let access = window.localStorage.getItem("access");
|
||||
window.baseURL = baseUrl; |
||||
baseUrl = baseUrl + "/"; |
||||
|
||||
const Axios = axios.create({ |
||||
withCredentials: true, |
||||
validateStatus: null, |
||||
baseURL: baseUrl, |
||||
//headers: access ? { Authorization: `Bearer ${access}` } : {},
|
||||
}); |
||||
class Proxy { |
||||
get = async (url, params, opt = {}, data) => |
||||
await this.check( |
||||
url, |
||||
opt, |
||||
async () => await Axios.get(url, { params, ...opt }), |
||||
data || params |
||||
); |
||||
post = async (url, params, opt = {}, data) => |
||||
await this.check( |
||||
url, |
||||
opt, |
||||
async () => await Axios.post(url, params, opt), |
||||
data || params |
||||
); |
||||
put = async (url, params, opt = {}, data) => |
||||
await this.check( |
||||
url, |
||||
opt, |
||||
async () => await Axios.put(url, params, opt), |
||||
data || params |
||||
); |
||||
delete = async (url, params, opt = {}, data) => { |
||||
await this.check( |
||||
url, |
||||
opt, |
||||
async () => await Axios.delete(url, { ...opt, data: params }), |
||||
data || params |
||||
); |
||||
}; |
||||
|
||||
check = async (url, { dispatch }, fetch, params) => { |
||||
dispatch = dispatch || (() => {}); |
||||
dispatch({ type: url.split("/")[0] + "/" + "loading" }); |
||||
let response = await fetch(); |
||||
switch (response.status) { |
||||
case 200: |
||||
dispatch({ type: url, data: response.data.data, params }); |
||||
return response.data.data; |
||||
case 401: |
||||
if (await this.refresh()) { |
||||
let response = await fetch(); |
||||
dispatch({ type: url, data: response.data.data, params }); |
||||
return response.data.data; |
||||
} |
||||
break; |
||||
default: |
||||
dispatch({ |
||||
type: url.split("/")[0] + "/" + "error", |
||||
data: response.data, |
||||
params, |
||||
}); |
||||
} |
||||
return false; |
||||
}; |
||||
|
||||
refresh = async () => { |
||||
let refresh = localStorage.getItem("refresh"); |
||||
if (!refresh) window.location.href = "/"; |
||||
let login = await this.login( |
||||
"user/login", |
||||
{}, |
||||
{ headers: { Authorization: `Bearer ${refresh}` } } |
||||
); |
||||
return login ? true : false; |
||||
}; |
||||
login = async (url, params, { dispatch }) => |
||||
this.post(url, params, { |
||||
dispatch: (obj) => { |
||||
let login = obj.data; |
||||
if (!login || !login.refreshToken) return false; |
||||
// localStorage.setItem("refresh", login.refreshToken);
|
||||
// localStorage.setItem("access", login.accessToken);
|
||||
delete login.refreshToken; |
||||
delete login.accessToken; |
||||
// localStorage.setItem("userData", JSON.stringify(login.profile));
|
||||
dispatch(obj); |
||||
}, |
||||
}); |
||||
|
||||
logout = async (url, params, { dispatch }) => { |
||||
this.post(url, params, { |
||||
dispatch: (obj) => { |
||||
// localStorage.removeItem("refresh");
|
||||
// localStorage.removeItem("access");
|
||||
// localStorage.removeItem("userData");
|
||||
dispatch(obj); |
||||
}, |
||||
}); |
||||
}; |
||||
status = () => { |
||||
// let refresh = localStorage.getItem("refresh");
|
||||
// let userData = localStorage.getItem("userData");
|
||||
// if (!refresh) return false;
|
||||
// if (refresh == "undefined") {
|
||||
// localStorage.removeItem("refresh");
|
||||
// localStorage.removeItem("access");
|
||||
// localStorage.removeItem("userData");
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// return JSON.parse(userData);
|
||||
}; |
||||
} |
||||
const _proxy = new Proxy(); |
||||
|
||||
export default _proxy; |
@ -1,32 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: [], |
||||
updateStatus: false, |
||||
}; |
||||
export default function activation(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "activation/list": |
||||
return { ...state, loading: false, list: data, error: null }; |
||||
case "activation/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "activation/updateStatus": |
||||
// toast.success("کتاب شما با موفقیت فعال گردید.");
|
||||
return { ...state, loading: false, error: null, updateStatus: true }; |
||||
case "activation/add": |
||||
// toast.success("کتاب شما با موفقیت فعال گردید.");
|
||||
return { ...state, loading: false, error: null }; |
||||
case "activation/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "activation/loading": |
||||
return { ...state, loading: true }; |
||||
case "activation/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,28 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: [], |
||||
}; |
||||
export default function blog(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "blog/list": |
||||
return { ...state, loading: false, list: data, error: null }; |
||||
case "blog/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "blog/add": |
||||
return { ...state, loading: false, error: null }; |
||||
case "blog/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
/////////////
|
||||
case "blog/loading": |
||||
return { ...state, loading: true }; |
||||
case "blog/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,127 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: [], |
||||
info: null, |
||||
searchResult: [], |
||||
filterResult: [], |
||||
subjects: [], |
||||
levels: [], |
||||
sortFilters: ["مرتب سازی", "محبوب ترین", "جدیدترین"], |
||||
}; |
||||
|
||||
const grades = [ |
||||
"پیش دبستان", |
||||
"اول", |
||||
"دوم", |
||||
"سوم", |
||||
"چهارم", |
||||
"پنجم", |
||||
"ششم", |
||||
"هفتم", |
||||
"هشتم", |
||||
"نهم", |
||||
"دهم", |
||||
"یازدهم", |
||||
"دوازدهم", |
||||
]; |
||||
export default function book(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "book/list": |
||||
let itemsSubject = (Array.isArray(data) ? data : []).map( |
||||
(item, index) => item.name |
||||
); |
||||
if (window.innerWidth < 1000) { |
||||
itemsSubject.unshift("نام کتاب"); |
||||
} |
||||
let itemsLevel = (Array.isArray(data) ? data : []) |
||||
.map((item) => item.gradeId * 1) |
||||
.sort((a, b) => a - b) |
||||
.map((e) => grades[e]); |
||||
if (window.innerWidth < 1000) { |
||||
itemsLevel.unshift("پایه تحصیلی"); |
||||
} |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
list: data, |
||||
subjects: [...new Set(itemsSubject)], |
||||
levels: [...new Set(itemsLevel)], |
||||
filterResult: data, |
||||
error: null, |
||||
}; |
||||
case "book/info": |
||||
return { ...state, loading: false, info: data, error: null }; |
||||
case "book/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "book/add": |
||||
return { ...state, loading: false, error: null }; |
||||
case "book/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "book/search": |
||||
return { ...state }; |
||||
case "book/filter": |
||||
const realList = state.list; |
||||
const level = data.level; |
||||
const subject = data.subject; |
||||
const sort = data.sort; |
||||
const search = data.search; |
||||
if (level.length > 0 || subject.length > 0 || sort || search) { |
||||
localStorage.setItem("filter", "ON"); |
||||
} |
||||
let finalSort; |
||||
let byLevelFilter = []; |
||||
if (level.length > 0) { |
||||
level.map((item1) => { |
||||
for (let i = 0; i < realList.length; i++) { |
||||
if (grades[realList[i].gradeId] === item1) { |
||||
byLevelFilter.push(realList[i]); |
||||
} |
||||
} |
||||
}); |
||||
} else { |
||||
byLevelFilter = realList; |
||||
} |
||||
|
||||
let bySubjectFilter = []; |
||||
if (subject.length > 0) { |
||||
subject.map((item1) => { |
||||
for (let i = 0; i < byLevelFilter.length; i++) { |
||||
if (byLevelFilter[i].name === item1) { |
||||
bySubjectFilter.push(byLevelFilter[i]); |
||||
} |
||||
} |
||||
}); |
||||
} else { |
||||
bySubjectFilter = byLevelFilter; |
||||
} |
||||
|
||||
const bySearchFilter = search |
||||
? bySubjectFilter.filter((item1) => item1.name.indexOf(search) !== -1) |
||||
: bySubjectFilter; |
||||
|
||||
if (sort === "گران ترین") { |
||||
finalSort = bySearchFilter.sort((item1, item2) => { |
||||
return item1.product[0].price - item2.product[0].price; |
||||
}); |
||||
} else { |
||||
finalSort = bySearchFilter; |
||||
} |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
error: null, |
||||
filterResult: finalSort, |
||||
}; |
||||
case "book/loading": |
||||
return { ...state, loading: true }; |
||||
case "book/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,25 +0,0 @@ |
||||
const initialState = { |
||||
list: [], |
||||
info: { users: [] }, |
||||
bio: { |
||||
album: [], |
||||
images: [], |
||||
videos: [], |
||||
music: [], |
||||
documnet: [], |
||||
link: [], |
||||
}, |
||||
}; |
||||
export default function chat(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case 'chat/list': |
||||
return { ...state, list: data }; |
||||
case 'chat/info': |
||||
return { ...state, info: data }; |
||||
case 'chat/bio': |
||||
return { ...state, bio: data }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,35 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: null, |
||||
}; |
||||
|
||||
export default function comment(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "comment/list": |
||||
return { ...state, loading: false, error: null }; |
||||
case "comment/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "comment/add": |
||||
return { ...state, loading: false, error: null }; |
||||
case "comment/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "comment/info": |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
list: data, |
||||
error: null, |
||||
}; |
||||
case "comment/loading": |
||||
return { ...state, loading: true }; |
||||
case "comment/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,26 +0,0 @@ |
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
uploads: {}, |
||||
lastUpload: null, |
||||
}; |
||||
|
||||
export default function file(state = initialState, action) { |
||||
let { type, data, params } = action; |
||||
switch (type) { |
||||
case "file/upload": |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
error: null, |
||||
uploads: { ...state.uploads, [params?.target || "last"]: data.id }, |
||||
lastUpload: data.id, |
||||
}; |
||||
case "file/loading": |
||||
return { ...state, loading: true }; |
||||
case "file/error": |
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,14 +0,0 @@ |
||||
// @create-index
|
||||
|
||||
export { default as chat } from "./chat.js"; |
||||
export { default as message } from "./message.js"; |
||||
export { default as publicApi } from "./public.js"; |
||||
export { default as user } from "./user.js"; |
||||
export { default as qr } from "./qr.js"; |
||||
export { default as book } from "./book.js"; |
||||
export { default as userProduct } from "./userProduct.js"; |
||||
export { default as userFactor } from "./userFactor.js"; |
||||
export { default as transport } from "./transport.js"; |
||||
export { default as comment } from "./comment.js"; |
||||
export { default as activation } from "./activation.js"; |
||||
export { default as file } from "./file.js"; |
@ -1,16 +0,0 @@ |
||||
const initialState = { |
||||
list: [], |
||||
}; |
||||
export default function chat(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case 'message/list': |
||||
return { ...state, list: data }; |
||||
case 'message/send': |
||||
return { ...state, list: [...state.list, ...data] }; |
||||
case 'message/sendKeys': |
||||
return { ...state, list: [...state.list, ...data] }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,34 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: null, |
||||
}; |
||||
export default function qr(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "qr/list": |
||||
return { ...state, loading: false, error: null }; |
||||
case "qr/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "qr/add": |
||||
return { ...state, loading: false, error: null }; |
||||
case "qr/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "qr/info": |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
list: data, |
||||
error: null, |
||||
}; |
||||
/////////////
|
||||
case "qr/loading": |
||||
return { ...state, loading: true }; |
||||
case "qr/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,32 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: [], |
||||
info: null, |
||||
}; |
||||
export default function transport(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "transport/list": |
||||
return { ...state, loading: false, list: data, error: null }; |
||||
case "transport/info": |
||||
return { ...state, loading: false, list: null, info: data, error: null }; |
||||
case "transport/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "transport/add": |
||||
return { ...state, loading: false, error: null }; |
||||
case "transport/setTransport": |
||||
// toast.success("روش ارسال با موفقیت تغییر یافت!");
|
||||
return { ...state, loading: false, error: null }; |
||||
case "transport/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "transport/loading": |
||||
return { ...state, loading: true }; |
||||
case "transport/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,66 +0,0 @@ |
||||
import proxy from "../proxy"; |
||||
// import { toast } from "react-toastify";
|
||||
const initialState = { |
||||
status: proxy.status(), |
||||
loading: false, |
||||
error: null, |
||||
list: null, |
||||
domains: [], |
||||
mothers: [], |
||||
profileStatus: false, |
||||
setDone: false, |
||||
}; |
||||
export default function user(state = initialState, action) { |
||||
let { type, data } = action; |
||||
switch (type) { |
||||
case "user/login": |
||||
case "user/register": |
||||
case "user/switchRole": |
||||
case "public/sendOTP": |
||||
// toast.success("کد به شماره شما ارسال گردید.");
|
||||
return { ...state, loading: false, status: data.profile, error: null }; |
||||
case "user/otp/login": |
||||
// window.location = "https://dnvn.ir/?" + Math.random();
|
||||
// toast.success("به دانوین خوش آمدید.");
|
||||
|
||||
return { |
||||
...state, |
||||
loading: false, |
||||
status: data.profile, |
||||
error: null, |
||||
}; |
||||
|
||||
case "user/getProfile": |
||||
localStorage.setItem("userData", JSON.stringify(data)); |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
status: data, |
||||
error: null, |
||||
setDone: false, |
||||
}; |
||||
case "user/logout": |
||||
localStorage.removeItem("refresh"); |
||||
localStorage.removeItem("access"); |
||||
localStorage.removeItem("userData"); |
||||
// window.location = "https://dnvn.ir/?" + Math.random();
|
||||
return { ...state, loading: false, status: proxy.status(), error: null }; |
||||
case "user/getUserRole": |
||||
return { ...state, loading: false, userRoles: data, error: null }; |
||||
case "user/list": |
||||
return { ...state, loading: false, list: data, error: null }; |
||||
case "user/domains": |
||||
return { ...state, loading: false, domains: data, error: null }; |
||||
case "mothers/list": |
||||
return { ...state, loading: false, mothers: data, error: null }; |
||||
case "user/setProfile": |
||||
return { ...state, loading: false, error: null, setDone: true }; |
||||
case "user/loading": |
||||
return { ...state, loading: true }; |
||||
case "user/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,51 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: [], |
||||
info: null, |
||||
sum: null, |
||||
checkEmpty: false, |
||||
isVerified: null, |
||||
}; |
||||
export default function userFactor(state = initialState, action) { |
||||
let { type, data, message } = action; |
||||
switch (type) { |
||||
case "userFactor/list": |
||||
const checkEmpty = data.filter( |
||||
(item) => item.condition === 2 && item.product.productType === (1 || 3) |
||||
); |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
list: data, |
||||
checkEmpty: checkEmpty.length > 0 ? false : true, |
||||
error: null, |
||||
}; |
||||
case "userFactor/info": |
||||
return { ...state, loading: false, info: data, error: null }; |
||||
case "userFactor/update": |
||||
console.log("userFactor/update"); |
||||
// toast.success("درخواست شما با موفقیت انجام شد.");
|
||||
return { ...state, loading: false, error: null }; |
||||
case "userFactor/add": |
||||
// toast.success("درخواست شما با موفقیت انجام شد.");
|
||||
return { ...state, loading: false, error: null, sum: data.payPrice }; |
||||
case "userFactor/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "userFactor/payment": |
||||
window.location.replace(data); |
||||
return { ...state, loading: false, error: null, isVerified: false }; |
||||
case "userFactor/verify": |
||||
return { ...state, loading: false, error: null, isVerified: true }; |
||||
case "userFactor/loading": |
||||
return { ...state, loading: true }; |
||||
case "userFactor/error": |
||||
console.log("error"); |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,53 +0,0 @@ |
||||
// import { toast } from "react-toastify";
|
||||
|
||||
const initialState = { |
||||
loading: false, |
||||
error: null, |
||||
list: null, |
||||
info: null, |
||||
sum: null, |
||||
checkEmpty: false, |
||||
hasPhysical: false, |
||||
myList: [], |
||||
}; |
||||
export default function userProduct(state = initialState, action) { |
||||
let { type, data, message } = action; |
||||
switch (type) { |
||||
case "userProduct/list": |
||||
const checkEmpty = data.filter( |
||||
(item) => item.condition === 2 && item.product.productType === (1 || 3) |
||||
); |
||||
const hasPhysical = |
||||
data.filter((item) => item.product.productType === 2).length > 0 |
||||
? true |
||||
: false; |
||||
return { |
||||
...state, |
||||
loading: false, |
||||
list: data, |
||||
checkEmpty: checkEmpty.length > 0 ? false : true, |
||||
error: null, |
||||
hasPhysical: hasPhysical, |
||||
}; |
||||
case "userProduct/info": |
||||
return { ...state, loading: false, info: data, error: null }; |
||||
case "userProduct/myList": |
||||
return { ...state, loading: false, myList: data, error: null }; |
||||
case "userProduct/update": |
||||
return { ...state, loading: false, error: null }; |
||||
case "userProduct/add": |
||||
if (window.location.pathname.indexOf("products") !== -1) { |
||||
// toast.success("درخواست شما با موفقیت انجام شد.");
|
||||
} |
||||
return { ...state, loading: false, error: null, sum: data.payPrice }; |
||||
case "userProduct/delete": |
||||
return { ...state, loading: false, error: null }; |
||||
case "userProduct/loading": |
||||
return { ...state, loading: true }; |
||||
case "userProduct/error": |
||||
// toast.error(data.message);
|
||||
return { ...state, loading: false, error: data.message }; |
||||
default: |
||||
return state; |
||||
} |
||||
} |
@ -1,13 +0,0 @@ |
||||
import { createStore, applyMiddleware } from 'redux'; |
||||
import { composeWithDevTools } from 'redux-devtools-extension'; |
||||
import { combineReducers } from 'redux'; |
||||
import * as reducers from './reducers'; |
||||
import thunk from 'redux-thunk'; |
||||
const initialState = {}; |
||||
const middleware = [thunk]; |
||||
const store = createStore( |
||||
combineReducers(reducers), |
||||
initialState, |
||||
composeWithDevTools(applyMiddleware(...middleware)) |
||||
); |
||||
export default store; |
@ -0,0 +1,55 @@ |
||||
import { Alert } from "react-native" |
||||
let awesomeResolve |
||||
const onConfirm = () => { |
||||
awesomeResolve(true) |
||||
} |
||||
const onCancel = () => { |
||||
awesomeResolve(false) |
||||
} |
||||
let apiResolverArray = [] |
||||
const resolver = ()=>{ |
||||
for(let item of apiResolverArray){ |
||||
item(true) |
||||
} |
||||
apiResolverArray = [] |
||||
} |
||||
export const asyncAlert = async (title, message, buttons, options) => new Promise((resolve) => { |
||||
for (let i in buttons) { |
||||
buttons[i].onPress = () => { |
||||
resolve(buttons[i].value) |
||||
} |
||||
delete buttons.value |
||||
} |
||||
Alert.alert(title, message, buttons, options) |
||||
}) |
||||
|
||||
export const asyncAwesomeAlert = async (title, message, options) => new Promise((resolve) => { |
||||
awesomeResolve = resolve |
||||
global.globalAlert({ |
||||
show: true, |
||||
onConfirm: onConfirm, |
||||
onCancel: onCancel, |
||||
title, |
||||
message, |
||||
...options |
||||
}) |
||||
}) |
||||
|
||||
export const asyncApiAwesomeAlert = async (title, message, options) => new Promise((resolve) => { |
||||
apiResolverArray.push(resolve) |
||||
global.globalApiAlert({ |
||||
show: true, |
||||
onConfirm: resolver, |
||||
onCancel: ()=>{}, |
||||
title, |
||||
message, |
||||
...options |
||||
}) |
||||
}) |
||||
|
||||
export const asyncSleep = function sleep(ms) { |
||||
return new Promise(resolve => setTimeout(resolve, ms)); |
||||
} |
||||
export const randomApiSleep = function randomApiSleep() { |
||||
return new Promise(resolve => setTimeout(resolve, Math.ceil(Math.random() * 1000 + 10))) |
||||
} |
@ -0,0 +1,12 @@ |
||||
export function debounce(callback, wait, context = this) { |
||||
let timeout = null; |
||||
let callbackArgs = null; |
||||
|
||||
const later = () => callback.apply(context, callbackArgs); |
||||
|
||||
return function() { |
||||
callbackArgs = arguments; |
||||
clearTimeout(timeout); |
||||
timeout = setTimeout(later, wait); |
||||
}; |
||||
} |
@ -0,0 +1,17 @@ |
||||
const ExtraDimension = require('react-native-extra-dimensions-android') |
||||
import { Dimensions } from "react-native" |
||||
import { isSoftMenuBarEnabled } from "react-native-extra-dimensions-android" |
||||
|
||||
const getHeight = () => { |
||||
var height = Math.round(Dimensions.get('window').height) |
||||
|
||||
if (isSoftMenuBarEnabled()) { |
||||
height = height - ExtraDimension.get("STATUS_BAR_HEIGHT") |
||||
} |
||||
|
||||
return height |
||||
} |
||||
|
||||
export const viewportWidth = ExtraDimension.get("REAL_WINDOW_WIDTH") |
||||
export const viewportHeight = getHeight() |
||||
|
@ -0,0 +1,9 @@ |
||||
import { AsyncStorage, AlertIOS, Platform, ToastAndroid, } from "react-native" |
||||
|
||||
export const toastMessage = (msg) => { |
||||
if (Platform.OS === 'android') { |
||||
ToastAndroid.show(msg, ToastAndroid.SHORT) |
||||
} else { |
||||
AlertIOS.alert(msg); |
||||
} |
||||
} |
Loading…
Reference in new issue