Browse Source

NET INFO

merge-requests/298/merge
Vitalik 2 years ago
parent
commit
179e4c435d
  1. 4
      ios/taskme.xcodeproj/project.pbxproj
  2. 2
      ios/taskme/Info.plist
  3. 337
      package-lock.json
  4. 3
      package.json
  5. 2
      src/App.tsx
  6. 9
      src/api/account/requests.ts
  7. 6
      src/api/account/responses.interfaces.ts
  8. 16
      src/api/tasks/requests.interface.ts
  9. 7
      src/api/tasks/requests.ts
  10. 19
      src/api/taxonomies/requests.ts
  11. 23
      src/api/users/requests.ts
  12. 4
      src/config/index.ts
  13. 8
      src/modules/executors/hooks/use-fetch-executors.hook.ts
  14. 15
      src/modules/groups/hooks/use-fetch-groups-with-tasks-count.hook.ts
  15. 11
      src/modules/home/screens/home.screen.tsx
  16. 13
      src/modules/home/smart-components/my-tasks-list.smart-component.tsx
  17. 3
      src/modules/root/components/index.ts
  18. 37
      src/modules/root/components/net-status.component.tsx
  19. 3
      src/modules/root/hooks/index.ts
  20. 47
      src/modules/root/hooks/use-net-connect.hook.ts
  21. 55
      src/modules/root/index.tsx
  22. 14
      src/modules/tasks/config/selected-tasks-menu-options.config.ts
  23. 2
      src/modules/tasks/hooks/use-fetch-task-executors.hook.ts
  24. 8
      src/modules/tasks/hooks/use-fetch-tasks-by-filter.hook.ts
  25. 21
      src/modules/tasks/hooks/use-task-actions.hook.ts
  26. 8
      src/modules/tasks/hooks/use-task-filter.hook.ts
  27. 4
      src/modules/tasks/screens/my-tasks.screen.tsx
  28. 19
      src/services/domain/account.service.ts
  29. 27
      src/services/domain/auth.service.ts
  30. 21
      src/services/domain/permissions.service.ts
  31. 8
      src/services/domain/tasks.service.ts
  32. 2
      src/services/domain/taxonomies.service.ts
  33. 1
      src/shared/hooks/use-flat-list.hook.ts
  34. 88
      yarn.lock

4
ios/taskme.xcodeproj/project.pbxproj

@ -764,7 +764,7 @@ @@ -764,7 +764,7 @@
CODE_SIGN_ENTITLEMENTS = taskme/taskme.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 100;
CURRENT_PROJECT_VERSION = 101;
DEVELOPMENT_TEAM = HQ3J3TDPR2;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
@ -802,7 +802,7 @@ @@ -802,7 +802,7 @@
CODE_SIGN_ENTITLEMENTS = taskme/taskme.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 100;
CURRENT_PROJECT_VERSION = 101;
DEVELOPMENT_TEAM = HQ3J3TDPR2;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";

2
ios/taskme/Info.plist

@ -34,6 +34,8 @@ @@ -34,6 +34,8 @@
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>

