feat(heartbeat): remove

This commit is contained in:
Jo 2025-08-02 15:38:37 +02:00
parent cd17372335
commit 69d9fc9a6a
Signed by: devthejo
GPG key ID: 00CCA7A92B1D5351
8 changed files with 217 additions and 42 deletions

View file

@ -20,7 +20,7 @@ import { onBackgroundEvent as notificationBackgroundEvent } from "~/notification
import onMessageReceived from "~/notifications/onMessageReceived"; import onMessageReceived from "~/notifications/onMessageReceived";
import { createLogger } from "~/lib/logger"; import { createLogger } from "~/lib/logger";
import { executeHeartbeatSync } from "~/location/backgroundTask"; // import { executeHeartbeatSync } from "~/location/backgroundTask";
// setup notification, this have to stay in index.js // setup notification, this have to stay in index.js
notifee.onBackgroundEvent(notificationBackgroundEvent); notifee.onBackgroundEvent(notificationBackgroundEvent);
@ -36,23 +36,23 @@ const geolocBgLogger = createLogger({
task: "headless", task: "headless",
}); });
const HeadlessTask = async (event) => { // const HeadlessTask = async (event) => {
try { // try {
switch (event?.name) { // switch (event?.name) {
case "heartbeat": // case "heartbeat":
await executeHeartbeatSync(); // await executeHeartbeatSync();
break; // break;
default: // default:
break; // break;
} // }
} catch (error) { // } catch (error) {
geolocBgLogger.error("HeadlessTask error", { // geolocBgLogger.error("HeadlessTask error", {
error, // error,
event, // event,
}); // });
} // }
}; // };
if (Platform.OS === "android") { // if (Platform.OS === "android") {
BackgroundGeolocation.registerHeadlessTask(HeadlessTask); // BackgroundGeolocation.registerHeadlessTask(HeadlessTask);
} // }

View file

@ -163,7 +163,12 @@
8EC12A68941D40E98E0D60BE /* Fix Xcode 15 Bug */, 8EC12A68941D40E98E0D60BE /* Fix Xcode 15 Bug */,
49AEAB1D332B45ED9A37B009 /* Fix Xcode 15 Bug */, 49AEAB1D332B45ED9A37B009 /* Fix Xcode 15 Bug */,
D75A41050AB3445786799848 /* 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 = ( buildRules = (
); );
@ -576,6 +581,176 @@ fi";
shellScript = " shellScript = "
echo \"Remove signature files (Xcode workaround)\"; echo \"Remove signature files (Xcode workaround)\";
rm -rf \"$CONFIGURATION_BUILD_DIR/MapLibre.xcframework-ios.signature\"; 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 */ /* End PBXShellScriptBuildPhase section */

View file

@ -25,7 +25,7 @@ import { useUpdates } from "~/updates";
import Error from "~/components/Error"; import Error from "~/components/Error";
import useTrackLocation from "~/hooks/useTrackLocation"; import useTrackLocation from "~/hooks/useTrackLocation";
import { initializeBackgroundFetch } from "~/services/backgroundFetch"; // import { initializeBackgroundFetch } from "~/services/backgroundFetch";
import useMount from "~/hooks/useMount"; import useMount from "~/hooks/useMount";
const appLogger = createLogger({ const appLogger = createLogger({
@ -221,22 +221,22 @@ function AppContent() {
useNetworkListener(); useNetworkListener();
useTrackLocation(); useTrackLocation();
useMount(() => { // useMount(() => {
const setupBackgroundFetch = async () => { // const setupBackgroundFetch = async () => {
try { // try {
appLogger.info("Setting up BackgroundFetch"); // appLogger.info("Setting up BackgroundFetch");
await initializeBackgroundFetch(); // await initializeBackgroundFetch();
appLogger.debug("BackgroundFetch setup completed"); // appLogger.debug("BackgroundFetch setup completed");
} catch (error) { // } catch (error) {
lifecycleLogger.error("BackgroundFetch setup failed", { // lifecycleLogger.error("BackgroundFetch setup failed", {
error: error?.message, // error: error?.message,
}); // });
errorHandler(error); // errorHandler(error);
} // }
}; // };
setupBackgroundFetch(); // setupBackgroundFetch();
}); // });
// Handle deep links after app is initialized with error handling // Handle deep links after app is initialized with error handling
useEffect(() => { useEffect(() => {

View file

@ -88,9 +88,9 @@ export const generateSuggestKeepOpenContent = (data) => {
export const generateBackgroundGeolocationLostContent = (data) => { export const generateBackgroundGeolocationLostContent = (data) => {
return { return {
title: `Alerte-Secours ne peut plus accéder à votre position`, title: `Alerte-Secours ne reçoit plus de mises à jour de votre position`,
body: `Vous ne pouvez plus recevoir d'alertes de proximité. Vérifiez les paramètres.`, body: `Vous ne pourrez 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.`, 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.`,
}; };
}; };

View file

@ -8,7 +8,7 @@ import notifSuggestKeepOpen from "./channels/notifSuggestKeepOpen";
import notifRelativeAllowAsk from "./channels/notifRelativeAllowAsk"; import notifRelativeAllowAsk from "./channels/notifRelativeAllowAsk";
import notifRelativeInvitation from "./channels/notifRelativeInvitation"; import notifRelativeInvitation from "./channels/notifRelativeInvitation";
import notifBackgroundGeolocationLost from "./channels/notifBackgroundGeolocationLost"; import notifBackgroundGeolocationLost from "./channels/notifBackgroundGeolocationLost";
import notifGeolocationHeartbeatSync from "./channels/notifGeolocationHeartbeatSync"; // import notifGeolocationHeartbeatSync from "./channels/notifGeolocationHeartbeatSync.js.bak";
const displayLogger = createLogger({ const displayLogger = createLogger({
module: BACKGROUND_SCOPES.NOTIFICATIONS, module: BACKGROUND_SCOPES.NOTIFICATIONS,
@ -23,7 +23,7 @@ const SUPPORTED_ACTIONS = {
"relative-allow-ask": notifRelativeAllowAsk, "relative-allow-ask": notifRelativeAllowAsk,
"relative-invitation": notifRelativeInvitation, "relative-invitation": notifRelativeInvitation,
"background-geolocation-lost": notifBackgroundGeolocationLost, "background-geolocation-lost": notifBackgroundGeolocationLost,
"geolocation-heartbeat-sync": notifGeolocationHeartbeatSync, // "geolocation-heartbeat-sync": notifGeolocationHeartbeatSync,
}; };
export default async function displayNotificationHandler(data) { export default async function displayNotificationHandler(data) {