Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
e6f23b83be | |||
f11f9d8371 | |||
4aff7380ce | |||
7501c04bbd | |||
3aebd4cd1c | |||
aea3a26096 | |||
b635f29f45 | |||
fd081d46a6 | |||
c1b220f007 | |||
754e14946c | |||
48b663799d | |||
894d26dad1 | |||
7f30ef9abf |
27 changed files with 870 additions and 82 deletions
20
CHANGELOG.md
20
CHANGELOG.md
|
@ -2,6 +2,26 @@
|
|||
|
||||
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.1](https://github.com/alerte-secours/as-app/compare/v1.11.0...v1.11.1) (2025-07-18)
|
||||
|
||||
## [1.11.0](https://github.com/alerte-secours/as-app/compare/v1.10.9...v1.11.0) (2025-07-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **anchor:** bglost notification scroll to permissions + wip ([fd081d4](https://github.com/alerte-secours/as-app/commit/fd081d46a657059353bfb1e6022b68eedaee4e1a))
|
||||
* optout sentry reporting ([c1b220f](https://github.com/alerte-secours/as-app/commit/c1b220f0078db8d07b3d58a7ac146d8af159a17d))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* force location sync storage effect on interval ([7f30ef9](https://github.com/alerte-secours/as-app/commit/7f30ef9abf11bbdade5c3db3bfd7269dc212b39c))
|
||||
* menu paramètres ([754e149](https://github.com/alerte-secours/as-app/commit/754e14946c0fa397558e5983a39c082c9072fe5c))
|
||||
* message_permission_required ([894d26d](https://github.com/alerte-secours/as-app/commit/894d26dad12c4736cde827232764ed5c8d77df4e))
|
||||
* **notification:** android background-geolocation-lost ([aea3a26](https://github.com/alerte-secours/as-app/commit/aea3a2609639f01b1d7aa414c67e3bdb99a1a47c))
|
||||
* title_permission_required ([48b6637](https://github.com/alerte-secours/as-app/commit/48b663799d4bb4ef69671f0291a77a65418e2544))
|
||||
* wip ([b635f29](https://github.com/alerte-secours/as-app/commit/b635f29f45928210bc9a9a8c5d201d91a6b48a07))
|
||||
|
||||
## [1.10.9](https://github.com/alerte-secours/as-app/compare/v1.10.7...v1.10.9) (2025-07-06)
|
||||
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ android {
|
|||
applicationId 'com.alertesecours'
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 189
|
||||
versionName "1.10.9"
|
||||
versionCode 191
|
||||
versionName "1.11.1"
|
||||
multiDexEnabled true
|
||||
testBuildType System.getProperty('testBuildType', 'debug')
|
||||
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
||||
|
|
|
@ -64,6 +64,10 @@
|
|||
<action android:name="com.alertesecours.OPEN_RELATIVES"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.alertesecours.OPEN_BACKGROUND_GEOLOCATION_SETTINGS"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
<intent-filter android:autoVerify="true" data-generated="true">
|
||||
<action android:name="android.intent.action.VIEW"/>
|
||||
<data android:scheme="https" android:host="app.alertesecours.fr" android:pathPrefix="/"/>
|
||||
|
|
7
android/app/src/main/res/values-fr/strings.xml
Normal file
7
android/app/src/main/res/values-fr/strings.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<resources>
|
||||
<string name="app_name">Alerte Secours</string>
|
||||
|
||||
<!-- French permission message for background geolocation -->
|
||||
<string name="message_permission_required">Alerte Secours nécessite la localisation en arrière-plan pour les alertes de proximité.</string>
|
||||
<string name="title_permission_required">Autorisation requise</string>
|
||||
</resources>
|
|
@ -4,4 +4,6 @@
|
|||
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
|
||||
<string name="expo_system_ui_user_interface_style" translatable="false">automatic</string>
|
||||
<string name="expo_runtime_version">1.0.0</string>
|
||||
<string name="message_permission_required">Alerte Secours nécessite la localisation en arrière-plan pour les alertes de proximité.</string>
|
||||
<string name="title_permission_required">Autorisation requise</string>
|
||||
</resources>
|
|
@ -131,13 +131,13 @@ let config = {
|
|||
"tel",
|
||||
"telprompt",
|
||||
],
|
||||
},
|
||||
UIBackgroundModes: ["location", "fetch", "processing"],
|
||||
BGTaskSchedulerPermittedIdentifiers: [
|
||||
"com.transistorsoft.fetch",
|
||||
"com.transistorsoft.customtask",
|
||||
],
|
||||
},
|
||||
UIBackgroundModes: ["location", "fetch", "processing"],
|
||||
},
|
||||
plugins: [
|
||||
[
|
||||
"react-native-background-geolocation",
|
||||
|
|
|
@ -97,3 +97,72 @@ You can run this script directly:
|
|||
export DEVICE=emulator-5554
|
||||
./install-android.sh
|
||||
```
|
||||
|
||||
# enable USB debug mode
|
||||
|
||||
Add udev rules for your device
|
||||
|
||||
1. First, find your device's vendor ID:
|
||||
|
||||
```sh
|
||||
lsusb
|
||||
```
|
||||
|
||||
Look for your phone manufacturer (e.g., Google, Samsung, OnePlus). Note the ID like 18d1:4ee7
|
||||
|
||||
2. Create/edit the udev rules file:
|
||||
|
||||
```sh
|
||||
sudo micro /etc/udev/rules.d/51-android.rules
|
||||
```
|
||||
|
||||
3. Add a line for your device. Here are common manufacturers:
|
||||
|
||||
```
|
||||
# Google
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
|
||||
# Samsung
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
|
||||
# OnePlus
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", MODE="0666", GROUP="plugdev"
|
||||
# Xiaomi
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="2717", MODE="0666", GROUP="plugdev"
|
||||
```
|
||||
|
||||
4. Set proper permissions and reload rules:
|
||||
|
||||
```sh
|
||||
sudo chmod a+r /etc/udev/rules.d/51-android.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo service udev restart
|
||||
```
|
||||
|
||||
5. Add yourself to the plugdev group:
|
||||
|
||||
```sh
|
||||
sudo usermod -aG plugdev $USER
|
||||
```
|
||||
|
||||
Force the authorization prompt
|
||||
|
||||
1. Kill adb server:
|
||||
|
||||
```sh
|
||||
adb kill-server
|
||||
```
|
||||
|
||||
2. Unplug your device
|
||||
3. On your phone:
|
||||
- Go to Developer options
|
||||
- Revoke USB debugging authorizations
|
||||
- Toggle USB debugging OFF then ON
|
||||
|
||||
4. Plug the device back in
|
||||
5. Start adb with proper permissions:
|
||||
|
||||
```sh
|
||||
adb start-server
|
||||
adb devices
|
||||
```
|
||||
|
||||
6. The authorization prompt should now appear on your phone
|
8
index.js
8
index.js
|
@ -19,7 +19,7 @@ import onMessageReceived from "~/notifications/onMessageReceived";
|
|||
|
||||
import { createLogger } from "~/lib/logger";
|
||||
import * as Sentry from "@sentry/react-native";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { memoryAsyncStorage } from "~/storage/memoryAsyncStorage";
|
||||
import { STORAGE_KEYS } from "~/storage/storageKeys";
|
||||
|
||||
// setup notification, this have to stay in index.js
|
||||
|
@ -38,7 +38,7 @@ const FORCE_SYNC_INTERVAL = 12 * 60 * 60 * 1000;
|
|||
// Helper functions for persisting sync time
|
||||
const getLastSyncTime = async () => {
|
||||
try {
|
||||
const value = await AsyncStorage.getItem(
|
||||
const value = await memoryAsyncStorage.getItem(
|
||||
STORAGE_KEYS.GEOLOCATION_LAST_SYNC_TIME,
|
||||
);
|
||||
return value ? parseInt(value, 10) : Date.now();
|
||||
|
@ -52,7 +52,7 @@ const getLastSyncTime = async () => {
|
|||
|
||||
const setLastSyncTime = async (time) => {
|
||||
try {
|
||||
await AsyncStorage.setItem(
|
||||
await memoryAsyncStorage.setItem(
|
||||
STORAGE_KEYS.GEOLOCATION_LAST_SYNC_TIME,
|
||||
time.toString(),
|
||||
);
|
||||
|
@ -139,7 +139,7 @@ const HeadlessTask = async (event) => {
|
|||
geolocBgLogger.debug("getCurrentPosition result", { location });
|
||||
|
||||
if (timeSinceLastSync >= FORCE_SYNC_INTERVAL) {
|
||||
geolocBgLogger.info("Forcing location sync after 24h");
|
||||
geolocBgLogger.info("Forcing location sync");
|
||||
|
||||
try {
|
||||
// Change pace to ensure location updates with timeout
|
||||
|
|
249
install-ios.sh
Executable file
249
install-ios.sh
Executable file
|
@ -0,0 +1,249 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Function to print colored output
|
||||
print_error() {
|
||||
echo -e "${RED}Error: $1${NC}" >&2
|
||||
}
|
||||
|
||||
print_success() {
|
||||
echo -e "${GREEN}$1${NC}"
|
||||
}
|
||||
|
||||
print_warning() {
|
||||
echo -e "${YELLOW}Warning: $1${NC}"
|
||||
}
|
||||
|
||||
print_info() {
|
||||
echo -e "${BLUE}$1${NC}"
|
||||
}
|
||||
|
||||
print_plain() {
|
||||
echo -e "$1"
|
||||
}
|
||||
|
||||
# Check if Xcode command line tools are available
|
||||
if ! command -v xcrun &> /dev/null; then
|
||||
print_error "Xcode command line tools are not installed."
|
||||
print_info "Please install them by running: xcode-select --install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Define IPA path
|
||||
IPA_PATH="ios/build/AlerteSecours.ipa"
|
||||
|
||||
# Check if IPA file exists
|
||||
if [ ! -f "$IPA_PATH" ]; then
|
||||
print_error "IPA file not found at: $IPA_PATH"
|
||||
print_info "Please build the iOS bundle first by running:"
|
||||
print_info " yarn bundle:ios"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
print_info "Found IPA file: $IPA_PATH"
|
||||
|
||||
# Function to get connected physical iOS devices
|
||||
get_physical_devices() {
|
||||
xcrun devicectl list devices 2>/dev/null | awk 'NR>2 && $4=="available" {print $3}' || true
|
||||
}
|
||||
|
||||
# Function to get available simulators (booted ones)
|
||||
get_booted_simulators() {
|
||||
xcrun simctl list devices | grep -E "\(Booted\)" | sed -E 's/.*\(([A-F0-9-]{36})\) \(Booted\)/\1/' || true
|
||||
}
|
||||
|
||||
# Function to get simulator name by UDID
|
||||
get_simulator_name() {
|
||||
local udid="$1"
|
||||
xcrun simctl list devices | grep "$udid" | sed -E 's/^[[:space:]]*([^(]+).*/\1/' | xargs
|
||||
}
|
||||
|
||||
# Function to get device name by UDID (for physical devices)
|
||||
get_device_name() {
|
||||
local udid="$1"
|
||||
xcrun devicectl list devices 2>/dev/null | awk -v target_udid="$udid" 'NR>2 && $3==target_udid {print $1}' || echo "Unknown Device"
|
||||
}
|
||||
|
||||
# Function to validate physical device UDID
|
||||
validate_physical_device() {
|
||||
local device_id="$1"
|
||||
local devices=$(get_physical_devices)
|
||||
|
||||
if [ -z "$devices" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$devices" | grep -q "^$device_id$"
|
||||
}
|
||||
|
||||
# Function to validate simulator UDID
|
||||
validate_simulator() {
|
||||
local simulator_id="$1"
|
||||
local simulators=$(get_booted_simulators)
|
||||
|
||||
if [ -z "$simulators" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$simulators" | grep -q "^$simulator_id$"
|
||||
}
|
||||
|
||||
# Function to install on physical device
|
||||
install_on_device() {
|
||||
local device_id="$1"
|
||||
local device_name=$(get_device_name "$device_id")
|
||||
|
||||
print_info "Installing on physical device: $device_name ($device_id)"
|
||||
|
||||
if xcrun devicectl device install app --device "$device_id" "$IPA_PATH"; then
|
||||
print_success "Installation completed successfully on $device_name!"
|
||||
return 0
|
||||
else
|
||||
print_error "Installation failed on $device_name"
|
||||
print_info "Common solutions:"
|
||||
print_info " 1. Make sure the device is unlocked and trusted"
|
||||
print_info " 2. Check that the provisioning profile matches the device"
|
||||
print_info " 3. Verify the device has enough storage space"
|
||||
print_info " 4. Try disconnecting and reconnecting the device"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to install on simulator
|
||||
install_on_simulator() {
|
||||
local simulator_id="$1"
|
||||
local simulator_name=$(get_simulator_name "$simulator_id")
|
||||
|
||||
print_info "Installing on simulator: $simulator_name ($simulator_id)"
|
||||
|
||||
if xcrun simctl install "$simulator_id" "$IPA_PATH"; then
|
||||
print_success "Installation completed successfully on $simulator_name!"
|
||||
return 0
|
||||
else
|
||||
print_error "Installation failed on $simulator_name"
|
||||
print_info "Make sure the simulator is booted and try again"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Main installation logic
|
||||
if [ -n "$IOS_DEVICE" ]; then
|
||||
# Specific physical device requested
|
||||
print_info "Using specified physical device: $IOS_DEVICE"
|
||||
|
||||
if ! validate_physical_device "$IOS_DEVICE"; then
|
||||
print_error "Physical device $IOS_DEVICE is not connected or not found."
|
||||
print_info "Connected physical devices:"
|
||||
physical_devices=$(get_physical_devices)
|
||||
if [ -n "$physical_devices" ]; then
|
||||
echo "$physical_devices" | while read -r device; do
|
||||
device_name=$(get_device_name "$device")
|
||||
print_info " - $device ($device_name)"
|
||||
done
|
||||
else
|
||||
print_info " No physical devices found"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install_on_device "$IOS_DEVICE"
|
||||
|
||||
elif [ -n "$IOS_SIMULATOR" ]; then
|
||||
# Specific simulator requested
|
||||
print_info "Using specified simulator: $IOS_SIMULATOR"
|
||||
|
||||
if ! validate_simulator "$IOS_SIMULATOR"; then
|
||||
print_error "Simulator $IOS_SIMULATOR is not booted or not found."
|
||||
print_info "Booted simulators:"
|
||||
booted_simulators=$(get_booted_simulators)
|
||||
if [ -n "$booted_simulators" ]; then
|
||||
echo "$booted_simulators" | while read -r sim; do
|
||||
sim_name=$(get_simulator_name "$sim")
|
||||
print_info " - $sim ($sim_name)"
|
||||
done
|
||||
else
|
||||
print_info " No booted simulators found"
|
||||
print_info " Start a simulator from Xcode or run: xcrun simctl boot <simulator-udid>"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install_on_simulator "$IOS_SIMULATOR"
|
||||
|
||||
else
|
||||
# Auto-detect: prefer physical devices, fallback to simulators
|
||||
print_info "Auto-detecting iOS targets..."
|
||||
|
||||
# Try physical devices first
|
||||
physical_devices=$(get_physical_devices)
|
||||
if [ -n "$physical_devices" ]; then
|
||||
target_device=$(echo "$physical_devices" | head -n 1)
|
||||
device_count=$(echo "$physical_devices" | wc -l | tr -d ' ')
|
||||
|
||||
if [ "$device_count" -gt 1 ]; then
|
||||
print_warning "Multiple physical devices found. Using first device: $target_device"
|
||||
print_info "Available physical devices:"
|
||||
echo "$physical_devices" | while read -r device; do
|
||||
device_name=$(get_device_name "$device")
|
||||
if [ "$device" = "$target_device" ]; then
|
||||
print_info " - $device ($device_name) [selected]"
|
||||
else
|
||||
print_info " - $device ($device_name)"
|
||||
fi
|
||||
done
|
||||
print_info "To use a specific device, run: IOS_DEVICE=<device-udid> yarn install:ios"
|
||||
else
|
||||
device_name=$(get_device_name "$target_device")
|
||||
print_info "Using physical device: $device_name ($target_device)"
|
||||
fi
|
||||
|
||||
install_on_device "$target_device"
|
||||
else
|
||||
# No physical devices, try simulators
|
||||
print_info "No physical devices found. Looking for booted simulators..."
|
||||
|
||||
booted_simulators=$(get_booted_simulators)
|
||||
if [ -n "$booted_simulators" ]; then
|
||||
target_simulator=$(echo "$booted_simulators" | head -n 1)
|
||||
simulator_count=$(echo "$booted_simulators" | wc -l | tr -d ' ')
|
||||
|
||||
if [ "$simulator_count" -gt 1 ]; then
|
||||
print_warning "Multiple booted simulators found. Using first simulator: $target_simulator"
|
||||
print_info "Available booted simulators:"
|
||||
echo "$booted_simulators" | while read -r sim; do
|
||||
sim_name=$(get_simulator_name "$sim")
|
||||
if [ "$sim" = "$target_simulator" ]; then
|
||||
print_info " - $sim ($sim_name) [selected]"
|
||||
else
|
||||
print_info " - $sim ($sim_name)"
|
||||
fi
|
||||
done
|
||||
print_info "To use a specific simulator, run: IOS_SIMULATOR=<simulator-udid> yarn install:ios"
|
||||
else
|
||||
simulator_name=$(get_simulator_name "$target_simulator")
|
||||
print_info "Using simulator: $simulator_name ($target_simulator)"
|
||||
fi
|
||||
|
||||
install_on_simulator "$target_simulator"
|
||||
else
|
||||
print_error "No iOS devices or booted simulators found."
|
||||
print_info "Please either:"
|
||||
print_info " 1. Connect and trust an iOS device, or"
|
||||
print_info " 2. Boot a simulator from Xcode"
|
||||
print_info ""
|
||||
print_info "Usage examples:"
|
||||
print_info " Auto-detect: yarn install:ios"
|
||||
print_info " Specific device: IOS_DEVICE=<device-udid> yarn install:ios"
|
||||
print_info " Specific simulator: IOS_SIMULATOR=<simulator-udid> yarn install:ios"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
|
@ -158,9 +158,12 @@
|
|||
800E24972A6A228C8D4807E9 /* [CP] Copy Pods Resources */,
|
||||
6C173A6450034E8CAB58FB0C /* Fix Xcode 15 Bug */,
|
||||
CBB0E03A64A84F6FB794EDB2 /* Upload Debug Symbols to Sentry */,
|
||||
6EA5AE3725914306AC3A5BE5 /* Remove signature files (Xcode workaround) */,
|
||||
8A20F54D80BCC2E27CF783AE /* [CP] Embed Pods Frameworks */,
|
||||
36EBB336DD5343908AA35FFC /* [CP-User] [RNFB] Core Configuration */,
|
||||
8EC12A68941D40E98E0D60BE /* Fix Xcode 15 Bug */,
|
||||
49AEAB1D332B45ED9A37B009 /* Fix Xcode 15 Bug */,
|
||||
D75A41050AB3445786799848 /* Fix Xcode 15 Bug */,
|
||||
ABC6C5A0D48A4B7980D60E1B /* Remove signature files (Xcode workaround) */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -473,6 +476,108 @@
|
|||
shellPath = /bin/sh;
|
||||
shellScript = "/bin/sh `${NODE_BINARY:-node} --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode-debug-files.sh'\"`";
|
||||
};
|
||||
8EC12A68941D40E98E0D60BE /* 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";
|
||||
};
|
||||
700E335CAFA54AABB46BAB62 /* 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\";
|
||||
";
|
||||
};
|
||||
49AEAB1D332B45ED9A37B009 /* 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";
|
||||
};
|
||||
E611D841DFAE4F71B8077AD3 /* 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\";
|
||||
";
|
||||
};
|
||||
D75A41050AB3445786799848 /* 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";
|
||||
};
|
||||
ABC6C5A0D48A4B7980D60E1B /* 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 */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
|
@ -516,7 +621,7 @@
|
|||
);
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alertesecours.alertesecours;
|
||||
PRODUCT_NAME = AlerteSecours;
|
||||
PRODUCT_NAME = "AlerteSecours";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "AlerteSecours/AlerteSecours-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
@ -535,7 +640,7 @@
|
|||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 2PZ49Y23LX;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64";
|
||||
INFOPLIST_FILE = AlerteSecours/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
|
@ -547,7 +652,7 @@
|
|||
);
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.alertesecours.alertesecours;
|
||||
PRODUCT_NAME = AlerteSecours;
|
||||
PRODUCT_NAME = "AlerteSecours";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "AlerteSecours/AlerteSecours-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 62 KiB |
|
@ -2,6 +2,11 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BGTaskSchedulerPermittedIdentifiers</key>
|
||||
<array>
|
||||
<string>com.transistorsoft.fetch</string>
|
||||
<string>com.transistorsoft.customtask</string>
|
||||
</array>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
|
@ -19,7 +24,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.10.9</string>
|
||||
<string>1.11.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
|
@ -42,7 +47,7 @@
|
|||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>189</string>
|
||||
<string>191</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "alerte-secours",
|
||||
"version": "1.10.9",
|
||||
"version": "1.11.1",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "expo start --dev-client --private-key-path ./keys/private-key.pem",
|
||||
|
@ -37,6 +37,7 @@
|
|||
"e2e:test": "detox test --configuration android.emu.debug",
|
||||
"e2e:run": "yarn start & yarn e2e:build && yarn e2e:deploy && yarn e2e:test",
|
||||
"install:android": "./install-android.sh",
|
||||
"install:ios": "./install-ios.sh",
|
||||
"log:android": "adb -s $DEVICE logcat | grep -E 'ReactNativeJS: '",
|
||||
"log:ios:simulator": "xcrun simctl spawn booted log stream --level debug --predicate 'subsystem contains \"com.facebook.react.log\" and processImagePath contains \"AlerteSecours\"'",
|
||||
"log:ios": "idevicesyslog | grep -i 'AlerteSecours\\|ReactNative'",
|
||||
|
@ -49,8 +50,8 @@
|
|||
"screenshot:android": "scripts/screenshot-android.sh"
|
||||
},
|
||||
"customExpoVersioning": {
|
||||
"versionCode": 189,
|
||||
"buildNumber": 189
|
||||
"versionCode": 191,
|
||||
"buildNumber": 191
|
||||
},
|
||||
"commit-and-tag-version": {
|
||||
"scripts": {
|
||||
|
|
|
@ -6,7 +6,7 @@ import { ErrorUtils } from "react-native";
|
|||
import { createLogger } from "~/lib/logger";
|
||||
import { SYSTEM_SCOPES } from "~/lib/logger/scopes";
|
||||
|
||||
import { authActions, permissionWizardActions } from "~/stores";
|
||||
import { authActions, permissionWizardActions, paramsActions } from "~/stores";
|
||||
import { secureStore } from "~/storage/memorySecureStore";
|
||||
import memoryAsyncStorage from "~/storage/memoryAsyncStorage";
|
||||
|
||||
|
@ -62,6 +62,7 @@ const initializeStores = () => {
|
|||
// Then initialize other stores sequentially
|
||||
initializeStore("authActions", authActions.init);
|
||||
initializeStore("permissionWizard", permissionWizardActions.init);
|
||||
initializeStore("paramsActions", paramsActions.init);
|
||||
initializeStore("storeSubscriptions", storeSubscriptions.init);
|
||||
|
||||
appLogger.info("Core initialization complete");
|
||||
|
|
|
@ -18,8 +18,8 @@ export default function DrawerItemList(props) {
|
|||
const { routes } = state;
|
||||
|
||||
const section1 = routes.slice(0, 5);
|
||||
const section2 = routes.slice(5, 8);
|
||||
const section3 = routes.slice(8, routes.length);
|
||||
const section2 = routes.slice(5, 9);
|
||||
const section3 = routes.slice(9, routes.length);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import { navActions } from "~/stores";
|
||||
import { createLogger } from "~/lib/logger";
|
||||
import { BACKGROUND_SCOPES } from "~/lib/logger/scopes";
|
||||
|
||||
const backgroundGeolocationLogger = createLogger({
|
||||
module: BACKGROUND_SCOPES.NOTIFICATIONS,
|
||||
feature: "action-open-background-geolocation-settings",
|
||||
});
|
||||
|
||||
export default function actionOpenBackgroundGeolocationSettings({ data }) {
|
||||
backgroundGeolocationLogger.debug(
|
||||
"actionOpenBackgroundGeolocationSettings called",
|
||||
);
|
||||
|
||||
navActions.setNextNavigation([
|
||||
{
|
||||
name: "Params",
|
||||
params: {
|
||||
anchor: "permissions",
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
|
@ -1,9 +1,26 @@
|
|||
import { navActions } from "~/stores";
|
||||
import { createLogger } from "~/lib/logger";
|
||||
import { BACKGROUND_SCOPES } from "~/lib/logger/scopes";
|
||||
|
||||
const settingsLogger = createLogger({
|
||||
module: BACKGROUND_SCOPES.NOTIFICATIONS,
|
||||
feature: "action-open-settings",
|
||||
});
|
||||
|
||||
export default function actionOpenSettings({ data }) {
|
||||
settingsLogger.debug("actionOpenSettings called", {
|
||||
data,
|
||||
hasData: !!data,
|
||||
dataKeys: data ? Object.keys(data) : [],
|
||||
});
|
||||
|
||||
navActions.setNextNavigation([
|
||||
{
|
||||
name: "Params",
|
||||
},
|
||||
]);
|
||||
|
||||
settingsLogger.debug("Navigation set to Params screen", {
|
||||
navigationTarget: "Params",
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,6 +21,18 @@ export default async function notifBackgroundGeolocationLost(data) {
|
|||
},
|
||||
);
|
||||
|
||||
// DEBUG: Log notification configuration for diagnosis
|
||||
backgroundGeolocationLogger.info(
|
||||
"DEBUG: Background geolocation notification config",
|
||||
{
|
||||
channelId,
|
||||
pressActionId: "open-settings",
|
||||
launchActivity: "default",
|
||||
hasData: !!data,
|
||||
dataKeys: data ? Object.keys(data) : [],
|
||||
},
|
||||
);
|
||||
|
||||
// Generate notification content
|
||||
const { title, body, bigText } =
|
||||
generateBackgroundGeolocationLostContent(data);
|
||||
|
@ -34,14 +46,14 @@ export default async function notifBackgroundGeolocationLost(data) {
|
|||
bigText,
|
||||
android: {
|
||||
pressAction: {
|
||||
id: "open-settings",
|
||||
id: "open-background-geolocation-settings",
|
||||
launchActivity: "default",
|
||||
},
|
||||
actions: [
|
||||
{
|
||||
title: "Paramètres",
|
||||
pressAction: {
|
||||
id: "open-settings",
|
||||
id: "open-background-geolocation-settings",
|
||||
launchActivity: "default",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -5,6 +5,6 @@ const channelId = "system";
|
|||
export async function createNotificationChannel() {
|
||||
await createChannel({
|
||||
id: channelId,
|
||||
name: "System",
|
||||
name: "Paramètres",
|
||||
});
|
||||
}
|
||||
|
|
|
@ -84,10 +84,13 @@ export const createNotificationHandlers = (handlers) => {
|
|||
suggest_keep_open: async (data) => await openAlert({ data }),
|
||||
relative_invitation: async (data) => await openRelatives({ data }),
|
||||
relative_allow_ask: async (data) => await openRelatives({ data }),
|
||||
background_geolocation_lost: async (data) => {
|
||||
background_geolocation_lost: async (_data) => {
|
||||
navActions.setNextNavigation([
|
||||
{
|
||||
name: "Params",
|
||||
params: {
|
||||
anchor: "permissions",
|
||||
},
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
|
|
@ -15,6 +15,7 @@ import actionRelativeAllowReject from "./actions/actionRelativeAllowReject";
|
|||
import actionRelativeInvitationAccept from "./actions/actionRelativeInvitationAccept";
|
||||
import actionRelativeInvitationReject from "./actions/actionRelativeInvitationReject";
|
||||
import actionOpenSettings from "./actions/actionOpenSettings";
|
||||
import actionOpenBackgroundGeolocationSettings from "./actions/actionOpenBackgroundGeolocationSettings";
|
||||
|
||||
import { navActions } from "~/stores";
|
||||
|
||||
|
@ -97,11 +98,12 @@ export const onNotificationOpenedAppEvent = async (remoteMessage) => {
|
|||
// return;
|
||||
// }
|
||||
try {
|
||||
eventLogger.info("Processing background notification tap", {
|
||||
eventLogger.debug("Processing background notification tap", {
|
||||
messageId: remoteMessage?.messageId,
|
||||
data: remoteMessage?.data,
|
||||
notification: remoteMessage?.notification,
|
||||
clickAction: remoteMessage?.notification?.android?.clickAction,
|
||||
notificationType: remoteMessage?.data?.type || "unknown",
|
||||
});
|
||||
|
||||
if (!remoteMessage?.notification) {
|
||||
|
@ -275,8 +277,27 @@ export const onEvent = async ({ type, notification, pressAction }) => {
|
|||
break;
|
||||
}
|
||||
case "open-settings": {
|
||||
eventLogger.debug("Processing open-settings action", {
|
||||
data,
|
||||
actionId,
|
||||
notificationId: notification?.id,
|
||||
launchActivity: pressAction?.launchActivity,
|
||||
});
|
||||
await actionOpenSettings({ data });
|
||||
break;
|
||||
}
|
||||
case "open-background-geolocation-settings": {
|
||||
eventLogger.debug(
|
||||
"Processing open-background-geolocation-settings action",
|
||||
{
|
||||
data,
|
||||
actionId,
|
||||
notificationId: notification?.id,
|
||||
launchActivity: pressAction?.launchActivity,
|
||||
},
|
||||
);
|
||||
await actionOpenBackgroundGeolocationSettings({ data });
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -123,6 +123,11 @@ export default async function setActionCategories() {
|
|||
title: "Paramètres",
|
||||
foreground: true,
|
||||
},
|
||||
{
|
||||
id: "open-background-geolocation-settings",
|
||||
title: "Paramètres",
|
||||
foreground: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
78
src/scenes/Params/SentryOptOut.js
Normal file
78
src/scenes/Params/SentryOptOut.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
import React, { useCallback } from "react";
|
||||
import { View } from "react-native";
|
||||
import { Title, Switch } from "react-native-paper";
|
||||
import { createStyles } from "~/theme";
|
||||
import { useParamsState, paramsActions } from "~/stores";
|
||||
import Text from "~/components/Text";
|
||||
import { setSentryEnabled } from "~/sentry";
|
||||
|
||||
function SentryOptOut() {
|
||||
const styles = useStyles();
|
||||
const { sentryEnabled } = useParamsState(["sentryEnabled"]);
|
||||
|
||||
const handleToggle = useCallback(async () => {
|
||||
const newValue = !sentryEnabled;
|
||||
await paramsActions.setSentryEnabled(newValue);
|
||||
|
||||
// Dynamically enable/disable Sentry
|
||||
setSentryEnabled(newValue);
|
||||
}, [sentryEnabled]);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Title style={styles.title}>Rapport d'erreurs</Title>
|
||||
<View style={styles.content}>
|
||||
<View style={styles.switchContainer}>
|
||||
<Text style={styles.label}>Envoyer les rapports d'erreurs</Text>
|
||||
<Switch
|
||||
value={sentryEnabled}
|
||||
onValueChange={handleToggle}
|
||||
style={styles.switch}
|
||||
/>
|
||||
</View>
|
||||
<Text style={styles.description}>
|
||||
Les rapports d'erreurs nous aident à améliorer l'application en nous
|
||||
permettant de mieux identifier et corriger les problèmes techniques.
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const useStyles = createStyles(({ theme: { colors } }) => ({
|
||||
container: {
|
||||
width: "100%",
|
||||
alignItems: "center",
|
||||
},
|
||||
title: {
|
||||
fontSize: 20,
|
||||
fontWeight: "bold",
|
||||
marginVertical: 15,
|
||||
},
|
||||
content: {
|
||||
width: "100%",
|
||||
},
|
||||
switchContainer: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
marginBottom: 5,
|
||||
paddingVertical: 5,
|
||||
},
|
||||
label: {
|
||||
fontSize: 16,
|
||||
flex: 1,
|
||||
marginRight: 15,
|
||||
},
|
||||
switch: {
|
||||
flexShrink: 0,
|
||||
},
|
||||
description: {
|
||||
fontSize: 14,
|
||||
color: colors.onSurfaceVariant,
|
||||
textAlign: "left",
|
||||
lineHeight: 20,
|
||||
},
|
||||
}));
|
||||
|
||||
export default SentryOptOut;
|
|
@ -1,17 +1,40 @@
|
|||
import React from "react";
|
||||
import { View, ScrollView } from "react-native";
|
||||
import React, { useCallback, useRef } from "react";
|
||||
import { View, ScrollView, InteractionManager } from "react-native";
|
||||
import { createStyles } from "~/theme";
|
||||
import ParamsNotifications from "./Notifications";
|
||||
import ParamsRadius from "./Radius";
|
||||
import ParamsEmergencyCall from "./EmergencyCall";
|
||||
import ThemeSwitcher from "./ThemeSwitcher";
|
||||
import Permissions from "./Permissions";
|
||||
import SentryOptOut from "./SentryOptOut";
|
||||
import { useRoute, useFocusEffect } from "@react-navigation/native";
|
||||
|
||||
export default function ParamsView({ data }) {
|
||||
const styles = useStyles();
|
||||
|
||||
const scrollRef = useRef(null);
|
||||
const { params } = useRoute();
|
||||
const didScroll = useRef(false);
|
||||
|
||||
const recordLayout = useCallback(
|
||||
(key) =>
|
||||
({
|
||||
nativeEvent: {
|
||||
layout: { y },
|
||||
},
|
||||
}) => {
|
||||
if (didScroll.current || params?.anchor !== key) return;
|
||||
|
||||
InteractionManager.runAfterInteractions(() => {
|
||||
scrollRef.current?.scrollTo({ y, animated: true });
|
||||
didScroll.current = true;
|
||||
});
|
||||
},
|
||||
[params?.anchor],
|
||||
);
|
||||
|
||||
return (
|
||||
<ScrollView style={styles.scrollView}>
|
||||
<ScrollView ref={scrollRef} style={styles.scrollView}>
|
||||
<View style={styles.container}>
|
||||
<View style={styles.section}>
|
||||
<ThemeSwitcher />
|
||||
|
@ -26,6 +49,9 @@ export default function ParamsView({ data }) {
|
|||
<ParamsRadius data={data} />
|
||||
</View>
|
||||
<View style={styles.section}>
|
||||
<SentryOptOut />
|
||||
</View>
|
||||
<View onLayout={recordLayout("permissions")} style={styles.section}>
|
||||
<Permissions />
|
||||
</View>
|
||||
</View>
|
||||
|
|
|
@ -3,6 +3,15 @@ import { Platform } from "react-native";
|
|||
|
||||
import env from "~/env";
|
||||
import packageJson from "../../package.json";
|
||||
import memoryAsyncStorage from "~/storage/memoryAsyncStorage";
|
||||
import { STORAGE_KEYS } from "~/storage/storageKeys";
|
||||
import { createLogger } from "~/lib/logger";
|
||||
import { SYSTEM_SCOPES } from "~/lib/logger/scopes";
|
||||
|
||||
const sentryLogger = createLogger({
|
||||
module: SYSTEM_SCOPES.APP,
|
||||
feature: "sentry",
|
||||
});
|
||||
|
||||
// Get the build number from native code
|
||||
const getBuildNumber = () => {
|
||||
|
@ -23,8 +32,54 @@ const getReleaseVersion = () => {
|
|||
return `com.alertesecours@${version}+${buildNumber}`;
|
||||
};
|
||||
|
||||
// Check if Sentry is enabled by user preference
|
||||
const checkSentryEnabled = async () => {
|
||||
try {
|
||||
// Wait for memory storage to be initialized
|
||||
let retries = 0;
|
||||
const maxRetries = 10;
|
||||
|
||||
while (retries < maxRetries) {
|
||||
try {
|
||||
const stored = await memoryAsyncStorage.getItem(
|
||||
STORAGE_KEYS.SENTRY_ENABLED,
|
||||
);
|
||||
if (stored !== null) {
|
||||
return JSON.parse(stored);
|
||||
}
|
||||
break; // Storage is ready, no preference stored
|
||||
} catch (error) {
|
||||
if (
|
||||
error.message?.includes("not initialized") &&
|
||||
retries < maxRetries - 1
|
||||
) {
|
||||
// Wait a bit and retry if storage not initialized
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
retries++;
|
||||
continue;
|
||||
}
|
||||
sentryLogger.warn("Failed to check Sentry preference", {
|
||||
error: error.message,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
sentryLogger.warn("Failed to check Sentry preference", {
|
||||
error: error.message,
|
||||
});
|
||||
}
|
||||
// Default to enabled if no preference stored or error occurred
|
||||
return true;
|
||||
};
|
||||
|
||||
// Initialize Sentry with user preference check
|
||||
const initializeSentry = async () => {
|
||||
const isEnabled = await checkSentryEnabled();
|
||||
|
||||
Sentry.init({
|
||||
dsn: env.SENTRY_DSN,
|
||||
enabled: isEnabled,
|
||||
tracesSampleRate: 0.1,
|
||||
debug: __DEV__,
|
||||
// Configure release to match ios-archive.sh format
|
||||
|
@ -80,3 +135,36 @@ Sentry.init({
|
|||
// }),
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
// Initialize Sentry asynchronously
|
||||
initializeSentry().catch((error) => {
|
||||
sentryLogger.warn("Failed to initialize Sentry", {
|
||||
error: error.message,
|
||||
});
|
||||
});
|
||||
|
||||
// Export function to dynamically control Sentry
|
||||
export const setSentryEnabled = (enabled) => {
|
||||
try {
|
||||
// Use the newer Sentry API
|
||||
const client = Sentry.getClient();
|
||||
if (client) {
|
||||
const options = client.getOptions();
|
||||
options.enabled = enabled;
|
||||
if (!enabled) {
|
||||
// Clear any pending events when disabling
|
||||
Sentry.withScope((scope) => {
|
||||
scope.clear();
|
||||
});
|
||||
}
|
||||
sentryLogger.info("Sentry state toggled", { enabled });
|
||||
} else {
|
||||
sentryLogger.warn("Sentry client not available for toggling");
|
||||
}
|
||||
} catch (error) {
|
||||
sentryLogger.warn("Failed to toggle Sentry state", {
|
||||
error: error.message,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
@ -80,4 +80,5 @@ export const STORAGE_KEYS = {
|
|||
LAST_KNOWN_LOCATION: registerAsyncStorageKey("@last_known_location"),
|
||||
EULA_ACCEPTED_SIMPLE: registerAsyncStorageKey("eula_accepted"),
|
||||
EMULATOR_MODE_ENABLED: registerAsyncStorageKey("emulator_mode_enabled"),
|
||||
SENTRY_ENABLED: registerAsyncStorageKey("@sentry_enabled"),
|
||||
};
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
import { createAtom } from "~/lib/atomic-zustand";
|
||||
import memoryAsyncStorage from "~/storage/memoryAsyncStorage";
|
||||
import { STORAGE_KEYS } from "~/storage/storageKeys";
|
||||
import { createLogger } from "~/lib/logger";
|
||||
import { SYSTEM_SCOPES } from "~/lib/logger/scopes";
|
||||
|
||||
const paramsLogger = createLogger({
|
||||
module: SYSTEM_SCOPES.APP,
|
||||
feature: "params",
|
||||
});
|
||||
|
||||
export default createAtom(({ merge, reset }) => {
|
||||
const setDevModeEnabled = (b) => {
|
||||
|
@ -37,6 +46,45 @@ export default createAtom(({ merge, reset }) => {
|
|||
});
|
||||
};
|
||||
|
||||
const setSentryEnabled = async (sentryEnabled) => {
|
||||
merge({
|
||||
sentryEnabled,
|
||||
});
|
||||
|
||||
// Persist to storage
|
||||
try {
|
||||
await memoryAsyncStorage.setItem(
|
||||
STORAGE_KEYS.SENTRY_ENABLED,
|
||||
JSON.stringify(sentryEnabled),
|
||||
);
|
||||
} catch (error) {
|
||||
paramsLogger.warn("Failed to persist Sentry preference", {
|
||||
error: error.message,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const initSentryEnabled = async () => {
|
||||
try {
|
||||
const stored = await memoryAsyncStorage.getItem(
|
||||
STORAGE_KEYS.SENTRY_ENABLED,
|
||||
);
|
||||
if (stored !== null) {
|
||||
const sentryEnabled = JSON.parse(stored);
|
||||
merge({ sentryEnabled });
|
||||
return sentryEnabled;
|
||||
}
|
||||
} catch (error) {
|
||||
paramsLogger.warn("Failed to load Sentry preference", {
|
||||
error: error.message,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const init = async () => {
|
||||
await initSentryEnabled();
|
||||
};
|
||||
|
||||
return {
|
||||
default: {
|
||||
// devModeEnabled: false,
|
||||
|
@ -46,6 +94,7 @@ export default createAtom(({ merge, reset }) => {
|
|||
mapColorScheme: "auto",
|
||||
hasRegisteredRelatives: null,
|
||||
alertListSortBy: "location",
|
||||
sentryEnabled: true,
|
||||
},
|
||||
actions: {
|
||||
reset,
|
||||
|
@ -55,6 +104,8 @@ export default createAtom(({ merge, reset }) => {
|
|||
setMapColorScheme,
|
||||
setHasRegisteredRelatives,
|
||||
setAlertListSortBy,
|
||||
setSentryEnabled,
|
||||
init,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue