Revert "fix(up-wip): register stucked loading"
This reverts commit c5ccfa8d08.
This commit is contained in:
parent
492904cbe8
commit
54083205f0
3 changed files with 12 additions and 62 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useCallback, useState, useEffect } from "react";
|
import React, { useCallback, useState, useEffect } from "react";
|
||||||
|
|
||||||
import { View, Alert } from "react-native";
|
import { View } from "react-native";
|
||||||
import LittleLoader from "~/components/LittleLoader";
|
import LittleLoader from "~/components/LittleLoader";
|
||||||
import { Button } from "react-native-paper";
|
import { Button } from "react-native-paper";
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
|
|
@ -70,20 +70,12 @@ export default function AccountManagementModalConnect({
|
||||||
};
|
};
|
||||||
}, [isLoading, loginRequest]);
|
}, [isLoading, loginRequest]);
|
||||||
|
|
||||||
const connectUsingPhoneNumber = async () => {
|
const connectUsingPhoneNumber = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
sendAuthSMS({
|
||||||
await sendAuthSMS({
|
smsType: "C",
|
||||||
smsType: "C",
|
body: "Se connecter sur Alerte-Secours:\nCode: [CODE]\n💙", // must don't exceed 160 chars including replaced [CODE]
|
||||||
body: "Se connecter sur Alerte-Secours:\nCode: [CODE]\n💙", // must don't exceed 160 chars including replaced [CODE]
|
});
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
setIsLoading(false);
|
|
||||||
Alert.alert(
|
|
||||||
"Échec de l’ouverture des SMS",
|
|
||||||
"Impossible d’ouvrir l’application SMS. Réessayez.",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const smsDisclaimerModalStatePair = useState({ visible: false });
|
const smsDisclaimerModalStatePair = useState({ visible: false });
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useState, useEffect, useCallback } from "react";
|
import React, { useState, useEffect, useCallback } from "react";
|
||||||
|
|
||||||
import { View, Alert } from "react-native";
|
import { View } from "react-native";
|
||||||
|
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
||||||
|
|
||||||
|
|
@ -41,18 +41,10 @@ export default function PhoneNumbersView({ data, waitingSmsType }) {
|
||||||
|
|
||||||
const registerPhoneNumber = useCallback(async () => {
|
const registerPhoneNumber = useCallback(async () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
sendAuthSMS({
|
||||||
await sendAuthSMS({
|
smsType: "R",
|
||||||
smsType: "R",
|
body: "S'enregistrer sur Alerte-Secours:\nCode: [CODE]\n💙", // must don't exceed 160 chars including replaced [CODE]
|
||||||
body: "S'enregistrer sur Alerte-Secours:\nCode: [CODE]\n💙", // must don't exceed 160 chars including replaced [CODE]
|
});
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
setIsLoading(false);
|
|
||||||
Alert.alert(
|
|
||||||
"Échec de l’ouverture des SMS",
|
|
||||||
"Impossible d’ouvrir l’application SMS. Réessayez.",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, [sendAuthSMS, setIsLoading]);
|
}, [sendAuthSMS, setIsLoading]);
|
||||||
|
|
||||||
// Clear loading state after 3 minutes
|
// Clear loading state after 3 minutes
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
|
|
||||||
import { ScrollView, View, AppState } from "react-native";
|
import { ScrollView, View } from "react-native";
|
||||||
|
|
||||||
import Loader from "~/components/Loader";
|
import Loader from "~/components/Loader";
|
||||||
import { useSubscription } from "@apollo/client";
|
import { useSubscription } from "@apollo/client";
|
||||||
|
|
@ -12,7 +12,6 @@ import { createLogger } from "~/lib/logger";
|
||||||
import { FEATURE_SCOPES } from "~/lib/logger/scopes";
|
import { FEATURE_SCOPES } from "~/lib/logger/scopes";
|
||||||
|
|
||||||
import withConnectivity from "~/hoc/withConnectivity";
|
import withConnectivity from "~/hoc/withConnectivity";
|
||||||
import { useFocusEffect } from "@react-navigation/native";
|
|
||||||
|
|
||||||
import Form from "./Form";
|
import Form from "./Form";
|
||||||
|
|
||||||
|
|
@ -38,39 +37,6 @@ export default withConnectivity(function Profile({ navigation, route }) {
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [userId]);
|
}, [userId]);
|
||||||
|
|
||||||
useFocusEffect(
|
|
||||||
React.useCallback(() => {
|
|
||||||
restart();
|
|
||||||
}, [restart]),
|
|
||||||
);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const sub = AppState.addEventListener("change", (state) => {
|
|
||||||
if (state === "active") {
|
|
||||||
restart();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return () => {
|
|
||||||
sub?.remove?.();
|
|
||||||
};
|
|
||||||
}, [restart]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (
|
|
||||||
route.params?.waitingSmsType &&
|
|
||||||
data?.selectOneUser?.oneUserLoginRequest
|
|
||||||
) {
|
|
||||||
navigation.setParams({
|
|
||||||
waitingSmsType: undefined,
|
|
||||||
openAccountModal: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, [
|
|
||||||
route.params?.waitingSmsType,
|
|
||||||
data?.selectOneUser?.oneUserLoginRequest,
|
|
||||||
navigation,
|
|
||||||
]);
|
|
||||||
|
|
||||||
if (loading || !data?.selectOneUser) {
|
if (loading || !data?.selectOneUser) {
|
||||||
return <Loader />;
|
return <Loader />;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue