solve problem of filter by pas
This commit is contained in:
parent
e6a51feb48
commit
ccd2f087c0
17
App.js
17
App.js
|
|
@ -83,9 +83,6 @@ import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser';
|
|||
import {IlinkEmitter} from './utils/events';
|
||||
import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAgent";
|
||||
import ReattachAccountUser from "./screens/wallet/user/ReattachAccountUser";
|
||||
import AcceptPrestationAgent from "./screens/nano-sante/AcceptPrestationAgent";
|
||||
import SouscrireAssuranceUser from "./screens/nano-sante/SouscrireAssuranceUser";
|
||||
import AskPrestationUser from "./screens/nano-sante/AskPrestationUser";
|
||||
|
||||
|
||||
const instructions = Platform.select({
|
||||
|
|
@ -140,8 +137,6 @@ const AppStack = createDrawerNavigator({
|
|||
reattachAccountUser: ReattachAccountUser,
|
||||
epargnerArgentUser: EpargnerArgentUser,
|
||||
createGroupNanoCredit: CreateGroupNanoCredit,
|
||||
souscrireAssuranceUser: SouscrireAssuranceUser,
|
||||
askPrestationUser: AskPrestationUser,
|
||||
groupNanoCredit: {
|
||||
screen: createBottomTabNavigator({
|
||||
demandeValidationGroupe: {
|
||||
|
|
@ -269,7 +264,6 @@ const AppAgentStack = createDrawerNavigator({
|
|||
envoieWalletToBankAgent: EnvoieWalletToBankAgent,
|
||||
createGroupNanoCredit: CreateGroupNanoCredit,
|
||||
cautionNanoCreditAgent: CautionNanoCreditAgent,
|
||||
acceptPrestationAgent: AcceptPrestationAgent
|
||||
})
|
||||
}, {
|
||||
contentComponent: OptionsMenu,
|
||||
|
|
@ -379,7 +373,7 @@ const AppSuperAdministrator = createDrawerNavigator({
|
|||
headerMode: 'none'
|
||||
});
|
||||
|
||||
export const AppNavigator = createSwitchNavigator({
|
||||
const AppNavigator = createSwitchNavigator({
|
||||
first: {
|
||||
screen: SplashScreen
|
||||
},
|
||||
|
|
@ -393,9 +387,8 @@ export const AppNavigator = createSwitchNavigator({
|
|||
});
|
||||
const AppContainer = createAppContainer(AppNavigator);
|
||||
|
||||
class App extends React.Component {
|
||||
|
||||
|
||||
export default class App extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
console.log("APP PROPS", this.props);
|
||||
|
|
@ -404,7 +397,6 @@ class App extends React.Component {
|
|||
OneSignal.setLogLevel(6, 0);
|
||||
IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
|
||||
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID.
|
||||
/*
|
||||
OneSignal.init("e8e7251f-713d-4658-9510-86d877fa6a7c", {
|
||||
kOSSettingsKeyAutoPrompt: false,
|
||||
kOSSettingsKeyInAppLaunchURL: false,
|
||||
|
|
@ -418,7 +410,6 @@ class App extends React.Component {
|
|||
OneSignal.addEventListener('received', this.onReceived);
|
||||
OneSignal.addEventListener('opened', this.onOpened);
|
||||
OneSignal.addEventListener('ids', this.onIds);
|
||||
*/
|
||||
}
|
||||
|
||||
updateLangue() {
|
||||
|
|
@ -549,8 +540,6 @@ function myiOSPromptCallback(permission) {
|
|||
// do something with permission value
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"name": "iLink",
|
||||
"name": "iLinkWorld",
|
||||
"displayName": "iLinkWorld"
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,84 +1,88 @@
|
|||
{
|
||||
"_from": "react-native@0.61.5",
|
||||
"_id": "react-native@0.61.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MXqE3NoGO0T3dUKIKkIppijBhRRMpfN6ANbhMXHDuyfA+fSilRWgCwYgR/YNCC7ntECoJYikKaNTUBB0DeQy6Q==",
|
||||
"_location": "/react-native",
|
||||
"_phantomChildren": {
|
||||
"@hapi/joi": "15.1.1",
|
||||
"@react-native-community/cli-debugger-ui": "3.0.0",
|
||||
"@react-native-community/cli-tools": "3.0.0",
|
||||
"@react-native-community/cli-types": "3.0.0",
|
||||
"@types/istanbul-lib-coverage": "2.0.1",
|
||||
"@types/istanbul-reports": "1.1.1",
|
||||
"@types/yargs-parser": "15.0.0",
|
||||
"chalk": "2.4.2",
|
||||
"command-exists": "1.2.9",
|
||||
"commander": "2.20.3",
|
||||
"compression": "1.7.4",
|
||||
"connect": "3.7.0",
|
||||
"core-js": "2.6.11",
|
||||
"cosmiconfig": "5.2.1",
|
||||
"deepmerge": "3.3.0",
|
||||
"didyoumean": "1.2.1",
|
||||
"envinfo": "7.7.4",
|
||||
"errorhandler": "1.5.1",
|
||||
"execa": "1.0.0",
|
||||
"fbjs-css-vars": "1.0.2",
|
||||
"fs-extra": "7.0.1",
|
||||
"glob": "7.1.6",
|
||||
"graceful-fs": "4.2.3",
|
||||
"inquirer": "3.3.0",
|
||||
"isomorphic-fetch": "2.2.1",
|
||||
"lodash": "4.17.15",
|
||||
"loose-envify": "1.4.0",
|
||||
"metro": "0.56.4",
|
||||
"metro-config": "0.56.4",
|
||||
"metro-core": "0.56.4",
|
||||
"metro-react-native-babel-transformer": "0.56.4",
|
||||
"minimist": "1.2.4",
|
||||
"mkdirp": "0.5.1",
|
||||
"morgan": "1.10.0",
|
||||
"node-notifier": "5.4.3",
|
||||
"object-assign": "4.1.1",
|
||||
"open": "6.4.0",
|
||||
"ora": "3.4.0",
|
||||
"p-limit": "2.2.2",
|
||||
"plist": "3.0.1",
|
||||
"promise": "7.3.1",
|
||||
"react-is": "16.13.0",
|
||||
"serve-static": "1.14.1",
|
||||
"setimmediate": "1.0.5",
|
||||
"shell-quote": "1.6.1",
|
||||
"sudo-prompt": "9.2.1",
|
||||
"ua-parser-js": "0.7.21",
|
||||
"wcwidth": "1.0.1",
|
||||
"ws": "1.1.5"
|
||||
"name": "react-native",
|
||||
"version": "0.61.5",
|
||||
"bin": "./cli.js",
|
||||
"description": "A framework for building native apps using React",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:facebook/react-native.git"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "react-native@0.61.5",
|
||||
"name": "react-native",
|
||||
"escapedName": "react-native",
|
||||
"rawSpec": "0.61.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.61.5"
|
||||
"engines": {
|
||||
"node": ">=8.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
"jest-junit": {
|
||||
"outputDirectory": "reports/junit",
|
||||
"outputName": "js-test-results.xml"
|
||||
},
|
||||
"main": "Libraries/react-native/react-native-implementation.js",
|
||||
"files": [
|
||||
".flowconfig",
|
||||
"android",
|
||||
"cli.js",
|
||||
"flow",
|
||||
"init.sh",
|
||||
"scripts/compose-source-maps.js",
|
||||
"scripts/ios-configure-glog.sh",
|
||||
"scripts/ios-install-third-party.sh",
|
||||
"scripts/launchPackager.bat",
|
||||
"scripts/launchPackager.command",
|
||||
"scripts/node-binary.sh",
|
||||
"scripts/packager.sh",
|
||||
"scripts/react-native-xcode.sh",
|
||||
"jest-preset.js",
|
||||
"jest",
|
||||
"lib",
|
||||
"rn-get-polyfills.js",
|
||||
"Libraries",
|
||||
"LICENSE",
|
||||
"packager",
|
||||
"react-native.config.js",
|
||||
"react.gradle",
|
||||
"React.podspec",
|
||||
"React-Core.podspec",
|
||||
"React",
|
||||
"ReactAndroid",
|
||||
"ReactCommon",
|
||||
"README.md",
|
||||
"third-party-podspecs",
|
||||
"template",
|
||||
"local-cli",
|
||||
"template.config.js",
|
||||
"!template/node_modules",
|
||||
"!template/yarn.lock",
|
||||
"!template/package-lock.json"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/react-native/-/react-native-0.61.5.tgz",
|
||||
"_shasum": "6e21acb56cbd75a3baeb1f70201a66f42600bba8",
|
||||
"_spec": "react-native@0.61.5",
|
||||
"_where": "/Users/retina/Documents/Projets/iLinkWorld",
|
||||
"bin": {
|
||||
"react-native": "cli.js"
|
||||
"scripts": {
|
||||
"start": "react-native start",
|
||||
"test": "jest",
|
||||
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
|
||||
"flow": "flow",
|
||||
"flow-check-ios": "flow check",
|
||||
"flow-check-android": "flow check --flowconfig-name .flowconfig.android",
|
||||
"lint": "eslint .",
|
||||
"lint-ci": "./scripts/circleci/analyze_code.sh && yarn shellcheck",
|
||||
"shellcheck": "./scripts/circleci/analyze_scripts.sh",
|
||||
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
|
||||
"format": "npm run prettier && npm run clang-format",
|
||||
"prettier": "prettier --write \"./**/*.{js,md,yml}\"",
|
||||
"format-check": "prettier --list-different \"./**/*.{js,md,yml}\"",
|
||||
"docker-setup-android": "docker pull reactnativecommunity/react-native-android",
|
||||
"docker-build-android": "docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .",
|
||||
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh",
|
||||
"test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh",
|
||||
"test-android-run-e2e": "docker run --privileged -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh --android --js",
|
||||
"test-android-all": "yarn run docker-build-android && yarn run test-android-run-unit && yarn run test-android-run-instrumentation && yarn run test-android-run-e2e",
|
||||
"test-android-instrumentation": "yarn run docker-build-android && yarn run test-android-run-instrumentation",
|
||||
"test-android-unit": "yarn run docker-build-android && yarn run test-android-run-unit",
|
||||
"test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e",
|
||||
"build-ios-e2e": "detox build -c ios.sim.release",
|
||||
"test-ios-e2e": "detox test -c ios.sim.release RNTester/e2e",
|
||||
"test-ios": "./scripts/objc-test.sh test"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/facebook/react-native/issues"
|
||||
"peerDependencies": {
|
||||
"react": "16.9.0"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"@react-native-community/cli": "^3.0.0",
|
||||
|
|
@ -110,27 +114,6 @@
|
|||
"stacktrace-parser": "^0.1.3",
|
||||
"whatwg-fetch": "^3.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "A framework for building native apps using React",
|
||||
"detox": {
|
||||
"test-runner": "jest",
|
||||
"runner-config": "RNTester/e2e/config.json",
|
||||
"specs": "",
|
||||
"configurations": {
|
||||
"ios.sim.release": {
|
||||
"binaryPath": "RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/",
|
||||
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
|
||||
"type": "ios.simulator",
|
||||
"name": "iPhone 6s"
|
||||
},
|
||||
"ios.sim.debug": {
|
||||
"binaryPath": "RNTester/build/Build/Products/Debug-iphonesimulator/RNTester.app/",
|
||||
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
|
||||
"type": "ios.simulator",
|
||||
"name": "iPhone 6s"
|
||||
}
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/generator": "^7.0.0",
|
||||
|
|
@ -168,87 +151,23 @@
|
|||
"ws": "^6.1.4",
|
||||
"yargs": "^9.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.3"
|
||||
},
|
||||
"files": [
|
||||
".flowconfig",
|
||||
"android",
|
||||
"cli.js",
|
||||
"flow",
|
||||
"init.sh",
|
||||
"scripts/compose-source-maps.js",
|
||||
"scripts/ios-configure-glog.sh",
|
||||
"scripts/ios-install-third-party.sh",
|
||||
"scripts/launchPackager.bat",
|
||||
"scripts/launchPackager.command",
|
||||
"scripts/node-binary.sh",
|
||||
"scripts/packager.sh",
|
||||
"scripts/react-native-xcode.sh",
|
||||
"jest-preset.js",
|
||||
"jest",
|
||||
"lib",
|
||||
"rn-get-polyfills.js",
|
||||
"Libraries",
|
||||
"LICENSE",
|
||||
"packager",
|
||||
"react-native.config.js",
|
||||
"react.gradle",
|
||||
"React.podspec",
|
||||
"React-Core.podspec",
|
||||
"React",
|
||||
"ReactAndroid",
|
||||
"ReactCommon",
|
||||
"README.md",
|
||||
"third-party-podspecs",
|
||||
"template",
|
||||
"local-cli",
|
||||
"template.config.js",
|
||||
"!template/node_modules",
|
||||
"!template/yarn.lock",
|
||||
"!template/package-lock.json"
|
||||
],
|
||||
"homepage": "https://github.com/facebook/react-native#readme",
|
||||
"jest-junit": {
|
||||
"outputDirectory": "reports/junit",
|
||||
"outputName": "js-test-results.xml"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "Libraries/react-native/react-native-implementation.js",
|
||||
"name": "react-native",
|
||||
"peerDependencies": {
|
||||
"react": "16.9.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/facebook/react-native.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build-ios-e2e": "detox build -c ios.sim.release",
|
||||
"clang-format": "clang-format -i --glob=*/**/*.{h,cpp,m,mm}",
|
||||
"docker-build-android": "docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .",
|
||||
"docker-setup-android": "docker pull reactnativecommunity/react-native-android",
|
||||
"flow": "flow",
|
||||
"flow-check-android": "flow check --flowconfig-name .flowconfig.android",
|
||||
"flow-check-ios": "flow check",
|
||||
"format": "npm run prettier && npm run clang-format",
|
||||
"format-check": "prettier --list-different \"./**/*.{js,md,yml}\"",
|
||||
"lint": "eslint .",
|
||||
"lint-ci": "./scripts/circleci/analyze_code.sh && yarn shellcheck",
|
||||
"prettier": "prettier --write \"./**/*.{js,md,yml}\"",
|
||||
"shellcheck": "./scripts/circleci/analyze_scripts.sh",
|
||||
"start": "react-native start",
|
||||
"test": "jest",
|
||||
"test-android-all": "yarn run docker-build-android && yarn run test-android-run-unit && yarn run test-android-run-instrumentation && yarn run test-android-run-e2e",
|
||||
"test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e",
|
||||
"test-android-instrumentation": "yarn run docker-build-android && yarn run test-android-run-instrumentation",
|
||||
"test-android-run-e2e": "docker run --privileged -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh --android --js",
|
||||
"test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh",
|
||||
"test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh",
|
||||
"test-android-unit": "yarn run docker-build-android && yarn run test-android-run-unit",
|
||||
"test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
|
||||
"test-ios": "./scripts/objc-test.sh test",
|
||||
"test-ios-e2e": "detox test -c ios.sim.release RNTester/e2e"
|
||||
},
|
||||
"version": "0.61.5"
|
||||
}
|
||||
"detox": {
|
||||
"test-runner": "jest",
|
||||
"runner-config": "RNTester/e2e/config.json",
|
||||
"specs": "",
|
||||
"configurations": {
|
||||
"ios.sim.release": {
|
||||
"binaryPath": "RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/",
|
||||
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
|
||||
"type": "ios.simulator",
|
||||
"name": "iPhone 6s"
|
||||
},
|
||||
"ios.sim.debug": {
|
||||
"binaryPath": "RNTester/build/Build/Products/Debug-iphonesimulator/RNTester.app/",
|
||||
"build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
|
||||
"type": "ios.simulator",
|
||||
"name": "iPhone 6s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,5 +64,8 @@
|
|||
"cautionNanoCreditAgent": "cautionNanoCreditAgent",
|
||||
"epargnerArgentUser": "epargnerArgentUser",
|
||||
"casserEpargneUser": "casserEpargneUser",
|
||||
"reattachAccountUser": "reattachAccountUser"
|
||||
"reattachAccountUser": "reattachAccountUser",
|
||||
"acceptPrestationAgent": "acceptPrestationAgent",
|
||||
"souscrireAssuranceUser": "souscrireAssuranceUser",
|
||||
"askPrestationUser": "askPrestationUser"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@
|
|||
"DEPOSIT_TO_BANK": "Your Wallet to bank",
|
||||
"NANO_CREDIT": "Nano credit",
|
||||
"NANO_CREDIT_LIST": "Nano credit list",
|
||||
"NANO_CREDIT_DISABLE": "Nano credit disable",
|
||||
"SAVINGS_LIST": "Savings list",
|
||||
"NO_NANO_CREDIT": "No nano credit demand",
|
||||
"NO_SAVINGS": "No savings",
|
||||
|
|
@ -337,6 +338,9 @@
|
|||
"SUCCESS_IDENTIFICATION": "Identification successful",
|
||||
"REFUSER_DEMANDE": "Reject the request",
|
||||
"ACCEPTER_DEMANDE": "Accept the request",
|
||||
"DEMAND_STATE": "Demand state",
|
||||
"CANCEL_ON": "Cancel on",
|
||||
"CANCEL_BY_HYPERVISOR": "Cancel by hypervisor",
|
||||
"REFUSED": "Refuse",
|
||||
"YOUR_THERE": "You are here",
|
||||
"SUCCESS_TRANSFER_COMMISSION": "Transfert effectué",
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@
|
|||
"DEPOSIT_TO_BANK": "Wallet vers banque",
|
||||
"NANO_CREDIT": "Nano crédit",
|
||||
"NANO_CREDIT_LIST": "Liste des nano crédit",
|
||||
"NANO_CREDIT_DISABLE": "Nano crédit désactivé",
|
||||
"SAVINGS_LIST": "Liste des épargnes",
|
||||
"NO_NANO_CREDIT": "Aucune demande de nano crédit",
|
||||
"NO_SAVINGS": "Aucune épargne",
|
||||
|
|
@ -345,6 +346,9 @@
|
|||
"REFUSER_DEMANDE": "Refuser la demande",
|
||||
"REFUSED": "Refusé",
|
||||
"ACCEPTER_DEMANDE": "Accepter la demande",
|
||||
"DEMAND_STATE": "Etat de la demande",
|
||||
"CANCEL_ON": "Annulé le",
|
||||
"CANCEL_BY_HYPERVISOR": "Annuler par l'hyperviseur",
|
||||
"SUCCESS_TRANSFER_COMMISSION": "Transfert de commission",
|
||||
"YOUR_THERE": "Vous êtes ici",
|
||||
"FILTER": "Filtrer",
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -811,6 +811,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"@ideditor/country-coder": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@ideditor/country-coder/-/country-coder-4.0.0.tgz",
|
||||
"integrity": "sha512-46yfsjYdWTLIzDzLzam7/QXQLlr/KAhGdIyL51OCtCpStdsYDBymSmUT5MooMBuRJf8VGyXlUXeGNH/M73n3yQ==",
|
||||
"requires": {
|
||||
"which-polygon": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"@jest/console": {
|
||||
"version": "24.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz",
|
||||
|
|
@ -4826,6 +4834,11 @@
|
|||
"type-check": "~0.3.2"
|
||||
}
|
||||
},
|
||||
"lineclip": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/lineclip/-/lineclip-1.1.5.tgz",
|
||||
"integrity": "sha1-K/JgZ9lDVP6r+R5CdoI221YW/RM="
|
||||
},
|
||||
"load-json-file": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
|
||||
|
|
@ -5727,6 +5740,11 @@
|
|||
"strict-uri-encode": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"quickselect": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.1.1.tgz",
|
||||
"integrity": "sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ=="
|
||||
},
|
||||
"raf": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
|
||||
|
|
@ -5735,6 +5753,14 @@
|
|||
"performance-now": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"rbush": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rbush/-/rbush-2.0.2.tgz",
|
||||
"integrity": "sha512-XBOuALcTm+O/H8G90b6pzu6nX6v2zCKiFG4BJho8a+bY6AER6t8uQUZdi5bomQc0AprCWhEGa7ncAbbRap0bRA==",
|
||||
"requires": {
|
||||
"quickselect": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"react-deep-force-update": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/react-deep-force-update/-/react-deep-force-update-1.1.2.tgz",
|
||||
|
|
@ -6121,11 +6147,6 @@
|
|||
"prop-types": "^15.5.10"
|
||||
}
|
||||
},
|
||||
"react-native-reanimated": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-1.7.0.tgz",
|
||||
"integrity": "sha512-FQWSqP605eQVJumuK2HpR+7heF0ZI+qfy4jNguv3Xv8nPFHeIgZaRTXHCEQL2AcuSIj50zy8jGJf5l134QMQWQ=="
|
||||
},
|
||||
"react-native-responsive-dimensions": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/react-native-responsive-dimensions/-/react-native-responsive-dimensions-2.0.1.tgz",
|
||||
|
|
@ -7629,6 +7650,15 @@
|
|||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
|
||||
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho="
|
||||
},
|
||||
"which-polygon": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/which-polygon/-/which-polygon-2.2.0.tgz",
|
||||
"integrity": "sha512-P2+zRXPqUsTVm4moH8gm7ZTlLtOemy4+EY8elJohjJNMTNpkXLFrlI7i2zUYJD8zHopgKH5TuBmYXca3ZLtMkg==",
|
||||
"requires": {
|
||||
"lineclip": "^1.1.5",
|
||||
"rbush": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"word-wrap": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@expo/react-native-action-sheet": "^3.8.0",
|
||||
"@ideditor/country-coder": "^4.0.0",
|
||||
"@react-native-community/async-storage": "^1.9.0",
|
||||
"@react-native-community/datetimepicker": "^2.4.0",
|
||||
"@react-native-community/viewpager": "^3.3.0",
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
import { AsyncStorage } from "react-native";
|
||||
import { persistReducer, persistStore } from "redux-persist";
|
||||
import { createStore, applyMiddleware, compose } from "redux";
|
||||
import {AsyncStorage} from "react-native";
|
||||
import {persistReducer, persistStore} from "redux-persist";
|
||||
import {createStore, applyMiddleware, compose} from "redux";
|
||||
import thunk from 'redux-thunk';
|
||||
import { createLogger } from 'redux-logger';
|
||||
import {createLogger} from 'redux-logger';
|
||||
import rootReducer from "./reducers";
|
||||
|
||||
|
||||
|
||||
/* const persistConfig = {
|
||||
key: 'root',
|
||||
storage: AsyncStorage,
|
||||
|
|
@ -17,11 +16,11 @@ const middlewares = [];
|
|||
middlewares.push(thunk);
|
||||
|
||||
const loggerMiddleware = createLogger({
|
||||
predicate: () => process.env.NODE_ENV === 'development'
|
||||
predicate: () => process.env.NODE_ENV === 'development'
|
||||
})
|
||||
middlewares.push(loggerMiddleware);
|
||||
|
||||
const store = createStore(rootReducer, compose(applyMiddleware(...middlewares)));
|
||||
let persistor = persistStore(store);
|
||||
|
||||
export { store, persistor };
|
||||
export {store, persistor};
|
||||
|
|
|
|||
|
|
@ -102,8 +102,9 @@ export default class UpdateInformations extends Component {
|
|||
}
|
||||
|
||||
onClickUpdatePosition() {
|
||||
this.setState({positionEnabled: true})
|
||||
this.setState({positionEnabled: true});
|
||||
Geolocation.getCurrentPosition((position) => {
|
||||
console.log("CURRENT POSITION", position);
|
||||
const myPosition = position.coords;
|
||||
updatePosition(myPosition.longitude, myPosition.latitude).then((response) => {
|
||||
var title = '';
|
||||
|
|
@ -130,11 +131,19 @@ export default class UpdateInformations extends Component {
|
|||
text: "Ok", onPress: () => {
|
||||
this.props.navigation.popToTop()
|
||||
}
|
||||
}])
|
||||
}]);
|
||||
}).catch((e) => {
|
||||
console.log(e);
|
||||
this.setState({positionEnabled: false})
|
||||
})
|
||||
}, null, this.props.geolocationOptions);
|
||||
}, (e) => {
|
||||
console.log(e);
|
||||
Alert.alert(I18n.t('ERROR_LABEL'), e.message, [{
|
||||
text: "Ok", onPress: () => {
|
||||
this.props.navigation.popToTop();
|
||||
}
|
||||
}]);
|
||||
}, this.props.geolocationOptions);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -307,7 +307,8 @@ class HistoryItemDetails extends Component {
|
|||
console.warn("ITEM ITEM", this.item);
|
||||
console.warn("Code Membre", user.code_membre);
|
||||
if (user) {
|
||||
if (this.item.code_parrain === user.code_membre) {
|
||||
if (this.item.code_parrain.toLowerCase() === user.code_membre.toLowerCase()) {
|
||||
console.warn("Conditions vérifié");
|
||||
if (this.item.status === '1') {
|
||||
return (<Button
|
||||
style={{
|
||||
|
|
@ -326,7 +327,8 @@ class HistoryItemDetails extends Component {
|
|||
{this.state.statut}
|
||||
</Button>
|
||||
)
|
||||
} else if (this.item.status === '2') {
|
||||
}
|
||||
if (this.item.status === '2') {
|
||||
return (<Button
|
||||
style={{
|
||||
borderColor: 'transparent',
|
||||
|
|
@ -405,9 +407,16 @@ class HistoryItemDetails extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
console.log("CREDIT MANAGE PROPS", this.props);
|
||||
let ago = moment.tz(this.item.date_creation, moment.tz.guess()).format();
|
||||
ago = moment(ago);
|
||||
|
||||
let cancelDate = "";
|
||||
if (parseInt(this.item.canceled_by_hypervisor) === 1) {
|
||||
console.log("CANCEL DATE", this.item.cancellation_date);
|
||||
cancelDate = moment.tz(this.item.cancellation_date, moment.tz.guess()).format();
|
||||
cancelDate = moment(cancelDate);
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
{this.renderPromptModifyAmountToSend()}
|
||||
|
|
@ -526,6 +535,44 @@ class HistoryItemDetails extends Component {
|
|||
}}>{ago.fromNow()}</Text>
|
||||
</View>
|
||||
</CardView>
|
||||
{
|
||||
parseInt(this.item.canceled_by_hypervisor) === 1 &&
|
||||
<CardView style={styles.cardcontainer}>
|
||||
<Text style={{
|
||||
fontSize: 17,
|
||||
fontWeight: 'bold',
|
||||
color: 'black',
|
||||
marginLeft: responsiveWidth(5)
|
||||
}}>
|
||||
{I18n.t('DEMAND_STATE')}
|
||||
</Text>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start'
|
||||
}}>
|
||||
<Icons name='md-git-branch'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{marginLeft: 20}}/>
|
||||
<Text style={styles.simpleuser}>{I18n.t('CANCEL_BY_HYPERVISOR')}</Text>
|
||||
</View>
|
||||
<View style={{
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'flex-start',
|
||||
marginTop: -20
|
||||
}}>
|
||||
<Icons name='md-calendar'
|
||||
size={28}
|
||||
color={theme.accent}
|
||||
style={{
|
||||
marginLeft: 20
|
||||
}}
|
||||
/>
|
||||
<Text
|
||||
style={styles.simpleuser}>{`${I18n.t('CANCEL_ON')} ${cancelDate.format(" Do MMMM YYYY à HH:mm")}`}</Text>
|
||||
</View>
|
||||
</CardView>
|
||||
}
|
||||
{this.state.user ? this.renderBtn() : null}
|
||||
</View>)
|
||||
}
|
||||
|
|
@ -590,4 +637,4 @@ const styles = StyleSheet.create({
|
|||
flex: 3,
|
||||
margin: 3,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import InterticielAds from './../ads/InterticielAds'
|
|||
import SnackBar from 'react-native-snackbar-component'
|
||||
import {FAB, Surface} from 'react-native-paper'
|
||||
import BottomSheet from 'reanimated-bottom-sheet'
|
||||
import MarkerManager from './../../webservice/persistences/MarkerManager'
|
||||
import {bindActionCreators} from 'redux';
|
||||
import getAuthApiKey from '../../webservice/AuthKeyApi';
|
||||
import {connect} from 'react-redux';
|
||||
|
|
@ -52,6 +53,7 @@ import getWalletActivated from '../../webservice/WalletApi';
|
|||
import {saveOnesignalIdsAction, saveOnesignalIdsReset} from '../../webservice/OnesignalApi';
|
||||
import OneSignal from 'react-native-onesignal';
|
||||
import {saveOnesignalIds} from '../../webservice/IlinkConstants';
|
||||
import {callingCodes} from "@ideditor/country-coder";
|
||||
|
||||
const countries = require("./../../utils/country_code.json")
|
||||
|
||||
|
|
@ -308,6 +310,7 @@ class Home extends BaseScreen {
|
|||
this.mounted = true;
|
||||
this.configuration = new Configuration()
|
||||
const {navigation} = this.props;
|
||||
this.markerManager = new MarkerManager()
|
||||
this.configuration.getCurrentPubValue().then((value) => {
|
||||
try {
|
||||
const val = parseInt(value)
|
||||
|
|
@ -371,7 +374,7 @@ class Home extends BaseScreen {
|
|||
this.setState({isLoading: false, isLoadingMap: false, loadingDialog: false})
|
||||
|
||||
if (user.category !== "geolocated") {
|
||||
|
||||
console.log("THIS IS CALL");
|
||||
this.showMyMembers();
|
||||
} else {
|
||||
if (myPosition.latitude <= 0 && myPosition.longitude <= 0) {
|
||||
|
|
@ -1700,6 +1703,7 @@ class Home extends BaseScreen {
|
|||
Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{
|
||||
text: "Ok",
|
||||
onPress: () => {
|
||||
_.isNil(user.latitude)
|
||||
}
|
||||
}])
|
||||
}}
|
||||
|
|
@ -1720,21 +1724,21 @@ class Home extends BaseScreen {
|
|||
}
|
||||
|
||||
onMapReady = () => {
|
||||
|
||||
console.log("MAP READY CALL");
|
||||
readUser().then((user) => {
|
||||
if (user) {
|
||||
this.setState({user: user})
|
||||
this.setState({user: user});
|
||||
this.setState({network: user.network, isSaveOneSignalOK: true});
|
||||
|
||||
const myPosition = {
|
||||
latitude: parseFloat(user.latitude),
|
||||
longitude: parseFloat(user.longitude)
|
||||
latitude: _.isNil(user.latitude) ? 0 : parseFloat(user.latitude),
|
||||
longitude: _.isNil(user.longitude) ? 0 : parseFloat(user.longitude)
|
||||
}
|
||||
this.setState({myPosition});
|
||||
this.refocusMap(false);
|
||||
|
||||
if (user.category) {
|
||||
this.setState({loadingDialog: false})
|
||||
this.setState({loadingDialog: false});
|
||||
if (user.category !== "geolocated") {
|
||||
this.showMyMembers();
|
||||
} else {
|
||||
|
|
@ -1891,7 +1895,7 @@ class Home extends BaseScreen {
|
|||
return item.id === filternetwork.id
|
||||
})
|
||||
let reseau = res[0];
|
||||
this.loadingMarkers(myPosition, filternetwork, value).then((datas) => {
|
||||
this.loadingMarkers(myPosition, filternetwork, value, undefined, true).then((datas) => {
|
||||
this.treatNewData(this.state.prevRegion, datas, true)
|
||||
}).catch((e) => {
|
||||
this.setState({showProgress: false})
|
||||
|
|
@ -2002,7 +2006,7 @@ class Home extends BaseScreen {
|
|||
const {myPosition, user, filternetwork} = this.state
|
||||
if (filternetwork !== undefined) {
|
||||
this.setState({showProgress: true})
|
||||
this.loadingMarkers(this.state.myPosition, filternetwork, this.state.value, 0).then((data) => {
|
||||
this.loadingMarkers(this.state.myPosition, filternetwork, this.state.value, 0, true).then((data) => {
|
||||
this.setState({showProgress: false})
|
||||
this.treatNewData(myPosition, data, true)
|
||||
}).catch((e) => {
|
||||
|
|
@ -2086,6 +2090,8 @@ class Home extends BaseScreen {
|
|||
)
|
||||
}
|
||||
|
||||
markerManager: MarkerManager
|
||||
|
||||
getHypervisorActionButton() {
|
||||
return (<ActionButton
|
||||
buttonColor={theme.accent}
|
||||
|
|
@ -2317,7 +2323,7 @@ class Home extends BaseScreen {
|
|||
)
|
||||
}
|
||||
|
||||
loadingMarkers(myPosition, filternetwork, value, p = undefined) {
|
||||
loadingMarkers(myPosition, filternetwork, value, p = undefined, isFilter = false) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const {allpoint} = this.state
|
||||
let page = p !== undefined ? p : this.state.page
|
||||
|
|
@ -2334,12 +2340,27 @@ class Home extends BaseScreen {
|
|||
const location = {longitude: parseFloat(mark.longitude), latitude: parseFloat(mark.latitude)}
|
||||
return geolib.getDistance(myPosition, location) <= (value * 1000)
|
||||
&& mark.network === filternetwork.name
|
||||
})
|
||||
this.setState({
|
||||
currentNetworkSize: currentNetwork.length,
|
||||
showProgress: false,
|
||||
currentNetworkMarkers: currentNetwork
|
||||
})
|
||||
});
|
||||
console.warn("currentNetworkSize", this.state.currentNetworkSize);
|
||||
console.warn("currentNetworkSize valuePosition", this.state.valuePosition);
|
||||
if (isFilter) {
|
||||
this.setState({
|
||||
currentNetworkSize: currentNetwork.length,
|
||||
showProgress: false,
|
||||
currentNetworkMarkers: currentNetwork
|
||||
}, () => {
|
||||
console.warn("currentNetworkSize", this.state.currentNetworkSize);
|
||||
console.warn("currentNetworkSize valuePosition", this.state.valuePosition);
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
showProgress: false,
|
||||
currentNetworkMarkers: currentNetwork
|
||||
}, () => {
|
||||
console.warn("currentNetworkSize", this.state.currentNetworkSize);
|
||||
console.warn("currentNetworkSize valuePosition", this.state.valuePosition);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.debug("after " + e.message)
|
||||
}
|
||||
|
|
@ -2423,111 +2444,103 @@ class Home extends BaseScreen {
|
|||
console.log("on treatposition")
|
||||
if (myPosition.longitude !== myLastPosition.longitude || myPosition.latitude !== myLastPosition.latitude) {
|
||||
this.setState({myPosition: myPosition})
|
||||
if (this.map) this.map.focusToUser()
|
||||
getPositionInformation(myPosition).then((response) => {
|
||||
if (response) {
|
||||
if (response.results !== undefined) {
|
||||
if (response.results.length > 0) {
|
||||
|
||||
let most = response.results[0]
|
||||
let {address_components, formatted_address, place_id} = most
|
||||
this.setState({address: address_components, textadress: formatted_address, place: place_id})
|
||||
|
||||
let results = response.results;
|
||||
let shortcountry;
|
||||
let mcountry;
|
||||
for (let i = 0; i < results[0].address_components.length; i++) {
|
||||
for (let j = 0; j < results[0].address_components[i].types.length; j++) {
|
||||
if (results[0].address_components[i].types[j] === "country") {
|
||||
mcountry = results[0].address_components[i];
|
||||
shortcountry = mcountry.short_name;
|
||||
this.setState({
|
||||
shortCountry: mcountry.short_name,
|
||||
longCountry: mcountry.long_name
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
console.warn("there ")
|
||||
for (let i of countries) {
|
||||
if (i.code === shortcountry) {
|
||||
this.setState({indicatif: i.dial_code})
|
||||
this.getNetworks(i.dial_code)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log("on treat 1")
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.treatPosition(myPosition)
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
console.log("on treat 2")
|
||||
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.treatPosition(myPosition)
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
}).catch((error) => {
|
||||
//Crashlytics.log(error.message)
|
||||
console.log("on treat 3")
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.treatPosition(myPosition)
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
if (this.map) this.map.focusToUser();
|
||||
let indicatif = callingCodes([myPosition.longitude, myPosition.latitude]);
|
||||
if (Array.isArray(indicatif))
|
||||
indicatif = "+" + indicatif[0];
|
||||
this.setState({
|
||||
indicatif: indicatif,
|
||||
enterPhone: indicatif
|
||||
});
|
||||
this.getNetworks(indicatif);
|
||||
/* getOpenCagePositionInformation(myPosition).then((response) => {
|
||||
if (response) {
|
||||
if (response.results !== undefined) {
|
||||
if (response.results.length > 0) {
|
||||
|
||||
let most = response.results[0]
|
||||
let {address_components, county, country} = most.components;
|
||||
let indicatif = callingCodes([myPosition.longitude, myPosition.latitude]);
|
||||
console.log("OPENCAGE RESPONSE", indicatif);
|
||||
this.setState({
|
||||
address: address_components,
|
||||
textadress: most.formatted,
|
||||
indicatif: `+${indicatif}`,
|
||||
enterPhone: `+${indicatif}`,
|
||||
shortCountry: county,
|
||||
longCountry: country
|
||||
});
|
||||
this.getNetworks(indicatif);
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log("on treat 1")
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.treatPosition(myPosition)
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
} else {
|
||||
console.log("on treat 2")
|
||||
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.treatPosition(myPosition)
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
}).catch((error) => {
|
||||
//Crashlytics.log(error.message)
|
||||
console.log("on treat 3")
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.treatPosition(myPosition)
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
});*/
|
||||
const reg = {
|
||||
latitude: myPosition.latitude,
|
||||
longitude: myPosition.longitude,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import IMarker from "./IMarker";
|
|||
import I18n from "react-native-i18n";
|
||||
import MapViewDirections from 'react-native-maps-directions';
|
||||
|
||||
const API_KEY = "AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI";
|
||||
const API_KEY = "AIzaSyBUQoQYY31-S3DPp7aRRIAjEda8T2pZvJE";
|
||||
const mnetwork = require('./../../datas/img/png/home_network.png');
|
||||
const othernetwork = require('./../../datas/img/png/other_net.png');
|
||||
import {copilot, CopilotStep} from 'react-native-copilot';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Component } from 'react';
|
||||
import React, {Component} from 'react';
|
||||
import {
|
||||
|
||||
StyleSheet,
|
||||
|
|
@ -18,25 +18,30 @@ import {
|
|||
} from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
|
||||
import { responsiveHeight, responsiveWidth, responsiveFontSize } from 'react-native-responsive-dimensions';
|
||||
import { Sae } from 'react-native-textinput-effects';
|
||||
import {responsiveHeight, responsiveWidth, responsiveFontSize} from 'react-native-responsive-dimensions';
|
||||
import {Sae} from 'react-native-textinput-effects';
|
||||
import Button from 'apsl-react-native-button';
|
||||
|
||||
let theme = require('./../../../utils/theme.json');
|
||||
import { login, saveNewuser, getCountryNetwork } from './../../../webservice/AuthApi';
|
||||
import {login, saveNewuser, getCountryNetwork, getAppVersion} from './../../../webservice/AuthApi';
|
||||
import * as Animatable from 'react-native-animatable';
|
||||
import isEqual from 'lodash/isEqual'
|
||||
import { getPositionInformation } from './../../../webservice/MapService'
|
||||
import {getOpenCagePositionInformation} from './../../../webservice/MapService'
|
||||
import SwitchSelector from 'react-native-switch-selector'
|
||||
import I18n from 'react-native-i18n'
|
||||
|
||||
let route = require('./../../../route.json');
|
||||
require('./../../../utils/Translations')
|
||||
let country = require('./../../../utils/country_code.json');
|
||||
import { IlinkEmitter } from './../../../utils/events'
|
||||
import { readUser } from "../../../webservice/AuthApi";
|
||||
import { MaterialDialog } from "react-native-material-dialog"
|
||||
import Spinner from "react-native-loading-spinner-overlay"
|
||||
import Geolocation from "react-native-geolocation-service"
|
||||
const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000 }
|
||||
import {IlinkEmitter} from './../../../utils/events'
|
||||
import {readUser} from "../../../webservice/AuthApi";
|
||||
import {MaterialDialog} from "react-native-material-dialog"
|
||||
import Spinner from "react-native-loading-spinner-overlay";
|
||||
import Geolocation from "react-native-geolocation-service";
|
||||
import {iso1A2Code, callingCodes, emojiFlag, feature} from '@ideditor/country-coder';
|
||||
import {opencageDataApiKey} from "../../../webservice/IlinkConstants";
|
||||
|
||||
const GEOLOCATION_OPTIONS = {enableHighAccuracy: true, timeout: 20000}
|
||||
const propTypes = {
|
||||
coordinate: PropTypes.shape({
|
||||
latitude: PropTypes.number.isRequired,
|
||||
|
|
@ -51,7 +56,8 @@ const propTypes = {
|
|||
heading: PropTypes.number,
|
||||
enableHack: PropTypes.bool,
|
||||
};
|
||||
const widthButton = responsiveWidth(80) > 350 ? 350 : responsiveWidth(80)
|
||||
const widthButton = responsiveWidth(80) > 350 ? 350 : responsiveWidth(80);
|
||||
|
||||
export class LoginUi extends Component {
|
||||
|
||||
handlePhoneRef = ref => this.phoneRef = ref;
|
||||
|
|
@ -60,50 +66,51 @@ export class LoginUi extends Component {
|
|||
enableHack: false,
|
||||
geolocationOptions: null,
|
||||
};
|
||||
|
||||
async requestCameraPermission() {
|
||||
if (Platform.OS === "android") {
|
||||
try {
|
||||
const granted = await PermissionsAndroid.request(
|
||||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
||||
{
|
||||
'title': 'Cool Photo App Camera Permission',
|
||||
'message': 'Cool Photo App needs access to your camera ' +
|
||||
'so you can take awesome pictures.'
|
||||
}
|
||||
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
|
||||
{
|
||||
'title': 'Cool Photo App Camera Permission',
|
||||
'message': 'Cool Photo App needs access to your camera ' +
|
||||
'so you can take awesome pictures.'
|
||||
}
|
||||
)
|
||||
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||
this.watchLocation()
|
||||
} else {
|
||||
this.setState({ loadingDialog: false })
|
||||
this.setState({loadingDialog: false})
|
||||
Alert.alert(I18n.t("TITLE_UNABLE_TO_AUTORISE"),
|
||||
I18n.t("MISSING_AUTORISATION_LOCATION"),
|
||||
[{
|
||||
text: I18n.t("RESTART"), onPress: () => {
|
||||
this.requestCameraPermission()
|
||||
}
|
||||
}, {
|
||||
text: I18n.t("QUIT_"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
}],
|
||||
{ cancelable: false }
|
||||
I18n.t("MISSING_AUTORISATION_LOCATION"),
|
||||
[{
|
||||
text: I18n.t("RESTART"), onPress: () => {
|
||||
this.requestCameraPermission()
|
||||
}
|
||||
}, {
|
||||
text: I18n.t("QUIT_"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
}],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(err)
|
||||
this.setState({ loadingDialog: false })
|
||||
this.setState({loadingDialog: false})
|
||||
Alert.alert(I18n.t("TITLE_ERROR_SURVENU"),
|
||||
I18n.t("TEXT_ERROR_START_APPLICATION"),
|
||||
[{
|
||||
text: I18n.t("RESTART"), onPress: () => {
|
||||
this.requestCameraPermission()
|
||||
}
|
||||
}, {
|
||||
text: I18n.t("QUIT_"), onPress: () => {
|
||||
// BackHandler.exitApp()
|
||||
}
|
||||
}],
|
||||
{ cancelable: false }
|
||||
I18n.t("TEXT_ERROR_START_APPLICATION"),
|
||||
[{
|
||||
text: I18n.t("RESTART"), onPress: () => {
|
||||
this.requestCameraPermission()
|
||||
}
|
||||
}, {
|
||||
text: I18n.t("QUIT_"), onPress: () => {
|
||||
// BackHandler.exitApp()
|
||||
}
|
||||
}],
|
||||
{cancelable: false}
|
||||
)
|
||||
|
||||
}
|
||||
|
|
@ -114,24 +121,25 @@ export class LoginUi extends Component {
|
|||
}
|
||||
|
||||
showConnexionAlertError() {
|
||||
this.setState({ loadingDialog: false })
|
||||
this.setState({loadingDialog: false})
|
||||
|
||||
Alert.alert(I18n.t("TITLE_PROBLE_COME"),
|
||||
I18n.t("TEXT_UNABLE_TO_GET_YOUR_POSITION"),
|
||||
[{
|
||||
text: I18n.t("QUIT_"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
}, {
|
||||
text: I18n.t("RESTART"),
|
||||
onPress: () => {
|
||||
this.setState({ loadingDialog: true })
|
||||
this.watchLocation()
|
||||
}
|
||||
}],
|
||||
{ cancelable: false }
|
||||
I18n.t("TEXT_UNABLE_TO_GET_YOUR_POSITION"),
|
||||
[{
|
||||
text: I18n.t("QUIT_"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
}, {
|
||||
text: I18n.t("RESTART"),
|
||||
onPress: () => {
|
||||
this.setState({loadingDialog: true})
|
||||
this.watchLocation()
|
||||
}
|
||||
}],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
|
||||
_storeData = async (position) => {
|
||||
try {
|
||||
console.warn("save result", await AsyncStorage.setItem('position', JSON.stringify(position)));
|
||||
|
|
@ -147,129 +155,133 @@ export class LoginUi extends Component {
|
|||
re.longitudeDelta = 0.04
|
||||
re.latitudeDelta = 0.01
|
||||
const pos = JSON.parse(value)
|
||||
this.setState({ region: re, oldPosition: pos })
|
||||
this.setState({region: re, oldPosition: pos})
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(error)
|
||||
}
|
||||
};
|
||||
|
||||
watchLocation(geo = null) {
|
||||
const options = geo == null ? GEOLOCATION_OPTIONS : geo
|
||||
this.watchID = Geolocation.getCurrentPosition((position) => {
|
||||
const myLastPosition = this.state.myPosition;
|
||||
const myPosition = position.coords;
|
||||
if (!isEqual(myPosition, myLastPosition)) {
|
||||
console.warn(myPosition)
|
||||
if (myPosition.longitude !== 0 && myPosition.latitude !== 0) {
|
||||
this._storeData(myPosition)
|
||||
this.retreiveinformationFromPosition(myPosition)
|
||||
} else {
|
||||
if (!this.state.alreadyRetry) {
|
||||
this.setState({ alreadyRetry: true })
|
||||
let geo = { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 }
|
||||
this.watchLocation(geo)
|
||||
} else {
|
||||
if (this.state.oldPosition) {
|
||||
this.retreiveinformationFromPosition(this.state.oldPosition)
|
||||
} else {
|
||||
Geolocation.watchPosition((position) => {
|
||||
if (position.longitude !== 0 && position.latitude !== 0) {
|
||||
this._storeData(position)
|
||||
this.retreiveinformationFromPosition(position)
|
||||
} else {
|
||||
Alert.alert(I18n.t("UNABLE_GET_INFORMATION")
|
||||
, I18n.t('UNABLE_GET_INFORMATION_TEXT'),
|
||||
[{ text: I18n.t("EXIT"), onPress: () => { BackHandler.exitApp() } },
|
||||
{ text: I18n.t("RESTART"), onPress: () => { this.watchLocation() } }],
|
||||
{ cancelable: false }
|
||||
)
|
||||
}
|
||||
}, (error) => {
|
||||
this.setState({ loadingDialog: false })
|
||||
Alert.alert(I18n.t("TITLE_ERROR_SURVENU"),
|
||||
I18n.t("TEXT_ERROR_START_APPLICATION"),
|
||||
[{
|
||||
text: "Ok", onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
}],
|
||||
{ cancelable: false })
|
||||
}, GEOLOCATION_OPTIONS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const myLastPosition = this.state.myPosition;
|
||||
const myPosition = position.coords;
|
||||
if (!isEqual(myPosition, myLastPosition)) {
|
||||
console.warn(myPosition)
|
||||
if (myPosition.longitude !== 0 && myPosition.latitude !== 0) {
|
||||
this._storeData(myPosition)
|
||||
this.retreiveinformationFromPosition(myPosition)
|
||||
} else {
|
||||
if (!this.state.alreadyRetry) {
|
||||
this.setState({alreadyRetry: true})
|
||||
let geo = {enableHighAccuracy: false, timeout: 20000, maximumAge: 1000}
|
||||
this.watchLocation(geo)
|
||||
} else {
|
||||
if (this.state.oldPosition) {
|
||||
this.retreiveinformationFromPosition(this.state.oldPosition)
|
||||
} else {
|
||||
Geolocation.watchPosition((position) => {
|
||||
if (position.longitude !== 0 && position.latitude !== 0) {
|
||||
this._storeData(position)
|
||||
this.retreiveinformationFromPosition(position)
|
||||
} else {
|
||||
Alert.alert(I18n.t("UNABLE_GET_INFORMATION")
|
||||
, I18n.t('UNABLE_GET_INFORMATION_TEXT'),
|
||||
[{
|
||||
text: I18n.t("EXIT"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("RESTART"), onPress: () => {
|
||||
this.watchLocation()
|
||||
}
|
||||
}],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
}, (error) => {
|
||||
this.setState({loadingDialog: false})
|
||||
Alert.alert(I18n.t("TITLE_ERROR_SURVENU"),
|
||||
I18n.t("TEXT_ERROR_START_APPLICATION"),
|
||||
[{
|
||||
text: "Ok", onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
}],
|
||||
{cancelable: false})
|
||||
}, GEOLOCATION_OPTIONS)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, (positionError) => {
|
||||
console.warn(positionError)
|
||||
Alert.alert(I18n.t("UNABLE_GET_INFORMATION")
|
||||
, I18n.t('UNABLE_GET_INFORMATION_TEXT'),
|
||||
[{ text: I18n.t("EXIT"), onPress: () => { BackHandler.exitApp() } },
|
||||
{ text: I18n.t("RESTART"), onPress: () => { this.watchLocation() } }],
|
||||
{ cancelable: false }
|
||||
)
|
||||
}
|
||||
, options)
|
||||
}, (positionError) => {
|
||||
console.warn(positionError)
|
||||
Alert.alert(I18n.t("UNABLE_GET_INFORMATION")
|
||||
, I18n.t('UNABLE_GET_INFORMATION_TEXT'),
|
||||
[{
|
||||
text: I18n.t("EXIT"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("RESTART"), onPress: () => {
|
||||
this.watchLocation()
|
||||
}
|
||||
}],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
, options)
|
||||
}
|
||||
|
||||
|
||||
retreiveinformationFromPosition(myPosition) {
|
||||
getPositionInformation(myPosition).then((response) => {
|
||||
console.log(response, myPosition)
|
||||
if (response.results !== undefined) {
|
||||
if (response.results.length > 0) {
|
||||
let most = response.results[0]
|
||||
let { address_components, formatted_address, place_id } = most
|
||||
this.setState({ address: address_components, textadress: formatted_address, place: place_id })
|
||||
let results = response.results;
|
||||
let shortcountry;
|
||||
let mcountry;
|
||||
for (let i = 0; i < results[0].address_components.length; i++) {
|
||||
for (let j = 0; j < results[0].address_components[i].types.length; j++) {
|
||||
if (results[0].address_components[i].types[j] === "country") {
|
||||
mcountry = results[0].address_components[i];
|
||||
shortcountry = mcountry.short_name;
|
||||
this.setState({ shortCountry: mcountry.short_name, longCountry: mcountry.long_name })
|
||||
this.getNetworks(mcountry.long_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i of country) {
|
||||
if (i.code === shortcountry) {
|
||||
this.setState({ indicatif: i.dial_code, enterPhone: i.dial_code });
|
||||
console.log("DIAL CODE", i.dial_code);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
this.setState({ phoneEnabled: true, loadingDialog: false });
|
||||
|
||||
} else {
|
||||
console.log(myPosition, response)
|
||||
this.showConnexionAlertError()
|
||||
}
|
||||
}).catch((e) => {
|
||||
|
||||
this.setState({ phoneEnabled: true, loadingDialog: false });
|
||||
Alert.alert(I18n.t("TITLE_PROBLE_COME"),
|
||||
I18n.t("TEXT_UNABLE_TO_GET_COUNTRY_INFO"), [{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
}, {
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.watchLocation()
|
||||
}
|
||||
}], { cancelable: false })
|
||||
let indicatif = callingCodes([myPosition.longitude, myPosition.latitude]);
|
||||
this.setState({
|
||||
indicatif: `+${indicatif}`,
|
||||
enterPhone: `+${indicatif}`
|
||||
});
|
||||
|
||||
/* getOpenCagePositionInformation(myPosition).then((response) => {
|
||||
console.log("OPENCAGE RESPONSE", response);
|
||||
if (response.results !== undefined) {
|
||||
if (response.results.length > 0) {
|
||||
let most = response.results[0]
|
||||
let {address_components, county, country} = most.components;
|
||||
let indicatif = callingCodes([myPosition.longitude, myPosition.latitude]);
|
||||
console.log("OPENCAGE RESPONSE", indicatif);
|
||||
this.setState({
|
||||
address: address_components,
|
||||
textadress: most.formatted,
|
||||
indicatif: `+${indicatif}`,
|
||||
enterPhone: `+${indicatif}`,
|
||||
shortCountry: county,
|
||||
longCountry: country
|
||||
});
|
||||
//this.getNetworks(country);
|
||||
} else {
|
||||
}
|
||||
this.setState({phoneEnabled: true, loadingDialog: false});
|
||||
|
||||
} else {
|
||||
console.log(myPosition, response)
|
||||
this.showConnexionAlertError()
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.log("OPENCAGE ERROR", e);
|
||||
this.setState({phoneEnabled: true, loadingDialog: false});
|
||||
});*/
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this._retrieveData()
|
||||
this.requestCameraPermission()
|
||||
this._retrieveData();
|
||||
this.requestCameraPermission();
|
||||
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.focusListener)
|
||||
this.focusListener.remove()
|
||||
|
|
@ -286,7 +298,7 @@ export class LoginUi extends Component {
|
|||
this.reseaux.push(networks[prop]);
|
||||
}
|
||||
}
|
||||
this.setState({ networks: this.reseaux });
|
||||
this.setState({networks: this.reseaux});
|
||||
|
||||
}, (err) => {
|
||||
console.log(err);
|
||||
|
|
@ -301,27 +313,27 @@ export class LoginUi extends Component {
|
|||
this.state = this.initState();
|
||||
this.Animation = new Animated.Value(0);
|
||||
this.BackgroundColorConfig = this.Animation.interpolate(
|
||||
{
|
||||
inputRange: [0, 0.5, 1],
|
||||
outputRange: this.state.colorsscheme
|
||||
});
|
||||
{
|
||||
inputRange: [0, 0.5, 1],
|
||||
outputRange: this.state.colorsscheme
|
||||
});
|
||||
this.BackgroundColorConfigAdmin = this.Animation.interpolate(
|
||||
{
|
||||
inputRange: [0, 0.5, 1],
|
||||
outputRange: this.state.colorsscheme.reverse()
|
||||
})
|
||||
{
|
||||
inputRange: [0, 0.5, 1],
|
||||
outputRange: this.state.colorsscheme.reverse()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
StartBackgroundColorAnimation = (value) => {
|
||||
this.Animation.setValue(value === 0 ? 0 : 1);
|
||||
this.setState({ stateLogin: value, typeaccount: value })
|
||||
this.setState({stateLogin: value, typeaccount: value})
|
||||
Animated.timing(
|
||||
this.Animation,
|
||||
{
|
||||
toValueF: value === 1 ? 0 : 1,
|
||||
duration: 500
|
||||
}
|
||||
this.Animation,
|
||||
{
|
||||
toValueF: value === 1 ? 0 : 1,
|
||||
duration: 500
|
||||
}
|
||||
).start();
|
||||
}
|
||||
|
||||
|
|
@ -355,6 +367,7 @@ export class LoginUi extends Component {
|
|||
type: this.state.typeaccount,
|
||||
});
|
||||
}
|
||||
|
||||
initState() {
|
||||
return {
|
||||
password: "",
|
||||
|
|
@ -364,135 +377,148 @@ export class LoginUi extends Component {
|
|||
phoneEnabled: false,
|
||||
snackVisible: false,
|
||||
snackText: '',
|
||||
loadingDialog: true,
|
||||
loadingDialog: false,
|
||||
stateLogin: -1,
|
||||
colorsscheme: [theme.primary, theme.primaryDark, theme.primaryDarkAdvanced]
|
||||
}
|
||||
}
|
||||
|
||||
options = [
|
||||
{ label: I18n.t('USER'), value: 0 },
|
||||
{ label: I18n.t('AGENT'), value: 1 },
|
||||
{label: I18n.t('USER'), value: 0},
|
||||
{label: I18n.t('AGENT'), value: 1},
|
||||
]
|
||||
|
||||
BackgroundColorConfig: null
|
||||
BackgroundColorConfigAdmin: null
|
||||
|
||||
render() {
|
||||
|
||||
return (
|
||||
<Animated.View style={[style.container,
|
||||
{ backgroundColor: this.BackgroundColorConfig }]}>
|
||||
<StatusBar
|
||||
backgroundColor={theme.primaryDark}
|
||||
barStyle="light-content"
|
||||
translucent={false}
|
||||
<Animated.View style={[style.container,
|
||||
{backgroundColor: this.BackgroundColorConfig}]}>
|
||||
<StatusBar
|
||||
backgroundColor={theme.primaryDark}
|
||||
barStyle="light-content"
|
||||
translucent={false}
|
||||
|
||||
/><Spinner
|
||||
visible={this.state.loadingDialog}
|
||||
textContent={I18n.t("LOADING_PROGRESS")}
|
||||
textStyle={{ color: '#FFF' }}
|
||||
/>
|
||||
/><Spinner
|
||||
visible={this.state.loadingDialog}
|
||||
textContent={I18n.t("LOADING_PROGRESS")}
|
||||
textStyle={{color: '#FFF'}}
|
||||
/>
|
||||
|
||||
<ScrollView>
|
||||
<TouchableOpacity onPress={() => {
|
||||
<ScrollView>
|
||||
<TouchableOpacity onPress={() => {
|
||||
|
||||
this.props.navigation.push(route.helpmenu)
|
||||
this.props.navigation.push(route.helpScreen)
|
||||
|
||||
}} >
|
||||
<View style={{
|
||||
alignSelf: 'flex-end',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: theme.primaryLight,
|
||||
height: 32,
|
||||
borderRadius: 12,
|
||||
marginTop: 30,
|
||||
marginRight: 20
|
||||
}}>
|
||||
<Text style={{ color: 'white', fontSize: 18, fontWeight: 'bold', padding: 5 }}>{I18n.t('HELP')}</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
<View style={style.logoContaner}>
|
||||
<Image style={style.logo} source={require('./../../../datas/img/icon3.png')} />
|
||||
</View>
|
||||
<Animatable.View ref={this.handlePhoneRef}>
|
||||
<Sae
|
||||
label={this.state.stateLogin !== 1 ? I18n.t('PHONE_NUMBER') : I18n.t('PHONE_NUMBER_ADMIN')}
|
||||
iconClass={FontAwesomeIcon}
|
||||
iconName={'phone'}
|
||||
iconColor={'white'}
|
||||
keyboardType={"numeric"}
|
||||
enabled={this.state.phoneEnabled}
|
||||
style={style.input}
|
||||
autoCapitalize={'none'}
|
||||
autoCorrect={false}
|
||||
value={this.state.enterPhone}
|
||||
ref={(com) => { this.numberRef = com }}
|
||||
onChangeText={(text) => this.setState({ enterPhone: text })}
|
||||
labelStyle={style.labelInput}
|
||||
/>
|
||||
</Animatable.View>
|
||||
<Animatable.View ref={this.handlePasswordRef}>
|
||||
<Sae
|
||||
label={I18n.t('PASSWORD')}
|
||||
ref={component => { this._pass = component }}
|
||||
iconClass={FontAwesomeIcon}
|
||||
iconName={'lock'}
|
||||
style={style.input}
|
||||
iconColor={'white'}
|
||||
labelStyle={style.labelInput}
|
||||
autoCapitalize={'none'}
|
||||
secureTextEntry={true}
|
||||
onChangeText={(text) => this.setState({ password: text })}
|
||||
autoCorrect={false}
|
||||
/>
|
||||
</Animatable.View>
|
||||
}}>
|
||||
<View style={{
|
||||
alignSelf: 'flex-end',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: theme.primaryLight,
|
||||
height: 32,
|
||||
borderRadius: 12,
|
||||
marginTop: 30,
|
||||
marginRight: 20
|
||||
}}>
|
||||
<Text style={{
|
||||
color: 'white',
|
||||
fontSize: 18,
|
||||
fontWeight: 'bold',
|
||||
padding: 5
|
||||
}}>{I18n.t('HELP')}</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
<View style={style.logoContaner}>
|
||||
<Image style={style.logo} source={require('./../../../datas/img/icon3.png')}/>
|
||||
</View>
|
||||
<Animatable.View ref={this.handlePhoneRef}>
|
||||
<Sae
|
||||
label={this.state.stateLogin !== 1 ? I18n.t('PHONE_NUMBER') : I18n.t('PHONE_NUMBER_ADMIN')}
|
||||
iconClass={FontAwesomeIcon}
|
||||
iconName={'phone'}
|
||||
iconColor={'white'}
|
||||
keyboardType={"numeric"}
|
||||
enabled={this.state.phoneEnabled}
|
||||
style={style.input}
|
||||
autoCapitalize={'none'}
|
||||
autoCorrect={false}
|
||||
value={this.state.enterPhone}
|
||||
ref={(com) => {
|
||||
this.numberRef = com
|
||||
}}
|
||||
onChangeText={(text) => this.setState({enterPhone: text})}
|
||||
labelStyle={style.labelInput}
|
||||
/>
|
||||
</Animatable.View>
|
||||
<Animatable.View ref={this.handlePasswordRef}>
|
||||
<Sae
|
||||
label={I18n.t('PASSWORD')}
|
||||
ref={component => {
|
||||
this._pass = component
|
||||
}}
|
||||
iconClass={FontAwesomeIcon}
|
||||
iconName={'lock'}
|
||||
style={style.input}
|
||||
iconColor={'white'}
|
||||
labelStyle={style.labelInput}
|
||||
autoCapitalize={'none'}
|
||||
secureTextEntry={true}
|
||||
onChangeText={(text) => this.setState({password: text})}
|
||||
autoCorrect={false}
|
||||
/>
|
||||
</Animatable.View>
|
||||
|
||||
|
||||
<View style={separator.btnContainer}>
|
||||
<TouchableOpacity onPress={() => {
|
||||
this.gotoForgottenPass()
|
||||
}}>
|
||||
<Text style={style.lostpassword}>
|
||||
{I18n.t("FORGOTTEN_PASSWORD")}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
<View style={style.contentSwitch}>
|
||||
<SwitchSelector options={this.options}
|
||||
initial={0}
|
||||
buttonColor={theme.accentLight}
|
||||
backgroundColor={theme.primaryDark}
|
||||
textColor='white'
|
||||
bold={true}
|
||||
hasPadding
|
||||
height={32}
|
||||
style={style.switch}
|
||||
onPress={(value) => {
|
||||
this.StartBackgroundColorAnimation(value)
|
||||
}} />
|
||||
</View>
|
||||
<Button style={style.loginBtn1}
|
||||
isLoading={this.state.isLoging}
|
||||
onPress={() => { this.connectClicked() }}
|
||||
>
|
||||
<Text style={style.loginBtnText2}>{I18n.t("CONNECT_USER")}</Text>
|
||||
</Button>
|
||||
<View style={separator.container}>
|
||||
<View style={separator.line} />
|
||||
<Text style={separator.text}>{I18n.t("OR_BIG")}</Text>
|
||||
<View style={separator.line} />
|
||||
</View>
|
||||
<Button style={style.loginBtn}
|
||||
onPress={() => {
|
||||
this.gotoTypeCreated()
|
||||
}}
|
||||
>
|
||||
<Text style={style.loginBtnText}>{I18n.t("CREATE_ACCOUNT")} </Text>
|
||||
</Button>
|
||||
</View>
|
||||
<View style={separator.btnContainer}>
|
||||
<TouchableOpacity onPress={() => {
|
||||
this.gotoForgottenPass()
|
||||
}}>
|
||||
<Text style={style.lostpassword}>
|
||||
{I18n.t("FORGOTTEN_PASSWORD")}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
<View style={style.contentSwitch}>
|
||||
<SwitchSelector options={this.options}
|
||||
initial={0}
|
||||
buttonColor={theme.accentLight}
|
||||
backgroundColor={theme.primaryDark}
|
||||
textColor='white'
|
||||
bold={true}
|
||||
hasPadding
|
||||
height={32}
|
||||
style={style.switch}
|
||||
onPress={(value) => {
|
||||
this.StartBackgroundColorAnimation(value)
|
||||
}}/>
|
||||
</View>
|
||||
<Button style={style.loginBtn1}
|
||||
isLoading={this.state.isLoging}
|
||||
onPress={() => {
|
||||
this.connectClicked()
|
||||
}}
|
||||
>
|
||||
<Text style={style.loginBtnText2}>{I18n.t("CONNECT_USER")}</Text>
|
||||
</Button>
|
||||
<View style={separator.container}>
|
||||
<View style={separator.line}/>
|
||||
<Text style={separator.text}>{I18n.t("OR_BIG")}</Text>
|
||||
<View style={separator.line}/>
|
||||
</View>
|
||||
<Button style={style.loginBtn}
|
||||
onPress={() => {
|
||||
this.gotoTypeCreated()
|
||||
}}
|
||||
>
|
||||
<Text style={style.loginBtnText}>{I18n.t("CREATE_ACCOUNT")} </Text>
|
||||
</Button>
|
||||
</View>
|
||||
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
|
||||
</Animated.View>
|
||||
</Animated.View>
|
||||
|
||||
)
|
||||
}
|
||||
|
|
@ -507,38 +533,37 @@ export class LoginUi extends Component {
|
|||
|
||||
if (this.state.password === null || this.state.password === undefined || this.state.password.length < 3 || this.state.password.lenght < 3) {
|
||||
this.passRef.shake(800)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.setState(previousState => {
|
||||
return { isLoging: !previousState.isLoging };
|
||||
return {isLoging: !previousState.isLoging};
|
||||
})
|
||||
login(this.state.enterPhone, this.state.password, this.state.typeaccount).then((responseJson) => {
|
||||
console.warn(responseJson)
|
||||
|
||||
if (responseJson.success === 1) {
|
||||
this.setState(previousState => {
|
||||
return { isLoging: !previousState.isLoging };
|
||||
return {isLoging: !previousState.isLoging};
|
||||
})
|
||||
const user = responseJson;
|
||||
if (!user.error) {
|
||||
if (user.etat === "1" || user.etat === 1) {
|
||||
saveNewuser(user);
|
||||
this.setState({ user: user })
|
||||
this.setState({user: user})
|
||||
|
||||
Alert.alert(
|
||||
I18n.t("CONNEXION_SUCCESSFUL"),
|
||||
I18n.t("CONNEXION_SUCCESSFULL_TEXT"),
|
||||
[
|
||||
{
|
||||
text: 'Ok', onPress: () => {
|
||||
this.setState(previousState => {
|
||||
return { isLoging: !previousState.isLoging };
|
||||
})
|
||||
this.gotoHome()
|
||||
}
|
||||
}
|
||||
],
|
||||
{ cancelable: false }
|
||||
I18n.t("CONNEXION_SUCCESSFUL"),
|
||||
I18n.t("CONNEXION_SUCCESSFULL_TEXT"),
|
||||
[
|
||||
{
|
||||
text: 'Ok', onPress: () => {
|
||||
this.setState(previousState => {
|
||||
return {isLoging: !previousState.isLoging};
|
||||
})
|
||||
this.gotoHome()
|
||||
}
|
||||
}
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
} else {
|
||||
if (user.category !== 'super') {
|
||||
|
|
@ -550,12 +575,15 @@ export class LoginUi extends Component {
|
|||
} else {
|
||||
if (user.etat_demande === 0 || user.etat_demande === '0') {
|
||||
Alert.alert(
|
||||
I18n.t('DONT_VALIDATE_ACCOUNT'),
|
||||
I18n.t('UNVALIDATE_ACCOUNT_TEXT'),
|
||||
[
|
||||
{ text: 'Ok', onPress: () => { } }
|
||||
],
|
||||
{ cancelable: false }
|
||||
I18n.t('DONT_VALIDATE_ACCOUNT'),
|
||||
I18n.t('UNVALIDATE_ACCOUNT_TEXT'),
|
||||
[
|
||||
{
|
||||
text: 'Ok', onPress: () => {
|
||||
}
|
||||
}
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
} else {
|
||||
this.props.navigation.push(route.activateaccount, {
|
||||
|
|
@ -567,24 +595,32 @@ export class LoginUi extends Component {
|
|||
}
|
||||
} else {
|
||||
this.setState(previousState => {
|
||||
return { isLoging: !previousState.isLoging };
|
||||
return {isLoging: !previousState.isLoging};
|
||||
})
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{ text: I18n.t("NO"), onPress: () => { BackHandler.exitApp() } },
|
||||
{ text: I18n.t("YES"), onPress: () => { this.connectClicked() } }
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.connectClicked()
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{ cancelable: false }
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
}
|
||||
|
||||
} else if (responseJson === null) {
|
||||
this.setState(previousState => {
|
||||
return { isLoging: !previousState.isLoging };
|
||||
return {isLoging: !previousState.isLoging};
|
||||
})
|
||||
|
||||
} else {
|
||||
|
|
@ -616,38 +652,38 @@ export class LoginUi extends Component {
|
|||
|
||||
if (message === null) {
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.connectClicked()
|
||||
}
|
||||
}
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.connectClicked()
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{ cancelable: false }
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
} else {
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
message
|
||||
,
|
||||
[
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
message
|
||||
,
|
||||
[
|
||||
|
||||
{
|
||||
text: "OK", onPress: () => {
|
||||
}
|
||||
}
|
||||
{
|
||||
text: "OK", onPress: () => {
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{ cancelable: false }
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
this.setState(previousState => {
|
||||
return {
|
||||
|
|
@ -656,32 +692,41 @@ export class LoginUi extends Component {
|
|||
};
|
||||
})
|
||||
setTimeout(() => {
|
||||
this.setState({ snackVisible: false })
|
||||
this.setState({snackVisible: false})
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.setState(previousState => {
|
||||
return { isLoging: !previousState.isLoging };
|
||||
})
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{ text: I18n.t("NO"), onPress: () => { BackHandler.exitApp() } },
|
||||
{ text: I18n.t("YES"), onPress: () => { this.connectClicked() } }
|
||||
.catch((e) => {
|
||||
this.setState(previousState => {
|
||||
return {isLoging: !previousState.isLoging};
|
||||
})
|
||||
Alert.alert(
|
||||
I18n.t("UNABLE_TO_CONNECT_TITLE"),
|
||||
I18n.t('TEXT_NETWORK_UNABLE')
|
||||
,
|
||||
[
|
||||
{
|
||||
text: I18n.t("NO"), onPress: () => {
|
||||
BackHandler.exitApp()
|
||||
}
|
||||
},
|
||||
{
|
||||
text: I18n.t("YES"), onPress: () => {
|
||||
this.connectClicked()
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
{ cancelable: false }
|
||||
)
|
||||
],
|
||||
{cancelable: false}
|
||||
)
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const separator = StyleSheet.create({
|
||||
line: {
|
||||
height: 1.5,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import {
|
|||
StyleSheet,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
ActivityIndicator,
|
||||
View
|
||||
} from 'react-native';
|
||||
import DeviceInfo from 'react-native-device-info';
|
||||
|
|
@ -284,4 +285,4 @@ const styles = StyleSheet.create({
|
|||
marginRight: 10,
|
||||
alignItems: "center"
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -271,8 +271,7 @@ export default class OptionsMenu extends Component {
|
|||
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|
||||
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe'
|
||||
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|
||||
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser'
|
||||
|| item === 'acceptPrestationAgent' || item === 'souscrireAssuranceUser' || item === 'askPrestationUser') {
|
||||
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser') {
|
||||
return null
|
||||
} else {
|
||||
const color = this.state.currentId === item.id ? theme.accent : "grey"
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ import * as Utils from '../../utils/DeviceUtils';
|
|||
import {IlinkEmitter} from "../../utils/events";
|
||||
import {
|
||||
cutString,
|
||||
cutStringWithoutDot,
|
||||
cutStringWithoutDot, displayToast,
|
||||
displayTransactionType,
|
||||
isEmptyObject,
|
||||
isIlinkWorldWallet,
|
||||
optionDepotScreen,
|
||||
optionIdentificationScreen,
|
||||
optionNanoCreditAgentScreen, optionNanoSanteAgent, optionNanoSanteUser,
|
||||
optionNanoCreditAgentScreen,
|
||||
optionPaiementFacture,
|
||||
optionRetraitScreen,
|
||||
transactionHistoryIlinkLabel
|
||||
|
|
@ -1445,14 +1445,18 @@ class WalletDetail extends Component {
|
|||
<TouchableOpacity style={styles.contain}
|
||||
onPress={
|
||||
() => {
|
||||
this.props.navigation.push(route.walletOptionSelect, {
|
||||
optionSelect: optionNanoCreditAgentScreen,
|
||||
wallet,
|
||||
lottie: {
|
||||
source: require("./../../datas/json/cedit-cards.json"),
|
||||
loop: true
|
||||
}
|
||||
});
|
||||
if (wallet.has_nano_credit === 1) {
|
||||
this.props.navigation.push(route.walletOptionSelect, {
|
||||
optionSelect: optionNanoCreditAgentScreen,
|
||||
wallet,
|
||||
lottie: {
|
||||
source: require("./../../datas/json/cedit-cards.json"),
|
||||
loop: true
|
||||
}
|
||||
});
|
||||
} else {
|
||||
displayToast(I18n.t('NANO_CREDIT_DISABLE'));
|
||||
}
|
||||
}
|
||||
}
|
||||
activeOpacity={0.9}>
|
||||
|
|
@ -1478,14 +1482,6 @@ class WalletDetail extends Component {
|
|||
<View style={[styles.containerTouch]}>
|
||||
<TouchableOpacity style={styles.contain}
|
||||
onPress={() => {
|
||||
this.props.navigation.push(route.walletOptionSelect, {
|
||||
optionSelect: optionNanoSanteAgent,
|
||||
onGoBack: () => this.refresh(),
|
||||
lottie: {
|
||||
source: require("./../../datas/json/spend-healthies.json"),
|
||||
loop: true
|
||||
}
|
||||
})
|
||||
}}
|
||||
activeOpacity={0.9}>
|
||||
<Icon name='heart-multiple'
|
||||
|
|
@ -2040,4 +2036,4 @@ const styles = StyleSheet.create({
|
|||
contentTitle: {
|
||||
paddingTop: 5,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -44,17 +44,18 @@ import {connect} from 'react-redux';
|
|||
import {bindActionCreators} from 'redux';
|
||||
import {
|
||||
cutString,
|
||||
cutStringWithoutDot,
|
||||
cutStringWithoutDot, displayToast,
|
||||
isEmptyObject,
|
||||
optionDepotUserScreen,
|
||||
optionIdentificationUserScreen,
|
||||
optionLinkAccountUserScreen,
|
||||
optionNanoCreditScreen, optionNanoSanteUser,
|
||||
optionLinkAccountUserScreen, optionNanoCreditAgentScreen,
|
||||
optionNanoCreditScreen,
|
||||
optionPaiementFacture,
|
||||
optionRetraitUserScreen,
|
||||
transactionHistoryIlinkLabel
|
||||
} from '../../utils/UtilsFunction';
|
||||
import {readUser} from '../../webservice/AuthApi';
|
||||
import LottieView from "lottie-react-native";
|
||||
|
||||
let moment = require('moment-timezone');
|
||||
|
||||
|
|
@ -536,15 +537,19 @@ class WalletDetailUser extends Component {
|
|||
<TouchableOpacity style={styles.contain}
|
||||
onPress={
|
||||
() => {
|
||||
this.props.navigation.push(route.walletOptionSelect, {
|
||||
optionSelect: optionNanoCreditScreen,
|
||||
wallet,
|
||||
lottie: {
|
||||
source: require("./../../datas/json/cedit-cards.json"),
|
||||
loop: true
|
||||
},
|
||||
isNanoCredit: true
|
||||
});
|
||||
if (this.props.result.response.has_nano_credit === 1) {
|
||||
this.props.navigation.push(route.walletOptionSelect, {
|
||||
optionSelect: optionNanoCreditScreen,
|
||||
wallet,
|
||||
lottie: {
|
||||
source: require("./../../datas/json/cedit-cards.json"),
|
||||
loop: true
|
||||
},
|
||||
isNanoCredit: true
|
||||
});
|
||||
} else {
|
||||
displayToast(I18n.t('NANO_CREDIT_DISABLE'));
|
||||
}
|
||||
}
|
||||
}
|
||||
activeOpacity={0.9}>
|
||||
|
|
@ -574,26 +579,16 @@ class WalletDetailUser extends Component {
|
|||
<View style={[styles.containerTouch]}>
|
||||
<TouchableOpacity style={styles.contain}
|
||||
onPress={() => {
|
||||
this.props.navigation.push(route.walletOptionSelect, {
|
||||
optionSelect: optionNanoSanteUser,
|
||||
onGoBack: () => this.refresh(),
|
||||
lottie: {
|
||||
source: require("./../../datas/json/spend-healthies.json"),
|
||||
loop: true
|
||||
}
|
||||
})
|
||||
}}
|
||||
activeOpacity={0.9}>
|
||||
<Icon name='heart-multiple'
|
||||
color={Color.primaryColor}
|
||||
size={30}
|
||||
style={styles.imageBanner}/>
|
||||
|
||||
<View style={[styles.content]}>
|
||||
|
||||
<View style={{paddingTop: 20,}}>
|
||||
<Text
|
||||
style={[Typography.headline, Typography.semibold]}>
|
||||
<Text style={[Typography.headline, Typography.semibold]}>
|
||||
{I18n.t('NANO_SANTE')}
|
||||
</Text>
|
||||
</View>
|
||||
|
|
@ -983,7 +978,7 @@ class WalletDetailUser extends Component {
|
|||
|
||||
|
||||
render() {
|
||||
|
||||
console.warn("Wallet Detail user Props", this.props);
|
||||
return (
|
||||
<>
|
||||
{this.state.displayModalHistory && this.renderModalHistoryDetail()}
|
||||
|
|
@ -1006,8 +1001,17 @@ class WalletDetailUser extends Component {
|
|||
:
|
||||
|
||||
this.renderDetailWallet(this.props.result.response)
|
||||
:
|
||||
null
|
||||
: this.props.error !== null &&
|
||||
this.props.error.data !== null &&
|
||||
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
|
||||
<LottieView
|
||||
style={styles.lottie}
|
||||
source={require("./../../datas/json/no_wallet")}
|
||||
autoPlay={true}
|
||||
loop={false}
|
||||
/>
|
||||
<Text style={Typography.body1}>{this.props.error.data.error}</Text>
|
||||
</View>
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -1059,6 +1063,10 @@ const styles = StyleSheet.create({
|
|||
tabbar: {
|
||||
height: 40
|
||||
},
|
||||
lottie: {
|
||||
width: 248,
|
||||
height: 248
|
||||
},
|
||||
imgBanner: {
|
||||
width: '100%',
|
||||
height: 250,
|
||||
|
|
@ -1135,7 +1143,6 @@ const styles = StyleSheet.create({
|
|||
flexDirection: 'row',
|
||||
flex: 1,
|
||||
paddingTop: 10,
|
||||
paddingTop: 10,
|
||||
paddingLeft: 10,
|
||||
paddingRight: 10,
|
||||
},
|
||||
|
|
@ -1174,4 +1181,4 @@ const styles = StyleSheet.create({
|
|||
contentTitle: {
|
||||
paddingTop: 5,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -223,14 +223,6 @@ class WalletOptionSelect extends Component {
|
|||
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||
});
|
||||
break;
|
||||
case 'NANO_SANTE':
|
||||
console.log("Option param", optionsParam);
|
||||
this.props.navigation.push(optionsParam.screen, {
|
||||
wallet: this.state.wallet,
|
||||
optionSelect: optionsParam.subScreenOption,
|
||||
onGoBack: () => this.props.navigation.state.params.onGoBack(),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
this.props.navigation.push(optionsParam.screen);
|
||||
break;
|
||||
|
|
@ -282,7 +274,7 @@ class WalletOptionSelect extends Component {
|
|||
displayToast(I18n.t('ALREADY_IDENTIFIED'));
|
||||
else
|
||||
this.redirectToRoute(options);
|
||||
} else if (_.isEqual(options.screen, 'modifyIdentificationUser') || _.isEqual(options.screen, 'askPrestationUser')) {
|
||||
} else if (_.isEqual(options.screen, 'modifyIdentificationUser')) {
|
||||
if (!this.state.isIdentified)
|
||||
displayToast(I18n.t('NOT_YET_IDENTIFY'));
|
||||
else
|
||||
|
|
@ -1168,4 +1160,4 @@ const styles = StyleSheet.create({
|
|||
},
|
||||
tagFollow: {width: 150, margin: 10},
|
||||
|
||||
});
|
||||
});
|
||||
|
|
@ -790,85 +790,4 @@ export const optionPaiementFacture = {
|
|||
subScreenOption: optionPaiementAbonnementTV
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
export const operateurAssureurUser = [
|
||||
{
|
||||
type: 'PAIEMENT_EAU',
|
||||
screen: route.paiementFacture,
|
||||
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
||||
title: 'Assureur 1',
|
||||
amount: "10 000 FCFA"
|
||||
},
|
||||
{
|
||||
type: 'PAIEMENT_EAU',
|
||||
screen: route.paiementFacture,
|
||||
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
||||
title: 'Assureur 2',
|
||||
amount: "20 000 FCFA"
|
||||
},
|
||||
{
|
||||
type: 'PAIEMENT_EAU',
|
||||
screen: route.paiementFacture,
|
||||
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
||||
title: 'Assureur 3',
|
||||
amount: "30 000 FCFA"
|
||||
},
|
||||
{
|
||||
type: 'PAIEMENT_EAU',
|
||||
screen: route.paiementFacture,
|
||||
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
||||
title: 'Assureur 4',
|
||||
amount: "40 000 FCFA"
|
||||
},
|
||||
{
|
||||
type: 'PAIEMENT_EAU',
|
||||
screen: route.paiementFacture,
|
||||
icon: 'http://test.ilink-app.com:8080/mobilebackend/datas/img/network/ilink-world-logo.png',
|
||||
title: 'Assureur 5',
|
||||
amount: "50 000 FCFA"
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
export const optionNanoSanteUser = {
|
||||
type: 'NANO_SANTE',
|
||||
title: 'NANO_SANTE',
|
||||
subTitle: 'CHOOSE_OPTION',
|
||||
options: [
|
||||
{
|
||||
type: 'FACTURE_WATER_ELECTRICITY',
|
||||
icon: 'heart-pulse',
|
||||
title: 'SOUSCRIRE_ASSURANCE',
|
||||
screen: route.souscrireAssuranceUser,
|
||||
subScreenOption: operateurAssureurUser
|
||||
},
|
||||
{
|
||||
type: 'FACTURE_ELECTRICITY',
|
||||
icon: 'note-plus',
|
||||
title: 'DEMANDER_PRESTATION',
|
||||
screen: route.askPrestationUser,
|
||||
subScreenOption: operateurAssureurUser
|
||||
},
|
||||
{
|
||||
type: 'FACTURE_SCHOOL',
|
||||
icon: 'cash',
|
||||
title: 'PAYER_ASSURANCE',
|
||||
screen: "",
|
||||
subScreenOption: operateurAssureurUser
|
||||
}
|
||||
]
|
||||
}
|
||||
export const optionNanoSanteAgent = {
|
||||
type: 'NANO_SANTE',
|
||||
title: 'NANO_SANTE',
|
||||
subTitle: 'CHOOSE_OPTION',
|
||||
options: [
|
||||
{
|
||||
type: 'FACTURE_WATER_ELECTRICITY',
|
||||
icon: 'check-circle',
|
||||
title: 'ACCEPTER_PRESTATION',
|
||||
screen: route.acceptPrestationAgent
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -164,6 +164,7 @@
|
|||
"DEPOSIT_TO_BANK": "Your Wallet to bank",
|
||||
"NANO_CREDIT": "Nano credit",
|
||||
"NANO_CREDIT_LIST": "Nano credit list",
|
||||
"NANO_CREDIT_DISABLE": "Nano credit disable",
|
||||
"SAVINGS_LIST": "Savings list",
|
||||
"NO_NANO_CREDIT": "No nano credit demand",
|
||||
"NO_SAVINGS": "No savings",
|
||||
|
|
@ -337,6 +338,9 @@
|
|||
"SUCCESS_IDENTIFICATION": "Identification successful",
|
||||
"REFUSER_DEMANDE": "Reject the request",
|
||||
"ACCEPTER_DEMANDE": "Accept the request",
|
||||
"DEMAND_STATE": "Demand state",
|
||||
"CANCEL_ON": "Cancel on",
|
||||
"CANCEL_BY_HYPERVISOR": "Cancel by hypervisor",
|
||||
"REFUSED": "Refuse",
|
||||
"YOUR_THERE": "You are here",
|
||||
"SUCCESS_TRANSFER_COMMISSION": "Transfert effectué",
|
||||
|
|
@ -555,10 +559,5 @@
|
|||
"UNABLE_GET_INFORMATION_TEXT": "Make sure your GPS is turned on and put in high precision mode and restart iLink World",
|
||||
"TITLE_HELP_SOON": "Help not available!",
|
||||
"YOUR_NETWORK": "Select your network",
|
||||
"HELP_SOON": "A tutorial helping you in understanding the features of the application will soon be available.",
|
||||
"ACCEPTER_PRESTATION": "Accept a service",
|
||||
"SOUSCRIRE_ASSURANCE": "Take out insurance",
|
||||
"DEMANDER_PRESTATION": "Request a service",
|
||||
"PAYER_ASSURANCE": "Pay an insurance",
|
||||
"INSURANCE_LIST": "Insurance list"
|
||||
"HELP_SOON": "A tutorial helping you in understanding the features of the application will soon be available."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@
|
|||
"DEPOSIT_TO_BANK": "Wallet vers banque",
|
||||
"NANO_CREDIT": "Nano crédit",
|
||||
"NANO_CREDIT_LIST": "Liste des nano crédit",
|
||||
"NANO_CREDIT_DISABLE": "Nano crédit désactivé",
|
||||
"SAVINGS_LIST": "Liste des épargnes",
|
||||
"NO_NANO_CREDIT": "Aucune demande de nano crédit",
|
||||
"NO_SAVINGS": "Aucune épargne",
|
||||
|
|
@ -345,6 +346,9 @@
|
|||
"REFUSER_DEMANDE": "Refuser la demande",
|
||||
"REFUSED": "Refusé",
|
||||
"ACCEPTER_DEMANDE": "Accepter la demande",
|
||||
"DEMAND_STATE": "Etat de la demande",
|
||||
"CANCEL_ON": "Annulé le",
|
||||
"CANCEL_BY_HYPERVISOR": "Annuler par l'hyperviseur",
|
||||
"SUCCESS_TRANSFER_COMMISSION": "Transfert de commission",
|
||||
"YOUR_THERE": "Vous êtes ici",
|
||||
"FILTER": "Filtrer",
|
||||
|
|
@ -558,10 +562,5 @@
|
|||
"UNABLE_GET_INFORMATION_TEXT": "Vérifiez que votre GPS est activé et mis en mode haute precision et relancez iLink World",
|
||||
"TITLE_HELP_SOON": "Aide non disponible !",
|
||||
"YOUR_NETWORK": "Sélectionner votre réseau",
|
||||
"HELP_SOON": "Un tutoriel vous aidant dans la compréhension des fonctionnalités de l'application vous sera bientôt mis à disposition.",
|
||||
"ACCEPTER_PRESTATION": "Accepter une prestation",
|
||||
"SOUSCRIRE_ASSURANCE": "Souscrire à une assurance",
|
||||
"DEMANDER_PRESTATION": "Demander une prestation",
|
||||
"PAYER_ASSURANCE": "Payer une assurance",
|
||||
"INSURANCE_LIST": "Liste des assureurs"
|
||||
"HELP_SOON": "Un tutoriel vous aidant dans la compréhension des fonctionnalités de l'application vous sera bientôt mis à disposition."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,255 +1,314 @@
|
|||
import React, { Component } from 'react';
|
||||
var DBEvents = require('react-native-db-models').DBEvents;
|
||||
import React from 'react';
|
||||
import axios from "axios";
|
||||
import I18n from 'react-native-i18n'
|
||||
import { db } from './persistences/db';
|
||||
import { configActionUrl, isDebugMode, adhesionUrl, locationActionUrl, memberActionUrl, networkActionUrl, demandeActionUrl } from "./IlinkConstants"
|
||||
import {db} from './persistences/db';
|
||||
import {
|
||||
adhesionUrl,
|
||||
configActionUrl,
|
||||
isDebugMode,
|
||||
locationActionUrl,
|
||||
memberActionUrl,
|
||||
networkActionUrl
|
||||
} from "./IlinkConstants"
|
||||
|
||||
|
||||
import Configuration from './persistences/Configuration';
|
||||
var DBEvents = require('react-native-db-models').DBEvents;
|
||||
var serializeJSON = function (data) {
|
||||
|
||||
return Object.keys(data).map(function (keyName) {
|
||||
return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
|
||||
}).join('&');
|
||||
return Object.keys(data).map(function (keyName) {
|
||||
return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
|
||||
}).join('&');
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const getCodeInformation = (code) => {
|
||||
var data = {
|
||||
"tag": 'member', "type": "agen_info_code", "code": code,
|
||||
"lang": I18n.currentLocale()
|
||||
};
|
||||
var data = {
|
||||
"tag": 'member', "type": "agen_info_code", "code": code,
|
||||
"lang": I18n.currentLocale()
|
||||
};
|
||||
|
||||
return queryData(data, memberActionUrl)
|
||||
return queryData(data, memberActionUrl)
|
||||
}
|
||||
export const getPubActiveObject = (idcpuntry) => {
|
||||
return queryData({ "tag": "get_pub", "id_country": idcpuntry }, configActionUrl);
|
||||
return queryData({"tag": "get_pub", "id_country": idcpuntry}, configActionUrl);
|
||||
|
||||
}
|
||||
export const getPasObject = () => {
|
||||
return queryData({ "tag": "get_pas" }, configActionUrl);
|
||||
return queryData({"tag": "get_pas"}, configActionUrl);
|
||||
}
|
||||
|
||||
function queryAuth(data) {
|
||||
return timeout(50000, queryData(data, adhesionUrl))
|
||||
return timeout(50000, queryData(data, adhesionUrl))
|
||||
}
|
||||
|
||||
async function queryData(data, url) {
|
||||
console.warn("REQUEST BODY", JSON.stringify(data));
|
||||
data["lang"] = I18n.currentLocale();
|
||||
data["isTest"] = isDebugMode
|
||||
let response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
let responseJson = null;
|
||||
let responseText = await response.text()
|
||||
try {
|
||||
console.warn("SERVER RESPONSE SUCCESS",responseText);
|
||||
responseJson = JSON.parse(responseText)
|
||||
} catch (e) {
|
||||
console.warn("SERVER RESPONSE ERROR",responseText);
|
||||
return { "error": "error", "error_msg": responseText }
|
||||
}
|
||||
return responseJson;
|
||||
console.warn("REQUEST URL", url);
|
||||
console.warn("REQUEST BODY", JSON.stringify(data));
|
||||
data["lang"] = I18n.currentLocale();
|
||||
data["isTest"] = isDebugMode
|
||||
/* await axios({
|
||||
url,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: JSON.stringify(data),
|
||||
}).then(serverResponse => {
|
||||
console.warn("SERVER RESPONSE SUCCESS", serverResponse);
|
||||
return serverResponse.data;
|
||||
}).catch(error => {
|
||||
console.warn("SERVER RESPONSE ERROR", error);
|
||||
return {"error": "error", "error_msg": error}
|
||||
});*/
|
||||
|
||||
let response = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
let responseJson = null;
|
||||
let responseText = await response.text()
|
||||
try {
|
||||
console.warn("SERVER RESPONSE SUCCESS", responseText);
|
||||
responseJson = JSON.parse(responseText)
|
||||
} catch (e) {
|
||||
console.warn("SERVER RESPONSE ERROR", responseText);
|
||||
return {"error": "error", "error_msg": responseText}
|
||||
}
|
||||
return responseJson;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function timeout(ms, promise) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
|
||||
}, ms)
|
||||
promise.then(resolve, reject)
|
||||
})
|
||||
return new Promise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
|
||||
}, ms)
|
||||
promise.then(resolve, reject)
|
||||
})
|
||||
}
|
||||
|
||||
export const validateUser = (user) => {
|
||||
var data = {
|
||||
"tag": 'member', "type": "valider_simple", "phone": user.phone,
|
||||
"lang": I18n.currentLocale()
|
||||
};
|
||||
return queryData(data, memberActionUrl)
|
||||
var data = {
|
||||
"tag": 'member', "type": "valider_simple", "phone": user.phone,
|
||||
"lang": I18n.currentLocale()
|
||||
};
|
||||
return queryData(data, memberActionUrl)
|
||||
};
|
||||
export const updatePosition = async (longitude, latitude) => {
|
||||
const user = await readUser()
|
||||
const data = { 'tag': 'member', 'type': 'update_position', "agentId": user['agentId'], "longitude": longitude, latitude: latitude }
|
||||
return queryData(data, memberActionUrl)
|
||||
const user = await readUser()
|
||||
const data = {
|
||||
'tag': 'member',
|
||||
'type': 'update_position',
|
||||
"agentId": user['agentId'],
|
||||
"longitude": longitude,
|
||||
latitude: latitude
|
||||
}
|
||||
return queryData(data, memberActionUrl)
|
||||
}
|
||||
export const valifateAgent = (user, info) => {
|
||||
var data = info;
|
||||
if (data === null) data = {}
|
||||
data["tag"] = "member";
|
||||
data['type'] = "validate_agent";
|
||||
data["phone"] = user.phone;
|
||||
data['code_validation'] = user.validation_code;
|
||||
if (user.category === "super" && (info === null || (info !== null && (info.nbre_code === undefined || info.nbr_code === null)))) {
|
||||
data["nbre_code"] = 10;
|
||||
data["nbre_code_superviseur"] = 0
|
||||
} else if (info === null || (info !== null && (info.nbre_code === undefined || info.nbre_code === null))) {
|
||||
data["nbre_code"] = 0;
|
||||
data["nbre_code_superviseur"] = 0
|
||||
}
|
||||
console.log(data);
|
||||
var data = info;
|
||||
if (data === null) data = {}
|
||||
data["tag"] = "member";
|
||||
data['type'] = "validate_agent";
|
||||
data["phone"] = user.phone;
|
||||
data['code_validation'] = user.validation_code;
|
||||
if (user.category === "super" && (info === null || (info !== null && (info.nbre_code === undefined || info.nbr_code === null)))) {
|
||||
data["nbre_code"] = 10;
|
||||
data["nbre_code_superviseur"] = 0
|
||||
} else if (info === null || (info !== null && (info.nbre_code === undefined || info.nbre_code === null))) {
|
||||
data["nbre_code"] = 0;
|
||||
data["nbre_code_superviseur"] = 0
|
||||
}
|
||||
console.log(data);
|
||||
|
||||
return queryData(data, memberActionUrl)
|
||||
return queryData(data, memberActionUrl)
|
||||
}
|
||||
|
||||
export const disconnect = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
readBrutUser().then((user) => {
|
||||
db.remove({ "_id": user._id }, { multi: true }, (error, numRemoved) => {
|
||||
if (error !== null) {
|
||||
reject(error)
|
||||
} else {
|
||||
console.log(numRemoved)
|
||||
if (numRemoved > 0) {
|
||||
resolve()
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
readBrutUser().then((user) => {
|
||||
db.remove({"_id": user._id}, {multi: true}, (error, numRemoved) => {
|
||||
if (error !== null) {
|
||||
reject(error)
|
||||
} else {
|
||||
console.log(numRemoved)
|
||||
if (numRemoved > 0) {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const login = (phone: String, password: String, type: Number) => {
|
||||
console.log("CURRENT_LANG", I18n.currentLocale());
|
||||
var data = {
|
||||
tag: type === 0 ? "login_user" : "login_agent",
|
||||
phone: phone,
|
||||
password: password,
|
||||
lang: I18n.currentLocale()
|
||||
};
|
||||
console.log("CURRENT_LANG", I18n.currentLocale());
|
||||
var data = {
|
||||
tag: type === 0 ? "login_user" : "login_agent",
|
||||
phone: phone,
|
||||
password: password,
|
||||
lang: I18n.currentLocale()
|
||||
};
|
||||
|
||||
return queryAuth(data);
|
||||
return queryAuth(data);
|
||||
};
|
||||
|
||||
export const reinitpassword = ($phone, $type) => {
|
||||
var data = { "tag": "forgot_pass", "number": $phone, "typeaccount": $type, "lang": I18n.currentLocale() };
|
||||
return queryAuth(data)
|
||||
var data = {"tag": "forgot_pass", "number": $phone, "typeaccount": $type, "lang": I18n.currentLocale()};
|
||||
return queryAuth(data)
|
||||
}
|
||||
export const updateUserData = async (data) => {
|
||||
const user = await readUser()
|
||||
user.longitude = data.longitude
|
||||
user.latitude = data.latitude
|
||||
db.update({ "user": { $exists: true } }, { user: user }, {}, function (err, numReplaced) {
|
||||
console.warn(err, numReplaced)
|
||||
})
|
||||
/* new Promise((resolve,reject)=>{
|
||||
readBrutUser().then((user)=>{
|
||||
db.remove({"_id": user._id},{multi:true},(error,numRemoved)=>{
|
||||
if(error!==null){
|
||||
reject(error)
|
||||
}else {
|
||||
let muser=user
|
||||
|
||||
db.insert(muser, function(err){
|
||||
if(err!==null) {
|
||||
console.log("error when save user")
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
console.log(numRemoved)
|
||||
if (numRemoved > 0) {
|
||||
resolve()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})*/
|
||||
const user = await readUser()
|
||||
user.longitude = data.longitude
|
||||
user.latitude = data.latitude
|
||||
db.update({"user": {$exists: true}}, {user: user}, {}, function (err, numReplaced) {
|
||||
console.warn(err, numReplaced)
|
||||
})
|
||||
/* new Promise((resolve,reject)=>{
|
||||
readBrutUser().then((user)=>{
|
||||
db.remove({"_id": user._id},{multi:true},(error,numRemoved)=>{
|
||||
if(error!==null){
|
||||
reject(error)
|
||||
}else {
|
||||
let muser=user
|
||||
|
||||
db.insert(muser, function(err){
|
||||
if(err!==null) {
|
||||
console.log("error when save user")
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
console.log(numRemoved)
|
||||
if (numRemoved > 0) {
|
||||
resolve()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})*/
|
||||
|
||||
}
|
||||
export const saveNewuser = (muser) => {
|
||||
let user = {
|
||||
user: muser
|
||||
}
|
||||
db.insert(user, function (err) {
|
||||
if (err !== null) {
|
||||
console.log("error when save user")
|
||||
console.log(err)
|
||||
}
|
||||
let user = {
|
||||
user: muser
|
||||
}
|
||||
db.insert(user, function (err) {
|
||||
if (err !== null) {
|
||||
console.log("error when save user")
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const readBrutUser = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
db.findOne({ "user": { $exists: true } }, (err, result) => {
|
||||
if (err !== null || result === null || result.user === undefined) {
|
||||
return new Promise((resolve, reject) => {
|
||||
db.findOne({"user": {$exists: true}}, (err, result) => {
|
||||
if (err !== null || result === null || result.user === undefined) {
|
||||
resolve(null)
|
||||
} else {
|
||||
if (result.user === null) {
|
||||
resolve(null)
|
||||
} else {
|
||||
if (result.user === null) { resolve(null) }
|
||||
else
|
||||
resolve(result)
|
||||
};
|
||||
})
|
||||
});
|
||||
} else
|
||||
resolve(result)
|
||||
}
|
||||
;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export const readUser = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
db.findOne({ "user": { $exists: true } }, async (err, result) => {
|
||||
if (err !== null || result === null || result.user === undefined) {
|
||||
return new Promise((resolve, reject) => {
|
||||
db.findOne({"user": {$exists: true}}, async (err, result) => {
|
||||
if (err !== null || result === null || result.user === undefined) {
|
||||
resolve(null)
|
||||
} else {
|
||||
if (result.user === null) {
|
||||
resolve(null)
|
||||
} else {
|
||||
if (result.user === null) {
|
||||
resolve(null)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
|
||||
resolve(result.user)
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
resolve(result.user)
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export const createGeolocatedAccount = (user) => {
|
||||
|
||||
return queryData(user, memberActionUrl)
|
||||
return queryData(user, memberActionUrl)
|
||||
}
|
||||
export const createUserAccount = (user) => {
|
||||
return queryData(user, memberActionUrl)
|
||||
return queryData(user, memberActionUrl)
|
||||
}
|
||||
|
||||
export const acceptDemandAdhesion = (data) => {
|
||||
return queryData({ "tag": "member", "type": "activeSupervisor", "code": data.code_membre, "phone": data.phone }, memberActionUrl)
|
||||
return queryData({
|
||||
"tag": "member",
|
||||
"type": "activeSupervisor",
|
||||
"code": data.code_membre,
|
||||
"phone": data.phone
|
||||
}, memberActionUrl)
|
||||
}
|
||||
export const deleteUser = async (data) => {
|
||||
return queryData({ "tag": "member", "type": "deleteAgent", "code": data.code_membre, "phone": data.phone }, memberActionUrl)
|
||||
return queryData({
|
||||
"tag": "member",
|
||||
"type": "deleteAgent",
|
||||
"code": data.code_membre,
|
||||
"phone": data.phone
|
||||
}, memberActionUrl)
|
||||
}
|
||||
export const listDemandAdhesion = async () => {
|
||||
const user = await readUser();
|
||||
const items = await queryData({ "type": "list_demande_adhesion", "tag": "member", "codeparrain": user.code_membre }, memberActionUrl)
|
||||
return items;
|
||||
const user = await readUser();
|
||||
const items = await queryData({
|
||||
"type": "list_demande_adhesion",
|
||||
"tag": "member",
|
||||
"codeparrain": user.code_membre
|
||||
}, memberActionUrl)
|
||||
return items;
|
||||
}
|
||||
export const categoryChild = async (code) => {
|
||||
const codes = await queryData({ "type": "get_category_child", "tag": "member", "codeparrain": code }, memberActionUrl)
|
||||
const codes = await queryData({"type": "get_category_child", "tag": "member", "codeparrain": code}, memberActionUrl)
|
||||
|
||||
return codes;
|
||||
return codes;
|
||||
}
|
||||
export const getListCountriesActive = async () => {
|
||||
const countries = await queryData({ "tag": "avail_countries" }, networkActionUrl);
|
||||
return countries;
|
||||
const countries = await queryData({"tag": "avail_countries"}, networkActionUrl);
|
||||
return countries;
|
||||
|
||||
}
|
||||
export const getCountryNetwork = (country) => {
|
||||
console.warn(country)
|
||||
return queryData({ "tag": 'listnetworkscountryindicatif', 'indicatif': country }, networkActionUrl)
|
||||
console.warn(country)
|
||||
return queryData({"tag": 'listnetworkscountryindicatif', 'indicatif': country}, networkActionUrl)
|
||||
}
|
||||
export const getTownInformationName = (town) => {
|
||||
return queryData({ "tag": "town_information_name", "name": town }, locationActionUrl);
|
||||
return queryData({"tag": "town_information_name", "name": town}, locationActionUrl);
|
||||
}
|
||||
export const generateAgentGeo = async (newPhone) => {
|
||||
const user = await readUser();
|
||||
const items = await queryData({ "type": "generateNetworkAgentForGeo", "tag": "member", "code_parrain": user.code_membre, 'phone': newPhone }, memberActionUrl)
|
||||
return items;
|
||||
const user = await readUser();
|
||||
const items = await queryData({
|
||||
"type": "generateNetworkAgentForGeo",
|
||||
"tag": "member",
|
||||
"code_parrain": user.code_membre,
|
||||
'phone': newPhone
|
||||
}, memberActionUrl)
|
||||
return items;
|
||||
}
|
||||
export const AssignAgentGeo = async (codeValidation, phone) => {
|
||||
const user = await readUser();
|
||||
const items = await queryData({ "type": "assignNetworkAgentToGeo", "tag": "member", "agentId": user.agentId, 'code_parrain': codeValidation, "phone": phone }, memberActionUrl)
|
||||
return items;
|
||||
const user = await readUser();
|
||||
const items = await queryData({
|
||||
"type": "assignNetworkAgentToGeo",
|
||||
"tag": "member",
|
||||
"agentId": user.agentId,
|
||||
'code_parrain': codeValidation,
|
||||
"phone": phone
|
||||
}, memberActionUrl)
|
||||
return items;
|
||||
}
|
||||
|
|
@ -10,11 +10,6 @@ export const isDebugMode = false
|
|||
export const baseUrl = "http://test.ilink-app.com:8080/mobilebackend";
|
||||
export const testBaseUrl = "https://test.ilink-app.com";
|
||||
|
||||
/*
|
||||
export const baseUrl = " http://ilink-app.com:8082/mobilebackend";
|
||||
export const testBaseUrl = "http://ilink-app.com:8080";
|
||||
*/
|
||||
|
||||
/* export const baseUrl = "https://preprod.ilink-app.com:8080/mobilebackend";
|
||||
export const testBaseUrl = "https://preprod.ilink-app.com"; */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,93 +1,99 @@
|
|||
import React, {Component} from 'react';
|
||||
|
||||
import React, { Component } from 'react';
|
||||
var db = require('./persistences/db.js');
|
||||
import I18n from 'react-native-i18n'
|
||||
import { readUser } from './AuthApi'
|
||||
import { isDebugMode, MARKER_URL } from "./IlinkConstants";
|
||||
import {readUser} from './AuthApi'
|
||||
import {isDebugMode, MARKER_URL} from "./IlinkConstants";
|
||||
|
||||
let GEOCODDING_URL = "https://maps.googleapis.com/maps/api/geocode/json"
|
||||
let API_KEY = "AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI"
|
||||
let GEOCODDING_URL = "https://ilink-app.com:8080/geocode";
|
||||
let API_KEY = "AIzaSyBUQoQYY31-S3DPp7aRRIAjEda8T2pZvJE"
|
||||
export const getLocalMarkers = () => {
|
||||
return db.markers.get_all()
|
||||
return db.markers.get_all()
|
||||
}
|
||||
export const getMakersFrom = function (country) {
|
||||
let tag = { tag: 'location', type: 'all', country: country }
|
||||
return timeout(15000, queryMap(tag))
|
||||
let tag = {tag: 'location', type: 'all', country: country}
|
||||
return timeout(15000, queryMap(tag))
|
||||
}
|
||||
|
||||
function timeout(ms, promise) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
|
||||
}, ms)
|
||||
promise.then(resolve, reject)
|
||||
})
|
||||
return new Promise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
|
||||
}, ms)
|
||||
promise.then(resolve, reject)
|
||||
})
|
||||
}
|
||||
|
||||
export const loadMarkers = (position, reseau, distance, page) => {
|
||||
return readUser().then((users) => {
|
||||
let user = users;
|
||||
if (user !== undefined) {
|
||||
let tag = {
|
||||
tag: 'location', type: 'around',
|
||||
page: page,
|
||||
id: user.id, position: position, network: reseau, distance: distance
|
||||
}
|
||||
return queryMap(tag)
|
||||
}
|
||||
})
|
||||
return readUser().then((users) => {
|
||||
let user = users;
|
||||
if (user !== undefined) {
|
||||
let tag = {
|
||||
tag: 'location', type: 'around',
|
||||
page: page,
|
||||
id: user.id, position: position, network: reseau, distance: distance
|
||||
}
|
||||
return queryMap(tag)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
export const loadGroupeAgent = (member_code) => {
|
||||
let data = { tag: 'location', type: 'all_network', codeparrain: member_code }
|
||||
return queryMap(data)
|
||||
let data = {tag: 'location', type: 'all_network', codeparrain: member_code}
|
||||
return queryMap(data)
|
||||
}
|
||||
export const loadNetwork = (network, userid) => {
|
||||
let data = { tag: 'location', type: "all_network_point", id: userid, network: network }
|
||||
return queryMap(data)
|
||||
let data = {tag: 'location', type: "all_network_point", id: userid, network: network}
|
||||
return queryMap(data)
|
||||
}
|
||||
export const getPositionInformation = async (position) => {
|
||||
let url = GEOCODDING_URL.concat('?latlng=' + position.latitude + "," + position.longitude + '&key=' + API_KEY);
|
||||
const data = fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) =>
|
||||
responseJson
|
||||
).catch((error) => {
|
||||
console.log("error get position")
|
||||
console.log(error)
|
||||
});
|
||||
let url = GEOCODDING_URL.concat('?latitude=' + position.latitude + "&longitude=" + position.longitude);
|
||||
const data = fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) =>
|
||||
responseJson
|
||||
).catch((error) => {
|
||||
console.log("error get position")
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
console.warn("freud", data);
|
||||
return data;
|
||||
console.warn("freud", data);
|
||||
return data;
|
||||
}
|
||||
const queryMap = async (data) => {
|
||||
data['lang'] = I18n.currentLocale()
|
||||
data["test"] = isDebugMode
|
||||
let response = await fetch(MARKER_URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
data['lang'] = I18n.currentLocale()
|
||||
data["test"] = isDebugMode;
|
||||
console.warn("REQUEST URL QUERY MAP", MARKER_URL);
|
||||
console.warn("REQUEST BODY QUERY MAP", JSON.stringify(data));
|
||||
let response = await fetch(MARKER_URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
|
||||
});
|
||||
let responseText = await response.text()
|
||||
//console.log("response= " + responseText)
|
||||
try {
|
||||
let responseJson = JSON.parse(responseText);
|
||||
console.warn("JSON RESPONSE", responseJson);
|
||||
return responseJson;
|
||||
} catch (e) {
|
||||
//console.log("erreur=" + responseText)
|
||||
//console.log(response)
|
||||
throw new Error("Erreur lors de la conversion en json")
|
||||
}
|
||||
throw new Error("Erreur lors de la conversion en json")
|
||||
});
|
||||
let responseText = await response.text()
|
||||
//console.log("response= " + responseText)
|
||||
try {
|
||||
let responseJson = JSON.parse(responseText);
|
||||
console.warn("JSON RESPONSE", responseJson);
|
||||
console.warn("SERVER RESPONSE SUCCESS", responseText);
|
||||
return responseJson;
|
||||
} catch (e) {
|
||||
//console.log("erreur=" + responseText)
|
||||
//console.log(response);
|
||||
console.warn("SERVER RESPONSE ERROR", responseText);
|
||||
throw new Error("Erreur lors de la conversion en json")
|
||||
}
|
||||
throw new Error("Erreur lors de la conversion en json")
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import axios from "axios";
|
|||
import I18n from 'react-native-i18n'
|
||||
|
||||
export const getWalletActivated = (userID) => {
|
||||
|
||||
console.log("URL REQUEST", `${walletActionUrl}/${userID}/activated`);
|
||||
const auth = store.getState().authKeyReducer;
|
||||
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
const Realm = require('realm');
|
||||
let geolib = require("geolib")
|
||||
|
||||
import GeolocatedPoint from './../../model/GeolocatedPoint'
|
||||
import Network from './../../model/Network'
|
||||
import {getLocalMarkers} from '../MapService';
|
||||
|
||||
GeolocatedPointSchema = {
|
||||
name: "GeolocatedPoint",
|
||||
properties: {
|
||||
id: 'int',
|
||||
firstname: 'string?',
|
||||
lastname: 'string',
|
||||
adresse: 'string',
|
||||
longitude: 'float',
|
||||
latitude: 'float',
|
||||
phone: 'string?',
|
||||
solde: 'int',
|
||||
country: 'string',
|
||||
category: 'string',
|
||||
email: 'string',
|
||||
etat: 'int',
|
||||
code_parrain: 'string',
|
||||
code_dial: 'string',
|
||||
network_id: 'int',
|
||||
transactionNumber: 'string?',
|
||||
code_membre: 'string',
|
||||
network: 'string'
|
||||
}
|
||||
}
|
||||
export default class MarkerManager {
|
||||
realm
|
||||
|
||||
constructor() {
|
||||
this.realm = new Realm({schema: [GeolocatedPointSchema]})
|
||||
}
|
||||
|
||||
getLocalMarkers() {
|
||||
return this.realm.objects('GeolocatedPoint').slice(0, 3);
|
||||
}
|
||||
|
||||
async getLocalMarkersFromDistance(distance: 5, location) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let points = getLocalMarkers();
|
||||
return points.filter((mark, index) => {
|
||||
const position = {longitude: parseFloat(mark.longitude), latitude: parseFloat(mark.latitude)}
|
||||
return geolib.getDistance(position, location) <= (distance * 1000)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
close() {
|
||||
this.realm.close();
|
||||
}
|
||||
|
||||
async insertMarkers(markers: Array<any>) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var count = 0
|
||||
let rejet = []
|
||||
markers.forEach((value, index) => {
|
||||
try {
|
||||
|
||||
this.realm.write(() => {
|
||||
this.realm.create('GeolocatedPoint', value);
|
||||
});
|
||||
count++
|
||||
} catch (e) {
|
||||
console.log("Error on creation");
|
||||
reject(e)
|
||||
rejet.push(value)
|
||||
}
|
||||
})
|
||||
|
||||
resolve({row: count, total: markers.length, rejet: rejet})
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue