Compare commits

..

2 commits

Author SHA1 Message Date
Arnaud Vergnet
8dae8adfbe Downgrade react-native-keychain to improve startup speed
Due to a bug, token retrieving was taking several seconds on recent Android versions.
Reference: https://github.com/oblador/react-native-keychain/issues/337
2020-10-07 11:03:32 +02:00
Arnaud Vergnet
00ed963503 Use generic password instead of internet credentials 2020-10-07 10:53:31 +02:00
4 changed files with 17 additions and 12 deletions

View file

@ -4,6 +4,12 @@ Ce fichier permet de regrouper les différentes informations sur des décisions
Ces notes pouvant évoluer dans le temps, leur date d'écriture est aussi indiquée. Ces notes pouvant évoluer dans le temps, leur date d'écriture est aussi indiquée.
## _2020-10-07_ | react-native-keychain
Bloquée en 4.0.5 à cause d'un problème de performances. Au dessus de cette version, la récupération du token prend plusieurs secondes, ce qui n'est pas acceptable.
[Référence](https://github.com/oblador/react-native-keychain/issues/337)
## _2020-09-24_ | Flow ## _2020-09-24_ | Flow
Flow est un système d'annotation permettant de rendre JavaScript typé statique. Développée par Facebook, cette technologie à initialement été adoptée. En revanche, de nombreux problèmes sont apparus : Flow est un système d'annotation permettant de rendre JavaScript typé statique. Développée par Facebook, cette technologie à initialement été adoptée. En revanche, de nombreux problèmes sont apparus :

14
package-lock.json generated
View file

@ -1,6 +1,6 @@
{ {
"name": "campus", "name": "campus",
"version": "4.0.1", "version": "4.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -9756,9 +9756,9 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==" "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
}, },
"node-fetch": { "node-fetch": {
"version": "2.6.0", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
}, },
"node-int64": { "node-int64": {
"version": "0.4.0", "version": "0.4.0",
@ -10751,9 +10751,9 @@
"integrity": "sha512-/VbpIEp8tSNNHIvstuA3Swx610whci1Zpc9mqNkqn14DkMbw+ORviln2u0XyHG1kPvvwTNGZY6QpeFwxYaSdbQ==" "integrity": "sha512-/VbpIEp8tSNNHIvstuA3Swx610whci1Zpc9mqNkqn14DkMbw+ORviln2u0XyHG1kPvvwTNGZY6QpeFwxYaSdbQ=="
}, },
"react-native-keychain": { "react-native-keychain": {
"version": "6.2.0", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/react-native-keychain/-/react-native-keychain-6.2.0.tgz", "resolved": "https://registry.npmjs.org/react-native-keychain/-/react-native-keychain-4.0.5.tgz",
"integrity": "sha512-U6fnOQRJPq+c0Abl+FoYy9v0H3kQU587tMamU/o+MoBSUScFLE3DQpkyT1PW4NF5IObgiGuqQdmjC2KgtBpjGA==" "integrity": "sha512-TbiO8AO055EPjaxIuKxrCEOB4r81uQCVDFbtcs+e4pEOHxf6z3JgDC0UU0poJElKfCh37b+TFRxQhg6DbsYJBA=="
}, },
"react-native-linear-gradient": { "react-native-linear-gradient": {
"version": "2.5.6", "version": "2.5.6",

View file

@ -45,7 +45,7 @@
"react-native-collapsible": "^1.5.3", "react-native-collapsible": "^1.5.3",
"react-native-gesture-handler": "^1.8.0", "react-native-gesture-handler": "^1.8.0",
"react-native-image-zoom-viewer": "^3.0.1", "react-native-image-zoom-viewer": "^3.0.1",
"react-native-keychain": "^6.2.0", "react-native-keychain": "4.0.5",
"react-native-linear-gradient": "^2.5.6", "react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.4.1", "react-native-localize": "^1.4.1",
"react-native-modalize": "^2.0.6", "react-native-modalize": "^2.0.6",

View file

@ -34,7 +34,6 @@ import {apiRequest, ERROR_TYPE} from '../utils/WebData';
* 500 : SERVER_ERROR -> pb coté serveur * 500 : SERVER_ERROR -> pb coté serveur
*/ */
const SERVER_NAME = 'amicale-insat.fr';
const AUTH_PATH = 'password'; const AUTH_PATH = 'password';
export default class ConnectionManager { export default class ConnectionManager {
@ -78,7 +77,7 @@ export default class ConnectionManager {
if (token != null) { if (token != null) {
resolve(); resolve();
} else { } else {
Keychain.getInternetCredentials(SERVER_NAME) Keychain.getGenericPassword()
.then((data: Keychain.UserCredentials | false) => { .then((data: Keychain.UserCredentials | false) => {
if (data && data.password != null) { if (data && data.password != null) {
this.token = data.password; this.token = data.password;
@ -108,7 +107,7 @@ export default class ConnectionManager {
*/ */
async saveLogin(email: string, token: string): Promise<void> { async saveLogin(email: string, token: string): Promise<void> {
return new Promise((resolve: () => void, reject: () => void) => { return new Promise((resolve: () => void, reject: () => void) => {
Keychain.setInternetCredentials(SERVER_NAME, 'token', token) Keychain.setGenericPassword('token', token)
.then(() => { .then(() => {
this.token = token; this.token = token;
resolve(); resolve();
@ -124,7 +123,7 @@ export default class ConnectionManager {
*/ */
async disconnect(): Promise<void> { async disconnect(): Promise<void> {
return new Promise((resolve: () => void, reject: () => void) => { return new Promise((resolve: () => void, reject: () => void) => {
Keychain.resetInternetCredentials(SERVER_NAME) Keychain.resetGenericPassword()
.then(() => { .then(() => {
this.token = null; this.token = null;
resolve(); resolve();