feat(heartbeat): remove
This commit is contained in:
parent
cd17372335
commit
69d9fc9a6a
8 changed files with 217 additions and 42 deletions
40
index.js
40
index.js
|
@ -20,7 +20,7 @@ import { onBackgroundEvent as notificationBackgroundEvent } from "~/notification
|
|||
import onMessageReceived from "~/notifications/onMessageReceived";
|
||||
|
||||
import { createLogger } from "~/lib/logger";
|
||||
import { executeHeartbeatSync } from "~/location/backgroundTask";
|
||||
// import { executeHeartbeatSync } from "~/location/backgroundTask";
|
||||
|
||||
// setup notification, this have to stay in index.js
|
||||
notifee.onBackgroundEvent(notificationBackgroundEvent);
|
||||
|
@ -36,23 +36,23 @@ const geolocBgLogger = createLogger({
|
|||
task: "headless",
|
||||
});
|
||||
|
||||
const HeadlessTask = async (event) => {
|
||||
try {
|
||||
switch (event?.name) {
|
||||
case "heartbeat":
|
||||
await executeHeartbeatSync();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
geolocBgLogger.error("HeadlessTask error", {
|
||||
error,
|
||||
event,
|
||||
});
|
||||
}
|
||||
};
|
||||
// const HeadlessTask = async (event) => {
|
||||
// try {
|
||||
// switch (event?.name) {
|
||||
// case "heartbeat":
|
||||
// await executeHeartbeatSync();
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// geolocBgLogger.error("HeadlessTask error", {
|
||||
// error,
|
||||
// event,
|
||||
// });
|
||||
// }
|
||||
// };
|
||||
|
||||
if (Platform.OS === "android") {
|
||||
BackgroundGeolocation.registerHeadlessTask(HeadlessTask);
|
||||
}
|
||||
// if (Platform.OS === "android") {
|
||||
// BackgroundGeolocation.registerHeadlessTask(HeadlessTask);
|
||||
// }
|
||||
|
|
|
@ -163,7 +163,12 @@
|
|||
8EC12A68941D40E98E0D60BE /* Fix Xcode 15 Bug */,
|
||||
49AEAB1D332B45ED9A37B009 /* Fix Xcode 15 Bug */,
|
||||
D75A41050AB3445786799848 /* Fix Xcode 15 Bug */,
|
||||
ABC6C5A0D48A4B7980D60E1B /* Remove signature files (Xcode workaround) */,
|
||||
FB7FA195D27D412AA897F419 /* Fix Xcode 15 Bug */,
|
||||
0C44FF6DBD8F4BDD8D2B9784 /* Fix Xcode 15 Bug */,
|
||||
AC008438EEF4422BA1C35CDF /* Fix Xcode 15 Bug */,
|
||||
1A6C945D28C14747A29A3560 /* Fix Xcode 15 Bug */,
|
||||
1C287A64431A4C0A859F067B /* Fix Xcode 15 Bug */,
|
||||
EBD8BAB94522461484E3792D /* Remove signature files (Xcode workaround) */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -576,6 +581,176 @@ fi";
|
|||
shellScript = "
|
||||
echo \"Remove signature files (Xcode workaround)\";
|
||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||
";
|
||||
};
|
||||
FB7FA195D27D412AA897F419 /* Fix Xcode 15 Bug */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Fix Xcode 15 Bug";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then
|
||||
echo \"Remove signature files (Xcode 15 workaround)\"
|
||||
find \"$BUILD_DIR/${CONFIGURATION}-iphoneos\" -name \"*.signature\" -type f | xargs -r rm
|
||||
fi";
|
||||
};
|
||||
B1FDDB484A8E497F9FF7F32C /* Remove signature files (Xcode workaround) */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Remove signature files (Xcode workaround)";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "
|
||||
echo \"Remove signature files (Xcode workaround)\";
|
||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||
";
|
||||
};
|
||||
0C44FF6DBD8F4BDD8D2B9784 /* Fix Xcode 15 Bug */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Fix Xcode 15 Bug";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then
|
||||
echo \"Remove signature files (Xcode 15 workaround)\"
|
||||
find \"$BUILD_DIR/${CONFIGURATION}-iphoneos\" -name \"*.signature\" -type f | xargs -r rm
|
||||
fi";
|
||||
};
|
||||
658BC0C976C44270ACBDF3C6 /* Remove signature files (Xcode workaround) */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Remove signature files (Xcode workaround)";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "
|
||||
echo \"Remove signature files (Xcode workaround)\";
|
||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||
";
|
||||
};
|
||||
AC008438EEF4422BA1C35CDF /* Fix Xcode 15 Bug */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Fix Xcode 15 Bug";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then
|
||||
echo \"Remove signature files (Xcode 15 workaround)\"
|
||||
find \"$BUILD_DIR/${CONFIGURATION}-iphoneos\" -name \"*.signature\" -type f | xargs -r rm
|
||||
fi";
|
||||
};
|
||||
6743177E81F94D198E926A21 /* Remove signature files (Xcode workaround) */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Remove signature files (Xcode workaround)";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "
|
||||
echo \"Remove signature files (Xcode workaround)\";
|
||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||
";
|
||||
};
|
||||
1A6C945D28C14747A29A3560 /* Fix Xcode 15 Bug */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Fix Xcode 15 Bug";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then
|
||||
echo \"Remove signature files (Xcode 15 workaround)\"
|
||||
find \"$BUILD_DIR/${CONFIGURATION}-iphoneos\" -name \"*.signature\" -type f | xargs -r rm
|
||||
fi";
|
||||
};
|
||||
96170835D29D4D569C60B051 /* Remove signature files (Xcode workaround) */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Remove signature files (Xcode workaround)";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "
|
||||
echo \"Remove signature files (Xcode workaround)\";
|
||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||
";
|
||||
};
|
||||
1C287A64431A4C0A859F067B /* Fix Xcode 15 Bug */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Fix Xcode 15 Bug";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if [ \"$XCODE_VERSION_MAJOR\" = \"1500\" ]; then
|
||||
echo \"Remove signature files (Xcode 15 workaround)\"
|
||||
find \"$BUILD_DIR/${CONFIGURATION}-iphoneos\" -name \"*.signature\" -type f | xargs -r rm
|
||||
fi";
|
||||
};
|
||||
EBD8BAB94522461484E3792D /* Remove signature files (Xcode workaround) */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
name = "Remove signature files (Xcode workaround)";
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "
|
||||
echo \"Remove signature files (Xcode workaround)\";
|
||||
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\";
|
||||
";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
|
|
@ -25,7 +25,7 @@ import { useUpdates } from "~/updates";
|
|||
import Error from "~/components/Error";
|
||||
|
||||
import useTrackLocation from "~/hooks/useTrackLocation";
|
||||
import { initializeBackgroundFetch } from "~/services/backgroundFetch";
|
||||
// import { initializeBackgroundFetch } from "~/services/backgroundFetch";
|
||||
import useMount from "~/hooks/useMount";
|
||||
|
||||
const appLogger = createLogger({
|
||||
|
@ -221,22 +221,22 @@ function AppContent() {
|
|||
useNetworkListener();
|
||||
useTrackLocation();
|
||||
|
||||
useMount(() => {
|
||||
const setupBackgroundFetch = async () => {
|
||||
try {
|
||||
appLogger.info("Setting up BackgroundFetch");
|
||||
await initializeBackgroundFetch();
|
||||
appLogger.debug("BackgroundFetch setup completed");
|
||||
} catch (error) {
|
||||
lifecycleLogger.error("BackgroundFetch setup failed", {
|
||||
error: error?.message,
|
||||
});
|
||||
errorHandler(error);
|
||||
}
|
||||
};
|
||||
// useMount(() => {
|
||||
// const setupBackgroundFetch = async () => {
|
||||
// try {
|
||||
// appLogger.info("Setting up BackgroundFetch");
|
||||
// await initializeBackgroundFetch();
|
||||
// appLogger.debug("BackgroundFetch setup completed");
|
||||
// } catch (error) {
|
||||
// lifecycleLogger.error("BackgroundFetch setup failed", {
|
||||
// error: error?.message,
|
||||
// });
|
||||
// errorHandler(error);
|
||||
// }
|
||||
// };
|
||||
|
||||
setupBackgroundFetch();
|
||||
});
|
||||
// setupBackgroundFetch();
|
||||
// });
|
||||
|
||||
// Handle deep links after app is initialized with error handling
|
||||
useEffect(() => {
|
||||
|
|
|
@ -88,9 +88,9 @@ export const generateSuggestKeepOpenContent = (data) => {
|
|||
|
||||
export const generateBackgroundGeolocationLostContent = (data) => {
|
||||
return {
|
||||
title: `Alerte-Secours ne peut plus accéder à votre position`,
|
||||
body: `Vous ne pouvez plus recevoir d'alertes de proximité. Vérifiez les paramètres.`,
|
||||
bigText: `Alerte-Secours ne peut plus accéder à votre position en arrière-plan. Vous ne pouvez plus recevoir d'alertes de proximité. Causes possibles : permissions révoquées, optimisation de batterie active, ou actualisation désactivée. Accédez aux paramètres de l'application pour réactiver.`,
|
||||
title: `Alerte-Secours ne reçoit plus de mises à jour de votre position`,
|
||||
body: `Vous ne pourrez plus recevoir d'alertes de proximité. Vérifiez les paramètres.`,
|
||||
bigText: `Alerte-Secours ne reçoit plus de mises à jour de votre position en arrière-plan. Vous ne pourrez plus recevoir d'alertes de proximité. Causes possibles : permissions révoquées, optimisation de batterie active, ou actualisation désactivée. Accédez aux paramètres de l'application pour réactiver.`,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import notifSuggestKeepOpen from "./channels/notifSuggestKeepOpen";
|
|||
import notifRelativeAllowAsk from "./channels/notifRelativeAllowAsk";
|
||||
import notifRelativeInvitation from "./channels/notifRelativeInvitation";
|
||||
import notifBackgroundGeolocationLost from "./channels/notifBackgroundGeolocationLost";
|
||||
import notifGeolocationHeartbeatSync from "./channels/notifGeolocationHeartbeatSync";
|
||||
// import notifGeolocationHeartbeatSync from "./channels/notifGeolocationHeartbeatSync.js.bak";
|
||||
|
||||
const displayLogger = createLogger({
|
||||
module: BACKGROUND_SCOPES.NOTIFICATIONS,
|
||||
|
@ -23,7 +23,7 @@ const SUPPORTED_ACTIONS = {
|
|||
"relative-allow-ask": notifRelativeAllowAsk,
|
||||
"relative-invitation": notifRelativeInvitation,
|
||||
"background-geolocation-lost": notifBackgroundGeolocationLost,
|
||||
"geolocation-heartbeat-sync": notifGeolocationHeartbeatSync,
|
||||
// "geolocation-heartbeat-sync": notifGeolocationHeartbeatSync,
|
||||
};
|
||||
|
||||
export default async function displayNotificationHandler(data) {
|
||||
|
|
Loading…
Add table
Reference in a new issue