solve problem of filter by pas

This commit is contained in:
bricezele 2021-05-24 12:11:55 +01:00
parent e6a51feb48
commit ccd2f087c0
31 changed files with 2994 additions and 2450 deletions

15
App.js
View File

@ -83,9 +83,6 @@ import CasserEpargneUser from './screens/nano-credit/CasserEpargneUser';
import {IlinkEmitter} from './utils/events'; import {IlinkEmitter} from './utils/events';
import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAgent"; import EnvoieWalletToBankAgent from "./screens/wallet/agent/EnvoieWalletToBankAgent";
import ReattachAccountUser from "./screens/wallet/user/ReattachAccountUser"; 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({ const instructions = Platform.select({
@ -140,8 +137,6 @@ const AppStack = createDrawerNavigator({
reattachAccountUser: ReattachAccountUser, reattachAccountUser: ReattachAccountUser,
epargnerArgentUser: EpargnerArgentUser, epargnerArgentUser: EpargnerArgentUser,
createGroupNanoCredit: CreateGroupNanoCredit, createGroupNanoCredit: CreateGroupNanoCredit,
souscrireAssuranceUser: SouscrireAssuranceUser,
askPrestationUser: AskPrestationUser,
groupNanoCredit: { groupNanoCredit: {
screen: createBottomTabNavigator({ screen: createBottomTabNavigator({
demandeValidationGroupe: { demandeValidationGroupe: {
@ -269,7 +264,6 @@ const AppAgentStack = createDrawerNavigator({
envoieWalletToBankAgent: EnvoieWalletToBankAgent, envoieWalletToBankAgent: EnvoieWalletToBankAgent,
createGroupNanoCredit: CreateGroupNanoCredit, createGroupNanoCredit: CreateGroupNanoCredit,
cautionNanoCreditAgent: CautionNanoCreditAgent, cautionNanoCreditAgent: CautionNanoCreditAgent,
acceptPrestationAgent: AcceptPrestationAgent
}) })
}, { }, {
contentComponent: OptionsMenu, contentComponent: OptionsMenu,
@ -379,7 +373,7 @@ const AppSuperAdministrator = createDrawerNavigator({
headerMode: 'none' headerMode: 'none'
}); });
export const AppNavigator = createSwitchNavigator({ const AppNavigator = createSwitchNavigator({
first: { first: {
screen: SplashScreen screen: SplashScreen
}, },
@ -393,8 +387,7 @@ export const AppNavigator = createSwitchNavigator({
}); });
const AppContainer = createAppContainer(AppNavigator); const AppContainer = createAppContainer(AppNavigator);
class App extends React.Component { export default class App extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -404,7 +397,6 @@ class App extends React.Component {
OneSignal.setLogLevel(6, 0); OneSignal.setLogLevel(6, 0);
IlinkEmitter.on("langueChange", this.updateLangue.bind(this)) IlinkEmitter.on("langueChange", this.updateLangue.bind(this))
// Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID. // Replace 'YOUR_ONESIGNAL_APP_ID' with your OneSignal App ID.
/*
OneSignal.init("e8e7251f-713d-4658-9510-86d877fa6a7c", { OneSignal.init("e8e7251f-713d-4658-9510-86d877fa6a7c", {
kOSSettingsKeyAutoPrompt: false, kOSSettingsKeyAutoPrompt: false,
kOSSettingsKeyInAppLaunchURL: false, kOSSettingsKeyInAppLaunchURL: false,
@ -418,7 +410,6 @@ class App extends React.Component {
OneSignal.addEventListener('received', this.onReceived); OneSignal.addEventListener('received', this.onReceived);
OneSignal.addEventListener('opened', this.onOpened); OneSignal.addEventListener('opened', this.onOpened);
OneSignal.addEventListener('ids', this.onIds); OneSignal.addEventListener('ids', this.onIds);
*/
} }
updateLangue() { updateLangue() {
@ -549,8 +540,6 @@ function myiOSPromptCallback(permission) {
// do something with permission value // do something with permission value
} }
export default App;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flex: 1, flex: 1,

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{ {
"name": "iLink", "name": "iLinkWorld",
"displayName": "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

View File

@ -1,84 +1,88 @@
{ {
"_from": "react-native@0.61.5", "name": "react-native",
"_id": "react-native@0.61.5", "version": "0.61.5",
"_inBundle": false, "bin": "./cli.js",
"_integrity": "sha512-MXqE3NoGO0T3dUKIKkIppijBhRRMpfN6ANbhMXHDuyfA+fSilRWgCwYgR/YNCC7ntECoJYikKaNTUBB0DeQy6Q==", "description": "A framework for building native apps using React",
"_location": "/react-native", "license": "MIT",
"_phantomChildren": { "repository": {
"@hapi/joi": "15.1.1", "type": "git",
"@react-native-community/cli-debugger-ui": "3.0.0", "url": "git@github.com:facebook/react-native.git"
"@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"
}, },
"_requested": { "engines": {
"type": "version", "node": ">=8.3"
"registry": true,
"raw": "react-native@0.61.5",
"name": "react-native",
"escapedName": "react-native",
"rawSpec": "0.61.5",
"saveSpec": null,
"fetchSpec": "0.61.5"
}, },
"_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", "scripts": {
"_shasum": "6e21acb56cbd75a3baeb1f70201a66f42600bba8", "start": "react-native start",
"_spec": "react-native@0.61.5", "test": "jest",
"_where": "/Users/retina/Documents/Projets/iLinkWorld", "test-ci": "jest --maxWorkers=2 --ci --reporters=\"default\" --reporters=\"jest-junit\"",
"bin": { "flow": "flow",
"react-native": "cli.js" "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": { "peerDependencies": {
"url": "https://github.com/facebook/react-native/issues" "react": "16.9.0"
}, },
"bundleDependencies": false,
"dependencies": { "dependencies": {
"@babel/runtime": "^7.0.0", "@babel/runtime": "^7.0.0",
"@react-native-community/cli": "^3.0.0", "@react-native-community/cli": "^3.0.0",
@ -110,27 +114,6 @@
"stacktrace-parser": "^0.1.3", "stacktrace-parser": "^0.1.3",
"whatwg-fetch": "^3.0.0" "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": { "devDependencies": {
"@babel/core": "^7.0.0", "@babel/core": "^7.0.0",
"@babel/generator": "^7.0.0", "@babel/generator": "^7.0.0",
@ -168,87 +151,23 @@
"ws": "^6.1.4", "ws": "^6.1.4",
"yargs": "^9.0.0" "yargs": "^9.0.0"
}, },
"engines": { "detox": {
"node": ">=8.3" "test-runner": "jest",
}, "runner-config": "RNTester/e2e/config.json",
"files": [ "specs": "",
".flowconfig", "configurations": {
"android", "ios.sim.release": {
"cli.js", "binaryPath": "RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/",
"flow", "build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
"init.sh", "type": "ios.simulator",
"scripts/compose-source-maps.js", "name": "iPhone 6s"
"scripts/ios-configure-glog.sh", },
"scripts/ios-install-third-party.sh", "ios.sim.debug": {
"scripts/launchPackager.bat", "binaryPath": "RNTester/build/Build/Products/Debug-iphonesimulator/RNTester.app/",
"scripts/launchPackager.command", "build": "xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet",
"scripts/node-binary.sh", "type": "ios.simulator",
"scripts/packager.sh", "name": "iPhone 6s"
"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"
} }

View File

@ -64,5 +64,8 @@
"cautionNanoCreditAgent": "cautionNanoCreditAgent", "cautionNanoCreditAgent": "cautionNanoCreditAgent",
"epargnerArgentUser": "epargnerArgentUser", "epargnerArgentUser": "epargnerArgentUser",
"casserEpargneUser": "casserEpargneUser", "casserEpargneUser": "casserEpargneUser",
"reattachAccountUser": "reattachAccountUser" "reattachAccountUser": "reattachAccountUser",
"acceptPrestationAgent": "acceptPrestationAgent",
"souscrireAssuranceUser": "souscrireAssuranceUser",
"askPrestationUser": "askPrestationUser"
} }

View File

@ -164,6 +164,7 @@
"DEPOSIT_TO_BANK": "Your Wallet to bank", "DEPOSIT_TO_BANK": "Your Wallet to bank",
"NANO_CREDIT": "Nano credit", "NANO_CREDIT": "Nano credit",
"NANO_CREDIT_LIST": "Nano credit list", "NANO_CREDIT_LIST": "Nano credit list",
"NANO_CREDIT_DISABLE": "Nano credit disable",
"SAVINGS_LIST": "Savings list", "SAVINGS_LIST": "Savings list",
"NO_NANO_CREDIT": "No nano credit demand", "NO_NANO_CREDIT": "No nano credit demand",
"NO_SAVINGS": "No savings", "NO_SAVINGS": "No savings",
@ -337,6 +338,9 @@
"SUCCESS_IDENTIFICATION": "Identification successful", "SUCCESS_IDENTIFICATION": "Identification successful",
"REFUSER_DEMANDE": "Reject the request", "REFUSER_DEMANDE": "Reject the request",
"ACCEPTER_DEMANDE": "Accept the request", "ACCEPTER_DEMANDE": "Accept the request",
"DEMAND_STATE": "Demand state",
"CANCEL_ON": "Cancel on",
"CANCEL_BY_HYPERVISOR": "Cancel by hypervisor",
"REFUSED": "Refuse", "REFUSED": "Refuse",
"YOUR_THERE": "You are here", "YOUR_THERE": "You are here",
"SUCCESS_TRANSFER_COMMISSION": "Transfert effectué", "SUCCESS_TRANSFER_COMMISSION": "Transfert effectué",

View File

@ -171,6 +171,7 @@
"DEPOSIT_TO_BANK": "Wallet vers banque", "DEPOSIT_TO_BANK": "Wallet vers banque",
"NANO_CREDIT": "Nano crédit", "NANO_CREDIT": "Nano crédit",
"NANO_CREDIT_LIST": "Liste des nano crédit", "NANO_CREDIT_LIST": "Liste des nano crédit",
"NANO_CREDIT_DISABLE": "Nano crédit désactivé",
"SAVINGS_LIST": "Liste des épargnes", "SAVINGS_LIST": "Liste des épargnes",
"NO_NANO_CREDIT": "Aucune demande de nano crédit", "NO_NANO_CREDIT": "Aucune demande de nano crédit",
"NO_SAVINGS": "Aucune épargne", "NO_SAVINGS": "Aucune épargne",
@ -345,6 +346,9 @@
"REFUSER_DEMANDE": "Refuser la demande", "REFUSER_DEMANDE": "Refuser la demande",
"REFUSED": "Refusé", "REFUSED": "Refusé",
"ACCEPTER_DEMANDE": "Accepter la demande", "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", "SUCCESS_TRANSFER_COMMISSION": "Transfert de commission",
"YOUR_THERE": "Vous êtes ici", "YOUR_THERE": "Vous êtes ici",
"FILTER": "Filtrer", "FILTER": "Filtrer",

File diff suppressed because one or more lines are too long

40
package-lock.json generated
View File

@ -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": { "@jest/console": {
"version": "24.9.0", "version": "24.9.0",
"resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz",
@ -4826,6 +4834,11 @@
"type-check": "~0.3.2" "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": { "load-json-file": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "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" "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": { "raf": {
"version": "3.4.1", "version": "3.4.1",
"resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz",
@ -5735,6 +5753,14 @@
"performance-now": "^2.1.0" "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": { "react-deep-force-update": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/react-deep-force-update/-/react-deep-force-update-1.1.2.tgz", "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" "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": { "react-native-responsive-dimensions": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/react-native-responsive-dimensions/-/react-native-responsive-dimensions-2.0.1.tgz", "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", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz",
"integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" "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": { "word-wrap": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",

View File

@ -15,6 +15,7 @@
}, },
"dependencies": { "dependencies": {
"@expo/react-native-action-sheet": "^3.8.0", "@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/async-storage": "^1.9.0",
"@react-native-community/datetimepicker": "^2.4.0", "@react-native-community/datetimepicker": "^2.4.0",
"@react-native-community/viewpager": "^3.3.0", "@react-native-community/viewpager": "^3.3.0",

View File

@ -1,12 +1,11 @@
import { AsyncStorage } from "react-native"; import {AsyncStorage} from "react-native";
import { persistReducer, persistStore } from "redux-persist"; import {persistReducer, persistStore} from "redux-persist";
import { createStore, applyMiddleware, compose } from "redux"; import {createStore, applyMiddleware, compose} from "redux";
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import { createLogger } from 'redux-logger'; import {createLogger} from 'redux-logger';
import rootReducer from "./reducers"; import rootReducer from "./reducers";
/* const persistConfig = { /* const persistConfig = {
key: 'root', key: 'root',
storage: AsyncStorage, storage: AsyncStorage,
@ -17,11 +16,11 @@ const middlewares = [];
middlewares.push(thunk); middlewares.push(thunk);
const loggerMiddleware = createLogger({ const loggerMiddleware = createLogger({
predicate: () => process.env.NODE_ENV === 'development' predicate: () => process.env.NODE_ENV === 'development'
}) })
middlewares.push(loggerMiddleware); middlewares.push(loggerMiddleware);
const store = createStore(rootReducer, compose(applyMiddleware(...middlewares))); const store = createStore(rootReducer, compose(applyMiddleware(...middlewares)));
let persistor = persistStore(store); let persistor = persistStore(store);
export { store, persistor }; export {store, persistor};

View File

@ -102,8 +102,9 @@ export default class UpdateInformations extends Component {
} }
onClickUpdatePosition() { onClickUpdatePosition() {
this.setState({positionEnabled: true}) this.setState({positionEnabled: true});
Geolocation.getCurrentPosition((position) => { Geolocation.getCurrentPosition((position) => {
console.log("CURRENT POSITION", position);
const myPosition = position.coords; const myPosition = position.coords;
updatePosition(myPosition.longitude, myPosition.latitude).then((response) => { updatePosition(myPosition.longitude, myPosition.latitude).then((response) => {
var title = ''; var title = '';
@ -130,11 +131,19 @@ export default class UpdateInformations extends Component {
text: "Ok", onPress: () => { text: "Ok", onPress: () => {
this.props.navigation.popToTop() this.props.navigation.popToTop()
} }
}]) }]);
}).catch((e) => { }).catch((e) => {
console.log(e);
this.setState({positionEnabled: false}) 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);
} }
} }

View File

@ -307,7 +307,8 @@ class HistoryItemDetails extends Component {
console.warn("ITEM ITEM", this.item); console.warn("ITEM ITEM", this.item);
console.warn("Code Membre", user.code_membre); console.warn("Code Membre", user.code_membre);
if (user) { 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') { if (this.item.status === '1') {
return (<Button return (<Button
style={{ style={{
@ -326,7 +327,8 @@ class HistoryItemDetails extends Component {
{this.state.statut} {this.state.statut}
</Button> </Button>
) )
} else if (this.item.status === '2') { }
if (this.item.status === '2') {
return (<Button return (<Button
style={{ style={{
borderColor: 'transparent', borderColor: 'transparent',
@ -405,9 +407,16 @@ class HistoryItemDetails extends Component {
} }
render() { render() {
console.log("CREDIT MANAGE PROPS", this.props);
let ago = moment.tz(this.item.date_creation, moment.tz.guess()).format(); let ago = moment.tz(this.item.date_creation, moment.tz.guess()).format();
ago = moment(ago); 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 ( return (
<View style={styles.container}> <View style={styles.container}>
{this.renderPromptModifyAmountToSend()} {this.renderPromptModifyAmountToSend()}
@ -526,6 +535,44 @@ class HistoryItemDetails extends Component {
}}>{ago.fromNow()}</Text> }}>{ago.fromNow()}</Text>
</View> </View>
</CardView> </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} {this.state.user ? this.renderBtn() : null}
</View>) </View>)
} }

View File

@ -45,6 +45,7 @@ import InterticielAds from './../ads/InterticielAds'
import SnackBar from 'react-native-snackbar-component' import SnackBar from 'react-native-snackbar-component'
import {FAB, Surface} from 'react-native-paper' import {FAB, Surface} from 'react-native-paper'
import BottomSheet from 'reanimated-bottom-sheet' import BottomSheet from 'reanimated-bottom-sheet'
import MarkerManager from './../../webservice/persistences/MarkerManager'
import {bindActionCreators} from 'redux'; import {bindActionCreators} from 'redux';
import getAuthApiKey from '../../webservice/AuthKeyApi'; import getAuthApiKey from '../../webservice/AuthKeyApi';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
@ -52,6 +53,7 @@ import getWalletActivated from '../../webservice/WalletApi';
import {saveOnesignalIdsAction, saveOnesignalIdsReset} from '../../webservice/OnesignalApi'; import {saveOnesignalIdsAction, saveOnesignalIdsReset} from '../../webservice/OnesignalApi';
import OneSignal from 'react-native-onesignal'; import OneSignal from 'react-native-onesignal';
import {saveOnesignalIds} from '../../webservice/IlinkConstants'; import {saveOnesignalIds} from '../../webservice/IlinkConstants';
import {callingCodes} from "@ideditor/country-coder";
const countries = require("./../../utils/country_code.json") const countries = require("./../../utils/country_code.json")
@ -308,6 +310,7 @@ class Home extends BaseScreen {
this.mounted = true; this.mounted = true;
this.configuration = new Configuration() this.configuration = new Configuration()
const {navigation} = this.props; const {navigation} = this.props;
this.markerManager = new MarkerManager()
this.configuration.getCurrentPubValue().then((value) => { this.configuration.getCurrentPubValue().then((value) => {
try { try {
const val = parseInt(value) const val = parseInt(value)
@ -371,7 +374,7 @@ class Home extends BaseScreen {
this.setState({isLoading: false, isLoadingMap: false, loadingDialog: false}) this.setState({isLoading: false, isLoadingMap: false, loadingDialog: false})
if (user.category !== "geolocated") { if (user.category !== "geolocated") {
console.log("THIS IS CALL");
this.showMyMembers(); this.showMyMembers();
} else { } else {
if (myPosition.latitude <= 0 && myPosition.longitude <= 0) { 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"), [{ Alert.alert(I18n.t("PROBLEM_OCCUR"), I18n.t("PROBLEM_OCCUR_DIRECTION"), [{
text: "Ok", text: "Ok",
onPress: () => { onPress: () => {
_.isNil(user.latitude)
} }
}]) }])
}} }}
@ -1720,21 +1724,21 @@ class Home extends BaseScreen {
} }
onMapReady = () => { onMapReady = () => {
console.log("MAP READY CALL");
readUser().then((user) => { readUser().then((user) => {
if (user) { if (user) {
this.setState({user: user}) this.setState({user: user});
this.setState({network: user.network, isSaveOneSignalOK: true}); this.setState({network: user.network, isSaveOneSignalOK: true});
const myPosition = { const myPosition = {
latitude: parseFloat(user.latitude), latitude: _.isNil(user.latitude) ? 0 : parseFloat(user.latitude),
longitude: parseFloat(user.longitude) longitude: _.isNil(user.longitude) ? 0 : parseFloat(user.longitude)
} }
this.setState({myPosition}); this.setState({myPosition});
this.refocusMap(false); this.refocusMap(false);
if (user.category) { if (user.category) {
this.setState({loadingDialog: false}) this.setState({loadingDialog: false});
if (user.category !== "geolocated") { if (user.category !== "geolocated") {
this.showMyMembers(); this.showMyMembers();
} else { } else {
@ -1891,7 +1895,7 @@ class Home extends BaseScreen {
return item.id === filternetwork.id return item.id === filternetwork.id
}) })
let reseau = res[0]; 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) this.treatNewData(this.state.prevRegion, datas, true)
}).catch((e) => { }).catch((e) => {
this.setState({showProgress: false}) this.setState({showProgress: false})
@ -2002,7 +2006,7 @@ class Home extends BaseScreen {
const {myPosition, user, filternetwork} = this.state const {myPosition, user, filternetwork} = this.state
if (filternetwork !== undefined) { if (filternetwork !== undefined) {
this.setState({showProgress: true}) 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.setState({showProgress: false})
this.treatNewData(myPosition, data, true) this.treatNewData(myPosition, data, true)
}).catch((e) => { }).catch((e) => {
@ -2086,6 +2090,8 @@ class Home extends BaseScreen {
) )
} }
markerManager: MarkerManager
getHypervisorActionButton() { getHypervisorActionButton() {
return (<ActionButton return (<ActionButton
buttonColor={theme.accent} 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) => { return new Promise((resolve, reject) => {
const {allpoint} = this.state const {allpoint} = this.state
let page = p !== undefined ? p : this.state.page 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)} const location = {longitude: parseFloat(mark.longitude), latitude: parseFloat(mark.latitude)}
return geolib.getDistance(myPosition, location) <= (value * 1000) return geolib.getDistance(myPosition, location) <= (value * 1000)
&& mark.network === filternetwork.name && mark.network === filternetwork.name
}) });
this.setState({ console.warn("currentNetworkSize", this.state.currentNetworkSize);
currentNetworkSize: currentNetwork.length, console.warn("currentNetworkSize valuePosition", this.state.valuePosition);
showProgress: false, if (isFilter) {
currentNetworkMarkers: currentNetwork 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) { } catch (e) {
console.debug("after " + e.message) console.debug("after " + e.message)
} }
@ -2423,111 +2444,103 @@ class Home extends BaseScreen {
console.log("on treatposition") console.log("on treatposition")
if (myPosition.longitude !== myLastPosition.longitude || myPosition.latitude !== myLastPosition.latitude) { if (myPosition.longitude !== myLastPosition.longitude || myPosition.latitude !== myLastPosition.latitude) {
this.setState({myPosition: myPosition}) this.setState({myPosition: myPosition})
if (this.map) this.map.focusToUser() if (this.map) this.map.focusToUser();
getPositionInformation(myPosition).then((response) => { let indicatif = callingCodes([myPosition.longitude, myPosition.latitude]);
if (response) { if (Array.isArray(indicatif))
if (response.results !== undefined) { indicatif = "+" + indicatif[0];
if (response.results.length > 0) { this.setState({
indicatif: indicatif,
let most = response.results[0] enterPhone: indicatif
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}
)
}); });
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 = { const reg = {
latitude: myPosition.latitude, latitude: myPosition.latitude,
longitude: myPosition.longitude, longitude: myPosition.longitude,

View File

@ -15,7 +15,7 @@ import IMarker from "./IMarker";
import I18n from "react-native-i18n"; import I18n from "react-native-i18n";
import MapViewDirections from 'react-native-maps-directions'; 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 mnetwork = require('./../../datas/img/png/home_network.png');
const othernetwork = require('./../../datas/img/png/other_net.png'); const othernetwork = require('./../../datas/img/png/other_net.png');
import {copilot, CopilotStep} from 'react-native-copilot'; import {copilot, CopilotStep} from 'react-native-copilot';

View File

@ -1,4 +1,4 @@
import React, { Component } from 'react'; import React, {Component} from 'react';
import { import {
StyleSheet, StyleSheet,
@ -18,25 +18,30 @@ import {
} from 'react-native'; } from 'react-native';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome'; import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome';
import { responsiveHeight, responsiveWidth, responsiveFontSize } from 'react-native-responsive-dimensions'; import {responsiveHeight, responsiveWidth, responsiveFontSize} from 'react-native-responsive-dimensions';
import { Sae } from 'react-native-textinput-effects'; import {Sae} from 'react-native-textinput-effects';
import Button from 'apsl-react-native-button'; import Button from 'apsl-react-native-button';
let theme = require('./../../../utils/theme.json'); 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 * as Animatable from 'react-native-animatable';
import isEqual from 'lodash/isEqual' import isEqual from 'lodash/isEqual'
import { getPositionInformation } from './../../../webservice/MapService' import {getOpenCagePositionInformation} from './../../../webservice/MapService'
import SwitchSelector from 'react-native-switch-selector' import SwitchSelector from 'react-native-switch-selector'
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
let route = require('./../../../route.json'); let route = require('./../../../route.json');
require('./../../../utils/Translations') require('./../../../utils/Translations')
let country = require('./../../../utils/country_code.json'); let country = require('./../../../utils/country_code.json');
import { IlinkEmitter } from './../../../utils/events' import {IlinkEmitter} from './../../../utils/events'
import { readUser } from "../../../webservice/AuthApi"; import {readUser} from "../../../webservice/AuthApi";
import { MaterialDialog } from "react-native-material-dialog" import {MaterialDialog} from "react-native-material-dialog"
import Spinner from "react-native-loading-spinner-overlay" import Spinner from "react-native-loading-spinner-overlay";
import Geolocation from "react-native-geolocation-service" import Geolocation from "react-native-geolocation-service";
const GEOLOCATION_OPTIONS = { enableHighAccuracy: true, timeout: 20000 } import {iso1A2Code, callingCodes, emojiFlag, feature} from '@ideditor/country-coder';
import {opencageDataApiKey} from "../../../webservice/IlinkConstants";
const GEOLOCATION_OPTIONS = {enableHighAccuracy: true, timeout: 20000}
const propTypes = { const propTypes = {
coordinate: PropTypes.shape({ coordinate: PropTypes.shape({
latitude: PropTypes.number.isRequired, latitude: PropTypes.number.isRequired,
@ -51,7 +56,8 @@ const propTypes = {
heading: PropTypes.number, heading: PropTypes.number,
enableHack: PropTypes.bool, enableHack: PropTypes.bool,
}; };
const widthButton = responsiveWidth(80) > 350 ? 350 : responsiveWidth(80) const widthButton = responsiveWidth(80) > 350 ? 350 : responsiveWidth(80);
export class LoginUi extends Component { export class LoginUi extends Component {
handlePhoneRef = ref => this.phoneRef = ref; handlePhoneRef = ref => this.phoneRef = ref;
@ -60,50 +66,51 @@ export class LoginUi extends Component {
enableHack: false, enableHack: false,
geolocationOptions: null, geolocationOptions: null,
}; };
async requestCameraPermission() { async requestCameraPermission() {
if (Platform.OS === "android") { if (Platform.OS === "android") {
try { try {
const granted = await PermissionsAndroid.request( const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{ {
'title': 'Cool Photo App Camera Permission', 'title': 'Cool Photo App Camera Permission',
'message': 'Cool Photo App needs access to your camera ' + 'message': 'Cool Photo App needs access to your camera ' +
'so you can take awesome pictures.' 'so you can take awesome pictures.'
} }
) )
if (granted === PermissionsAndroid.RESULTS.GRANTED) { if (granted === PermissionsAndroid.RESULTS.GRANTED) {
this.watchLocation() this.watchLocation()
} else { } else {
this.setState({ loadingDialog: false }) this.setState({loadingDialog: false})
Alert.alert(I18n.t("TITLE_UNABLE_TO_AUTORISE"), Alert.alert(I18n.t("TITLE_UNABLE_TO_AUTORISE"),
I18n.t("MISSING_AUTORISATION_LOCATION"), I18n.t("MISSING_AUTORISATION_LOCATION"),
[{ [{
text: I18n.t("RESTART"), onPress: () => { text: I18n.t("RESTART"), onPress: () => {
this.requestCameraPermission() this.requestCameraPermission()
} }
}, { }, {
text: I18n.t("QUIT_"), onPress: () => { text: I18n.t("QUIT_"), onPress: () => {
BackHandler.exitApp() BackHandler.exitApp()
} }
}], }],
{ cancelable: false } {cancelable: false}
) )
} }
} catch (err) { } catch (err) {
console.warn(err) console.warn(err)
this.setState({ loadingDialog: false }) this.setState({loadingDialog: false})
Alert.alert(I18n.t("TITLE_ERROR_SURVENU"), Alert.alert(I18n.t("TITLE_ERROR_SURVENU"),
I18n.t("TEXT_ERROR_START_APPLICATION"), I18n.t("TEXT_ERROR_START_APPLICATION"),
[{ [{
text: I18n.t("RESTART"), onPress: () => { text: I18n.t("RESTART"), onPress: () => {
this.requestCameraPermission() this.requestCameraPermission()
} }
}, { }, {
text: I18n.t("QUIT_"), onPress: () => { text: I18n.t("QUIT_"), onPress: () => {
// BackHandler.exitApp() // BackHandler.exitApp()
} }
}], }],
{ cancelable: false } {cancelable: false}
) )
} }
@ -114,24 +121,25 @@ export class LoginUi extends Component {
} }
showConnexionAlertError() { showConnexionAlertError() {
this.setState({ loadingDialog: false }) this.setState({loadingDialog: false})
Alert.alert(I18n.t("TITLE_PROBLE_COME"), Alert.alert(I18n.t("TITLE_PROBLE_COME"),
I18n.t("TEXT_UNABLE_TO_GET_YOUR_POSITION"), I18n.t("TEXT_UNABLE_TO_GET_YOUR_POSITION"),
[{ [{
text: I18n.t("QUIT_"), onPress: () => { text: I18n.t("QUIT_"), onPress: () => {
BackHandler.exitApp() BackHandler.exitApp()
} }
}, { }, {
text: I18n.t("RESTART"), text: I18n.t("RESTART"),
onPress: () => { onPress: () => {
this.setState({ loadingDialog: true }) this.setState({loadingDialog: true})
this.watchLocation() this.watchLocation()
} }
}], }],
{ cancelable: false } {cancelable: false}
) )
} }
_storeData = async (position) => { _storeData = async (position) => {
try { try {
console.warn("save result", await AsyncStorage.setItem('position', JSON.stringify(position))); 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.longitudeDelta = 0.04
re.latitudeDelta = 0.01 re.latitudeDelta = 0.01
const pos = JSON.parse(value) const pos = JSON.parse(value)
this.setState({ region: re, oldPosition: pos }) this.setState({region: re, oldPosition: pos})
} }
} catch (error) { } catch (error) {
console.warn(error) console.warn(error)
} }
}; };
watchLocation(geo = null) { watchLocation(geo = null) {
const options = geo == null ? GEOLOCATION_OPTIONS : geo const options = geo == null ? GEOLOCATION_OPTIONS : geo
this.watchID = Geolocation.getCurrentPosition((position) => { this.watchID = Geolocation.getCurrentPosition((position) => {
const myLastPosition = this.state.myPosition; const myLastPosition = this.state.myPosition;
const myPosition = position.coords; const myPosition = position.coords;
if (!isEqual(myPosition, myLastPosition)) { if (!isEqual(myPosition, myLastPosition)) {
console.warn(myPosition) console.warn(myPosition)
if (myPosition.longitude !== 0 && myPosition.latitude !== 0) { if (myPosition.longitude !== 0 && myPosition.latitude !== 0) {
this._storeData(myPosition) this._storeData(myPosition)
this.retreiveinformationFromPosition(myPosition) this.retreiveinformationFromPosition(myPosition)
} else { } else {
if (!this.state.alreadyRetry) { if (!this.state.alreadyRetry) {
this.setState({ alreadyRetry: true }) this.setState({alreadyRetry: true})
let geo = { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 } let geo = {enableHighAccuracy: false, timeout: 20000, maximumAge: 1000}
this.watchLocation(geo) this.watchLocation(geo)
} else { } else {
if (this.state.oldPosition) { if (this.state.oldPosition) {
this.retreiveinformationFromPosition(this.state.oldPosition) this.retreiveinformationFromPosition(this.state.oldPosition)
} else { } else {
Geolocation.watchPosition((position) => { Geolocation.watchPosition((position) => {
if (position.longitude !== 0 && position.latitude !== 0) { if (position.longitude !== 0 && position.latitude !== 0) {
this._storeData(position) this._storeData(position)
this.retreiveinformationFromPosition(position) this.retreiveinformationFromPosition(position)
} else { } else {
Alert.alert(I18n.t("UNABLE_GET_INFORMATION") Alert.alert(I18n.t("UNABLE_GET_INFORMATION")
, I18n.t('UNABLE_GET_INFORMATION_TEXT'), , I18n.t('UNABLE_GET_INFORMATION_TEXT'),
[{ text: I18n.t("EXIT"), onPress: () => { BackHandler.exitApp() } }, [{
{ text: I18n.t("RESTART"), onPress: () => { this.watchLocation() } }], text: I18n.t("EXIT"), onPress: () => {
{ cancelable: false } BackHandler.exitApp()
) }
} },
}, (error) => { {
this.setState({ loadingDialog: false }) text: I18n.t("RESTART"), onPress: () => {
Alert.alert(I18n.t("TITLE_ERROR_SURVENU"), this.watchLocation()
I18n.t("TEXT_ERROR_START_APPLICATION"), }
[{ }],
text: "Ok", onPress: () => { {cancelable: false}
BackHandler.exitApp() )
} }
}], }, (error) => {
{ cancelable: false }) this.setState({loadingDialog: false})
}, GEOLOCATION_OPTIONS) Alert.alert(I18n.t("TITLE_ERROR_SURVENU"),
} I18n.t("TEXT_ERROR_START_APPLICATION"),
} [{
} text: "Ok", onPress: () => {
} BackHandler.exitApp()
}
}],
{cancelable: false})
}, GEOLOCATION_OPTIONS)
}
}
}
}
}, (positionError) => { }, (positionError) => {
console.warn(positionError) console.warn(positionError)
Alert.alert(I18n.t("UNABLE_GET_INFORMATION") Alert.alert(I18n.t("UNABLE_GET_INFORMATION")
, I18n.t('UNABLE_GET_INFORMATION_TEXT'), , I18n.t('UNABLE_GET_INFORMATION_TEXT'),
[{ text: I18n.t("EXIT"), onPress: () => { BackHandler.exitApp() } }, [{
{ text: I18n.t("RESTART"), onPress: () => { this.watchLocation() } }], text: I18n.t("EXIT"), onPress: () => {
{ cancelable: false } BackHandler.exitApp()
) }
} },
, options) {
text: I18n.t("RESTART"), onPress: () => {
this.watchLocation()
}
}],
{cancelable: false}
)
}
, options)
} }
retreiveinformationFromPosition(myPosition) { retreiveinformationFromPosition(myPosition) {
getPositionInformation(myPosition).then((response) => { let indicatif = callingCodes([myPosition.longitude, myPosition.latitude]);
console.log(response, myPosition) this.setState({
if (response.results !== undefined) { indicatif: `+${indicatif}`,
if (response.results.length > 0) { enterPhone: `+${indicatif}`
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 })
}); });
/* 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() { componentDidMount() {
this._retrieveData() this._retrieveData();
this.requestCameraPermission() this.requestCameraPermission();
} }
componentWillUnmount() { componentWillUnmount() {
if (this.focusListener) if (this.focusListener)
this.focusListener.remove() this.focusListener.remove()
@ -286,7 +298,7 @@ export class LoginUi extends Component {
this.reseaux.push(networks[prop]); this.reseaux.push(networks[prop]);
} }
} }
this.setState({ networks: this.reseaux }); this.setState({networks: this.reseaux});
}, (err) => { }, (err) => {
console.log(err); console.log(err);
@ -301,27 +313,27 @@ export class LoginUi extends Component {
this.state = this.initState(); this.state = this.initState();
this.Animation = new Animated.Value(0); this.Animation = new Animated.Value(0);
this.BackgroundColorConfig = this.Animation.interpolate( this.BackgroundColorConfig = this.Animation.interpolate(
{ {
inputRange: [0, 0.5, 1], inputRange: [0, 0.5, 1],
outputRange: this.state.colorsscheme outputRange: this.state.colorsscheme
}); });
this.BackgroundColorConfigAdmin = this.Animation.interpolate( this.BackgroundColorConfigAdmin = this.Animation.interpolate(
{ {
inputRange: [0, 0.5, 1], inputRange: [0, 0.5, 1],
outputRange: this.state.colorsscheme.reverse() outputRange: this.state.colorsscheme.reverse()
}) })
} }
StartBackgroundColorAnimation = (value) => { StartBackgroundColorAnimation = (value) => {
this.Animation.setValue(value === 0 ? 0 : 1); this.Animation.setValue(value === 0 ? 0 : 1);
this.setState({ stateLogin: value, typeaccount: value }) this.setState({stateLogin: value, typeaccount: value})
Animated.timing( Animated.timing(
this.Animation, this.Animation,
{ {
toValueF: value === 1 ? 0 : 1, toValueF: value === 1 ? 0 : 1,
duration: 500 duration: 500
} }
).start(); ).start();
} }
@ -355,6 +367,7 @@ export class LoginUi extends Component {
type: this.state.typeaccount, type: this.state.typeaccount,
}); });
} }
initState() { initState() {
return { return {
password: "", password: "",
@ -364,135 +377,148 @@ export class LoginUi extends Component {
phoneEnabled: false, phoneEnabled: false,
snackVisible: false, snackVisible: false,
snackText: '', snackText: '',
loadingDialog: true, loadingDialog: false,
stateLogin: -1, stateLogin: -1,
colorsscheme: [theme.primary, theme.primaryDark, theme.primaryDarkAdvanced] colorsscheme: [theme.primary, theme.primaryDark, theme.primaryDarkAdvanced]
} }
} }
options = [ options = [
{ label: I18n.t('USER'), value: 0 }, {label: I18n.t('USER'), value: 0},
{ label: I18n.t('AGENT'), value: 1 }, {label: I18n.t('AGENT'), value: 1},
] ]
BackgroundColorConfig: null BackgroundColorConfig: null
BackgroundColorConfigAdmin: null BackgroundColorConfigAdmin: null
render() { render() {
return ( return (
<Animated.View style={[style.container, <Animated.View style={[style.container,
{ backgroundColor: this.BackgroundColorConfig }]}> {backgroundColor: this.BackgroundColorConfig}]}>
<StatusBar <StatusBar
backgroundColor={theme.primaryDark} backgroundColor={theme.primaryDark}
barStyle="light-content" barStyle="light-content"
translucent={false} translucent={false}
/><Spinner /><Spinner
visible={this.state.loadingDialog} visible={this.state.loadingDialog}
textContent={I18n.t("LOADING_PROGRESS")} textContent={I18n.t("LOADING_PROGRESS")}
textStyle={{ color: '#FFF' }} textStyle={{color: '#FFF'}}
/> />
<ScrollView> <ScrollView>
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.props.navigation.push(route.helpmenu) this.props.navigation.push(route.helpScreen)
}} > }}>
<View style={{ <View style={{
alignSelf: 'flex-end', alignSelf: 'flex-end',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: theme.primaryLight, backgroundColor: theme.primaryLight,
height: 32, height: 32,
borderRadius: 12, borderRadius: 12,
marginTop: 30, marginTop: 30,
marginRight: 20 marginRight: 20
}}> }}>
<Text style={{ color: 'white', fontSize: 18, fontWeight: 'bold', padding: 5 }}>{I18n.t('HELP')}</Text> <Text style={{
</View> color: 'white',
</TouchableOpacity> fontSize: 18,
<View style={style.logoContaner}> fontWeight: 'bold',
<Image style={style.logo} source={require('./../../../datas/img/icon3.png')} /> padding: 5
</View> }}>{I18n.t('HELP')}</Text>
<Animatable.View ref={this.handlePhoneRef}> </View>
<Sae </TouchableOpacity>
label={this.state.stateLogin !== 1 ? I18n.t('PHONE_NUMBER') : I18n.t('PHONE_NUMBER_ADMIN')} <View style={style.logoContaner}>
iconClass={FontAwesomeIcon} <Image style={style.logo} source={require('./../../../datas/img/icon3.png')}/>
iconName={'phone'} </View>
iconColor={'white'} <Animatable.View ref={this.handlePhoneRef}>
keyboardType={"numeric"} <Sae
enabled={this.state.phoneEnabled} label={this.state.stateLogin !== 1 ? I18n.t('PHONE_NUMBER') : I18n.t('PHONE_NUMBER_ADMIN')}
style={style.input} iconClass={FontAwesomeIcon}
autoCapitalize={'none'} iconName={'phone'}
autoCorrect={false} iconColor={'white'}
value={this.state.enterPhone} keyboardType={"numeric"}
ref={(com) => { this.numberRef = com }} enabled={this.state.phoneEnabled}
onChangeText={(text) => this.setState({ enterPhone: text })} style={style.input}
labelStyle={style.labelInput} autoCapitalize={'none'}
/> autoCorrect={false}
</Animatable.View> value={this.state.enterPhone}
<Animatable.View ref={this.handlePasswordRef}> ref={(com) => {
<Sae this.numberRef = com
label={I18n.t('PASSWORD')} }}
ref={component => { this._pass = component }} onChangeText={(text) => this.setState({enterPhone: text})}
iconClass={FontAwesomeIcon} labelStyle={style.labelInput}
iconName={'lock'} />
style={style.input} </Animatable.View>
iconColor={'white'} <Animatable.View ref={this.handlePasswordRef}>
labelStyle={style.labelInput} <Sae
autoCapitalize={'none'} label={I18n.t('PASSWORD')}
secureTextEntry={true} ref={component => {
onChangeText={(text) => this.setState({ password: text })} this._pass = component
autoCorrect={false} }}
/> iconClass={FontAwesomeIcon}
</Animatable.View> 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}> <View style={separator.btnContainer}>
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.gotoForgottenPass() this.gotoForgottenPass()
}}> }}>
<Text style={style.lostpassword}> <Text style={style.lostpassword}>
{I18n.t("FORGOTTEN_PASSWORD")} {I18n.t("FORGOTTEN_PASSWORD")}
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
<View style={style.contentSwitch}> <View style={style.contentSwitch}>
<SwitchSelector options={this.options} <SwitchSelector options={this.options}
initial={0} initial={0}
buttonColor={theme.accentLight} buttonColor={theme.accentLight}
backgroundColor={theme.primaryDark} backgroundColor={theme.primaryDark}
textColor='white' textColor='white'
bold={true} bold={true}
hasPadding hasPadding
height={32} height={32}
style={style.switch} style={style.switch}
onPress={(value) => { onPress={(value) => {
this.StartBackgroundColorAnimation(value) this.StartBackgroundColorAnimation(value)
}} /> }}/>
</View> </View>
<Button style={style.loginBtn1} <Button style={style.loginBtn1}
isLoading={this.state.isLoging} isLoading={this.state.isLoging}
onPress={() => { this.connectClicked() }} onPress={() => {
> this.connectClicked()
<Text style={style.loginBtnText2}>{I18n.t("CONNECT_USER")}</Text> }}
</Button> >
<View style={separator.container}> <Text style={style.loginBtnText2}>{I18n.t("CONNECT_USER")}</Text>
<View style={separator.line} /> </Button>
<Text style={separator.text}>{I18n.t("OR_BIG")}</Text> <View style={separator.container}>
<View style={separator.line} /> <View style={separator.line}/>
</View> <Text style={separator.text}>{I18n.t("OR_BIG")}</Text>
<Button style={style.loginBtn} <View style={separator.line}/>
onPress={() => { </View>
this.gotoTypeCreated() <Button style={style.loginBtn}
}} onPress={() => {
> this.gotoTypeCreated()
<Text style={style.loginBtnText}>{I18n.t("CREATE_ACCOUNT")} </Text> }}
</Button> >
</View> <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) { if (this.state.password === null || this.state.password === undefined || this.state.password.length < 3 || this.state.password.lenght < 3) {
this.passRef.shake(800) this.passRef.shake(800)
} } else {
else {
this.setState(previousState => { this.setState(previousState => {
return { isLoging: !previousState.isLoging }; return {isLoging: !previousState.isLoging};
}) })
login(this.state.enterPhone, this.state.password, this.state.typeaccount).then((responseJson) => { login(this.state.enterPhone, this.state.password, this.state.typeaccount).then((responseJson) => {
console.warn(responseJson) console.warn(responseJson)
if (responseJson.success === 1) { if (responseJson.success === 1) {
this.setState(previousState => { this.setState(previousState => {
return { isLoging: !previousState.isLoging }; return {isLoging: !previousState.isLoging};
}) })
const user = responseJson; const user = responseJson;
if (!user.error) { if (!user.error) {
if (user.etat === "1" || user.etat === 1) { if (user.etat === "1" || user.etat === 1) {
saveNewuser(user); saveNewuser(user);
this.setState({ user: user }) this.setState({user: user})
Alert.alert( Alert.alert(
I18n.t("CONNEXION_SUCCESSFUL"), I18n.t("CONNEXION_SUCCESSFUL"),
I18n.t("CONNEXION_SUCCESSFULL_TEXT"), I18n.t("CONNEXION_SUCCESSFULL_TEXT"),
[ [
{ {
text: 'Ok', onPress: () => { text: 'Ok', onPress: () => {
this.setState(previousState => { this.setState(previousState => {
return { isLoging: !previousState.isLoging }; return {isLoging: !previousState.isLoging};
}) })
this.gotoHome() this.gotoHome()
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} else { } else {
if (user.category !== 'super') { if (user.category !== 'super') {
@ -550,12 +575,15 @@ export class LoginUi extends Component {
} else { } else {
if (user.etat_demande === 0 || user.etat_demande === '0') { if (user.etat_demande === 0 || user.etat_demande === '0') {
Alert.alert( Alert.alert(
I18n.t('DONT_VALIDATE_ACCOUNT'), I18n.t('DONT_VALIDATE_ACCOUNT'),
I18n.t('UNVALIDATE_ACCOUNT_TEXT'), I18n.t('UNVALIDATE_ACCOUNT_TEXT'),
[ [
{ text: 'Ok', onPress: () => { } } {
], text: 'Ok', onPress: () => {
{ cancelable: false } }
}
],
{cancelable: false}
) )
} else { } else {
this.props.navigation.push(route.activateaccount, { this.props.navigation.push(route.activateaccount, {
@ -567,24 +595,32 @@ export class LoginUi extends Component {
} }
} else { } else {
this.setState(previousState => { this.setState(previousState => {
return { isLoging: !previousState.isLoging }; return {isLoging: !previousState.isLoging};
}) })
Alert.alert( Alert.alert(
I18n.t("UNABLE_TO_CONNECT_TITLE"), I18n.t("UNABLE_TO_CONNECT_TITLE"),
I18n.t('TEXT_NETWORK_UNABLE') I18n.t('TEXT_NETWORK_UNABLE')
, ,
[ [
{ text: I18n.t("NO"), onPress: () => { BackHandler.exitApp() } }, {
{ text: I18n.t("YES"), onPress: () => { this.connectClicked() } } text: I18n.t("NO"), onPress: () => {
BackHandler.exitApp()
}
},
{
text: I18n.t("YES"), onPress: () => {
this.connectClicked()
}
}
], ],
{ cancelable: false } {cancelable: false}
) )
} }
} else if (responseJson === null) { } else if (responseJson === null) {
this.setState(previousState => { this.setState(previousState => {
return { isLoging: !previousState.isLoging }; return {isLoging: !previousState.isLoging};
}) })
} else { } else {
@ -616,38 +652,38 @@ export class LoginUi extends Component {
if (message === null) { if (message === null) {
Alert.alert( Alert.alert(
I18n.t("UNABLE_TO_CONNECT_TITLE"), I18n.t("UNABLE_TO_CONNECT_TITLE"),
I18n.t('TEXT_NETWORK_UNABLE') I18n.t('TEXT_NETWORK_UNABLE')
, ,
[ [
{ {
text: I18n.t("NO"), onPress: () => { text: I18n.t("NO"), onPress: () => {
BackHandler.exitApp() BackHandler.exitApp()
} }
}, },
{ {
text: I18n.t("YES"), onPress: () => { text: I18n.t("YES"), onPress: () => {
this.connectClicked() this.connectClicked()
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
} else { } else {
Alert.alert( Alert.alert(
I18n.t("UNABLE_TO_CONNECT_TITLE"), I18n.t("UNABLE_TO_CONNECT_TITLE"),
message message
, ,
[ [
{ {
text: "OK", onPress: () => { text: "OK", onPress: () => {
} }
} }
], ],
{ cancelable: false } {cancelable: false}
) )
this.setState(previousState => { this.setState(previousState => {
return { return {
@ -656,32 +692,41 @@ export class LoginUi extends Component {
}; };
}) })
setTimeout(() => { setTimeout(() => {
this.setState({ snackVisible: false }) this.setState({snackVisible: false})
}, 2000) }, 2000)
} }
} }
}) })
.catch((e) => { .catch((e) => {
this.setState(previousState => { this.setState(previousState => {
return { isLoging: !previousState.isLoging }; return {isLoging: !previousState.isLoging};
}) })
Alert.alert( Alert.alert(
I18n.t("UNABLE_TO_CONNECT_TITLE"), I18n.t("UNABLE_TO_CONNECT_TITLE"),
I18n.t('TEXT_NETWORK_UNABLE') I18n.t('TEXT_NETWORK_UNABLE')
, ,
[ [
{ text: I18n.t("NO"), onPress: () => { BackHandler.exitApp() } }, {
{ text: I18n.t("YES"), onPress: () => { this.connectClicked() } } text: I18n.t("NO"), onPress: () => {
BackHandler.exitApp()
}
},
{
text: I18n.t("YES"), onPress: () => {
this.connectClicked()
}
}
], ],
{ cancelable: false } {cancelable: false}
) )
}) })
} }
} }
} }
const separator = StyleSheet.create({ const separator = StyleSheet.create({
line: { line: {
height: 1.5, height: 1.5,

View File

@ -16,6 +16,7 @@ import {
StyleSheet, StyleSheet,
Text, Text,
TouchableOpacity, TouchableOpacity,
ActivityIndicator,
View View
} from 'react-native'; } from 'react-native';
import DeviceInfo from 'react-native-device-info'; import DeviceInfo from 'react-native-device-info';

View File

@ -271,8 +271,7 @@ export default class OptionsMenu extends Component {
|| item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent' || item === 'envoieCashVersAutreWalletAgent' || item === 'retraitCarteVersCashUser' || item === 'envoiCashVersCashAgent' || item === 'envoieCashVersCashAgent'
|| item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe' || item === 'envoieCashVersCarteAgent' || item === 'modifyIdentificationUser' || item === 'createGroupNanoCredit' || item === 'groupNanoCredit' || item === 'demandeValidationGroupe'
|| item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent' || item === 'adhererGroupNanoCredit' || item === 'myNanoCreditGroup' || item === 'askNanoCredit' || item === 'refundNanoCreditUser' || item === 'cautionNanoCreditAgent'
|| item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser' || item === 'epargnerArgentUser' || item === 'askNanoCredit' || item === 'casserEpargneUser' || item === 'envoieWalletToBankAgent' || item === 'reattachAccountUser') {
|| item === 'acceptPrestationAgent' || item === 'souscrireAssuranceUser' || item === 'askPrestationUser') {
return null return null
} else { } else {
const color = this.state.currentId === item.id ? theme.accent : "grey" const color = this.state.currentId === item.id ? theme.accent : "grey"

View File

@ -37,13 +37,13 @@ import * as Utils from '../../utils/DeviceUtils';
import {IlinkEmitter} from "../../utils/events"; import {IlinkEmitter} from "../../utils/events";
import { import {
cutString, cutString,
cutStringWithoutDot, cutStringWithoutDot, displayToast,
displayTransactionType, displayTransactionType,
isEmptyObject, isEmptyObject,
isIlinkWorldWallet, isIlinkWorldWallet,
optionDepotScreen, optionDepotScreen,
optionIdentificationScreen, optionIdentificationScreen,
optionNanoCreditAgentScreen, optionNanoSanteAgent, optionNanoSanteUser, optionNanoCreditAgentScreen,
optionPaiementFacture, optionPaiementFacture,
optionRetraitScreen, optionRetraitScreen,
transactionHistoryIlinkLabel transactionHistoryIlinkLabel
@ -1445,14 +1445,18 @@ class WalletDetail extends Component {
<TouchableOpacity style={styles.contain} <TouchableOpacity style={styles.contain}
onPress={ onPress={
() => { () => {
this.props.navigation.push(route.walletOptionSelect, { if (wallet.has_nano_credit === 1) {
optionSelect: optionNanoCreditAgentScreen, this.props.navigation.push(route.walletOptionSelect, {
wallet, optionSelect: optionNanoCreditAgentScreen,
lottie: { wallet,
source: require("./../../datas/json/cedit-cards.json"), lottie: {
loop: true source: require("./../../datas/json/cedit-cards.json"),
} loop: true
}); }
});
} else {
displayToast(I18n.t('NANO_CREDIT_DISABLE'));
}
} }
} }
activeOpacity={0.9}> activeOpacity={0.9}>
@ -1478,14 +1482,6 @@ class WalletDetail extends Component {
<View style={[styles.containerTouch]}> <View style={[styles.containerTouch]}>
<TouchableOpacity style={styles.contain} <TouchableOpacity style={styles.contain}
onPress={() => { 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}> activeOpacity={0.9}>
<Icon name='heart-multiple' <Icon name='heart-multiple'

View File

@ -44,17 +44,18 @@ import {connect} from 'react-redux';
import {bindActionCreators} from 'redux'; import {bindActionCreators} from 'redux';
import { import {
cutString, cutString,
cutStringWithoutDot, cutStringWithoutDot, displayToast,
isEmptyObject, isEmptyObject,
optionDepotUserScreen, optionDepotUserScreen,
optionIdentificationUserScreen, optionIdentificationUserScreen,
optionLinkAccountUserScreen, optionLinkAccountUserScreen, optionNanoCreditAgentScreen,
optionNanoCreditScreen, optionNanoSanteUser, optionNanoCreditScreen,
optionPaiementFacture, optionPaiementFacture,
optionRetraitUserScreen, optionRetraitUserScreen,
transactionHistoryIlinkLabel transactionHistoryIlinkLabel
} from '../../utils/UtilsFunction'; } from '../../utils/UtilsFunction';
import {readUser} from '../../webservice/AuthApi'; import {readUser} from '../../webservice/AuthApi';
import LottieView from "lottie-react-native";
let moment = require('moment-timezone'); let moment = require('moment-timezone');
@ -536,15 +537,19 @@ class WalletDetailUser extends Component {
<TouchableOpacity style={styles.contain} <TouchableOpacity style={styles.contain}
onPress={ onPress={
() => { () => {
this.props.navigation.push(route.walletOptionSelect, { if (this.props.result.response.has_nano_credit === 1) {
optionSelect: optionNanoCreditScreen, this.props.navigation.push(route.walletOptionSelect, {
wallet, optionSelect: optionNanoCreditScreen,
lottie: { wallet,
source: require("./../../datas/json/cedit-cards.json"), lottie: {
loop: true source: require("./../../datas/json/cedit-cards.json"),
}, loop: true
isNanoCredit: true },
}); isNanoCredit: true
});
} else {
displayToast(I18n.t('NANO_CREDIT_DISABLE'));
}
} }
} }
activeOpacity={0.9}> activeOpacity={0.9}>
@ -574,26 +579,16 @@ class WalletDetailUser extends Component {
<View style={[styles.containerTouch]}> <View style={[styles.containerTouch]}>
<TouchableOpacity style={styles.contain} <TouchableOpacity style={styles.contain}
onPress={() => { 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}> activeOpacity={0.9}>
<Icon name='heart-multiple' <Icon name='heart-multiple'
color={Color.primaryColor} color={Color.primaryColor}
size={30} size={30}
style={styles.imageBanner}/> style={styles.imageBanner}/>
<View style={[styles.content]}> <View style={[styles.content]}>
<View style={{paddingTop: 20,}}> <View style={{paddingTop: 20,}}>
<Text <Text style={[Typography.headline, Typography.semibold]}>
style={[Typography.headline, Typography.semibold]}>
{I18n.t('NANO_SANTE')} {I18n.t('NANO_SANTE')}
</Text> </Text>
</View> </View>
@ -983,7 +978,7 @@ class WalletDetailUser extends Component {
render() { render() {
console.warn("Wallet Detail user Props", this.props);
return ( return (
<> <>
{this.state.displayModalHistory && this.renderModalHistoryDetail()} {this.state.displayModalHistory && this.renderModalHistoryDetail()}
@ -1006,8 +1001,17 @@ class WalletDetailUser extends Component {
: :
this.renderDetailWallet(this.props.result.response) this.renderDetailWallet(this.props.result.response)
: : this.props.error !== null &&
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: { tabbar: {
height: 40 height: 40
}, },
lottie: {
width: 248,
height: 248
},
imgBanner: { imgBanner: {
width: '100%', width: '100%',
height: 250, height: 250,
@ -1135,7 +1143,6 @@ const styles = StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
flex: 1, flex: 1,
paddingTop: 10, paddingTop: 10,
paddingTop: 10,
paddingLeft: 10, paddingLeft: 10,
paddingRight: 10, paddingRight: 10,
}, },

View File

@ -223,14 +223,6 @@ class WalletOptionSelect extends Component {
onGoBack: () => this.props.navigation.state.params.onGoBack(), onGoBack: () => this.props.navigation.state.params.onGoBack(),
}); });
break; 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: default:
this.props.navigation.push(optionsParam.screen); this.props.navigation.push(optionsParam.screen);
break; break;
@ -282,7 +274,7 @@ class WalletOptionSelect extends Component {
displayToast(I18n.t('ALREADY_IDENTIFIED')); displayToast(I18n.t('ALREADY_IDENTIFIED'));
else else
this.redirectToRoute(options); this.redirectToRoute(options);
} else if (_.isEqual(options.screen, 'modifyIdentificationUser') || _.isEqual(options.screen, 'askPrestationUser')) { } else if (_.isEqual(options.screen, 'modifyIdentificationUser')) {
if (!this.state.isIdentified) if (!this.state.isIdentified)
displayToast(I18n.t('NOT_YET_IDENTIFY')); displayToast(I18n.t('NOT_YET_IDENTIFY'));
else else

View File

@ -791,84 +791,3 @@ export const optionPaiementFacture = {
}, },
] ]
} }
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
}
]
}

View File

@ -164,6 +164,7 @@
"DEPOSIT_TO_BANK": "Your Wallet to bank", "DEPOSIT_TO_BANK": "Your Wallet to bank",
"NANO_CREDIT": "Nano credit", "NANO_CREDIT": "Nano credit",
"NANO_CREDIT_LIST": "Nano credit list", "NANO_CREDIT_LIST": "Nano credit list",
"NANO_CREDIT_DISABLE": "Nano credit disable",
"SAVINGS_LIST": "Savings list", "SAVINGS_LIST": "Savings list",
"NO_NANO_CREDIT": "No nano credit demand", "NO_NANO_CREDIT": "No nano credit demand",
"NO_SAVINGS": "No savings", "NO_SAVINGS": "No savings",
@ -337,6 +338,9 @@
"SUCCESS_IDENTIFICATION": "Identification successful", "SUCCESS_IDENTIFICATION": "Identification successful",
"REFUSER_DEMANDE": "Reject the request", "REFUSER_DEMANDE": "Reject the request",
"ACCEPTER_DEMANDE": "Accept the request", "ACCEPTER_DEMANDE": "Accept the request",
"DEMAND_STATE": "Demand state",
"CANCEL_ON": "Cancel on",
"CANCEL_BY_HYPERVISOR": "Cancel by hypervisor",
"REFUSED": "Refuse", "REFUSED": "Refuse",
"YOUR_THERE": "You are here", "YOUR_THERE": "You are here",
"SUCCESS_TRANSFER_COMMISSION": "Transfert effectué", "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", "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!", "TITLE_HELP_SOON": "Help not available!",
"YOUR_NETWORK": "Select your network", "YOUR_NETWORK": "Select your network",
"HELP_SOON": "A tutorial helping you in understanding the features of the application will soon be available.", "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"
} }

View File

@ -171,6 +171,7 @@
"DEPOSIT_TO_BANK": "Wallet vers banque", "DEPOSIT_TO_BANK": "Wallet vers banque",
"NANO_CREDIT": "Nano crédit", "NANO_CREDIT": "Nano crédit",
"NANO_CREDIT_LIST": "Liste des nano crédit", "NANO_CREDIT_LIST": "Liste des nano crédit",
"NANO_CREDIT_DISABLE": "Nano crédit désactivé",
"SAVINGS_LIST": "Liste des épargnes", "SAVINGS_LIST": "Liste des épargnes",
"NO_NANO_CREDIT": "Aucune demande de nano crédit", "NO_NANO_CREDIT": "Aucune demande de nano crédit",
"NO_SAVINGS": "Aucune épargne", "NO_SAVINGS": "Aucune épargne",
@ -345,6 +346,9 @@
"REFUSER_DEMANDE": "Refuser la demande", "REFUSER_DEMANDE": "Refuser la demande",
"REFUSED": "Refusé", "REFUSED": "Refusé",
"ACCEPTER_DEMANDE": "Accepter la demande", "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", "SUCCESS_TRANSFER_COMMISSION": "Transfert de commission",
"YOUR_THERE": "Vous êtes ici", "YOUR_THERE": "Vous êtes ici",
"FILTER": "Filtrer", "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", "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 !", "TITLE_HELP_SOON": "Aide non disponible !",
"YOUR_NETWORK": "Sélectionner votre réseau", "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.", "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"
} }

View File

@ -1,255 +1,314 @@
import React, { Component } from 'react'; import React from 'react';
var DBEvents = require('react-native-db-models').DBEvents; import axios from "axios";
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
import { db } from './persistences/db'; import {db} from './persistences/db';
import { configActionUrl, isDebugMode, adhesionUrl, locationActionUrl, memberActionUrl, networkActionUrl, demandeActionUrl } from "./IlinkConstants" import {
adhesionUrl,
configActionUrl,
isDebugMode,
locationActionUrl,
memberActionUrl,
networkActionUrl
} from "./IlinkConstants"
var DBEvents = require('react-native-db-models').DBEvents;
import Configuration from './persistences/Configuration';
var serializeJSON = function (data) { var serializeJSON = function (data) {
return Object.keys(data).map(function (keyName) { return Object.keys(data).map(function (keyName) {
return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName]) return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName])
}).join('&'); }).join('&');
}; };
export const getCodeInformation = (code) => { export const getCodeInformation = (code) => {
var data = { var data = {
"tag": 'member', "type": "agen_info_code", "code": code, "tag": 'member', "type": "agen_info_code", "code": code,
"lang": I18n.currentLocale() "lang": I18n.currentLocale()
}; };
return queryData(data, memberActionUrl) return queryData(data, memberActionUrl)
} }
export const getPubActiveObject = (idcpuntry) => { 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 = () => { export const getPasObject = () => {
return queryData({ "tag": "get_pas" }, configActionUrl); return queryData({"tag": "get_pas"}, configActionUrl);
} }
function queryAuth(data) { function queryAuth(data) {
return timeout(50000, queryData(data, adhesionUrl)) return timeout(50000, queryData(data, adhesionUrl))
} }
async function queryData(data, url) { async function queryData(data, url) {
console.warn("REQUEST BODY", JSON.stringify(data)); console.warn("REQUEST URL", url);
data["lang"] = I18n.currentLocale(); console.warn("REQUEST BODY", JSON.stringify(data));
data["isTest"] = isDebugMode data["lang"] = I18n.currentLocale();
let response = await fetch(url, { data["isTest"] = isDebugMode
method: 'POST', /* await axios({
headers: { url,
Accept: 'application/json', method: 'POST',
'Content-Type': 'application/json', headers: {
}, Accept: 'application/json',
body: JSON.stringify(data), 'Content-Type': 'application/json',
}); },
let responseJson = null; data: JSON.stringify(data),
let responseText = await response.text() }).then(serverResponse => {
try { console.warn("SERVER RESPONSE SUCCESS", serverResponse);
console.warn("SERVER RESPONSE SUCCESS",responseText); return serverResponse.data;
responseJson = JSON.parse(responseText) }).catch(error => {
} catch (e) { console.warn("SERVER RESPONSE ERROR", error);
console.warn("SERVER RESPONSE ERROR",responseText); return {"error": "error", "error_msg": error}
return { "error": "error", "error_msg": responseText } });*/
}
return responseJson; 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) { function timeout(ms, promise) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
setTimeout(function () { setTimeout(function () {
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE"))) reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
}, ms) }, ms)
promise.then(resolve, reject) promise.then(resolve, reject)
}) })
} }
export const validateUser = (user) => { export const validateUser = (user) => {
var data = { var data = {
"tag": 'member', "type": "valider_simple", "phone": user.phone, "tag": 'member', "type": "valider_simple", "phone": user.phone,
"lang": I18n.currentLocale() "lang": I18n.currentLocale()
}; };
return queryData(data, memberActionUrl) return queryData(data, memberActionUrl)
}; };
export const updatePosition = async (longitude, latitude) => { export const updatePosition = async (longitude, latitude) => {
const user = await readUser() const user = await readUser()
const data = { 'tag': 'member', 'type': 'update_position', "agentId": user['agentId'], "longitude": longitude, latitude: latitude } const data = {
return queryData(data, memberActionUrl) 'tag': 'member',
'type': 'update_position',
"agentId": user['agentId'],
"longitude": longitude,
latitude: latitude
}
return queryData(data, memberActionUrl)
} }
export const valifateAgent = (user, info) => { export const valifateAgent = (user, info) => {
var data = info; var data = info;
if (data === null) data = {} if (data === null) data = {}
data["tag"] = "member"; data["tag"] = "member";
data['type'] = "validate_agent"; data['type'] = "validate_agent";
data["phone"] = user.phone; data["phone"] = user.phone;
data['code_validation'] = user.validation_code; data['code_validation'] = user.validation_code;
if (user.category === "super" && (info === null || (info !== null && (info.nbre_code === undefined || info.nbr_code === null)))) { if (user.category === "super" && (info === null || (info !== null && (info.nbre_code === undefined || info.nbr_code === null)))) {
data["nbre_code"] = 10; data["nbre_code"] = 10;
data["nbre_code_superviseur"] = 0 data["nbre_code_superviseur"] = 0
} else if (info === null || (info !== null && (info.nbre_code === undefined || info.nbre_code === null))) { } else if (info === null || (info !== null && (info.nbre_code === undefined || info.nbre_code === null))) {
data["nbre_code"] = 0; data["nbre_code"] = 0;
data["nbre_code_superviseur"] = 0 data["nbre_code_superviseur"] = 0
} }
console.log(data); console.log(data);
return queryData(data, memberActionUrl) return queryData(data, memberActionUrl)
} }
export const disconnect = () => { export const disconnect = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
readBrutUser().then((user) => { readBrutUser().then((user) => {
db.remove({ "_id": user._id }, { multi: true }, (error, numRemoved) => { db.remove({"_id": user._id}, {multi: true}, (error, numRemoved) => {
if (error !== null) { if (error !== null) {
reject(error) reject(error)
} else { } else {
console.log(numRemoved) console.log(numRemoved)
if (numRemoved > 0) { if (numRemoved > 0) {
resolve() resolve()
}
} }
}) }
}) })
}) })
})
} }
export const login = (phone: String, password: String, type: Number) => { export const login = (phone: String, password: String, type: Number) => {
console.log("CURRENT_LANG", I18n.currentLocale()); console.log("CURRENT_LANG", I18n.currentLocale());
var data = { var data = {
tag: type === 0 ? "login_user" : "login_agent", tag: type === 0 ? "login_user" : "login_agent",
phone: phone, phone: phone,
password: password, password: password,
lang: I18n.currentLocale() lang: I18n.currentLocale()
}; };
return queryAuth(data); return queryAuth(data);
}; };
export const reinitpassword = ($phone, $type) => { export const reinitpassword = ($phone, $type) => {
var data = { "tag": "forgot_pass", "number": $phone, "typeaccount": $type, "lang": I18n.currentLocale() }; var data = {"tag": "forgot_pass", "number": $phone, "typeaccount": $type, "lang": I18n.currentLocale()};
return queryAuth(data) return queryAuth(data)
} }
export const updateUserData = async (data) => { export const updateUserData = async (data) => {
const user = await readUser() const user = await readUser()
user.longitude = data.longitude user.longitude = data.longitude
user.latitude = data.latitude user.latitude = data.latitude
db.update({ "user": { $exists: true } }, { user: user }, {}, function (err, numReplaced) { db.update({"user": {$exists: true}}, {user: user}, {}, function (err, numReplaced) {
console.warn(err, numReplaced) console.warn(err, numReplaced)
}) })
/* new Promise((resolve,reject)=>{ /* new Promise((resolve,reject)=>{
readBrutUser().then((user)=>{ readBrutUser().then((user)=>{
db.remove({"_id": user._id},{multi:true},(error,numRemoved)=>{ db.remove({"_id": user._id},{multi:true},(error,numRemoved)=>{
if(error!==null){ if(error!==null){
reject(error) reject(error)
}else { }else {
let muser=user let muser=user
db.insert(muser, function(err){ db.insert(muser, function(err){
if(err!==null) { if(err!==null) {
console.log("error when save user") console.log("error when save user")
console.log(err) console.log(err)
} }
}) })
console.log(numRemoved) console.log(numRemoved)
if (numRemoved > 0) { if (numRemoved > 0) {
resolve() resolve()
} }
} }
}) })
}) })
})*/ })*/
} }
export const saveNewuser = (muser) => { export const saveNewuser = (muser) => {
let user = { let user = {
user: muser user: muser
} }
db.insert(user, function (err) { db.insert(user, function (err) {
if (err !== null) { if (err !== null) {
console.log("error when save user") console.log("error when save user")
console.log(err) console.log(err)
} }
}) })
} }
const readBrutUser = () => { const readBrutUser = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.findOne({ "user": { $exists: true } }, (err, result) => { db.findOne({"user": {$exists: true}}, (err, result) => {
if (err !== null || result === null || result.user === undefined) { if (err !== null || result === null || result.user === undefined) {
resolve(null)
} else {
if (result.user === null) {
resolve(null) resolve(null)
} else { } else
if (result.user === null) { resolve(null) } resolve(result)
else }
resolve(result) ;
}; })
}) });
});
} }
export const readUser = () => { export const readUser = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.findOne({ "user": { $exists: true } }, async (err, result) => { db.findOne({"user": {$exists: true}}, async (err, result) => {
if (err !== null || result === null || result.user === undefined) { if (err !== null || result === null || result.user === undefined) {
resolve(null)
} else {
if (result.user === null) {
resolve(null) resolve(null)
} else { } else {
if (result.user === null) {
resolve(null)
}
else {
resolve(result.user) resolve(result.user)
} }
} }
}) })
}); });
} }
export const createGeolocatedAccount = (user) => { export const createGeolocatedAccount = (user) => {
return queryData(user, memberActionUrl) return queryData(user, memberActionUrl)
} }
export const createUserAccount = (user) => { export const createUserAccount = (user) => {
return queryData(user, memberActionUrl) return queryData(user, memberActionUrl)
} }
export const acceptDemandAdhesion = (data) => { 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) => { 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 () => { export const listDemandAdhesion = async () => {
const user = await readUser(); const user = await readUser();
const items = await queryData({ "type": "list_demande_adhesion", "tag": "member", "codeparrain": user.code_membre }, memberActionUrl) const items = await queryData({
return items; "type": "list_demande_adhesion",
"tag": "member",
"codeparrain": user.code_membre
}, memberActionUrl)
return items;
} }
export const categoryChild = async (code) => { 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 () => { export const getListCountriesActive = async () => {
const countries = await queryData({ "tag": "avail_countries" }, networkActionUrl); const countries = await queryData({"tag": "avail_countries"}, networkActionUrl);
return countries; return countries;
} }
export const getCountryNetwork = (country) => { export const getCountryNetwork = (country) => {
console.warn(country) console.warn(country)
return queryData({ "tag": 'listnetworkscountryindicatif', 'indicatif': country }, networkActionUrl) return queryData({"tag": 'listnetworkscountryindicatif', 'indicatif': country}, networkActionUrl)
} }
export const getTownInformationName = (town) => { 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) => { export const generateAgentGeo = async (newPhone) => {
const user = await readUser(); const user = await readUser();
const items = await queryData({ "type": "generateNetworkAgentForGeo", "tag": "member", "code_parrain": user.code_membre, 'phone': newPhone }, memberActionUrl) const items = await queryData({
return items; "type": "generateNetworkAgentForGeo",
"tag": "member",
"code_parrain": user.code_membre,
'phone': newPhone
}, memberActionUrl)
return items;
} }
export const AssignAgentGeo = async (codeValidation, phone) => { export const AssignAgentGeo = async (codeValidation, phone) => {
const user = await readUser(); const user = await readUser();
const items = await queryData({ "type": "assignNetworkAgentToGeo", "tag": "member", "agentId": user.agentId, 'code_parrain': codeValidation, "phone": phone }, memberActionUrl) const items = await queryData({
return items; "type": "assignNetworkAgentToGeo",
"tag": "member",
"agentId": user.agentId,
'code_parrain': codeValidation,
"phone": phone
}, memberActionUrl)
return items;
} }

View File

@ -10,11 +10,6 @@ export const isDebugMode = false
export const baseUrl = "http://test.ilink-app.com:8080/mobilebackend"; export const baseUrl = "http://test.ilink-app.com:8080/mobilebackend";
export const testBaseUrl = "https://test.ilink-app.com"; 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 baseUrl = "https://preprod.ilink-app.com:8080/mobilebackend";
export const testBaseUrl = "https://preprod.ilink-app.com"; */ export const testBaseUrl = "https://preprod.ilink-app.com"; */

View File

@ -1,93 +1,99 @@
import React, {Component} from 'react';
import React, { Component } from 'react';
var db = require('./persistences/db.js'); var db = require('./persistences/db.js');
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
import { readUser } from './AuthApi' import {readUser} from './AuthApi'
import { isDebugMode, MARKER_URL } from "./IlinkConstants"; import {isDebugMode, MARKER_URL} from "./IlinkConstants";
let GEOCODDING_URL = "https://maps.googleapis.com/maps/api/geocode/json" let GEOCODDING_URL = "https://ilink-app.com:8080/geocode";
let API_KEY = "AIzaSyAYOEp-Pckvc3TwOIulCICokKgmp14rGHI" let API_KEY = "AIzaSyBUQoQYY31-S3DPp7aRRIAjEda8T2pZvJE"
export const getLocalMarkers = () => { export const getLocalMarkers = () => {
return db.markers.get_all() return db.markers.get_all()
} }
export const getMakersFrom = function (country) { export const getMakersFrom = function (country) {
let tag = { tag: 'location', type: 'all', country: country } let tag = {tag: 'location', type: 'all', country: country}
return timeout(15000, queryMap(tag)) return timeout(15000, queryMap(tag))
} }
function timeout(ms, promise) { function timeout(ms, promise) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
setTimeout(function () { setTimeout(function () {
reject(new Error(I18n.t("TEXT_NETWORK_UNABLE"))) reject(new Error(I18n.t("TEXT_NETWORK_UNABLE")))
}, ms) }, ms)
promise.then(resolve, reject) promise.then(resolve, reject)
}) })
} }
export const loadMarkers = (position, reseau, distance, page) => { export const loadMarkers = (position, reseau, distance, page) => {
return readUser().then((users) => { return readUser().then((users) => {
let user = users; let user = users;
if (user !== undefined) { if (user !== undefined) {
let tag = { let tag = {
tag: 'location', type: 'around', tag: 'location', type: 'around',
page: page, page: page,
id: user.id, position: position, network: reseau, distance: distance id: user.id, position: position, network: reseau, distance: distance
} }
return queryMap(tag) return queryMap(tag)
} }
}) })
} }
export const loadGroupeAgent = (member_code) => { export const loadGroupeAgent = (member_code) => {
let data = { tag: 'location', type: 'all_network', codeparrain: member_code } let data = {tag: 'location', type: 'all_network', codeparrain: member_code}
return queryMap(data) return queryMap(data)
} }
export const loadNetwork = (network, userid) => { export const loadNetwork = (network, userid) => {
let data = { tag: 'location', type: "all_network_point", id: userid, network: network } let data = {tag: 'location', type: "all_network_point", id: userid, network: network}
return queryMap(data) return queryMap(data)
} }
export const getPositionInformation = async (position) => { export const getPositionInformation = async (position) => {
let url = GEOCODDING_URL.concat('?latlng=' + position.latitude + "," + position.longitude + '&key=' + API_KEY); let url = GEOCODDING_URL.concat('?latitude=' + position.latitude + "&longitude=" + position.longitude);
const data = fetch(url, { const data = fetch(url, {
method: 'GET', method: 'GET',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => .then((responseJson) =>
responseJson responseJson
).catch((error) => { ).catch((error) => {
console.log("error get position") console.log("error get position")
console.log(error) console.log(error)
}); });
console.warn("freud", data); console.warn("freud", data);
return data; return data;
} }
const queryMap = async (data) => { const queryMap = async (data) => {
data['lang'] = I18n.currentLocale() data['lang'] = I18n.currentLocale()
data["test"] = isDebugMode data["test"] = isDebugMode;
let response = await fetch(MARKER_URL, { console.warn("REQUEST URL QUERY MAP", MARKER_URL);
method: 'POST', console.warn("REQUEST BODY QUERY MAP", JSON.stringify(data));
headers: { let response = await fetch(MARKER_URL, {
Accept: 'application/json', method: 'POST',
'Content-Type': 'application/json', headers: {
}, Accept: 'application/json',
body: JSON.stringify(data), 'Content-Type': 'application/json',
},
body: JSON.stringify(data),
}); });
let responseText = await response.text() let responseText = await response.text()
//console.log("response= " + responseText) //console.log("response= " + responseText)
try { try {
let responseJson = JSON.parse(responseText); let responseJson = JSON.parse(responseText);
console.warn("JSON RESPONSE", responseJson); console.warn("JSON RESPONSE", responseJson);
return responseJson; console.warn("SERVER RESPONSE SUCCESS", responseText);
} catch (e) { return responseJson;
//console.log("erreur=" + responseText) } catch (e) {
//console.log(response) //console.log("erreur=" + responseText)
throw new Error("Erreur lors de la conversion en json") //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")
}
throw new Error("Erreur lors de la conversion en json")
} }

View File

@ -48,7 +48,7 @@ import axios from "axios";
import I18n from 'react-native-i18n' import I18n from 'react-native-i18n'
export const getWalletActivated = (userID) => { export const getWalletActivated = (userID) => {
console.log("URL REQUEST", `${walletActionUrl}/${userID}/activated`);
const auth = store.getState().authKeyReducer; const auth = store.getState().authKeyReducer;
const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : ''; const authKey = auth !== null ? `${auth.authKey.token_type} ${auth.authKey.access_token}` : '';

View File

@ -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})
})
}
}