337
package-lock.json generated

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
"@react-native-async-storage/async-storage": "^1.15.8",
"@react-native-community/cameraroll": "^4.1.2",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/netinfo": "^6.2.1",
"@react-native-community/netinfo": "^9.0.0",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-picker/picker": "^1.16.6",
"@react-navigation/bottom-tabs": "^6.0.5",
@ -110,6 +110,7 @@ @@ -110,6 +110,7 @@
"icon-set-creator": "^0.1.3",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"patch-package": "^6.4.7",
"react-native-svg-app-icon": "^0.5.0",
"react-native-svg-transformer": "^0.14.3",
"react-test-renderer": "17.0.1"
@ -3006,9 +3007,9 @@ @@ -3006,9 +3007,9 @@
"dev": true
},
"node_modules/@react-native-community/netinfo": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-6.2.1.tgz",
"integrity": "sha512-742sh+NMbPo59MaLRXBWwkT5K6HQPrmoS0pg0z9QuXshXieQIOTkqEEDMkQZS0QnS8fPFr8MxMPw/TAxH9b8Ig==",
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-9.0.0.tgz",
"integrity": "sha512-oodeVNdL0IT/Fv0cpL7CdxnnESNKiiAzf29yhvGSJBvuFmyHxvmYOtBIX27HWG9tQU8Yzeh+MyQcKBCNmkva+Q==",
"peerDependencies": {
"react-native": ">=0.59"
}
@ -3830,6 +3831,12 @@ @@ -3830,6 +3831,12 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@yarnpkg/lockfile": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz",
"integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==",
"dev": true
},
"node_modules/abab": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz",
@ -7095,6 +7102,15 @@ @@ -7095,6 +7102,15 @@
"node": ">=8"
}
},
"node_modules/find-yarn-workspace-root": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz",
"integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==",
"dev": true,
"dependencies": {
"micromatch": "^4.0.2"
}
},
"node_modules/flat-cache": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
@ -8205,7 +8221,6 @@ @@ -8205,7 +8221,6 @@
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"dev": true,
"optional": true,
"bin": {
"is-docker": "cli.js"
},
@ -9686,6 +9701,15 @@ @@ -9686,6 +9701,15 @@
"graceful-fs": "^4.1.9"
}
},
"node_modules/klaw-sync": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz",
"integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==",
"dev": true,
"dependencies": {
"graceful-fs": "^4.1.11"
}
},
"node_modules/kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@ -11368,6 +11392,149 @@ @@ -11368,6 +11392,149 @@
"node": ">=0.10.0"
}
},
"node_modules/patch-package": {
"version": "6.4.7",
"resolved": "https://registry.npmjs.org/patch-package/-/patch-package-6.4.7.tgz",
"integrity": "sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ==",
"dev": true,
"dependencies": {
"@yarnpkg/lockfile": "^1.1.0",
"chalk": "^2.4.2",
"cross-spawn": "^6.0.5",
"find-yarn-workspace-root": "^2.0.0",
"fs-extra": "^7.0.1",
"is-ci": "^2.0.0",
"klaw-sync": "^6.0.0",
"minimist": "^1.2.0",
"open": "^7.4.2",
"rimraf": "^2.6.3",
"semver": "^5.6.0",
"slash": "^2.0.0",
"tmp": "^0.0.33"
},
"bin": {
"patch-package": "index.js"
},
"engines": {
"npm": ">5"
}
},
"node_modules/patch-package/node_modules/ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"dependencies": {
"color-convert": "^1.9.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/patch-package/node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/patch-package/node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true,
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/patch-package/node_modules/fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
"dev": true,
"dependencies": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
},
"engines": {
"node": ">=6 <7 || >=8"
}
},
"node_modules/patch-package/node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"engines": {
"node": ">=4"
}
},
"node_modules/patch-package/node_modules/is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"dependencies": {
"is-docker": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/patch-package/node_modules/open": {
"version": "7.4.2",
"resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz",
"integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==",
"dev": true,
"dependencies": {
"is-docker": "^2.0.0",
"is-wsl": "^2.1.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/patch-package/node_modules/semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true,
"bin": {
"semver": "bin/semver"
}
},
"node_modules/patch-package/node_modules/slash": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz",
"integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==",
"dev": true,
"engines": {
"node": ">=6"
}
},
"node_modules/patch-package/node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/path": {
"version": "0.12.7",
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
@ -14787,6 +14954,18 @@ @@ -14787,6 +14954,18 @@
"resolved": "https://registry.npmjs.org/tinymask/-/tinymask-1.0.2.tgz",
"integrity": "sha1-3zd1qUCHsNPQVsJW6JI8AbfsCUE="
},
"node_modules/tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true,
"dependencies": {
"os-tmpdir": "~1.0.2"
},
"engines": {
"node": ">=0.6.0"
}
},
"node_modules/tmpl": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
@ -17799,9 +17978,9 @@ @@ -17799,9 +17978,9 @@
"dev": true
},
"@react-native-community/netinfo": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-6.2.1.tgz",
"integrity": "sha512-742sh+NMbPo59MaLRXBWwkT5K6HQPrmoS0pg0z9QuXshXieQIOTkqEEDMkQZS0QnS8fPFr8MxMPw/TAxH9b8Ig==",
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-9.0.0.tgz",
"integrity": "sha512-oodeVNdL0IT/Fv0cpL7CdxnnESNKiiAzf29yhvGSJBvuFmyHxvmYOtBIX27HWG9tQU8Yzeh+MyQcKBCNmkva+Q==",
"requires": {}
},
"@react-native-community/push-notification-ios": {
@ -18441,6 +18620,12 @@ @@ -18441,6 +18620,12 @@
"eslint-visitor-keys": "^1.1.0"
}
},
"@yarnpkg/lockfile": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz",
"integrity": "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==",
"dev": true
},
"abab": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz",
@ -20970,6 +21155,15 @@ @@ -20970,6 +21155,15 @@
"path-exists": "^4.0.0"
}
},
"find-yarn-workspace-root": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz",
"integrity": "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ==",
"dev": true,
"requires": {
"micromatch": "^4.0.2"
}
},
"flat-cache": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
@ -21793,8 +21987,7 @@ @@ -21793,8 +21987,7 @@
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
"dev": true,
"optional": true
"dev": true
},
"is-extendable": {
"version": "0.1.1",
@ -22916,6 +23109,15 @@ @@ -22916,6 +23109,15 @@
"graceful-fs": "^4.1.9"
}
},
"klaw-sync": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz",
"integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.11"
}
},
"kleur": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
@ -24274,6 +24476,112 @@ @@ -24274,6 +24476,112 @@
"resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz",
"integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ="
},
"patch-package": {
"version": "6.4.7",
"resolved": "https://registry.npmjs.org/patch-package/-/patch-package-6.4.7.tgz",
"integrity": "sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ==",
"dev": true,
"requires": {
"@yarnpkg/lockfile": "^1.1.0",
"chalk": "^2.4.2",
"cross-spawn": "^6.0.5",
"find-yarn-workspace-root": "^2.0.0",
"fs-extra": "^7.0.1",
"is-ci": "^2.0.0",
"klaw-sync": "^6.0.0",
"minimist": "^1.2.0",
"open": "^7.4.2",
"rimraf": "^2.6.3",
"semver": "^5.6.0",
"slash": "^2.0.0",
"tmp": "^0.0.33"
},
"dependencies": {
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true
},
"fs-extra": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz",
"integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true
},
"is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
"dev": true,
"requires": {
"is-docker": "^2.0.0"
}
},
"open": {
"version": "7.4.2",
"resolved": "https://registry.npmjs.org/open/-/open-7.4.2.tgz",
"integrity": "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q==",
"dev": true,
"requires": {
"is-docker": "^2.0.0",
"is-wsl": "^2.1.1"
}
},
"semver": {
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
"dev": true
},
"slash": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz",
"integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==",
"dev": true
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
}
}
},
"path": {
"version": "0.12.7",
"resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
@ -26945,6 +27253,15 @@ @@ -26945,6 +27253,15 @@
"resolved": "https://registry.npmjs.org/tinymask/-/tinymask-1.0.2.tgz",
"integrity": "sha1-3zd1qUCHsNPQVsJW6JI8AbfsCUE="
},
"tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
"integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
"dev": true,
"requires": {
"os-tmpdir": "~1.0.2"
}
},
"tmpl": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",

3
package.json

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
"@react-native-async-storage/async-storage": "^1.15.8",
"@react-native-community/cameraroll": "^4.1.2",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/netinfo": "^6.2.1",
"@react-native-community/netinfo": "^9.0.0",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-picker/picker": "^1.16.6",
"@react-navigation/bottom-tabs": "^6.0.5",
@ -115,6 +115,7 @@ @@ -115,6 +115,7 @@
"icon-set-creator": "^0.1.3",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"patch-package": "^6.4.7",
"react-native-svg-app-icon": "^0.5.0",
"react-native-svg-transformer": "^0.14.3",
"react-test-renderer": "17.0.1"

2
src/App.tsx

@ -11,6 +11,8 @@ import { NetworkProvider } from 'react-native-offline' @@ -11,6 +11,8 @@ import { NetworkProvider } from 'react-native-offline'
import { ActionSheetProvider } from '@expo/react-native-action-sheet'
import 'react-native-gesture-handler'
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet'
import axios from 'axios'
import { fetchGroupsWithTasksCountReq } from './api'
LogBox.ignoreLogs(['Warning: ...', 'Require cycle: ...']) // Ignore log notification by message
LogBox.ignoreAllLogs() //Ignore all log notifications

9
src/api/account/requests.ts

