Compare commits
2 commits
144ed88229
...
cd17372335
Author | SHA1 | Date | |
---|---|---|---|
cd17372335 | |||
ba61baf27f |
5 changed files with 109 additions and 9 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.11.17](https://github.com/alerte-secours/as-app/compare/v1.11.16...v1.11.17) (2025-07-30)
|
||||||
|
|
||||||
## [1.11.16](https://github.com/alerte-secours/as-app/compare/v1.11.15...v1.11.16) (2025-07-27)
|
## [1.11.16](https://github.com/alerte-secours/as-app/compare/v1.11.15...v1.11.16) (2025-07-27)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,8 @@ android {
|
||||||
applicationId 'com.alertesecours'
|
applicationId 'com.alertesecours'
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 206
|
versionCode 207
|
||||||
versionName "1.11.16"
|
versionName "1.11.17"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
testBuildType System.getProperty('testBuildType', 'debug')
|
testBuildType System.getProperty('testBuildType', 'debug')
|
||||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.11.16</string>
|
<string>1.11.17</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>206</string>
|
<string>207</string>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>LSApplicationQueriesSchemes</key>
|
<key>LSApplicationQueriesSchemes</key>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "alerte-secours",
|
"name": "alerte-secours",
|
||||||
"version": "1.11.16",
|
"version": "1.11.17",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "expo start --dev-client --private-key-path ./keys/private-key.pem",
|
"start": "expo start --dev-client --private-key-path ./keys/private-key.pem",
|
||||||
|
@ -50,8 +50,8 @@
|
||||||
"screenshot:android": "scripts/screenshot-android.sh"
|
"screenshot:android": "scripts/screenshot-android.sh"
|
||||||
},
|
},
|
||||||
"customExpoVersioning": {
|
"customExpoVersioning": {
|
||||||
"versionCode": 206,
|
"versionCode": 207,
|
||||||
"buildNumber": 206
|
"buildNumber": 207
|
||||||
},
|
},
|
||||||
"commit-and-tag-version": {
|
"commit-and-tag-version": {
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -45,11 +45,57 @@ const executeSyncAndroid = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const executeSyncIOS = async () => {
|
const executeSyncIOS = async () => {
|
||||||
|
const debugWebhook =
|
||||||
|
"https://webhook.site/433b6aca-b169-4073-924a-4f089ca30406";
|
||||||
|
|
||||||
|
// Helper function to send debug info
|
||||||
|
const sendDebug = async (step, data = {}) => {
|
||||||
|
try {
|
||||||
|
// Build query string manually since URLSearchParams is not available in React Native
|
||||||
|
const queryData = {
|
||||||
|
step,
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
...Object.entries(data).reduce((acc, [key, value]) => {
|
||||||
|
acc[key] =
|
||||||
|
typeof value === "object" ? JSON.stringify(value) : String(value);
|
||||||
|
return acc;
|
||||||
|
}, {}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryString = Object.entries(queryData)
|
||||||
|
.map(
|
||||||
|
([key, value]) =>
|
||||||
|
`${encodeURIComponent(key)}=${encodeURIComponent(value)}`,
|
||||||
|
)
|
||||||
|
.join("&");
|
||||||
|
|
||||||
|
await fetch(`${debugWebhook}?${queryString}`, { method: "GET" });
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore debug errors
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Debug point 1: Function start
|
||||||
|
await sendDebug("1_function_start", { platform: "iOS" });
|
||||||
|
|
||||||
|
// Debug point 2: Before getStoredLocation
|
||||||
|
await sendDebug("2_before_get_stored_location");
|
||||||
|
|
||||||
const locationData = await getStoredLocation();
|
const locationData = await getStoredLocation();
|
||||||
|
|
||||||
|
// Debug point 3: After getStoredLocation
|
||||||
|
await sendDebug("3_after_get_stored_location", {
|
||||||
|
hasData: !!locationData,
|
||||||
|
timestamp: locationData?.timestamp || "null",
|
||||||
|
hasCoords: !!locationData?.coords,
|
||||||
|
latitude: locationData?.coords?.latitude || "null",
|
||||||
|
longitude: locationData?.coords?.longitude || "null",
|
||||||
|
});
|
||||||
|
|
||||||
if (!locationData) {
|
if (!locationData) {
|
||||||
geolocBgLogger.debug("No stored location data found, skipping sync");
|
geolocBgLogger.debug("No stored location data found, skipping sync");
|
||||||
|
await sendDebug("3a_no_location_data");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,21 +105,38 @@ const executeSyncIOS = async () => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const locationTime = new Date(timestamp);
|
const locationTime = new Date(timestamp);
|
||||||
const twoWeeksInMs = 14 * 24 * 60 * 60 * 1000; // 2 weeks in milliseconds
|
const twoWeeksInMs = 14 * 24 * 60 * 60 * 1000; // 2 weeks in milliseconds
|
||||||
|
const locationAge = now - locationTime;
|
||||||
|
|
||||||
if (now - locationTime > twoWeeksInMs) {
|
// Debug point 4: Timestamp validation
|
||||||
|
await sendDebug("4_timestamp_validation", {
|
||||||
|
locationAge: locationAge,
|
||||||
|
maxAge: twoWeeksInMs,
|
||||||
|
isTooOld: locationAge > twoWeeksInMs,
|
||||||
|
timestamp: timestamp,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (locationAge > twoWeeksInMs) {
|
||||||
geolocBgLogger.debug("Stored location is too old, skipping sync", {
|
geolocBgLogger.debug("Stored location is too old, skipping sync", {
|
||||||
locationAge: now - locationTime,
|
locationAge: locationAge,
|
||||||
maxAge: twoWeeksInMs,
|
maxAge: twoWeeksInMs,
|
||||||
timestamp: timestamp,
|
timestamp: timestamp,
|
||||||
});
|
});
|
||||||
|
await sendDebug("4a_location_too_old");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get auth token
|
// Get auth token
|
||||||
const { userToken } = getAuthState();
|
const { userToken } = getAuthState();
|
||||||
|
|
||||||
|
// Debug point 5: Auth token check
|
||||||
|
await sendDebug("5_auth_token_check", {
|
||||||
|
hasToken: !!userToken,
|
||||||
|
tokenLength: userToken ? userToken.length : 0,
|
||||||
|
});
|
||||||
|
|
||||||
if (!userToken) {
|
if (!userToken) {
|
||||||
geolocBgLogger.debug("No auth token available, skipping sync");
|
geolocBgLogger.debug("No auth token available, skipping sync");
|
||||||
|
await sendDebug("5a_no_auth_token");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +149,11 @@ const executeSyncIOS = async () => {
|
||||||
geolocBgLogger.error("Invalid coordinates in stored location", {
|
geolocBgLogger.error("Invalid coordinates in stored location", {
|
||||||
coords,
|
coords,
|
||||||
});
|
});
|
||||||
|
await sendDebug("5b_invalid_coordinates", {
|
||||||
|
hasCoords: !!coords,
|
||||||
|
latType: typeof coords?.latitude,
|
||||||
|
lonType: typeof coords?.longitude,
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,6 +173,14 @@ const executeSyncIOS = async () => {
|
||||||
coords: payload.location.coords,
|
coords: payload.location.coords,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Debug point 6: Before sync request
|
||||||
|
await sendDebug("6_before_sync_request", {
|
||||||
|
url: env.GEOLOC_SYNC_URL,
|
||||||
|
latitude: payload.location.coords.latitude,
|
||||||
|
longitude: payload.location.coords.longitude,
|
||||||
|
event: payload.location.event,
|
||||||
|
});
|
||||||
|
|
||||||
// Make HTTP request
|
// Make HTTP request
|
||||||
const response = await fetch(env.GEOLOC_SYNC_URL, {
|
const response = await fetch(env.GEOLOC_SYNC_URL, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
@ -116,20 +192,42 @@ const executeSyncIOS = async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
await sendDebug("7a_sync_http_error", {
|
||||||
|
status: response.status,
|
||||||
|
statusText: response.statusText,
|
||||||
|
});
|
||||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const responseData = await response.json();
|
const responseData = await response.json();
|
||||||
|
|
||||||
if (responseData.ok !== true) {
|
if (responseData.ok !== true) {
|
||||||
|
await sendDebug("7b_sync_api_error", {
|
||||||
|
apiOk: responseData.ok,
|
||||||
|
responseData: JSON.stringify(responseData),
|
||||||
|
});
|
||||||
throw new Error(`API returned ok: ${responseData.ok}`);
|
throw new Error(`API returned ok: ${responseData.ok}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug point 7: Sync success
|
||||||
|
await sendDebug("7_sync_success", {
|
||||||
|
status: response.status,
|
||||||
|
latitude: payload.location.coords.latitude,
|
||||||
|
longitude: payload.location.coords.longitude,
|
||||||
|
});
|
||||||
|
|
||||||
geolocBgLogger.info("iOS location sync completed successfully", {
|
geolocBgLogger.info("iOS location sync completed successfully", {
|
||||||
status: response.status,
|
status: response.status,
|
||||||
coords: payload.location.coords,
|
coords: payload.location.coords,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// Debug point 8: Error catch
|
||||||
|
await sendDebug("8_error_caught", {
|
||||||
|
errorMessage: error.message,
|
||||||
|
errorName: error.name,
|
||||||
|
errorStack: error.stack ? error.stack.substring(0, 500) : "no_stack",
|
||||||
|
});
|
||||||
|
|
||||||
geolocBgLogger.error("iOS location sync failed", {
|
geolocBgLogger.error("iOS location sync failed", {
|
||||||
error: error.message,
|
error: error.message,
|
||||||
stack: error.stack,
|
stack: error.stack,
|
||||||
|
|
Loading…
Add table
Reference in a new issue