chore: clean

This commit is contained in:
devthejo 2025-06-28 08:03:17 +02:00
parent 7a816c867e
commit 52e7314005
2 changed files with 36 additions and 100 deletions

View file

@ -184,7 +184,8 @@
F71413BB66E2439C85473BEA /* Fix Xcode 15 Bug */, F71413BB66E2439C85473BEA /* Fix Xcode 15 Bug */,
496EE3C8D7E445ABA85A39A6 /* Fix Xcode 15 Bug */, 496EE3C8D7E445ABA85A39A6 /* Fix Xcode 15 Bug */,
F7ADCC68A8E44BA69FCA849E /* Fix Xcode 15 Bug */, F7ADCC68A8E44BA69FCA849E /* Fix Xcode 15 Bug */,
3F0C28FA929447E59D14DFED /* Remove signature files (Xcode workaround) */, B1AB92A327A24FB294681EDD /* Fix Xcode 15 Bug */,
F65632CE7D4A409F817EEC81 /* Remove signature files (Xcode workaround) */,
); );
buildRules = ( buildRules = (
); );
@ -1029,6 +1030,40 @@ 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\";
";
};
B1AB92A327A24FB294681EDD /* 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";
};
F65632CE7D4A409F817EEC81 /* 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

@ -330,110 +330,11 @@ export default async function trackLocation() {
code: error.code, code: error.code,
}); });
} }
// Add a function to check for pending records
async function checkPendingRecords() {
try {
const count = await BackgroundGeolocation.getCount();
locationLogger.debug("Pending location records", { count });
Sentry.addBreadcrumb({
message: "Checking pending location records",
category: "geolocation",
level: "info",
data: { pendingCount: count },
});
if (count > 0) {
locationLogger.info(`Found ${count} pending records, forcing sync`);
await Sentry.startSpan(
{
name: "force-sync-pending-records",
op: "geolocation-sync",
},
async (span) => {
try {
const { userToken } = getAuthState();
const state = await BackgroundGeolocation.getState();
if (userToken && state.enabled) {
const records = await BackgroundGeolocation.sync();
locationLogger.debug("Forced sync result", {
recordsCount: records?.length || 0,
});
Sentry.addBreadcrumb({
message: "Forced sync completed",
category: "geolocation",
level: "info",
data: {
recordsCount: records?.length || 0,
hadToken: true,
wasEnabled: true,
},
});
span.setStatus({ code: SPAN_STATUS_OK, message: "ok" });
} else {
Sentry.addBreadcrumb({
message: "Forced sync skipped",
category: "geolocation",
level: "warning",
data: {
hasToken: !!userToken,
isEnabled: state.enabled,
},
});
span.setStatus({ code: SPAN_STATUS_OK, message: "skipped" });
}
} catch (error) {
locationLogger.error("Forced sync failed", {
error: error,
stack: error.stack,
});
Sentry.captureException(error, {
tags: {
module: "track-location",
operation: "force-sync-pending",
},
contexts: {
pendingRecords: { count },
},
});
span.setStatus({
code: SPAN_STATUS_ERROR,
message: "internal_error",
});
throw error; // Re-throw to ensure span captures the error
}
},
);
}
} catch (error) {
locationLogger.error("Failed to get pending records count", {
error: error.message,
});
Sentry.captureException(error, {
tags: {
module: "track-location",
operation: "check-pending-records",
},
});
}
}
const { userToken } = getAuthState(); const { userToken } = getAuthState();
locationLogger.debug("Setting up auth state subscription"); locationLogger.debug("Setting up auth state subscription");
subscribeAuthState(({ userToken }) => userToken, handleAuth); subscribeAuthState(({ userToken }) => userToken, handleAuth);
locationLogger.debug("Performing initial auth handling"); locationLogger.debug("Performing initial auth handling");
handleAuth(userToken); handleAuth(userToken);
// Check for pending records after a short delay to ensure everything is initialized
setTimeout(checkPendingRecords, 5000);
// Initialize emulator mode if previously enabled // Initialize emulator mode if previously enabled
initEmulatorMode(); initEmulatorMode();
} }