@ -1,13 +1,20 @@ @@ -1,13 +1,20 @@
import { convertToFormData } from '@/shared/helpers/api.helpers'
import http from '../http.service'
import { ApiResponse } from '../http.types'
import { IFetchAccountResponse } from './responses.interfaces'
import {
IFetchAccountResponse,
IGetAccountCacheInfoResponse,
} from './responses.interfaces'
import { IUpdateAccountPayload } from './requests.interfaces'
export const fetchAccount = (): ApiResponse<IFetchAccountResponse> => {
return http.get<IFetchAccountResponse>('account', {})
}
export const fetchAccountCacheInfoReq = () => {
return http.get<IGetAccountCacheInfoResponse>('account/cache-info', {})
}
export const updateAvatarReq = (avatar: unknown) => {
return http.put<{ avatarUrl: string }>(
'account/avatar',

6
src/api/account/responses.interfaces.ts

@ -1,3 +1,9 @@ @@ -1,3 +1,9 @@
import { IUser } from '@/shared'
export interface IFetchAccountResponse extends IUser {}
export interface IGetAccountCacheInfoResponse {
accountV?: string
permissionsV?: string
}

16
src/api/tasks/requests.interface.ts

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
import { IRequestConfig } from "../http.service";
import { IRequestConfig } from '../http.service'
import { AxiosRequestConfig } from 'axios'
import { TaskStatus } from "@/shared";
import { TaskStatus } from '@/shared'
export interface ICreateTaskRequest {
name: string
description: string
@ -15,15 +15,19 @@ export interface ICreateTaskRequest { @@ -15,15 +15,19 @@ export interface ICreateTaskRequest {
}
export interface IChangeTaskExecutor {
taskIds: number[],
taskIds: number[]
executorId: number
}
export interface IReassignTask {
taskId: number,
export interface IReassignTasks {
tasksIds: number[]
executorsIds: number[]
}
export interface IReassingTasksResult {
result: Record<number, Record<number, string>>
}
export interface IMarkTasksAsDoneRequest {
taskIds: number[]
doneDate?: Date | string
@ -57,4 +61,4 @@ export interface IFetchTasksParams extends AxiosRequestConfig { @@ -57,4 +61,4 @@ export interface IFetchTasksParams extends AxiosRequestConfig {
startDateTo?: string | Date
searchString?: string
tasksIds?: (number | string)[]
}
}

7
src/api/tasks/requests.ts

@ -7,7 +7,8 @@ import { @@ -7,7 +7,8 @@ import {
ICreateTaskRequest,
IFetchTasksParams,
IMarkTasksAsDoneRequest,
IReassignTask,
IReassignTasks,
IReassingTasksResult,
IRemoveTasksFromFavorite,
IUpdateTaskRequest,
} from './requests.interface'
@ -51,8 +52,8 @@ export const fetchUserTasksReq = ( @@ -51,8 +52,8 @@ export const fetchUserTasksReq = (
// return http.put<ITaskPreview[]>('tasks/change-executor', data)
// }
export const reassignTaskReq = (data: IReassignTask) => {
return http.post<Record<number, number>>('tasks/reassign', data)
export const reassignTaskReq = (data: IReassignTasks) => {
return http.post<IReassingTasksResult>('tasks/reassign', data)
}
export const fetchGroupTasksReq = (

19
src/api/taxonomies/requests.ts

@ -24,6 +24,25 @@ export const fetchGroupsWithTasksCountReq = ( @@ -24,6 +24,25 @@ export const fetchGroupsWithTasksCountReq = (
)
}
// export const fetchGroupsWithTasksCountReq = async (
// params: Req.IFetchGroupsWithTasksCountParams = {
// params: { sortField: 'id', sort: 'DESC', limit: 10 },
// },
// ): ApiResponse<Res.IFetchGroupsWithTasksCountResponse> => {
// const response = await fetch(
// 'http://185.69.154.136:5000/app/taxonomies/groups-with-tasks-count?limit=30&page=1&withoutEmpty=true&sort=DESC&sortField=id',
// {
// headers: {
// accept: 'application/json, text/plain, */*',
// authorization:
// 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ5UE9VNlJpRTNvYUtkc3lsZ2FIeUhUQnRWSEplZmRSU0dJSWY1dzh1Wk5NTGtKYlRuclVIS1g0NUxpNm1lZmF6U0RIeTdQaz0iLCJpYXQiOjE2NTU4NDE5MzIsImV4cCI6MTY1NTg0MjI5Mn0.-ijpMegwlfSxrmNP08uno5_lhX_ndi3NTcnCAK9uzfo',
// },
// },
// )
// return
// }
export const createNewTaxonomyReason = (
params: Req.ICreateTaxonomyReason,
): ApiResponse<Res.ICreateTaxonomyReasonResponse> => {

23
src/api/users/requests.ts

@ -23,3 +23,26 @@ export const fetchTPermittedExecutorsReq = ( @@ -23,3 +23,26 @@ export const fetchTPermittedExecutorsReq = (
params,
)
}
// export const fetchTPermittedExecutorsReq = async (
// params: IRequestConfig = {
// params: { sortField: 'id', sort: 'DESC', limit: 5 },
// },
// ): ApiResponse<IFetchPermittedExecutorsResponse> => {
// const response = await fetch(
// 'http://185.69.154.136:5000/app/users/executors-by-permissions-to-read-tasks?limit=30&page=1&withoutEmpty=true&sort=DESC&sortField=id',
// {
// headers: {
// Accept: 'application/json',
// 'Content-Type': 'application/json',
// authorization:
// 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1Nnp4ODI2Z25IV2Z0TmRNV2hoWE1IeGp3WUM2dDUycGptUTNLOVJ6QWIxVmNXbmtGYk43blJxVG9Vby9lMGpYLzNrRFpoOD0iLCJpYXQiOjE2NTU4NDI5NjIsImV4cCI6MTY1NTg0MzMyMn0.59keffcjgOeSk9yJqNaWU5G29SoTqe3ajobb6FUX37w',
// },
// },
// )
// return {
// data: await response.json(),
// status: 200,
// } as any
// }

4
src/config/index.ts

@ -9,8 +9,8 @@ export const dynamicConfig = { @@ -9,8 +9,8 @@ export const dynamicConfig = {
// baseUrl: 'http://46.101.170.206:5000/app/',
// socketUrl: 'http://46.101.170.206:5000',
baseUrl: 'http://185.69.154.136:5000',
socketUrl: 'http://185.69.154.136:5000',
baseUrl: 'https://taskme-api.work-jetup.site',
socketUrl: 'https://taskme-api.work-jetup.site/',
oneSignalKey: '8b9066f5-8c3f-49f7-bef4-c5ab621f9d27',
}

8
src/modules/executors/hooks/use-fetch-executors.hook.ts

@ -3,6 +3,7 @@ import { IShortUser, useFlatList } from '@/shared' @@ -3,6 +3,7 @@ import { IShortUser, useFlatList } from '@/shared'
import { usersService } from '@/services/domain/users.service'
import { IPermittedExecutorResponse } from '@/api/users/responses.interface'
import { transformPermittedExecutors } from '@/api/users/transforms'
import { fetchTPermittedExecutorsReq } from '@/api'
export const useFetchPermittedExecutors = (
loadParams: { [key: string]: string | boolean },
@ -17,10 +18,9 @@ export const useFetchPermittedExecutors = ( @@ -17,10 +18,9 @@ export const useFetchPermittedExecutors = (
loadMore,
resetFlatList,
setLoadParams,
count
count,
} = useFlatList<IShortUser>({
fetchItems: params =>
usersService.fetchPermittedExecutors({ ...params }),
fetchItems: fetchTPermittedExecutorsReq,
needInit: true,
serrializatorItems: (_items: IPermittedExecutorResponse[]) =>
transformPermittedExecutors(_items),
@ -40,6 +40,6 @@ export const useFetchPermittedExecutors = ( @@ -40,6 +40,6 @@ export const useFetchPermittedExecutors = (
loadMore,
setSearchVal,
setLoadParams,
count
count,
}
}

15
src/modules/groups/hooks/use-fetch-groups-with-tasks-count.hook.ts

@ -1,12 +1,13 @@ @@ -1,12 +1,13 @@
import { useEffect, useState } from 'react'
import { ITaxonomyWithTasksCount, useFlatList } from '@/shared'
import { taxonomiesService } from '@/services/domain'
import { fetchGroupsWithTasksCountReq } from '@/api'
export const useFetchGroupsWithTasksCount = (
loadParams: { [key: string]: string | boolean },
limit: number,
) => {
const [searchString, setSearchVal] = useState<string>()
const [searchString, setSearchVal] = useState<string>(null)
const {
items: groups,
@ -15,14 +16,10 @@ export const useFetchGroupsWithTasksCount = ( @@ -15,14 +16,10 @@ export const useFetchGroupsWithTasksCount = (
loadMore,
resetFlatList,
setLoadParams,
count
count,
} = useFlatList<ITaxonomyWithTasksCount>({
fetchItems: params =>
taxonomiesService.fetchGroupsWithTasksCount({
...params,
limit: 30,
}),
needInit: false,
fetchItems: fetchGroupsWithTasksCountReq,
needInit: true,
loadParams,
limit: 30,
})
@ -39,6 +36,6 @@ export const useFetchGroupsWithTasksCount = ( @@ -39,6 +36,6 @@ export const useFetchGroupsWithTasksCount = (
loadMore,
setSearchVal,
setLoadParams,
count
count,
}
}

11
src/modules/home/screens/home.screen.tsx

@ -26,6 +26,7 @@ import { useTaskFilter } from '@/modules/tasks/hooks' @@ -26,6 +26,7 @@ import { useTaskFilter } from '@/modules/tasks/hooks'
import { HomeExecutorsBlock, HomeGroupsBlock } from '../atoms'
import { needRedirect } from '@/services/system/notification.service'
import { getTitleByCount } from '@/shared/helpers'
import { fetchTPermittedExecutorsReq } from '@/api'
interface IProps extends IRouteParams {}
@ -35,6 +36,7 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => { @@ -35,6 +36,7 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => {
const [searchValue, setValue] = useState<string>(null)
const [isOpenDrawer, setDrawer] = useState<boolean>(false)
const [tasksCount, setTasksCount] = useState(0)
const [alreadyToLoadTasks, setAlreadyToLoad] = useState(false)
const taskFilter = useTaskFilter({
onSubmit: () => {
@ -66,6 +68,14 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => { @@ -66,6 +68,14 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => {
5,
)
useEffect(() => {
if (respExecutors.isLoading && !alreadyToLoadTasks) {
setTimeout(() => {
setAlreadyToLoad(true)
}, 100)
}
}, [respExecutors.count])
useEffect(() => {
if (searchValue !== null) {
respExecutors.setLoadParams({ searchString: searchValue })
@ -194,6 +204,7 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => { @@ -194,6 +204,7 @@ export const HomeScreen: FC<IProps> = ({ navigation }) => {
<MyTasksListSmart
searchString={searchValue}
onLoaded={onTasksLoaded}
alreadyToLoad={alreadyToLoadTasks}
/>
</View>
</ScrollView>

13
src/modules/home/smart-components/my-tasks-list.smart-component.tsx

@ -25,16 +25,20 @@ import { @@ -25,16 +25,20 @@ import {
interface IProps {
searchString?: string
onLoaded?: (count: number) => void
alreadyToLoad?: boolean
}
export const MyTasksListSmart: FC<IProps> = props => {
export const MyTasksListSmart: FC<IProps> = ({
alreadyToLoad = true,
...props
}) => {
const nav = useNav()
const { styles } = useTheme(createStyles)
const { handlePressOneTaskAction } = useTaskActions()
const { selectedTasks, handleSelectTask, handleResetSelected } =
useTaskSelector()
const { styles } = useTheme(createStyles)
const {
items: myTasks,
isLoading,
@ -43,6 +47,7 @@ export const MyTasksListSmart: FC<IProps> = props => { @@ -43,6 +47,7 @@ export const MyTasksListSmart: FC<IProps> = props => {
count,
} = useFetchTasksByFilter({
limit: 5,
alreadyToLoad,
})
useEffect(() => {
@ -54,8 +59,6 @@ export const MyTasksListSmart: FC<IProps> = props => { @@ -54,8 +59,6 @@ export const MyTasksListSmart: FC<IProps> = props => {
setLoadParams({ searchString: props.searchString })
}, [props.searchString])
const { handlePressOneTaskAction } = useTaskActions()
const onPressTask = (task: ITaskPreview) => {
nav.navigate(RouteKey.TaskDetails, {
taskId: task.id,

3
src/modules/root/components/index.ts

@ -1 +1,2 @@ @@ -1 +1,2 @@
export * from './tab-bar.component'
export * from './net-status.component'
export * from './tab-bar.component'

37
src/modules/root/components/net-status.component.tsx

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
import { Txt, useTheme } from '@/shared'
import { PartialTheme } from '@/shared/themes/interfaces'
import React, { FC } from 'react'
import { StyleSheet, View } from 'react-native'
interface INetStatusProps {
status: 'online' | 'try' | 'loos'
}
export const NetStatus: FC<INetStatusProps> = ({ status }) => {
const { styles } = useTheme(createStyles)
console.log(status)
if (status === 'online') return null
return (
<View style={styles.container}>
{status === 'try' ? (
<Txt>Проблеми з мережею, перевірка підключення</Txt>
) : (
<Txt>З'єднання відсутні</Txt>
)}
</View>
)
}
const createStyles = (theme: PartialTheme) =>
StyleSheet.create({
container: {
position: 'absolute',
top: 0,
left: 0,
backgroundColor: '#000',
zIndex: 9999,
width: '100%',
height: 50,
},
})

3
src/modules/root/hooks/index.ts

@ -1 +1,2 @@ @@ -1 +1,2 @@
export * from './use-app-badge.hook'
export * from './use-app-badge.hook'
export * from './use-net-connect.hook'

47
src/modules/root/hooks/use-net-connect.hook.ts

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
import NetInfo, { useNetInfo } from '@react-native-community/netinfo'
import _ from 'lodash'
import { useEffect, useState } from 'react'
import { Alert } from 'react-native'
export const useNetConnect = () => {
const { isConnected } = useNetInfo()
const [checkCount, setCheckCount] = useState(0)
const [status, setStatus] = useState<'online' | 'try' | 'loos'>('online')
const internetConnectionHandler = () => {
if (!_.isBoolean(isConnected)) return
if (isConnected) setCheckCount(0)
else {
setCheckCount(checkCount + 1)
}
}
const checkConnect = async () => {
const state = await NetInfo.refresh()
if (state.isConnected) setCheckCount(0)
else setCheckCount(checkCount + 1)
}
useEffect(() => {
if (checkCount > 3) {
setStatus('loos')
} else if (checkCount > 0) {
setStatus('try')
setTimeout(() => {
checkConnect()
}, 100)
} else {
setStatus('online')
}
}, [checkCount])
useEffect(() => {
console.log('is connected')
internetConnectionHandler()
}, [isConnected])
return {
isConnected,
status,
}
}

55
src/modules/root/index.tsx

@ -1,10 +1,7 @@ @@ -1,10 +1,7 @@
import React, { FC, useEffect, useMemo } from 'react'
import React, { FC, useEffect, useMemo, useState } from 'react'
import { useSelector } from 'react-redux'
import { NavigationContainer } from '@react-navigation/native'
import {
selectActiveNavigationModule,
selectPrevActiveModule,
} from '@/store/shared'
import { selectActiveNavigationModule } from '@/store/shared'
import { ActionSheet, NavigationModuleKey } from '@/shared'
import {
AuthNavigationGroup,
@ -24,65 +21,36 @@ import { authService } from '@/services/domain' @@ -24,65 +21,36 @@ import { authService } from '@/services/domain'
import { ModalPickerSmartComponent } from './smart-components/modal-picker.smart-component'
import SplashScreen from 'react-native-splash-screen'
import { FinishTaskModal } from '../tasks/smart-components'
import {
navigationRef,
NavigationService,
} from '@/services/system/navigation.service'
import { useNetInfo } from '@react-native-community/netinfo'
import { navigationRef } from '@/services/system/navigation.service'
import { SelectTaxonomiesModalSmart } from '../taxonomies/smart-components'
import { SelectUserModalSmart } from '../users/smart-components'
import { LoadingScreen } from './screens'
import _ from 'lodash'
import { selectAccount } from '@/store/account'
import { useAppBadge } from './hooks'
import { useAppBadge, useNetConnect } from './hooks'
import { RecordAudioModalSmart } from '../media'
import { ChatSendImgModal } from '../chats/components'
import { NetStatus } from './components'
export const Navigation: FC = () => {
const activeModule = useSelector(selectActiveNavigationModule)
const prevActiveModule = useSelector(selectPrevActiveModule)
const account = useSelector(selectAccount)
const [isAppReady, setAppReady] = useState(false)
useAppBadge()
const { isConnected, status } = useNetConnect()
const { isConnected } = useNetInfo()
useAppBadge()
const handleAutoAuth = async () => {
try {
const start = new Date().getTime()
await authService.autoAuth()
const now = new Date().getTime() - start
if (now > 400) return SplashScreen.hide()
setTimeout(() => SplashScreen.hide(), 500 - now)
} catch (e) {
console.log(e)
SplashScreen.hide()
}
}
const internetConnectionHandler = () => {
try {
if (!_.isBoolean(isConnected)) return
if (isConnected === false) {
NavigationService.setModule(
NavigationModuleKey.NoInternetConnection,
)
} else if (
activeModule === NavigationModuleKey.NoInternetConnection &&
account
) {
NavigationService.setModule(prevActiveModule)
} else handleAutoAuth()
setAppReady(true)
} finally {
SplashScreen.hide()
}
}
useEffect(() => {
internetConnectionHandler()
SplashScreen.hide()
if (isConnected && !isAppReady) handleAutoAuth()
}, [isConnected])
const modules = {
@ -115,6 +83,7 @@ export const Navigation: FC = () => { @@ -115,6 +83,7 @@ export const Navigation: FC = () => {
return (
<>
<NetStatus status={status} />
<NavigationContainer ref={navigationRef}>
{navigation}
</NavigationContainer>

14
src/modules/tasks/config/selected-tasks-menu-options.config.ts

@ -70,6 +70,20 @@ export const getSelectedTasksMenuOptions = ( @@ -70,6 +70,20 @@ export const getSelectedTasksMenuOptions = (
},
})
if (!summary.hasFinished && !summary.hasRemoved)
result.push({
name: 'Перепоставити',
onPress: () =>
navigate(RouteKey.SelectTaskExecutors, {
pageTitle: 'Перепоставити задачу',
onSubmit: async selectedUsers => {
await actions.onPressAction(FullTaskActions.Reassign, {
executorsIds: selectedUsers.map(user => user.id),
})
},
}),
})
result.push({
name: 'Друкувати',
onPress: () => actions.onPressAction(FullTaskActions.Print),

2
src/modules/tasks/hooks/use-fetch-task-executors.hook.ts

@ -25,7 +25,7 @@ export const useFetchTaskExecutors = () => { @@ -25,7 +25,7 @@ export const useFetchTaskExecutors = () => {
sort: 'DESC',
sortField: 'id',
},
limit: 3,
limit: 10,
clearWhenReload: false,
})

8
src/modules/tasks/hooks/use-fetch-tasks-by-filter.hook.ts

@ -15,6 +15,7 @@ export interface IProps { @@ -15,6 +15,7 @@ export interface IProps {
closeFilter?: () => void
searchString?: string
limit?: number
alreadyToLoad?: boolean
}
export const useFetchTasksByFilter = ({
@ -22,6 +23,7 @@ export const useFetchTasksByFilter = ({ @@ -22,6 +23,7 @@ export const useFetchTasksByFilter = ({
searchString,
closeFilter,
limit,
alreadyToLoad = true,
}: IProps) => {
const accountId = useSelector(selectId)
@ -63,7 +65,7 @@ export const useFetchTasksByFilter = ({ @@ -63,7 +65,7 @@ export const useFetchTasksByFilter = ({
fetchItems: params => tasksService.getTasks(params),
serrializatorItems: (items: ITaskPreviewResponse[]) =>
transformTasksInList(items) as any,
needInit: true,
needInit: false,
loadParams: {
sort: 'DESC',
sortField: 'id',
@ -74,6 +76,10 @@ export const useFetchTasksByFilter = ({ @@ -74,6 +76,10 @@ export const useFetchTasksByFilter = ({
clearWhenReload: false,
})
useEffect(() => {
if (alreadyToLoad) resetFlatList()
}, [alreadyToLoad])
useEffect(() => {
if (searchString) setLoadParams({ ...getFetchParams(), searchString })
}, [searchString])

21
src/modules/tasks/hooks/use-task-actions.hook.ts

@ -27,7 +27,7 @@ const actionRequests: Partial<Record<FullTaskActions, any>> = { @@ -27,7 +27,7 @@ const actionRequests: Partial<Record<FullTaskActions, any>> = {
}: {
taskIds: number[]
executorsIds: number[]
}) => tasksService.reassign({ taskId: taskIds[0], executorsIds }),
}) => tasksService.reassign({ tasksIds: taskIds, executorsIds }),
}
export const useTaskActions = (reload = (id: number) => {}) => {
@ -36,9 +36,6 @@ export const useTaskActions = (reload = (id: number) => {}) => { @@ -36,9 +36,6 @@ export const useTaskActions = (reload = (id: number) => {}) => {
const userId = useSelector(selectId)
const { print, pdf } = useTasksPrint()
// const [error, setError] = useState<TaskActionErrors | string>(null)
// const [success, setSuccess] = useState(false)
const getTasksIds = (tasks: ITaskPreview[] = selectedTasks) =>
tasks.map(it => it.id)
@ -69,14 +66,11 @@ export const useTaskActions = (reload = (id: number) => {}) => { @@ -69,14 +66,11 @@ export const useTaskActions = (reload = (id: number) => {}) => {
simpleDispatch(new UnselectAll())
}
const onReassing = (newTasksIds: Record<number, number>) => {
console.log('newTasksIds', newTasksIds)
if (!newTasksIds) return
const firstExecutor = Object.keys(newTasksIds)[0]
console.log('firstExecutor', firstExecutor)
console.log('newTasksIds[firstExecutor]', newTasksIds[firstExecutor])
reload(newTasksIds[firstExecutor])
const onReassing = (result: Record<number, Record<number, number>>) => {
if (!result) return
const firstTaskKey = Object.keys(result)[0]
const firstExecutorKey = Object.keys(result[firstTaskKey])[0]
reload(result[firstTaskKey][firstExecutorKey])
}
const showError = (error: TaskActionErrors) => {
@ -106,8 +100,7 @@ export const useTaskActions = (reload = (id: number) => {}) => { @@ -106,8 +100,7 @@ export const useTaskActions = (reload = (id: number) => {}) => {
console.log('TASK DONE', action, result)
if (action === FullTaskActions.Reassign)
onReassing(result.tasksIds)
if (action === FullTaskActions.Reassign) onReassing(result)
} catch (e: any) {
console.log('Error on do task action', e.response.data.message)
}

8
src/modules/tasks/hooks/use-task-filter.hook.ts

@ -20,14 +20,6 @@ export const useTaskFilter = ({ onSubmit, ...props }: IProps) => { @@ -20,14 +20,6 @@ export const useTaskFilter = ({ onSubmit, ...props }: IProps) => {
...filterInitialState,
...props,
}
useEffect(() => {
console.log('INIT')
return () => {
console.log('DESTROY')
}
}, [])
const { values, setFormField, setForm } = useForm<ITaskFilter>(
formValues,
null,

4
src/modules/tasks/screens/my-tasks.screen.tsx

@ -34,8 +34,6 @@ export const MyTasksScreen: FC<IProps> = ({ navigation, route }) => { @@ -34,8 +34,6 @@ export const MyTasksScreen: FC<IProps> = ({ navigation, route }) => {
const { selectedTasks, handleSelectTask, handleResetSelected } =
useTaskSelector()
const { handlePressOneTaskAction } = useTaskActions()
const {
items: myTasks,
loadMore,
@ -45,6 +43,8 @@ export const MyTasksScreen: FC<IProps> = ({ navigation, route }) => { @@ -45,6 +43,8 @@ export const MyTasksScreen: FC<IProps> = ({ navigation, route }) => {
closeFilter: () => setDrawer(false),
})
const { handlePressOneTaskAction } = useTaskActions()
const onPressTask = (task: ITaskPreview) => {
navigation.navigate(
RouteKey.TaskDetails as never,

19
src/services/domain/account.service.ts

@ -2,12 +2,25 @@ import { simpleDispatch } from '@/store/store-helpers' @@ -2,12 +2,25 @@ import { simpleDispatch } from '@/store/store-helpers'
import { SetLoadingAccount, SaveAccount } from '@/store/account'
import { fetchAccount } from '@/api'
import { IUser } from '@/shared/interfaces'
import AsyncStorage from '@react-native-async-storage/async-storage'
const loadAccount = async () => {
const loadAccount = async (version?: string) => {
simpleDispatch(new SetLoadingAccount({ isLoading: true }))
try {
const { data } = await fetchAccount()
simpleDispatch(new SaveAccount({ account: data }))
let account: IUser
if (version) {
const cached = await AsyncStorage.getItem(`acc${version}`)
if (cached) account = JSON.parse(cached)
}
if (!account) {
const { data } = await fetchAccount()
await AsyncStorage.setItem(`acc${version}`, JSON.stringify(data))
account = data
}
simpleDispatch(new SaveAccount({ account }))
} catch (e: any) {
console.log(e)
} finally {

27
src/services/domain/auth.service.ts

@ -7,6 +7,7 @@ import { @@ -7,6 +7,7 @@ import {
finishLogin,
signOut,
resetSessionReq,
fetchAccountCacheInfoReq,
} from '@/api'
import { SaveTokens } from '@/store/auth'
import { simpleDispatch } from '@/store/store-helpers'
@ -23,6 +24,7 @@ import { factoriesService } from './factories.service' @@ -23,6 +24,7 @@ import { factoriesService } from './factories.service'
import { contactsService } from './contacts.service'
import { tasksService } from './tasks.service'
import { chatsService } from './chats.service'
import { IGetAccountCacheInfoResponse } from '@/api/account/responses.interfaces'
let phoneNumber: string
@ -51,15 +53,22 @@ const finishAuth = async (code: string) => { @@ -51,15 +53,22 @@ const finishAuth = async (code: string) => {
}
}
const autoAuth = async () => {
const loadCacheInfo = async () => {
const { data } = await fetchAccountCacheInfoReq()
return data
}
export const autoAuth = async () => {
try {
const existTokens = await getTokensFromStore()
if (!existTokens.refreshToken) throw new Error()
await refreshSession()
await loadDataAfterAuth()
await loadNotImportantData()
await saveTokens(existTokens)
const cacheInfo = await loadCacheInfo()
await loadDataAfterAuth(cacheInfo)
loadNotImportantData()
NavigationService.setModule(NavigationModuleKey.User)
} catch (e) {
@ -70,9 +79,11 @@ const autoAuth = async () => { @@ -70,9 +79,11 @@ const autoAuth = async () => {
}
}
const loadDataAfterAuth = async () => {
await accountService.loadAccount()
await permissionsService.loadPermissionsForUsers()
const loadDataAfterAuth = async (
cacheInfo: IGetAccountCacheInfoResponse = {},
) => {
await accountService.loadAccount(cacheInfo.accountV)
await permissionsService.loadPermissionsForUsers(cacheInfo.permissionsV)
setAppIsReady()
}

21
src/services/domain/permissions.service.ts

@ -9,6 +9,7 @@ import { @@ -9,6 +9,7 @@ import {
SetLoadingPermissions,
} from '@/store/permissions'
import { simpleDispatch } from '@/store/store-helpers'
import AsyncStorage from '@react-native-async-storage/async-storage'
import _ from 'lodash'
class PermissionsService extends Service {
@ -16,12 +17,26 @@ class PermissionsService extends Service { @@ -16,12 +17,26 @@ class PermissionsService extends Service {
return this.select(selectPermissionsForUsers)
}
public async loadPermissionsForUsers() {
public async loadPermissionsForUsers(version?: string) {
simpleDispatch(new SetLoadingPermissions({ isLoading: true }))
try {
const { data } = await fetchUserPermissionsReq()
let permissions
if (version) {
const cached = await AsyncStorage.getItem(`prm${version}`)
if (cached) permissions = JSON.parse(cached)
}
if (!permissions) {
const { data } = await fetchUserPermissionsReq()
await AsyncStorage.setItem(
`prm${version}`,
JSON.stringify(data),
)
permissions = data
}
simpleDispatch(
new SavePermissionsForUsers({ usersPermissions: data.user }),
new SavePermissionsForUsers({ usersPermissions: permissions }),
)
} catch (e: any) {
console.log(e)

8
src/services/domain/tasks.service.ts

@ -126,12 +126,16 @@ const markTasksAsDone = async (data: IMarkTasksAsDoneRequest) => { @@ -126,12 +126,16 @@ const markTasksAsDone = async (data: IMarkTasksAsDoneRequest) => {
// appEvents.emit('reloadTask', {})
// }
const reassign = async (data: { executorsIds: number[]; taskId: number }) => {
const reassign = async (data: {
executorsIds: number[]
tasksIds: number[]
}) => {
const response = await reassignTaskReq(data)
console.log('response.data', response.data.result)
appEvents.emit('reloadTask', {})
return response.data
return response.data.result
}
const addTasksToFavorite = async (data: IAddTasksToFavorite) => {

2
src/services/domain/taxonomies.service.ts

@ -44,7 +44,9 @@ const fetchGroups = async () => { @@ -44,7 +44,9 @@ const fetchGroups = async () => {
const fetchGroupsWithTasksCount = async (params?: IRequestConfig) => {
try {
console.log('START')
const groups = await fetchGroupsWithTasksCountReq(params)
console.log('START 2')
return groups
} catch (err) {
console.log('FETCH GROUPS WITH TASKS COUNT ERROR: ', err)

1
src/shared/hooks/use-flat-list.hook.ts

@ -65,6 +65,7 @@ export const useFlatList = <T>(props: IProps<T>) => { @@ -65,6 +65,7 @@ export const useFlatList = <T>(props: IProps<T>) => {
const response = props.serrializatorResponse(
await props.fetchItems({ params: loadParams.current }),
)
if (!response) throw {}
loadParams.current = {

88
yarn.lock

@ -1355,10 +1355,10 @@ @@ -1355,10 +1355,10 @@
"resolved" "https://registry.npmjs.org/@react-native-community/eslint-plugin/-/eslint-plugin-1.1.0.tgz"
"version" "1.1.0"
"@react-native-community/netinfo@^6.2.1", "@react-native-community/netinfo@>= 6":
"integrity" "sha512-742sh+NMbPo59MaLRXBWwkT5K6HQPrmoS0pg0z9QuXshXieQIOTkqEEDMkQZS0QnS8fPFr8MxMPw/TAxH9b8Ig=="
"resolved" "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-6.2.1.tgz"
"version" "6.2.1"
"@react-native-community/netinfo@^9.0.0", "@react-native-community/netinfo@>= 6":
"integrity" "sha512-oodeVNdL0IT/Fv0cpL7CdxnnESNKiiAzf29yhvGSJBvuFmyHxvmYOtBIX27HWG9tQU8Yzeh+MyQcKBCNmkva+Q=="
"resolved" "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-9.0.0.tgz"
"version" "9.0.0"
"@react-native-community/push-notification-ios@^1.10.1", "@react-native-community/push-notification-ios@^1.2.0":
"integrity" "sha512-k6bZWUKLif4GjenyTD3aQLwA2VT3bNmt22INO/34lexnpmqkPDZF7nreqbckTHG0Zso9wDTe4N/AZJUC/d8iRg=="
@ -1870,6 +1870,11 @@ @@ -1870,6 +1870,11 @@
dependencies:
"eslint-visitor-keys" "^1.1.0"
"@yarnpkg/lockfile@^1.1.0":
"integrity" "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ=="
"resolved" "https://registry.npmjs.org/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz"
"version" "1.1.0"
"abab@^2.0.3", "abab@^2.0.5":
"integrity" "sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q=="
"resolved" "https://registry.npmjs.org/abab/-/abab-2.0.5.tgz"
@ -2987,7 +2992,7 @@ @@ -2987,7 +2992,7 @@
dependencies:
"node-fetch" "2.6.1"
"cross-spawn@^6.0.0":
"cross-spawn@^6.0.0", "cross-spawn@^6.0.5":
"integrity" "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ=="
"resolved" "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz"
"version" "6.0.5"
@ -3951,6 +3956,13 @@ @@ -3951,6 +3956,13 @@
"locate-path" "^5.0.0"
"path-exists" "^4.0.0"
"find-yarn-workspace-root@^2.0.0":
"integrity" "sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ=="
"resolved" "https://registry.npmjs.org/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz"
"version" "2.0.0"
dependencies:
"micromatch" "^4.0.2"
"flat-cache@^2.0.1":
"integrity" "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA=="
"resolved" "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz"
@ -4041,6 +4053,15 @@ @@ -4041,6 +4053,15 @@
"jsonfile" "^2.1.0"
"klaw" "^1.0.0"
"fs-extra@^7.0.1":
"integrity" "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw=="
"resolved" "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz"
"version" "7.0.1"
dependencies:
"graceful-fs" "^4.1.2"
"jsonfile" "^4.0.0"
"universalify" "^0.1.0"
"fs-extra@^8.1.0", "fs-extra@>=3.0.0":
"integrity" "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g=="
"resolved" "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz"
@ -4775,6 +4796,13 @@ @@ -4775,6 +4796,13 @@
"resolved" "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz"
"version" "1.1.0"
"is-wsl@^2.1.1":
"integrity" "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="
"resolved" "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz"
"version" "2.2.0"
dependencies:
"is-docker" "^2.0.0"
"is-wsl@^2.2.0":
"integrity" "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="
"resolved" "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz"
@ -5468,6 +5496,13 @@ @@ -5468,6 +5496,13 @@
"resolved" "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz"
"version" "6.0.3"
"klaw-sync@^6.0.0":
"integrity" "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ=="
"resolved" "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz"
"version" "6.0.0"
dependencies:
"graceful-fs" "^4.1.11"
"klaw@^1.0.0":
"integrity" "sha1-QIhDO0azsbolnXh4XY6W9zugJDk="
"resolved" "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz"
@ -6451,6 +6486,14 @@ @@ -6451,6 +6486,14 @@
dependencies:
"is-wsl" "^1.1.0"
"open@^7.4.2":
"integrity" "sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q=="
"resolved" "https://registry.npmjs.org/open/-/open-7.4.2.tgz"
"version" "7.4.2"
dependencies:
"is-docker" "^2.0.0"
"is-wsl" "^2.1.1"
"optionator@^0.8.1":
"integrity" "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA=="
"resolved" "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz"
@ -6492,7 +6535,7 @@ @@ -6492,7 +6535,7 @@
"strip-ansi" "^5.2.0"
"wcwidth" "^1.0.1"
"os-tmpdir@^1.0.0":
"os-tmpdir@^1.0.0", "os-tmpdir@~1.0.2":
"integrity" "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
"resolved" "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz"
"version" "1.0.2"
@ -6578,6 +6621,25 @@ @@ -6578,6 +6621,25 @@
"resolved" "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz"
"version" "0.1.1"
"patch-package@^6.4.7":
"integrity" "sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ=="
"resolved" "https://registry.npmjs.org/patch-package/-/patch-package-6.4.7.tgz"
"version" "6.4.7"
dependencies:
"@yarnpkg/lockfile" "^1.1.0"
"chalk" "^2.4.2"
"cross-spawn" "^6.0.5"
"find-yarn-workspace-root" "^2.0.0"
"fs-extra" "^7.0.1"
"is-ci" "^2.0.0"
"klaw-sync" "^6.0.0"
"minimist" "^1.2.0"
"open" "^7.4.2"
"rimraf" "^2.6.3"
"semver" "^5.6.0"
"slash" "^2.0.0"
"tmp" "^0.0.33"
"path-dirname@^1.0.2":
"integrity" "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA="
"resolved" "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz"
@ -7681,7 +7743,7 @@ @@ -7681,7 +7743,7 @@
"resolved" "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz"
"version" "0.1.15"
"rimraf@^2.5.4":
"rimraf@^2.5.4", "rimraf@^2.6.3":
"integrity" "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w=="
"resolved" "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz"
"version" "2.7.1"
@ -8036,6 +8098,11 @@ @@ -8036,6 +8098,11 @@
"resolved" "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz"
"version" "1.0.5"
"slash@^2.0.0":
"integrity" "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A=="
"resolved" "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz"
"version" "2.0.0"
"slash@^3.0.0":
"integrity" "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="
"resolved" "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz"
@ -8574,6 +8641,13 @@ @@ -8574,6 +8641,13 @@
"resolved" "https://registry.npmjs.org/tinymask/-/tinymask-1.0.2.tgz"
"version" "1.0.2"
"tmp@^0.0.33":
"integrity" "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw=="
"resolved" "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz"
"version" "0.0.33"
dependencies:
"os-tmpdir" "~1.0.2"
"tmpl@1.0.x":
"integrity" "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE="
"resolved" "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz"

Loading…
Cancel
Save