|
|
@ -50,37 +50,40 @@ export default function App() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
useEffect(async () => { |
|
|
|
if (netInfo.isInternetReachable) { |
|
|
|
const cachedForms = await cache.get("sendforms"); |
|
|
|
if (!isReconnected) { |
|
|
|
notImplemented( |
|
|
|
colors.greenWarning, |
|
|
|
"Conexão à internet restabelecida", |
|
|
|
3000, |
|
|
|
true |
|
|
|
); |
|
|
|
setIsReconnected(true); |
|
|
|
} |
|
|
|
|
|
|
|
if (cachedForms) { |
|
|
|
const arrayForms = JSON.parse(cachedForms); |
|
|
|
arrayForms.forEach(async (element) => { |
|
|
|
const isSent = await sendFormAnswer( |
|
|
|
element, |
|
|
|
netInfo.isInternetReachable, |
|
|
|
null |
|
|
|
useEffect(() => { |
|
|
|
async function getNetInfo() { |
|
|
|
if (netInfo.isInternetReachable) { |
|
|
|
const cachedForms = await cache.get("sendforms"); |
|
|
|
if (!isReconnected) { |
|
|
|
notImplemented( |
|
|
|
colors.greenWarning, |
|
|
|
"Conexão à internet restabelecida", |
|
|
|
3000, |
|
|
|
true |
|
|
|
); |
|
|
|
setIsReconnected(true); |
|
|
|
} |
|
|
|
|
|
|
|
if (isSent.ok) { |
|
|
|
cache.clear("sendforms"); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (cachedForms) { |
|
|
|
const arrayForms = JSON.parse(cachedForms); |
|
|
|
arrayForms.forEach(async (element) => { |
|
|
|
const isSent = await sendFormAnswer( |
|
|
|
element, |
|
|
|
netInfo.isInternetReachable, |
|
|
|
null |
|
|
|
); |
|
|
|
|
|
|
|
if (isSent.ok) { |
|
|
|
cache.clear("sendforms"); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
notImplemented(colors.blueWarning, "Sem conexão à internet", null, false); |
|
|
|
setIsReconnected(false); |
|
|
|
} |
|
|
|
} else { |
|
|
|
notImplemented(colors.blueWarning, "Sem conexão à internet", null, false); |
|
|
|
setIsReconnected(false); |
|
|
|
} |
|
|
|
getNetInfo() |
|
|
|
}, [netInfo.isInternetReachable]); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|