Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71694b2e11 | ||
|
|
b2c4cfb038 | ||
|
|
2bc819b993 | ||
|
|
75f9163e4e | ||
|
|
72893cf223 | ||
|
|
7ed3b975ee | ||
|
|
12034c9a0f | ||
|
|
3adebccb0c | ||
|
|
db2fe567bb | ||
|
|
2f512dd5cd | ||
|
|
74233f18b3 | ||
|
|
a50525f793 | ||
|
|
60fb1bdc7a | ||
|
|
2766e200e1 | ||
|
|
2b160ee2f8 | ||
|
|
37bab4e744 | ||
|
|
1b55534e20 |
+36
-22
@@ -1154,7 +1154,7 @@ export GEM_PATH=$shortened_path
|
||||
###### 1. Bump the version in package.json & CHANGELOG.md for `MARKETING_VERSION`, then `grep CURRENT_PROJECT_VERSION ios/App/App.xcodeproj/project.pbxproj` and add 1 for the numbered version here:
|
||||
|
||||
```bash
|
||||
cd ios/App && xcrun agvtool new-version 77 && perl -p -i -e "s/MARKETING_VERSION = .*;/MARKETING_VERSION = 1.4.11;/g" App.xcodeproj/project.pbxproj && cd -
|
||||
cd ios/App && xcrun agvtool new-version 80 && perl -p -i -e "s/MARKETING_VERSION = .*;/MARKETING_VERSION = 1.4.14;/g" App.xcodeproj/project.pbxproj && cd -
|
||||
# Unfortunately this edits Info.plist directly.
|
||||
#xcrun agvtool new-marketing-version 0.4.5
|
||||
```
|
||||
@@ -1333,12 +1333,13 @@ npm run build:android:test:run # test env build, install, launch
|
||||
npm run build:android # Development build (builds and opens Android Studio)
|
||||
npm run build:android:dev # Development build (builds and opens Android Studio)
|
||||
npm run build:android:test # Test build (builds for testing environment)
|
||||
npm run build:android:prod # Production build (builds for production environment).
|
||||
npm run build:android:prod # Production web bundle in a debug APK (not for upload; use build:android:release)
|
||||
|
||||
# Auto-run builds
|
||||
npm run build:android:test:run # Test build with auto-run (builds then runs on emulator)
|
||||
npm run build:android:prod:run # Production build with auto-run (builds then runs on emulator)
|
||||
# Auto-run targets the one connected device; with none or several it prompts, or exits 9 without a terminal
|
||||
# Auto-run installs the APK just built (debug, or release with --release) via native-run:
|
||||
# a hardware device, else a running emulator, else it boots an AVD. Set ANDROID_SERIAL to choose.
|
||||
|
||||
# Firebase off (`:nostore` sets FIREBASE_ENABLED=false, which passes -PfirebaseEnabled=false)
|
||||
npm run build:android:test:nostore:run # Same as test:run, without Firebase
|
||||
@@ -1347,13 +1348,11 @@ npm run build:android:prod:nostore # Same as prod, without Firebase
|
||||
# Debug and release builds
|
||||
npm run build:android:debug # Debug build (builds debug APK)
|
||||
npm run build:android:debug:run # Debug build with auto-run (builds then runs on emulator)
|
||||
npm run build:android:release # Release build (builds release APK)
|
||||
npm run build:android:release:run # Release build with auto-run (builds then runs on device)
|
||||
npm run build:android:release # Play Store release: production mode, signed APK + AAB (fails if unsigned)
|
||||
npm run build:android:release:run # Production release APK, installed and launched on a device
|
||||
|
||||
# Additional operations
|
||||
npm run build:android:studio # Build and open in Android Studio
|
||||
npm run build:android:apk # Build and generate APK file
|
||||
npm run build:android:aab # Build and generate AAB (Android App Bundle)
|
||||
npm run build:android:clean # Clean build artifacts only
|
||||
npm run build:android:sync # Sync Capacitor only
|
||||
npm run build:android:assets # Generate assets only
|
||||
@@ -1446,16 +1445,25 @@ The recommended way to build for Android is using the automated build script:
|
||||
##### 1. Bump the version in package.json, then update these versions & run:
|
||||
|
||||
```bash
|
||||
perl -p -i -e 's/versionCode .*/versionCode 77/g' android/app/build.gradle
|
||||
perl -p -i -e 's/versionName .*/versionName "1.4.11"/g' android/app/build.gradle
|
||||
perl -p -i -e 's/versionCode .*/versionCode 80/g' android/app/build.gradle
|
||||
perl -p -i -e 's/versionName .*/versionName "1.4.14"/g' android/app/build.gradle
|
||||
```
|
||||
|
||||
##### 1.1 Bump daily-notifications-plugin
|
||||
|
||||
If there is an update in the daily-notifications-plugin then run this:
|
||||
|
||||
```
|
||||
npm run deps:update-daily-notification-plugin
|
||||
```
|
||||
|
||||
##### 2. Build
|
||||
|
||||
Here's prod. Also available: test, dev
|
||||
Here's 'release'. Also available: prod, test, dev -- but only 'release' builds an aab for the Play Store
|
||||
|
||||
```bash
|
||||
npm run build:android:prod
|
||||
# if you use pkgx: pkgx +openjdk.org /bin/zsh
|
||||
npm run build:android:release
|
||||
```
|
||||
|
||||
##### 2.1. (Optional) Open the project in Android Studio
|
||||
@@ -1464,15 +1472,20 @@ npm run build:android:prod
|
||||
npx cap open android
|
||||
```
|
||||
|
||||
##### 3. Use Android Studio to build and run on emulator or device
|
||||
##### 2.2 (Optional) Android Build from the console
|
||||
|
||||
#### Android Build from the console
|
||||
This is if you didn't build with ":release" but rather with ":prod".
|
||||
|
||||
`cd android`
|
||||
|
||||
* Note that this currently fails: `./gradlew build`
|
||||
|
||||
To create a signed `aab` release:
|
||||
To create a signed `aab` release, run `npm run build:android:release` from the
|
||||
project root: it builds the production web bundle, syncs it, and runs
|
||||
`assembleRelease` and `bundleRelease`. It first runs
|
||||
`scripts/check-installed-deps.js`, which stops the build when `node_modules`
|
||||
does not match `package-lock.json` (fix with `npm ci`); it never updates
|
||||
dependencies itself. The steps below are the manual equivalent.
|
||||
|
||||
- Setup by adding the app/gradle.properties.secrets file (see properties at top
|
||||
of app/build.gradle) and the app/time-safari-upload-key-pkcs12.jks file
|
||||
@@ -1498,13 +1511,15 @@ To create an unsigned debugging bundle (not usable in Play Store):
|
||||
uploading, confirm it has production server defaults:
|
||||
`./scripts/check-prod-bundle.sh android/app/build/outputs/bundle/release/app-release.aab`
|
||||
* `build-android.sh` runs `./gradlew clean`, which deletes any earlier `aab`, so
|
||||
run `bundleRelease` after the build script finishes.
|
||||
when building by hand, run `bundleRelease` after the build script finishes.
|
||||
|
||||
##### 3 Release to Play Store
|
||||
|
||||
At play.google.com/console:
|
||||
|
||||
- Go to Production or the Closed Testing and either Create Track or Manage Track.
|
||||
- Click "Create new release".
|
||||
- Upload the `aab` file from: app/build/outputs/bundle/release/app-release.aab
|
||||
- Upload the `aab` file from: android/app/build/outputs/bundle/release/app-release.aab
|
||||
- Hit "Next".
|
||||
- Save, go to "Publishing Overview" as prompted, and click "Send changes for review".
|
||||
|
||||
@@ -2157,10 +2172,9 @@ command chaining, following DRY principles.
|
||||
--test Build for testing environment
|
||||
--prod, --production Build for production environment
|
||||
--debug Build debug APK
|
||||
--release Build release APK
|
||||
--release Build signed release APK (production unless --dev/--test)
|
||||
--studio Open Android Studio after build
|
||||
--apk Build APK file
|
||||
--aab Build AAB (Android App Bundle)
|
||||
--aab Also build a signed release AAB (implies --release)
|
||||
--clean Clean build artifacts only
|
||||
--sync Sync Capacitor only
|
||||
--assets Generate assets only
|
||||
@@ -2170,8 +2184,8 @@ command chaining, following DRY principles.
|
||||
|
||||
# Examples
|
||||
./scripts/build-android.sh --dev --studio # Development build + open studio
|
||||
./scripts/build-android.sh --prod --apk # Production APK build
|
||||
./scripts/build-android.sh --test --aab # Testing AAB build
|
||||
./scripts/build-android.sh --prod # Production web build, debug APK
|
||||
./scripts/build-android.sh --prod --aab # Play Store release APK + AAB
|
||||
./scripts/build-android.sh --clean # Clean only
|
||||
./scripts/build-android.sh --sync # Sync only
|
||||
```
|
||||
@@ -2185,7 +2199,7 @@ command chaining, following DRY principles.
|
||||
**Build Types**:
|
||||
|
||||
- **Debug**: Build debug APK (default)
|
||||
- **Release**: Build release APK
|
||||
- **Release**: Build signed release APK (production mode unless --dev or --test is given)
|
||||
|
||||
**Exit Codes**:
|
||||
|
||||
|
||||
@@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [1.4.14] - 2026.11.11
|
||||
### Fixed
|
||||
- Crash on starting the camera (and other permissions requests)
|
||||
|
||||
|
||||
## [1.4.13] - 2026.11.10
|
||||
### Fixed
|
||||
- Tapping the New Activity notification opens New Activity, including when that tap is what launches the app. Receiving the notification does not open it.
|
||||
### Changed
|
||||
- SMS notifications are the default in settings, followed by advanced ones: push, on-device, and reminder.
|
||||
- The iOS camera and location permission prompts say Giftopia. The location prompts say it is used to find people and projects nearby, and the "always" location prompt has a message too.
|
||||
|
||||
|
||||
## [1.4.11] - 2026.11.01
|
||||
### Added
|
||||
- The first visit to the feed asks for interests (and an optional location) instead of showing the three welcome pages, then shows the people and projects closest in meaning, nearest first.
|
||||
|
||||
@@ -378,10 +378,10 @@ Prerequisites: git, Node.js 20 (see `.nvmrc`), Java 21, and the Android SDK with
|
||||
|
||||
```bash
|
||||
npm ci
|
||||
npm run build:android:prod -- --apk
|
||||
npm run build:android:prod
|
||||
```
|
||||
|
||||
`npm ci` installs the exact dependency versions locked for 1.4.6. `build:android:prod -- --apk` builds the web app with production server settings, syncs it into the Android project, and runs `./gradlew assembleDebug`. The result is signed with your local Android debug key, so it installs on any device without a release keystore.
|
||||
`npm ci` installs the exact dependency versions locked for 1.4.6. `build:android:prod` builds the web app with production server settings, syncs it into the Android project, and runs `./gradlew assembleDebug`. The result is signed with your local Android debug key, so it installs on any device without a release keystore.
|
||||
|
||||
4. Find the APK at `android/app/build/outputs/apk/debug/app-debug.apk` and install it, either with `adb install android/app/build/outputs/apk/debug/app-debug.apk` (USB debugging enabled on the phone) or by copying the file to the phone and opening it (allow "Install unknown apps" for the file manager).
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ android {
|
||||
applicationId "app.timesafari.app"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 77
|
||||
versionName "1.4.11"
|
||||
versionCode 80
|
||||
versionName "1.4.14"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
|
||||
Vendored
+12
@@ -19,3 +19,15 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
-renamesourcefileattribute SourceFile
|
||||
|
||||
# Capacitor plugin annotations. Without this, R8 sees no class implementing the
|
||||
# @CapacitorPlugin annotation interface (runtime proxies are invisible to it),
|
||||
# concludes PluginHandle.pluginAnnotation is always null, and compiles
|
||||
# Plugin.getPermissionStates() to a NullPointerException. Every plugin's
|
||||
# checkPermissions()/requestPermissions() then crashes release builds only.
|
||||
-keep @interface com.getcapacitor.annotation.** { *; }
|
||||
-keep @interface com.getcapacitor.NativePlugin { *; }
|
||||
-keepclassmembers class com.getcapacitor.PluginHandle {
|
||||
private com.getcapacitor.annotation.CapacitorPlugin pluginAnnotation;
|
||||
private com.getcapacitor.NativePlugin legacyPluginAnnotation;
|
||||
}
|
||||
|
||||
@@ -67,14 +67,15 @@
|
||||
/>
|
||||
|
||||
<!-- BootReceiver: reschedule daily notification after device restart.
|
||||
Two intent-filters: BOOT_COMPLETED has no Uri, so must not share a filter with <data scheme="package"/> or the boot broadcast never matches. -->
|
||||
Two intent-filters: BOOT_COMPLETED has no Uri, so must not share a filter with <data scheme="package"/> or the boot broadcast never matches.
|
||||
Not directBootAware and no LOCKED_BOOT_COMPLETED: before first unlock, credential-encrypted storage is
|
||||
unavailable, and both TimeSafariApplication (via TimeSafariNativeFetcher) and BootReceiver read
|
||||
SharedPreferences, which throws IllegalStateException and crashes the process. -->
|
||||
<receiver
|
||||
android:name="org.timesafari.dailynotification.BootReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:directBootAware="true">
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
<intent-filter android:priority="1000">
|
||||
|
||||
@@ -54,7 +54,6 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher
|
||||
|
||||
private final Gson gson = new Gson();
|
||||
private final Context appContext;
|
||||
private final SharedPreferences prefs;
|
||||
|
||||
private volatile String apiBaseUrl;
|
||||
private volatile String activeDid;
|
||||
@@ -65,7 +64,17 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher
|
||||
|
||||
public TimeSafariNativeFetcher(Context context) {
|
||||
this.appContext = context.getApplicationContext();
|
||||
this.prefs = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opened on use, never in the constructor: this object is built in
|
||||
* Application.onCreate, which also runs when a direct-boot-aware component
|
||||
* (e.g. Firebase messaging) starts the process before the user's first unlock,
|
||||
* and credential-encrypted SharedPreferences throw until then.
|
||||
* getSharedPreferences caches the instance, so repeated calls are cheap.
|
||||
*/
|
||||
private SharedPreferences prefs() {
|
||||
return appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -291,7 +300,7 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher
|
||||
|
||||
private List<String> getStarredPlanIds() {
|
||||
try {
|
||||
String idsJson = prefs.getString(KEY_STARRED_PLAN_IDS, "[]");
|
||||
String idsJson = prefs().getString(KEY_STARRED_PLAN_IDS, "[]");
|
||||
if (idsJson == null || idsJson.isEmpty() || "[]".equals(idsJson)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -308,7 +317,7 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher
|
||||
}
|
||||
|
||||
private String getLastAcknowledgedJwtId() {
|
||||
return prefs.getString(KEY_LAST_ACKED_JWT_ID, null);
|
||||
return prefs().getString(KEY_LAST_ACKED_JWT_ID, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,7 +339,7 @@ public class TimeSafariNativeFetcher implements NativeNotificationContentFetcher
|
||||
}
|
||||
}
|
||||
if (jwtId != null) {
|
||||
prefs.edit().putString(KEY_LAST_ACKED_JWT_ID, jwtId).apply();
|
||||
prefs().edit().putString(KEY_LAST_ACKED_JWT_ID, jwtId).apply();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Could not extract JWT ID from response", e);
|
||||
|
||||
+24
-15
@@ -103,8 +103,9 @@ alert channels keep requiring registration).
|
||||
- Notification settings are also on `AccountViewView.vue`, under
|
||||
"New Activity Notification", and only for registered identities (the notify
|
||||
API refuses unregistered DIDs). Two channels:
|
||||
- In-App (`notifyingNewActivityTime`), shown only when
|
||||
`showGeneralAdvanced` is on because of iOS delivery problems
|
||||
- In-App (`notifyingNewActivityTime`), under a collapsed "Advanced" link
|
||||
that shows only when `showGeneralAdvanced` is on, because of iOS delivery
|
||||
problems
|
||||
(`doc/sms-notifications.md`), delivered by server push or on-device
|
||||
schedule (`newActivityDelivery`).
|
||||
- SMS (`smsNotificationsEnabled`, `notifyingNewActivitySmsPhone`,
|
||||
@@ -310,20 +311,27 @@ kept interests wait on the phone for that moment.
|
||||
matches use your saved profile."
|
||||
- **Step 2, "Get alerted."** On the phone apps only
|
||||
(`offersAlerts(capabilities)`: native and mobile), since web and desktop
|
||||
have no Notifications section. Two choices, in this order:
|
||||
have no Notifications section. Text message up front, in-app under a
|
||||
collapsed "Advanced" link:
|
||||
1. **Text message** (labelled "most reliable"): runs the existing
|
||||
`toggleSmsEnabled` → `SmsVerificationDialog` → time prompt →
|
||||
`authorizeSmsAlertSearch` sequence. Shown disabled with the reason when
|
||||
the identity uses a passkey or SMS is otherwise unavailable.
|
||||
2. **In-app notification**: runs the existing in-app enable path, with the
|
||||
note "may arrive late on iPhone".
|
||||
A link to `help-notification-types` sits under both.
|
||||
note "may arrive late on iPhone". It sits under "Advanced", whose link
|
||||
shows only with `showGeneralAdvanced` on; once in-app is on, it shows
|
||||
regardless so the card reports it. A link to
|
||||
`help-notification-types` sits under it.
|
||||
- "Done" and "No thanks" at the bottom; both set the stage to `done`, which
|
||||
clears the dot and the card. Completing every step shown (the save, plus
|
||||
an alert on the phone apps) also sets `done`.
|
||||
The card is a thin layer over methods `AccountViewView` already has; the
|
||||
notification section below it is unchanged, so a person who ignores the
|
||||
card finds the same toggles where they always were.
|
||||
The card is a thin layer over methods `AccountViewView` already has. The
|
||||
notification section below it follows the same layout: SMS first, then an
|
||||
"Advanced" link (shown only with `showGeneralAdvanced` on) that expands
|
||||
in-app New Activity and, last, the Daily Reminder. A channel that is on
|
||||
shows even while collapsed, so it can be turned off. The section shows only
|
||||
for registered identities; an unregistered one sees just a channel that is
|
||||
still on.
|
||||
|
||||
### Welcome text
|
||||
|
||||
@@ -393,10 +401,11 @@ its registration gate.
|
||||
(Google's on most Android phones; absent on some FOSS devices).
|
||||
4. **Geolocation dependency.** Accept `@capacitor/geolocation` and its
|
||||
`play-services-location` dependency (with the map fallback).
|
||||
5. **In-app choice visibility.** The card shows the in-app option even when
|
||||
`showGeneralAdvanced` is off. SMS is listed first. The card appears only
|
||||
for registered identities, so neither choice needs a registration
|
||||
message.
|
||||
5. **In-app choice visibility.** SMS is the default alert. The in-app option
|
||||
sits under a collapsed "Advanced" link that shows only when
|
||||
`showGeneralAdvanced` is on, on the card and in the Profile page's
|
||||
Notifications section alike. The card appears only for registered
|
||||
identities, so neither choice needs a registration message.
|
||||
6. **Default alert time.** Pre-fill the time prompt with 9:00 local and show
|
||||
"change".
|
||||
7. **Re-prompt rule.** After the "x" close, return on the next cold start.
|
||||
@@ -415,7 +424,7 @@ its registration gate.
|
||||
- [x] Tests in `test/controller-partner-9-similar.js`: unregistered text query
|
||||
succeeds; per-IP limit with a spoofed `X-Forwarded-For` ignored when the
|
||||
proxy is not trusted; cache hit skips inference; full queue returns 503.
|
||||
- [ ] Deploy to the test server before the app's results view depends on it.
|
||||
- [x] Deploy to the test server before the app's results view depends on it.
|
||||
|
||||
### This app: state and gating
|
||||
|
||||
@@ -444,7 +453,7 @@ its registration gate.
|
||||
(`ACCESS_COARSE_LOCATION`, `ACCESS_FINE_LOCATION`), iOS
|
||||
`NSLocationWhenInUseUsageDescription`, Podfile entry; note the Play Services
|
||||
dependency in `doc/android-firebase-gms.md`.
|
||||
- [ ] iOS `pod install` for `CapacitorGeolocation` (updates `Podfile.lock`;
|
||||
- [x] iOS `pod install` for `CapacitorGeolocation` (updates `Podfile.lock`;
|
||||
`scripts/build-ios.sh` runs it through `cap sync`) — next: run on a machine
|
||||
with CocoaPods (Trent)
|
||||
- [x] `src/libs/partnerServer.ts`: `fetchSimilar(params)` typed client for
|
||||
@@ -466,7 +475,7 @@ its registration gate.
|
||||
Discover, Projects, and the results view; sets `bannerShownAt`.
|
||||
- [x] `NextStepCard.vue` in `AccountViewView.vue`: Step 1 save (text +
|
||||
rounded point + `searchBoxes[0]`), Step 2 alerts with SMS first and in-app
|
||||
second, reasons when disabled, "Done" / "No thanks"; rendered only for
|
||||
under "Advanced", reasons when disabled, "Done" / "No thanks"; rendered only for
|
||||
registered identities; clears interests from `onboardingState` only on a
|
||||
successful save.
|
||||
- [x] `AccountViewView.vue` "Public Profile": with no saved profile, pre-fill
|
||||
@@ -568,10 +568,11 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = App/AppDebug.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 77;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
|
||||
FIREBASE_ENABLED = YES;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Giftopia;
|
||||
@@ -580,7 +581,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.4.11;
|
||||
MARKETING_VERSION = 1.4.14;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -599,10 +600,11 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 77;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||
ENABLE_APP_SANDBOX = NO;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
|
||||
FIREBASE_ENABLED = YES;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Giftopia;
|
||||
@@ -611,7 +613,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.4.11;
|
||||
MARKETING_VERSION = 1.4.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
||||
@@ -629,7 +631,7 @@
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = TimeSafariShareExtension/TimeSafariShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 77;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
FIREBASE_ENABLED = YES;
|
||||
@@ -645,7 +647,7 @@
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MARKETING_VERSION = 1.4.11;
|
||||
MARKETING_VERSION = 1.4.14;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari.TimeSafariShareExtension;
|
||||
@@ -669,7 +671,7 @@
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = TimeSafariShareExtension/TimeSafariShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 77;
|
||||
CURRENT_PROJECT_VERSION = 80;
|
||||
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
FIREBASE_ENABLED = YES;
|
||||
@@ -685,7 +687,7 @@
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MARKETING_VERSION = 1.4.11;
|
||||
MARKETING_VERSION = 1.4.14;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari.TimeSafariShareExtension;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
|
||||
Generated
+4
-4
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "giftopia",
|
||||
"version": "1.4.12-beta",
|
||||
"version": "1.4.15-beta",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "giftopia",
|
||||
"version": "1.4.12-beta",
|
||||
"version": "1.4.15-beta",
|
||||
"dependencies": {
|
||||
"@capacitor-community/electron": "^5.0.1",
|
||||
"@capacitor-community/sqlite": "^7.0.3",
|
||||
@@ -11512,8 +11512,8 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@timesafari/daily-notification-plugin": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "git+https://gitea.anomalistdesign.com/trent_larson/daily-notification-plugin.git#cde2d5ab96c6413929aa5a2b13c59f2d8032165d",
|
||||
"version": "5.0.1",
|
||||
"resolved": "git+https://gitea.anomalistdesign.com/trent_larson/daily-notification-plugin.git#5953daa423eb0e2e136e816aa469f2eba7deee82",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
|
||||
+3
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "giftopia",
|
||||
"version": "1.4.12-beta",
|
||||
"version": "1.4.15-beta",
|
||||
"description": "Giftopia App",
|
||||
"author": {
|
||||
"name": "Gift Economies Team"
|
||||
@@ -17,8 +17,6 @@
|
||||
"auto-run:prod": "./scripts/auto-run.sh --prod",
|
||||
"auto-run:test": "./scripts/auto-run.sh --test",
|
||||
"build:android": "./scripts/build-android.sh",
|
||||
"build:android:aab": "./scripts/build-android.sh --aab",
|
||||
"build:android:apk": "./scripts/build-android.sh --apk",
|
||||
"build:android:assets": "./scripts/build-android.sh --assets",
|
||||
"build:android:clean": "./scripts/build-android.sh --clean",
|
||||
"build:android:debug": "./scripts/build-android.sh --debug",
|
||||
@@ -32,8 +30,8 @@
|
||||
"build:android:prod:nostore": "FIREBASE_ENABLED=false npm run build:android:prod",
|
||||
"build:android:prod:nostore:run": "FIREBASE_ENABLED=false npm run build:android:prod:run",
|
||||
"build:android:prod:run": "./scripts/build-android.sh --prod --auto-run",
|
||||
"build:android:release": "./scripts/build-android.sh --release",
|
||||
"build:android:release:run": "./scripts/build-android.sh --release --auto-run",
|
||||
"build:android:release": "./scripts/build-android.sh --prod --release --aab",
|
||||
"build:android:release:run": "./scripts/build-android.sh --prod --release --auto-run",
|
||||
"build:android:studio": "./scripts/build-android.sh --studio",
|
||||
"build:android:sync": "./scripts/build-android.sh --sync",
|
||||
"build:android:test": "./scripts/build-android.sh --test",
|
||||
|
||||
+52
-40
@@ -14,10 +14,10 @@
|
||||
# --test Build for testing environment
|
||||
# --prod, --production Build for production environment
|
||||
# --debug Build debug APK
|
||||
# --release Build release APK
|
||||
# --release Build signed release APK (production mode unless
|
||||
# --dev or --test is given; fails if unsigned)
|
||||
# --studio Open Android Studio after build
|
||||
# --apk Build APK file
|
||||
# --aab Build AAB (Android App Bundle)
|
||||
# --aab Also build a signed release AAB (implies --release)
|
||||
# --clean Clean build artifacts only
|
||||
# --sync Sync Capacitor only
|
||||
# --assets Generate assets only
|
||||
@@ -29,8 +29,8 @@
|
||||
#
|
||||
# Examples:
|
||||
# ./scripts/build-android.sh --dev --studio # Development build + open studio
|
||||
# ./scripts/build-android.sh --prod --apk # Production APK build
|
||||
# ./scripts/build-android.sh --test --aab # Testing AAB build
|
||||
# ./scripts/build-android.sh --prod # Production web build, debug APK
|
||||
# ./scripts/build-android.sh --prod --aab # Play Store release APK + AAB
|
||||
# ./scripts/build-android.sh --clean # Clean only
|
||||
# ./scripts/build-android.sh --sync # Sync only
|
||||
#
|
||||
@@ -44,6 +44,8 @@
|
||||
# 7 - Asset generation failed
|
||||
# 8 - Android Studio launch failed
|
||||
# 9 - Android asset validation failed
|
||||
# 10 - Production bundle check failed
|
||||
# 11 - node_modules does not match package-lock.json (release builds)
|
||||
|
||||
# Exit on any error
|
||||
set -e
|
||||
@@ -329,9 +331,9 @@ validate_android_assets() {
|
||||
|
||||
# Default values
|
||||
BUILD_MODE="development"
|
||||
BUILD_MODE_SET=false
|
||||
BUILD_TYPE="debug"
|
||||
OPEN_STUDIO=false
|
||||
BUILD_APK=false
|
||||
BUILD_AAB=false
|
||||
CLEAN_ONLY=false
|
||||
SYNC_ONLY=false
|
||||
@@ -352,12 +354,15 @@ parse_android_args() {
|
||||
case $arg in
|
||||
--dev|--development)
|
||||
BUILD_MODE="development"
|
||||
BUILD_MODE_SET=true
|
||||
;;
|
||||
--test)
|
||||
BUILD_MODE="test"
|
||||
BUILD_MODE_SET=true
|
||||
;;
|
||||
--prod|--production)
|
||||
BUILD_MODE="production"
|
||||
BUILD_MODE_SET=true
|
||||
;;
|
||||
--debug)
|
||||
BUILD_TYPE="debug"
|
||||
@@ -368,11 +373,9 @@ parse_android_args() {
|
||||
--studio)
|
||||
OPEN_STUDIO=true
|
||||
;;
|
||||
--apk)
|
||||
BUILD_APK=true
|
||||
;;
|
||||
--aab)
|
||||
BUILD_AAB=true
|
||||
BUILD_TYPE="release"
|
||||
;;
|
||||
--clean)
|
||||
CLEAN_ONLY=true
|
||||
@@ -428,15 +431,14 @@ print_android_usage() {
|
||||
echo " --test Build for testing environment"
|
||||
echo " --prod, --production Build for production environment"
|
||||
echo " --debug Build debug APK (default)"
|
||||
echo " --release Build release APK"
|
||||
echo " --release Build signed release APK (production unless --dev/--test)"
|
||||
echo " --studio Open Android Studio after build"
|
||||
echo " --apk Build APK file"
|
||||
echo " --aab Build AAB (Android App Bundle)"
|
||||
echo " --aab Also build a signed release AAB (implies --release)"
|
||||
echo " --clean Clean build artifacts only"
|
||||
echo " --sync Sync Capacitor only"
|
||||
echo " --assets Generate assets only"
|
||||
echo " --deploy Deploy APK to connected device"
|
||||
echo " --auto-run Auto-run app after build"
|
||||
echo " --auto-run Install and launch the APK just built (debug or release)"
|
||||
echo " --uninstall Uninstall app from connected device"
|
||||
echo " --api-ip <ip> Custom IP address for claim API (defaults to 10.0.2.2)"
|
||||
echo ""
|
||||
@@ -449,8 +451,8 @@ print_android_usage() {
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 --dev --studio # Development build + open studio"
|
||||
echo " $0 --prod --apk # Production APK build"
|
||||
echo " $0 --test --aab # Testing AAB build"
|
||||
echo " $0 --prod # Production web build, debug APK"
|
||||
echo " $0 --prod --aab # Play Store release APK + AAB"
|
||||
echo " $0 --test --auto-run # Test build + auto-run"
|
||||
echo " $0 --clean # Clean only"
|
||||
echo " $0 --sync # Sync only"
|
||||
@@ -464,6 +466,13 @@ print_android_usage() {
|
||||
# Parse command line arguments
|
||||
parse_android_args "$@"
|
||||
|
||||
# A release build without an explicit mode would otherwise bundle the
|
||||
# development web build (emulator API servers at 10.0.2.2).
|
||||
if [ "$BUILD_TYPE" = "release" ] && [ "$BUILD_MODE_SET" = false ]; then
|
||||
BUILD_MODE="production"
|
||||
log_info "Release build without a mode; using production"
|
||||
fi
|
||||
|
||||
# Firebase is on unless FIREBASE_ENABLED is false, 0, or no. Gradle also
|
||||
# defaults firebaseEnabled=true; this only forwards an explicit opt-out.
|
||||
gradle_firebase_arg=""
|
||||
@@ -600,6 +609,12 @@ if [ "$UNINSTALL" = true ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Step 2.5: A release packages whatever is in node_modules; make sure that is
|
||||
# what package-lock.json records (e.g. the daily-notification-plugin commit).
|
||||
if [ "$BUILD_TYPE" = "release" ]; then
|
||||
safe_execute "Checking node_modules against package-lock.json" "node scripts/check-installed-deps.js" || exit 11
|
||||
fi
|
||||
|
||||
# Step 3: Clean dist directory
|
||||
log_info "Cleaning dist directory..."
|
||||
clean_build_artifacts "dist"
|
||||
@@ -650,17 +665,16 @@ if [ "$BUILD_TYPE" = "debug" ]; then
|
||||
safe_execute "Assembling debug build" "cd android && ./gradlew assembleDebug ${gradle_firebase_arg} && cd .." || exit 5
|
||||
elif [ "$BUILD_TYPE" = "release" ]; then
|
||||
safe_execute "Assembling release build" "cd android && ./gradlew assembleRelease ${gradle_firebase_arg} && cd .." || exit 5
|
||||
fi
|
||||
|
||||
# Step 10: Build APK/AAB if requested
|
||||
if [ "$BUILD_APK" = true ]; then
|
||||
if [ "$BUILD_TYPE" = "debug" ]; then
|
||||
safe_execute "Building debug APK" "cd android && ./gradlew assembleDebug ${gradle_firebase_arg} && cd .." || exit 5
|
||||
else
|
||||
safe_execute "Building release APK" "cd android && ./gradlew assembleRelease ${gradle_firebase_arg} && cd .." || exit 5
|
||||
# Gradle signs release only when a keystore is configured (env vars or
|
||||
# android/app/gradle.properties.secrets); otherwise it quietly writes
|
||||
# app-release-unsigned.apk, which neither installs nor uploads.
|
||||
if [ ! -f "android/app/build/outputs/apk/release/app-release.apk" ]; then
|
||||
log_error "Release build is unsigned: configure the keystore (see top of android/app/build.gradle)"
|
||||
exit 5
|
||||
fi
|
||||
fi
|
||||
|
||||
# Step 10: Build AAB if requested (step 9 already built the APK)
|
||||
if [ "$BUILD_AAB" = true ]; then
|
||||
safe_execute "Building AAB" "cd android && ./gradlew bundleRelease ${gradle_firebase_arg} && cd .." || exit 5
|
||||
if [ "$BUILD_MODE" = "production" ]; then
|
||||
@@ -669,24 +683,24 @@ if [ "$BUILD_AAB" = true ]; then
|
||||
fi
|
||||
|
||||
# Step 11: Auto-run app if requested
|
||||
# cap run runs sync by default, which would overwrite capacitor.plugins.json again;
|
||||
# we already synced and ran restore-local-plugins.js above, so skip sync here.
|
||||
# Install and launch the APK built above with native-run (the tool cap run uses
|
||||
# for its deploy step). Not `npx cap run android`: that always rebuilds with
|
||||
# assembleDebug, which installs a debug build even after --release and drops
|
||||
# -PfirebaseEnabled=false. With no target, native-run picks a hardware device,
|
||||
# else a running emulator, else boots an AVD. ANDROID_SERIAL picks a target.
|
||||
if [ "$AUTO_RUN" = true ]; then
|
||||
log_step "Auto-running Android app..."
|
||||
# With exactly one connected device, target it directly. Otherwise cap run
|
||||
# shows an interactive picker, which without a terminal exits 0 having
|
||||
# launched nothing, so fail instead of reporting a false success.
|
||||
run_devices=$(adb devices | awk 'NR > 1 && $2 == "device" { print $1 }')
|
||||
run_apk="android/app/build/outputs/apk/${BUILD_TYPE}/app-${BUILD_TYPE}.apk"
|
||||
run_target=""
|
||||
if [ "$(printf '%s\n' "$run_devices" | grep -c .)" = "1" ]; then
|
||||
run_target="--target $run_devices"
|
||||
elif [ ! -t 0 ]; then
|
||||
log_error "Auto-run needs exactly one connected device when not run from a terminal (found: ${run_devices:-none})"
|
||||
exit 9
|
||||
if [ -n "$ANDROID_SERIAL" ]; then
|
||||
run_target="--target $ANDROID_SERIAL"
|
||||
fi
|
||||
safe_execute "Launching app" "npx cap run android --no-sync $run_target" || {
|
||||
if [ "$BUILD_TYPE" = "release" ]; then
|
||||
log_info "Installing a release-signed APK over a debug-signed install fails; uninstall first if needed"
|
||||
fi
|
||||
safe_execute "Installing and launching $run_apk" "npx native-run android --app $run_apk $run_target" || {
|
||||
log_error "Failed to launch Android app"
|
||||
log_info "You can manually run with: npx cap run android --no-sync"
|
||||
log_info "You can retry with: npx native-run android --app $run_apk"
|
||||
exit 9
|
||||
}
|
||||
log_success "Android app launched successfully!"
|
||||
@@ -701,11 +715,9 @@ fi
|
||||
log_success "Android build completed successfully!"
|
||||
log_info "Build mode: $BUILD_MODE"
|
||||
log_info "Build type: $BUILD_TYPE"
|
||||
if [ "$BUILD_APK" = true ]; then
|
||||
log_info "APK build: completed"
|
||||
fi
|
||||
log_info "APK: android/app/build/outputs/apk/${BUILD_TYPE}/app-${BUILD_TYPE}.apk"
|
||||
if [ "$BUILD_AAB" = true ]; then
|
||||
log_info "AAB build: completed"
|
||||
log_info "AAB: android/app/build/outputs/bundle/release/app-release.aab"
|
||||
fi
|
||||
if [ "$AUTO_RUN" = true ]; then
|
||||
log_info "Auto-run: completed"
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Fail when node_modules does not match package-lock.json.
|
||||
*
|
||||
* Compares the committed lockfile with npm's record of what is installed
|
||||
* (node_modules/.package-lock.json). A release build packages whatever is in
|
||||
* node_modules, so a lockfile pulled without `npm ci` (for example a newer
|
||||
* daily-notification-plugin commit) would otherwise ship the stale install.
|
||||
*
|
||||
* Git dependencies are compared by resolved commit, registry packages by
|
||||
* version. Optional packages missing from node_modules are skipped, since npm
|
||||
* leaves out optional packages for other platforms.
|
||||
*
|
||||
* Usage: node scripts/check-installed-deps.js
|
||||
* Fix a failure with: npm ci
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = path.join(__dirname, '..');
|
||||
const lockPath = path.join(root, 'package-lock.json');
|
||||
const installedPath = path.join(root, 'node_modules', '.package-lock.json');
|
||||
|
||||
if (!fs.existsSync(installedPath)) {
|
||||
console.error('❌ node_modules/.package-lock.json not found. Run "npm ci".');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const locked = JSON.parse(fs.readFileSync(lockPath, 'utf8')).packages || {};
|
||||
const installed = JSON.parse(fs.readFileSync(installedPath, 'utf8')).packages || {};
|
||||
|
||||
const problems = [];
|
||||
for (const [pkgPath, want] of Object.entries(locked)) {
|
||||
if (pkgPath === '' || !pkgPath.startsWith('node_modules/') || want.link) {
|
||||
continue;
|
||||
}
|
||||
const have = installed[pkgPath];
|
||||
const name = pkgPath.replace(/^.*node_modules\//, '');
|
||||
if (!have) {
|
||||
if (!want.optional && !want.devOptional && !want.peer) {
|
||||
problems.push(`${name}: locked ${want.version}, not installed`);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (want.resolved && want.resolved.startsWith('git+')) {
|
||||
if (have.resolved !== want.resolved) {
|
||||
const commit = (r) => (r || 'unknown').split('#').pop();
|
||||
problems.push(`${name}: locked commit ${commit(want.resolved)}, installed ${commit(have.resolved)}`);
|
||||
}
|
||||
} else if (have.version !== want.version) {
|
||||
problems.push(`${name}: locked ${want.version}, installed ${have.version}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (problems.length > 0) {
|
||||
console.error('❌ node_modules does not match package-lock.json:');
|
||||
for (const p of problems) {
|
||||
console.error(` ${p}`);
|
||||
}
|
||||
console.error(' Run "npm ci" (or commit the lockfile you meant to build with).');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('✅ node_modules matches package-lock.json');
|
||||
@@ -0,0 +1,37 @@
|
||||
<!--
|
||||
HelpDetails.vue - a collapsible help section: an uppercase header with a
|
||||
chevron that turns when the section is open, and the content below it.
|
||||
`open` sets only whether it starts open; the person toggles it after that.
|
||||
-->
|
||||
<template>
|
||||
<details class="help-details mt-2" :open="open">
|
||||
<summary
|
||||
class="cursor-pointer font-semibold uppercase text-inherit list-none flex items-center gap-2 [&::-webkit-details-marker]:hidden"
|
||||
>
|
||||
<font-awesome
|
||||
icon="chevron-right"
|
||||
class="details-chevron w-[0.75em] flex-shrink-0 transition-transform duration-200"
|
||||
/>
|
||||
{{ title }}
|
||||
</summary>
|
||||
<div class="pl-0 mt-2">
|
||||
<slot />
|
||||
</div>
|
||||
</details>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Prop, Vue } from "vue-facing-decorator";
|
||||
|
||||
@Component
|
||||
export default class HelpDetails extends Vue {
|
||||
@Prop({ required: true }) title!: string;
|
||||
@Prop({ default: false }) open!: boolean;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.help-details[open] .details-chevron {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
</style>
|
||||
@@ -516,9 +516,9 @@ export default class ImageMethodDialog extends Vue {
|
||||
}
|
||||
|
||||
/**
|
||||
* Lifecycle hook: Cleans up camera stream when component is destroyed
|
||||
* Lifecycle hook: Cleans up camera stream when component is unmounted
|
||||
*/
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
this.stopCameraPreview();
|
||||
}
|
||||
|
||||
|
||||
@@ -844,7 +844,7 @@ export default class MeetingMembersList extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
this.stopAutoRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<!--
|
||||
NextStepCard.vue - the interests onboarding's follow-up, at the top of the
|
||||
Profile page: save the interests to the public profile, then, where the
|
||||
app has alerts (the phone apps), pick a daily alert. A thin layer: the
|
||||
app has alerts (the phone apps), pick a daily alert: text messages up
|
||||
front, a push or on-device notification under "Advanced". A thin layer: the
|
||||
page runs the actions with the methods its own profile and notification
|
||||
sections use, and this only shows them.
|
||||
See doc/CHANGES/PLAN-onboarding-by-interests.md.
|
||||
@@ -98,6 +99,31 @@
|
||||
{{ smsDisabledReason }}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<!--
|
||||
One advanced choice sits behind this link: the push notification where
|
||||
the page offers it, the on-device notification otherwise.
|
||||
Once it is on, it shows regardless, so the card reports it.
|
||||
-->
|
||||
<button
|
||||
class="text-sm text-blue-500 mb-2"
|
||||
:aria-expanded="advancedOpen"
|
||||
aria-controls="nextStepAdvanced"
|
||||
data-testId="nextStepAdvancedToggle"
|
||||
@click="advancedOpen = !advancedOpen"
|
||||
>
|
||||
<font-awesome
|
||||
:icon="advancedOpen ? 'chevron-down' : 'chevron-right'"
|
||||
class="fa-fw"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
Advanced
|
||||
</button>
|
||||
<div
|
||||
v-if="showInApp"
|
||||
id="nextStepAdvanced"
|
||||
class="grid grid-cols-1 gap-2 mb-2"
|
||||
>
|
||||
<button
|
||||
class="text-left px-4 py-2 rounded-md border border-blue-300 bg-white"
|
||||
:disabled="inAppOn"
|
||||
@@ -105,21 +131,30 @@
|
||||
@click="$emit('in-app')"
|
||||
>
|
||||
<font-awesome icon="comment" class="fa-fw" />
|
||||
In-app notification
|
||||
{{
|
||||
inAppStarredOnly ? "On-device notification" : "Push notification"
|
||||
}}
|
||||
<span v-if="inAppOn" class="block text-sm text-green-700">
|
||||
On, at {{ inAppTime }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="inAppStarredOnly"
|
||||
class="block text-xs text-slate-500"
|
||||
>
|
||||
Checks your starred projects only, not interest matches. Your
|
||||
phone's system may deliver it late or skip it.
|
||||
</span>
|
||||
<span v-else class="block text-xs text-slate-500">
|
||||
May arrive late on iPhone.
|
||||
Your phone's system may deliver it late or drop it.
|
||||
</span>
|
||||
</button>
|
||||
<router-link
|
||||
:to="{ name: 'help-notification-types' }"
|
||||
class="text-sm text-blue-500"
|
||||
>
|
||||
Which should I choose?
|
||||
</router-link>
|
||||
</div>
|
||||
<router-link
|
||||
:to="{ name: 'help-notification-types' }"
|
||||
class="text-sm text-blue-500"
|
||||
>
|
||||
Which should I choose?
|
||||
</router-link>
|
||||
</template>
|
||||
|
||||
<div class="grid grid-cols-2 gap-2 mt-4">
|
||||
@@ -162,6 +197,15 @@ export default class NextStepCard extends Vue {
|
||||
@Prop({ default: "" }) smsDisabledReason!: string;
|
||||
@Prop({ default: false }) inAppOn!: boolean;
|
||||
@Prop({ default: "" }) inAppTime!: string;
|
||||
/** The choice is the on-device check (starred projects only), not the push */
|
||||
@Prop({ default: false }) inAppStarredOnly!: boolean;
|
||||
|
||||
advancedOpen = false;
|
||||
|
||||
/** The push or on-device choice: under "Advanced", or shown while it is on. */
|
||||
get showInApp(): boolean {
|
||||
return this.advancedOpen || this.inAppOn;
|
||||
}
|
||||
|
||||
text = "";
|
||||
includeLocation = true;
|
||||
|
||||
@@ -288,9 +288,9 @@ export default class PhotoDialog extends Vue {
|
||||
}
|
||||
|
||||
/**
|
||||
* Lifecycle hook: Cleans up camera stream when component is destroyed
|
||||
* Lifecycle hook: Cleans up camera stream when component is unmounted
|
||||
*/
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
this.stopCameraPreview();
|
||||
}
|
||||
|
||||
|
||||
@@ -798,11 +798,9 @@ export default class PushNotificationPermission extends Vue {
|
||||
logger.info(
|
||||
"[PushNotificationPermission] New Activity: skipping single reminder schedule; parent will schedule dual notification",
|
||||
);
|
||||
// The parent saves the time: in the settings for the server push, in
|
||||
// the device store for the on-device check.
|
||||
const timeText = this.notificationTimeText;
|
||||
await this.$saveSettings({ notifyingNewActivityTime: timeText });
|
||||
logger.debug(
|
||||
"[PushNotificationPermission] Settings saved: notifyingNewActivityTime",
|
||||
);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
|
||||
@@ -20,13 +20,40 @@
|
||||
<code class="text-[11px] break-all">{{ activeBackendUrl }}</code>
|
||||
</p>
|
||||
<button
|
||||
class="w-full text-sm mb-4 px-3 py-2 rounded border border-slate-300 bg-white"
|
||||
v-if="backendUrlDraft.trim() !== savedBackendUrl"
|
||||
class="w-full text-sm mb-2 px-3 py-1 rounded bg-blue-600 border border-blue-700 text-white"
|
||||
:disabled="busy"
|
||||
:class="{ 'opacity-50 cursor-not-allowed': busy }"
|
||||
@click="onSaveBackendUrl"
|
||||
>
|
||||
Save Backend URL
|
||||
Confirm this change
|
||||
</button>
|
||||
<div class="mb-4" role="group" aria-label="Quick notify server selection">
|
||||
<button
|
||||
class="px-3 rounded bg-slate-200 border border-slate-400"
|
||||
aria-label="Use production notify server URL"
|
||||
:disabled="busy"
|
||||
@click="backendUrlDraft = AppString.PROD_NOTIFY_API_SERVER"
|
||||
>
|
||||
Use Prod
|
||||
</button>
|
||||
<button
|
||||
class="px-3 rounded bg-slate-200 border border-slate-400"
|
||||
aria-label="Use test notify server URL"
|
||||
:disabled="busy"
|
||||
@click="backendUrlDraft = AppString.TEST_NOTIFY_API_SERVER"
|
||||
>
|
||||
Use Test
|
||||
</button>
|
||||
<button
|
||||
class="px-3 rounded bg-slate-200 border border-slate-400"
|
||||
aria-label="Use local notify server URL"
|
||||
:disabled="busy"
|
||||
@click="backendUrlDraft = AppString.LOCAL_NOTIFY_API_SERVER"
|
||||
>
|
||||
Use Local
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<label class="flex items-center gap-2 text-sm mb-4 cursor-pointer">
|
||||
<input
|
||||
@@ -263,6 +290,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import { AppString } from "@/constants/app";
|
||||
import { copyToClipboard } from "@/services/ClipboardService";
|
||||
import { subscribe } from "@/services/notifications/NotificationDebugEvents";
|
||||
import { NotificationDebugService } from "@/services/notifications/NotificationDebugService";
|
||||
@@ -279,6 +307,8 @@ const busy = ref(false);
|
||||
const pending = ref<PendingInfo[]>([]);
|
||||
const pendingInspectorMessage = ref<string | null>(null);
|
||||
const backendUrlDraft = ref("");
|
||||
/** The saved override ("" when using the default), to detect an unconfirmed draft. */
|
||||
const savedBackendUrl = ref("");
|
||||
const testModeEnabled = ref(NotificationDebugService.isTestModeEnabled());
|
||||
const bypassAuthEnabled = ref(NotificationDebugService.isBypassAuthEnabled());
|
||||
const fcmToken = ref<string | null>(NotificationDebugService.getFcmToken());
|
||||
@@ -335,8 +365,9 @@ async function onClearNotifications(): Promise<void> {
|
||||
}
|
||||
|
||||
function syncBackendState(): void {
|
||||
backendUrlDraft.value =
|
||||
savedBackendUrl.value =
|
||||
NotificationDebugService.getBackendUrlOverride() ?? "";
|
||||
backendUrlDraft.value = savedBackendUrl.value;
|
||||
testModeEnabled.value = NotificationDebugService.isTestModeEnabled();
|
||||
bypassAuthEnabled.value = NotificationDebugService.isBypassAuthEnabled();
|
||||
fcmToken.value = NotificationDebugService.getFcmToken();
|
||||
|
||||
@@ -59,7 +59,8 @@ export const ACCOUNT_VIEW_CONSTANTS = {
|
||||
// Notification messages
|
||||
NOTIFICATIONS: {
|
||||
NEW_ACTIVITY_INFO: `
|
||||
This will notify you with an app message when there is new relevant activity for you personally.
|
||||
This tells you when there is new relevant activity for you personally:
|
||||
by text message, or, as an advanced feature, through your phone's notifications.
|
||||
Do you want more details?
|
||||
`,
|
||||
NEW_ACTIVITY_SMS_INFO: `
|
||||
@@ -75,8 +76,8 @@ export const ACCOUNT_VIEW_CONSTANTS = {
|
||||
"This will remove your phone number and turn off all text messages. You will have to verify a number again to re-enable them. Are you sure?",
|
||||
REMINDER_INFO: `
|
||||
This will notify you at a specific time each day.
|
||||
Note that it does not give you personalized notifications,
|
||||
so if you want less reliable but personalized notification then choose a 'New Activity' Notification.
|
||||
It shows only your own message, with nothing personalized;
|
||||
for news about activity relevant to you, turn on New Activity text messages.
|
||||
Do you want more details?
|
||||
`,
|
||||
},
|
||||
|
||||
@@ -49,7 +49,7 @@ export type Settings = {
|
||||
newActivityCursors?: string;
|
||||
// JSON text of OnboardingState (src/libs/onboarding.ts): the mobile interests onboarding
|
||||
onboardingState?: string;
|
||||
// how in-app New Activity notifications arrive: "server" (push; the default when unset) or "device" (on-device schedule)
|
||||
// which notifier notifyingNewActivityTime belongs to: "server" (push; the default when unset) or, in rows from older versions, "device" (on-device); see newActivityDelivery.ts
|
||||
newActivityDelivery?: string;
|
||||
|
||||
// The claim list has a most recent one used in notifications that's separate from the last viewed
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
faArrowUp,
|
||||
faArrowUpRightFromSquare,
|
||||
faBan,
|
||||
faBell,
|
||||
faBitcoinSign,
|
||||
faBurst,
|
||||
faCalendar,
|
||||
@@ -115,6 +116,7 @@ library.add(
|
||||
faArrowUp,
|
||||
faArrowUpRightFromSquare,
|
||||
faBan,
|
||||
faBell,
|
||||
faBitcoinSign,
|
||||
faBurst,
|
||||
faCalendar,
|
||||
|
||||
+8
-42
@@ -46,14 +46,9 @@ import "./utils/safeAreaInset";
|
||||
import "@timesafari/daily-notification-plugin";
|
||||
import {
|
||||
configureNativeFetcherIfReady,
|
||||
initializeNativePushAndFirebaseMessaging,
|
||||
onNotificationAuthMayBeReady,
|
||||
runLegacyApiNotificationsCleanupOnce,
|
||||
} from "@/services/notifications";
|
||||
import { effectiveNewActivityDelivery } from "@/services/notifications/newActivityDelivery";
|
||||
import { serverPushSupported } from "@/services/notifications/firebaseMessagingClient";
|
||||
import { DailyNotification } from "@/plugins/DailyNotificationPlugin";
|
||||
import { retrieveSettingsForActiveAccount } from "@/db/databaseUtil";
|
||||
import { runDeferredCapacitorStartup } from "./main.capacitorDeferredStartup";
|
||||
|
||||
logger.log("[Capacitor] 🚀 Starting initialization");
|
||||
logger.log("[Capacitor] Platform:", process.env.VITE_PLATFORM);
|
||||
@@ -358,42 +353,13 @@ if (
|
||||
});
|
||||
}
|
||||
|
||||
// Register deeplink listener and configure native notification fetcher after app is mounted
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
logger.info(
|
||||
`[Main] ⏳ Delaying listener registration to ensure Capacitor is ready...`,
|
||||
);
|
||||
await registerDeepLinkListener();
|
||||
logger.info(`[Main] 🎉 Deep link system fully initialized!`);
|
||||
// One-time: remove persisted legacy api_* schedules from pre-retirement installs
|
||||
await runLegacyApiNotificationsCleanupOnce();
|
||||
// Firebase Messaging (JS) + Capacitor PushNotifications (FCM/APNs token,
|
||||
// delivery listeners). Skipped for on-device New Activity delivery, so the
|
||||
// device is not registered with the notification service.
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
const delivery = effectiveNewActivityDelivery(
|
||||
settings,
|
||||
await serverPushSupported(),
|
||||
);
|
||||
if (delivery === "server") {
|
||||
await initializeNativePushAndFirebaseMessaging();
|
||||
}
|
||||
// Exactly one New Activity notifier runs. Installs from before the
|
||||
// delivery choice also have the on-device schedule; drop it where the
|
||||
// server push is the one that runs.
|
||||
if (settings.notifyingNewActivityTime && delivery === "server") {
|
||||
try {
|
||||
await DailyNotification.cancelDualSchedule?.();
|
||||
} catch (error) {
|
||||
logger.warn("[Main] cancelDualSchedule failed:", error);
|
||||
}
|
||||
}
|
||||
// Configure native fetcher for API-driven daily notifications (activeDid + JWT)
|
||||
await configureNativeFetcherIfReady();
|
||||
} catch (error) {
|
||||
logger.error(`[Main] ❌ Deep link system initialization failed:`, error);
|
||||
}
|
||||
// Register deeplink listener and configure native notification fetcher after app is mounted.
|
||||
// The tap listener, appUrlOpen, and server-push setup each have their own error boundary.
|
||||
setTimeout(() => {
|
||||
logger.info(
|
||||
`[Main] ⏳ Delaying listener registration to ensure Capacitor is ready...`,
|
||||
);
|
||||
void runDeferredCapacitorStartup(registerDeepLinkListener);
|
||||
}, 2000); // 2 second delay to ensure Capacitor is fully ready
|
||||
|
||||
// Log app initialization status
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
jest.mock("@/utils/logger", () => ({
|
||||
logger: {
|
||||
error: jest.fn(),
|
||||
info: jest.fn(),
|
||||
debug: jest.fn(),
|
||||
warn: jest.fn(),
|
||||
log: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("@/services/notifications/firebaseMessagingClient", () => ({
|
||||
ensurePushNotificationActionListener: () => mockEnsure(),
|
||||
initializeNativePushAndFirebaseMessaging: () => mockInitialize(),
|
||||
serverPushSupported: () => mockServerPushSupported(),
|
||||
}));
|
||||
|
||||
jest.mock("@/services/notifications/deviceNotifications", () => ({
|
||||
migrateDeviceNotificationsOnce: (supported: boolean) =>
|
||||
mockMigrate(supported),
|
||||
}));
|
||||
|
||||
jest.mock("@/db/databaseUtil", () => ({
|
||||
retrieveSettingsForActiveAccount: () => mockRetrieve(),
|
||||
}));
|
||||
|
||||
jest.mock("@/services/notifications/legacyApiNotificationsCleanup", () => ({
|
||||
runLegacyApiNotificationsCleanupOnce: () => mockCleanup(),
|
||||
}));
|
||||
|
||||
jest.mock("@/services/notifications/nativeFetcherConfig", () => ({
|
||||
configureNativeFetcherIfReady: () => mockConfigure(),
|
||||
}));
|
||||
|
||||
import { logger } from "@/utils/logger";
|
||||
import { runDeferredCapacitorStartup } from "./main.capacitorDeferredStartup";
|
||||
|
||||
const mockEnsure = jest.fn();
|
||||
const mockInitialize = jest.fn();
|
||||
const mockServerPushSupported = jest.fn();
|
||||
const mockMigrate = jest.fn();
|
||||
const mockRetrieve = jest.fn();
|
||||
const mockCleanup = jest.fn();
|
||||
const mockConfigure = jest.fn();
|
||||
|
||||
describe("runDeferredCapacitorStartup", () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
mockEnsure.mockResolvedValue(undefined);
|
||||
mockInitialize.mockResolvedValue(undefined);
|
||||
mockServerPushSupported.mockResolvedValue(true);
|
||||
mockMigrate.mockResolvedValue(undefined);
|
||||
mockRetrieve.mockResolvedValue({ notifyingNewActivityTime: "9:00 AM" });
|
||||
mockCleanup.mockResolvedValue(undefined);
|
||||
mockConfigure.mockResolvedValue(undefined);
|
||||
});
|
||||
|
||||
it("registers the tap listener when server push is off and does not register FCM", async () => {
|
||||
mockRetrieve.mockResolvedValue({ notifyingNewActivityTime: "" });
|
||||
|
||||
await runDeferredCapacitorStartup(async () => undefined);
|
||||
|
||||
expect(mockEnsure).toHaveBeenCalledTimes(1);
|
||||
expect(mockInitialize).not.toHaveBeenCalled();
|
||||
expect(mockConfigure).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("registers the tap listener when the saved time is an on-device schedule", async () => {
|
||||
mockRetrieve.mockResolvedValue({
|
||||
notifyingNewActivityTime: "9:00 AM",
|
||||
newActivityDelivery: "device",
|
||||
});
|
||||
|
||||
await runDeferredCapacitorStartup(async () => undefined);
|
||||
|
||||
expect(mockEnsure).toHaveBeenCalledTimes(1);
|
||||
expect(mockInitialize).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("still registers FCM when server push is on", async () => {
|
||||
await runDeferredCapacitorStartup(async () => undefined);
|
||||
|
||||
expect(mockEnsure).toHaveBeenCalledTimes(1);
|
||||
expect(mockInitialize).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("still registers the tap listener when appUrlOpen registration throws", async () => {
|
||||
const order: string[] = [];
|
||||
mockEnsure.mockImplementation(async () => {
|
||||
order.push("ensure");
|
||||
});
|
||||
mockInitialize.mockImplementation(async () => {
|
||||
order.push("init");
|
||||
});
|
||||
|
||||
await expect(
|
||||
runDeferredCapacitorStartup(async () => {
|
||||
order.push("deep-link");
|
||||
throw new Error("appUrlOpen failed");
|
||||
}),
|
||||
).resolves.toBeUndefined();
|
||||
|
||||
expect(order).toEqual(["ensure", "deep-link", "init"]);
|
||||
expect(logger.error).toHaveBeenCalled();
|
||||
expect(mockInitialize).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("still registers appUrlOpen when the tap listener fails", async () => {
|
||||
mockEnsure.mockRejectedValue(new Error("listener failed"));
|
||||
const registerDeepLink = jest.fn().mockResolvedValue(undefined);
|
||||
|
||||
await expect(
|
||||
runDeferredCapacitorStartup(registerDeepLink),
|
||||
).resolves.toBeUndefined();
|
||||
|
||||
expect(registerDeepLink).toHaveBeenCalledTimes(1);
|
||||
expect(mockInitialize).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("still registers the tap listener when settings hydration throws", async () => {
|
||||
mockRetrieve.mockRejectedValue(new Error("database unavailable"));
|
||||
const registerDeepLink = jest.fn().mockResolvedValue(undefined);
|
||||
|
||||
await expect(
|
||||
runDeferredCapacitorStartup(registerDeepLink),
|
||||
).resolves.toBeUndefined();
|
||||
|
||||
expect(mockEnsure).toHaveBeenCalledTimes(1);
|
||||
expect(registerDeepLink).toHaveBeenCalledTimes(1);
|
||||
expect(mockInitialize).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Work that runs after the native WebView is up, in separate error boundaries.
|
||||
*
|
||||
* A failure while registering `appUrlOpen`, the notification-tap listener, or
|
||||
* server-push setup must not skip the others. The tap listener does not wait
|
||||
* on the server-push setting, permission, or an FCM token.
|
||||
*/
|
||||
|
||||
import { retrieveSettingsForActiveAccount } from "@/db/databaseUtil";
|
||||
import { logger } from "@/utils/logger";
|
||||
import { migrateDeviceNotificationsOnce } from "@/services/notifications/deviceNotifications";
|
||||
import {
|
||||
ensurePushNotificationActionListener,
|
||||
initializeNativePushAndFirebaseMessaging,
|
||||
serverPushSupported,
|
||||
} from "@/services/notifications/firebaseMessagingClient";
|
||||
import { runLegacyApiNotificationsCleanupOnce } from "@/services/notifications/legacyApiNotificationsCleanup";
|
||||
import { configureNativeFetcherIfReady } from "@/services/notifications/nativeFetcherConfig";
|
||||
import { serverPushTime } from "@/services/notifications/newActivityDelivery";
|
||||
|
||||
export async function runDeferredCapacitorStartup(
|
||||
registerDeepLinkListener: () => Promise<unknown>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await ensurePushNotificationActionListener();
|
||||
} catch (error) {
|
||||
logger.error(`[Main] ❌ Push notification action listener failed:`, error);
|
||||
}
|
||||
|
||||
try {
|
||||
await registerDeepLinkListener();
|
||||
logger.info(`[Main] 🎉 Deep link system fully initialized!`);
|
||||
} catch (error) {
|
||||
logger.error(`[Main] ❌ Deep link system initialization failed:`, error);
|
||||
}
|
||||
|
||||
try {
|
||||
await runLegacyApiNotificationsCleanupOnce();
|
||||
// Token registration stays behind the server-push setting so a device
|
||||
// that has not asked for New Activity pushes is not registered. The tap
|
||||
// listener above is already attached either way.
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
const pushSupported = await serverPushSupported();
|
||||
await migrateDeviceNotificationsOnce(pushSupported);
|
||||
if (serverPushTime(settings, pushSupported)) {
|
||||
await initializeNativePushAndFirebaseMessaging();
|
||||
}
|
||||
await configureNativeFetcherIfReady();
|
||||
} catch (error) {
|
||||
logger.error(`[Main] ❌ Server push setup failed:`, error);
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,17 @@ const routes: Array<RouteRecordRaw> = [
|
||||
path: "/contact-qr",
|
||||
name: "contact-qr",
|
||||
component: () => import("../views/ContactQRScanShowView.vue"),
|
||||
// This view scans with the in-page web reader; native platforms use the
|
||||
// full-screen view, which wires up the native scanner.
|
||||
beforeEnter: async (to) => {
|
||||
const { QRNavigationService } = await import(
|
||||
"../services/QRNavigationService"
|
||||
);
|
||||
const target = QRNavigationService.getInstance().getQRScannerRoute();
|
||||
return target.name === to.name
|
||||
? true
|
||||
: { name: target.name, query: to.query, replace: true };
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/contact-qr-scan-full",
|
||||
@@ -464,8 +475,22 @@ router.beforeEach(async (to, _from, next) => {
|
||||
}
|
||||
});
|
||||
|
||||
const QR_SCAN_ROUTE_NAMES = new Set(["contact-qr", "contact-qr-scan-full"]);
|
||||
|
||||
// Add navigation success logging and scroll-to-top (app uses #app as scroll container, not window)
|
||||
router.afterEach((to, from) => {
|
||||
// Fallback for the scan views' beforeRouteLeave cleanup: a native scanner left
|
||||
// running keeps the WebView transparent, with the camera showing behind every
|
||||
// page. The module is already loaded whenever a scan view was the "from" route.
|
||||
if (
|
||||
QR_SCAN_ROUTE_NAMES.has(String(from?.name)) &&
|
||||
!QR_SCAN_ROUTE_NAMES.has(String(to.name))
|
||||
) {
|
||||
import("../services/QRScanner/QRScannerFactory")
|
||||
.then(({ QRScannerFactory }) => QRScannerFactory.cleanup())
|
||||
.catch((error) => logger.error("[Router] QR scanner cleanup:", error));
|
||||
}
|
||||
|
||||
const app = document.getElementById("app");
|
||||
if (app) {
|
||||
app.scrollTop = 0;
|
||||
|
||||
@@ -21,6 +21,9 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
private cameraStateListeners: Set<CameraStateListener> = new Set();
|
||||
private currentState: CameraState = "off";
|
||||
private currentStateMessage?: string;
|
||||
/** Incremented by every stopScan(); lets an in-progress start notice it. */
|
||||
private scanGeneration = 0;
|
||||
private startPromise: Promise<void> | null = null;
|
||||
|
||||
async checkPermissions(): Promise<boolean> {
|
||||
try {
|
||||
@@ -77,28 +80,68 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
}
|
||||
|
||||
async startScan(options?: QRScannerOptions): Promise<void> {
|
||||
// Serialize starts: a start that is still finishing could otherwise call
|
||||
// the native stopScan() after this one has started the camera.
|
||||
// Re-check after each wait, since another caller may have started meanwhile.
|
||||
for (;;) {
|
||||
if (this.startPromise) {
|
||||
await this.startPromise.catch(() => undefined);
|
||||
} else if (this.cleanupPromise) {
|
||||
logger.debug("Waiting for previous cleanup to complete");
|
||||
await this.cleanupPromise.catch(() => undefined);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isScanning) {
|
||||
logger.debug("Scanner already running");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.cleanupPromise) {
|
||||
logger.debug("Waiting for previous cleanup to complete");
|
||||
await this.cleanupPromise;
|
||||
const startPromise = this.runStartScan(options);
|
||||
this.startPromise = startPromise;
|
||||
try {
|
||||
await startPromise;
|
||||
} finally {
|
||||
if (this.startPromise === startPromise) {
|
||||
this.startPromise = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the native scanner. Every stopScan() increments scanGeneration; when
|
||||
* it changes during one of the awaits below, the start is abandoned, and a
|
||||
* camera that already started is stopped again. Without this, a stop that
|
||||
* lands mid-start is a no-op and the camera stays on behind a transparent
|
||||
* WebView.
|
||||
*/
|
||||
private async runStartScan(options?: QRScannerOptions): Promise<void> {
|
||||
this.isScanning = true;
|
||||
const generation = ++this.scanGeneration;
|
||||
const stopRequested = () => generation !== this.scanGeneration;
|
||||
|
||||
try {
|
||||
this.updateCameraState("initializing", "Starting camera...");
|
||||
|
||||
// Ensure we have permissions before starting
|
||||
if (!(await this.checkPermissions())) {
|
||||
this.updateCameraState("permission_denied", "Camera permission denied");
|
||||
logger.debug("Requesting camera permissions");
|
||||
const granted = await this.requestPermissions();
|
||||
if (!granted) {
|
||||
this.updateCameraState(
|
||||
"permission_denied",
|
||||
"Camera permission denied",
|
||||
);
|
||||
throw new Error("Camera permission denied");
|
||||
}
|
||||
}
|
||||
if (stopRequested()) {
|
||||
logger.debug("Stop requested during permission check; not starting");
|
||||
this.updateCameraState("off", "Camera stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if scanning is supported
|
||||
if (!(await this.isSupported())) {
|
||||
@@ -108,10 +151,13 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
);
|
||||
throw new Error("QR scanning not supported on this device");
|
||||
}
|
||||
if (stopRequested()) {
|
||||
logger.debug("Stop requested during support check; not starting");
|
||||
this.updateCameraState("off", "Camera stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info("Starting MLKit scanner");
|
||||
this.isScanning = true;
|
||||
this.updateCameraState("active", "Camera is active");
|
||||
|
||||
const scanOptions: StartScanOptions = {
|
||||
formats: [BarcodeFormat.QrCode],
|
||||
@@ -121,7 +167,7 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
|
||||
logger.debug("Scanner options:", scanOptions);
|
||||
|
||||
// Add listener for barcode scans
|
||||
// Add listener for barcode scans; stopScan() removes it again
|
||||
const handle = await BarcodeScanner.addListener(
|
||||
"barcodesScanned",
|
||||
(result) => {
|
||||
@@ -131,9 +177,24 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
},
|
||||
);
|
||||
this.listenerHandles.push(handle.remove);
|
||||
if (stopRequested()) {
|
||||
logger.debug("Stop requested while adding listener; not starting");
|
||||
await this.removeNativeListeners();
|
||||
this.updateCameraState("off", "Camera stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
// Start continuous scanning
|
||||
await BarcodeScanner.startScan(scanOptions);
|
||||
if (stopRequested()) {
|
||||
logger.debug("Stop requested while camera was starting; stopping it");
|
||||
await this.removeNativeListeners();
|
||||
await BarcodeScanner.stopScan();
|
||||
this.updateCameraState("off", "Camera stopped");
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateCameraState("active", "Camera is active");
|
||||
logger.info("MLKit scanner started successfully");
|
||||
} catch (error) {
|
||||
const wrappedError =
|
||||
@@ -142,7 +203,9 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
error: wrappedError.message,
|
||||
stack: wrappedError.stack,
|
||||
});
|
||||
this.isScanning = false;
|
||||
if (generation === this.scanGeneration) {
|
||||
this.isScanning = false;
|
||||
}
|
||||
this.updateCameraState("error", wrappedError.message);
|
||||
await this.cleanup();
|
||||
this.scanListener?.onError?.(wrappedError);
|
||||
@@ -151,6 +214,10 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
}
|
||||
|
||||
async stopScan(): Promise<void> {
|
||||
// Invalidate any start that is still in progress, even when the native
|
||||
// camera has not started yet.
|
||||
this.scanGeneration++;
|
||||
|
||||
if (!this.isScanning) {
|
||||
logger.debug("Scanner not running");
|
||||
return;
|
||||
@@ -159,6 +226,7 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
try {
|
||||
logger.debug("Stopping QR scanner");
|
||||
this.updateCameraState("off", "Camera stopped");
|
||||
await this.removeNativeListeners();
|
||||
await BarcodeScanner.stopScan();
|
||||
logger.info("QR scanner stopped successfully");
|
||||
} catch (error) {
|
||||
@@ -176,6 +244,18 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
}
|
||||
}
|
||||
|
||||
private async removeNativeListeners(): Promise<void> {
|
||||
const handles = this.listenerHandles;
|
||||
this.listenerHandles = [];
|
||||
for (const remove of handles) {
|
||||
try {
|
||||
await remove();
|
||||
} catch (error) {
|
||||
logger.warn("Error removing listener:", error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addListener(listener: ScanListener): void {
|
||||
this.scanListener = listener;
|
||||
}
|
||||
@@ -196,13 +276,7 @@ export class CapacitorQRScanner implements QRScannerService {
|
||||
}
|
||||
|
||||
// Remove all listeners
|
||||
for (const handle of this.listenerHandles) {
|
||||
try {
|
||||
await handle();
|
||||
} catch (error) {
|
||||
logger.warn("Error removing listener:", error);
|
||||
}
|
||||
}
|
||||
await this.removeNativeListeners();
|
||||
|
||||
logger.info("QR scanner cleanup completed");
|
||||
} catch (error) {
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
*
|
||||
* Upload mints a delegated JWT batch for the active identity and
|
||||
* `POST /notifications/alert-authorization`, with the send time the person
|
||||
* picked for in-app New Activity notifications, converted to UTC. Without a
|
||||
* picked for New Activity push notifications, converted to UTC. Without a
|
||||
* time (the debug panel) it sends 09:00 in the device's zone. Revoke sends
|
||||
* `DELETE` on that same route and does not unregister the FCM device. The
|
||||
* in-app New Activity toggle uploads on enable and on a new time, and revokes
|
||||
* New Activity push toggle uploads on enable and on a new time, and revokes
|
||||
* on disable.
|
||||
*
|
||||
* The SMS channel uploads the same body through `authorizeSmsAlertSearch`, and
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { deviceStateFromSettingsRows } from "./deviceNotifications";
|
||||
|
||||
jest.mock("@capacitor/preferences", () => ({
|
||||
Preferences: { get: jest.fn(), set: jest.fn(), remove: jest.fn() },
|
||||
}));
|
||||
jest.mock("@/services/PlatformServiceFactory", () => ({
|
||||
PlatformServiceFactory: { getInstance: jest.fn() },
|
||||
}));
|
||||
jest.mock("@/utils/logger", () => ({
|
||||
logger: { info: jest.fn(), warn: jest.fn(), error: jest.fn() },
|
||||
}));
|
||||
|
||||
const A = "did:ethr:0xA";
|
||||
const B = "did:ethr:0xB";
|
||||
|
||||
describe("deviceStateFromSettingsRows", () => {
|
||||
it("finds nothing when nothing is on", () => {
|
||||
expect(deviceStateFromSettingsRows([{ accountDid: A }], A, true)).toEqual({
|
||||
dailyReminder: null,
|
||||
newActivity: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("prefers the active identity's reminder", () => {
|
||||
const state = deviceStateFromSettingsRows(
|
||||
[
|
||||
{ accountDid: A, notifyingReminderTime: "8:00 AM" },
|
||||
{
|
||||
accountDid: B,
|
||||
notifyingReminderTime: "9:00 PM",
|
||||
notifyingReminderMessage: "Thanks?",
|
||||
},
|
||||
],
|
||||
B,
|
||||
true,
|
||||
);
|
||||
expect(state.dailyReminder).toEqual({
|
||||
time: "9:00 PM",
|
||||
message: "Thanks?",
|
||||
});
|
||||
});
|
||||
|
||||
it("falls back to another identity's reminder", () => {
|
||||
const state = deviceStateFromSettingsRows(
|
||||
[{ accountDid: A, notifyingReminderTime: "8:00 AM" }, { accountDid: B }],
|
||||
B,
|
||||
true,
|
||||
);
|
||||
expect(state.dailyReminder).toEqual({ time: "8:00 AM", message: "" });
|
||||
});
|
||||
|
||||
it("makes the on-device identity the owner, not a server-push one", () => {
|
||||
const state = deviceStateFromSettingsRows(
|
||||
[
|
||||
// an unmarked time is the server push's: not the owner
|
||||
{ accountDid: B, notifyingNewActivityTime: "7:00 AM" },
|
||||
{
|
||||
accountDid: A,
|
||||
newActivityDelivery: "device",
|
||||
notifyingNewActivityTime: "6:00 AM",
|
||||
},
|
||||
],
|
||||
B,
|
||||
true,
|
||||
);
|
||||
expect(state.newActivity).toEqual({ ownerDid: A, time: "6:00 AM" });
|
||||
});
|
||||
|
||||
it("treats every identity as on-device in a build without push", () => {
|
||||
const state = deviceStateFromSettingsRows(
|
||||
[{ accountDid: B, notifyingNewActivityTime: "7:00 AM" }],
|
||||
B,
|
||||
false,
|
||||
);
|
||||
expect(state.newActivity).toEqual({ ownerDid: B, time: "7:00 AM" });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,197 @@
|
||||
/**
|
||||
* Notification state that belongs to the phone, not to an identity.
|
||||
*
|
||||
* The daily-notification-plugin keeps one Daily Reminder schedule and one
|
||||
* on-device New Activity (dual) schedule per device, whichever identity is
|
||||
* active. Their state lives here, in Capacitor Preferences, so every identity
|
||||
* sees what the phone is actually doing:
|
||||
*
|
||||
* - Daily Reminder: a fixed message at a time. No identity involved.
|
||||
* - On-device New Activity: owned by the identity that turned it on. Its
|
||||
* background fetch uses that identity's JWTs and starred projects, so the
|
||||
* native fetcher is configured only while the owner is the active identity.
|
||||
* With another identity active the fetch has no credentials and the
|
||||
* schedule sends nothing (`fallbackBehavior: "skip"`): it is paused.
|
||||
*
|
||||
* The server channels (SMS and FCM push) stay in per-identity settings: the
|
||||
* notification service holds them per DID. The push and the on-device check
|
||||
* are independent, so an identity can have both.
|
||||
*/
|
||||
import { Preferences } from "@capacitor/preferences";
|
||||
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
import { logger } from "@/utils/logger";
|
||||
import { serverPushTime } from "./newActivityDelivery";
|
||||
|
||||
const DAILY_REMINDER_KEY = "deviceDailyReminder";
|
||||
const DEVICE_NEW_ACTIVITY_KEY = "deviceNewActivity";
|
||||
const MIGRATED_KEY = "deviceNotificationsMigrated";
|
||||
|
||||
export interface DeviceDailyReminder {
|
||||
/** Display time, such as "9:00 AM" */
|
||||
time: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface DeviceNewActivity {
|
||||
/** The identity whose credentials and starred projects the fetch uses */
|
||||
ownerDid: string;
|
||||
/** Display time, such as "9:00 AM" */
|
||||
time: string;
|
||||
}
|
||||
|
||||
async function readJson<T>(key: string): Promise<T | null> {
|
||||
try {
|
||||
const { value } = await Preferences.get({ key });
|
||||
return value ? (JSON.parse(value) as T) : null;
|
||||
} catch (error) {
|
||||
logger.warn(`[deviceNotifications] Could not read ${key}:`, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function writeJson(key: string, value: unknown | null): Promise<void> {
|
||||
if (value == null) {
|
||||
await Preferences.remove({ key });
|
||||
} else {
|
||||
await Preferences.set({ key, value: JSON.stringify(value) });
|
||||
}
|
||||
}
|
||||
|
||||
export function getDailyReminder(): Promise<DeviceDailyReminder | null> {
|
||||
return readJson<DeviceDailyReminder>(DAILY_REMINDER_KEY);
|
||||
}
|
||||
|
||||
/** @param reminder null when the reminder is off */
|
||||
export function saveDailyReminder(
|
||||
reminder: DeviceDailyReminder | null,
|
||||
): Promise<void> {
|
||||
return writeJson(DAILY_REMINDER_KEY, reminder);
|
||||
}
|
||||
|
||||
export function getDeviceNewActivity(): Promise<DeviceNewActivity | null> {
|
||||
return readJson<DeviceNewActivity>(DEVICE_NEW_ACTIVITY_KEY);
|
||||
}
|
||||
|
||||
/** @param state null when the on-device New Activity schedule is off */
|
||||
export function saveDeviceNewActivity(
|
||||
state: DeviceNewActivity | null,
|
||||
): Promise<void> {
|
||||
return writeJson(DEVICE_NEW_ACTIVITY_KEY, state);
|
||||
}
|
||||
|
||||
/** True when the on-device New Activity schedule belongs to `did`. */
|
||||
export async function ownsDeviceNewActivity(did: string): Promise<boolean> {
|
||||
const state = await getDeviceNewActivity();
|
||||
return !!did && state?.ownerDid === did;
|
||||
}
|
||||
|
||||
interface SettingsRowForMigration {
|
||||
accountDid?: string;
|
||||
newActivityDelivery?: string;
|
||||
notifyingNewActivityTime?: string;
|
||||
notifyingReminderMessage?: string;
|
||||
notifyingReminderTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick the device state from per-identity settings rows, preferring the
|
||||
* active identity. Pure, for testing.
|
||||
*/
|
||||
export function deviceStateFromSettingsRows(
|
||||
rows: SettingsRowForMigration[],
|
||||
activeDid: string,
|
||||
serverPushSupported: boolean,
|
||||
): {
|
||||
dailyReminder: DeviceDailyReminder | null;
|
||||
newActivity: DeviceNewActivity | null;
|
||||
} {
|
||||
const activeFirst = [
|
||||
...rows.filter((r) => r.accountDid === activeDid),
|
||||
...rows.filter((r) => r.accountDid !== activeDid),
|
||||
];
|
||||
const reminderRow = activeFirst.find((r) => r.notifyingReminderTime);
|
||||
const deviceRow = activeFirst.find(
|
||||
(r) =>
|
||||
r.accountDid &&
|
||||
r.notifyingNewActivityTime &&
|
||||
!serverPushTime(r, serverPushSupported),
|
||||
);
|
||||
return {
|
||||
dailyReminder: reminderRow
|
||||
? {
|
||||
time: reminderRow.notifyingReminderTime as string,
|
||||
message: reminderRow.notifyingReminderMessage || "",
|
||||
}
|
||||
: null,
|
||||
newActivity: deviceRow
|
||||
? {
|
||||
ownerDid: deviceRow.accountDid as string,
|
||||
time: deviceRow.notifyingNewActivityTime as string,
|
||||
}
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Once per install: copy the Daily Reminder and the on-device New Activity
|
||||
* owner out of per-identity settings, where earlier versions kept them.
|
||||
* Where several identities had one on, the active identity wins, since the
|
||||
* phone held only one schedule of each anyway.
|
||||
*/
|
||||
export async function migrateDeviceNotificationsOnce(
|
||||
serverPushSupported: boolean,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const { value } = await Preferences.get({ key: MIGRATED_KEY });
|
||||
if (value) return;
|
||||
|
||||
const service = PlatformServiceFactory.getInstance();
|
||||
const activeRow = await service.dbGetOneRow(
|
||||
"SELECT activeDid FROM active_identity WHERE id = 1",
|
||||
);
|
||||
const activeDid = activeRow?.[0] ? String(activeRow[0]) : "";
|
||||
const result = await service.dbQuery(
|
||||
"SELECT accountDid, newActivityDelivery, notifyingNewActivityTime," +
|
||||
" notifyingReminderMessage, notifyingReminderTime" +
|
||||
" FROM settings WHERE accountDid IS NOT NULL",
|
||||
);
|
||||
const rows: SettingsRowForMigration[] = (result?.values ?? []).map(
|
||||
(values) => {
|
||||
const row: Record<string, unknown> = {};
|
||||
result!.columns.forEach((column, i) => {
|
||||
row[column] = values[i];
|
||||
});
|
||||
return {
|
||||
accountDid: (row.accountDid as string) || undefined,
|
||||
newActivityDelivery: (row.newActivityDelivery as string) || undefined,
|
||||
notifyingNewActivityTime:
|
||||
(row.notifyingNewActivityTime as string) || undefined,
|
||||
notifyingReminderMessage:
|
||||
(row.notifyingReminderMessage as string) || undefined,
|
||||
notifyingReminderTime:
|
||||
(row.notifyingReminderTime as string) || undefined,
|
||||
};
|
||||
},
|
||||
);
|
||||
const state = deviceStateFromSettingsRows(
|
||||
rows,
|
||||
activeDid,
|
||||
serverPushSupported,
|
||||
);
|
||||
if (state.dailyReminder && !(await getDailyReminder())) {
|
||||
await saveDailyReminder(state.dailyReminder);
|
||||
}
|
||||
if (state.newActivity && !(await getDeviceNewActivity())) {
|
||||
await saveDeviceNewActivity(state.newActivity);
|
||||
}
|
||||
await Preferences.set({ key: MIGRATED_KEY, value: "1" });
|
||||
logger.info("[deviceNotifications] Migrated device notification state", {
|
||||
dailyReminder: !!state.dailyReminder,
|
||||
newActivity: !!state.newActivity,
|
||||
});
|
||||
} catch (error) {
|
||||
// left unmarked, so the next start tries again
|
||||
logger.error("[deviceNotifications] Migration failed:", error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
jest.mock("@capacitor/core", () => ({
|
||||
Capacitor: {
|
||||
isNativePlatform: () => mockIsNativePlatform(),
|
||||
getPlatform: () => mockGetPlatform(),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("@capacitor/push-notifications", () => ({
|
||||
PushNotifications: {
|
||||
addListener: (eventName: string, listener: (payload: unknown) => void) =>
|
||||
mockAddListener(eventName, listener),
|
||||
requestPermissions: () => mockRequestPermissions(),
|
||||
register: () => mockRegister(),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("firebase/app", () => ({
|
||||
getApps: () => [],
|
||||
initializeApp: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock("firebase/messaging", () => ({
|
||||
getMessaging: jest.fn(),
|
||||
getToken: jest.fn(),
|
||||
isSupported: jest.fn(async () => false),
|
||||
onMessage: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock("@/utils/logger", () => ({
|
||||
logger: {
|
||||
debug: jest.fn(),
|
||||
info: jest.fn(),
|
||||
warn: jest.fn(),
|
||||
error: jest.fn(),
|
||||
log: jest.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("@/plugins/NotificationInspectorPlugin", () => ({
|
||||
NotificationInspector: {
|
||||
isFirebaseConfigured: jest.fn(async () => ({ configured: true })),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("./NativeNotificationService", () => ({
|
||||
handleCapacitorPushNotificationReceived: (notification: unknown) =>
|
||||
mockHandleReceived(notification),
|
||||
}));
|
||||
|
||||
jest.mock("./notificationApiAuth", () => ({
|
||||
getNotificationApiHeaders: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock("./notificationAuthLifecycle", () => ({
|
||||
deferFcmRegistration: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock("./NotificationService", () => ({
|
||||
registerToken: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock("@/services/QRNavigationService", () => ({
|
||||
QRNavigationService: {
|
||||
getInstance: () => ({
|
||||
getQRScannerRoute: () => ({ name: "contact-qr" }),
|
||||
}),
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock("./firebaseWebEnv", () => ({
|
||||
readFirebaseWebEnv: () => ({}),
|
||||
}));
|
||||
|
||||
jest.mock("@/router", () => ({
|
||||
__esModule: true,
|
||||
default: {
|
||||
isReady: () => Promise.resolve(),
|
||||
replace: (location: unknown) => mockReplace(location),
|
||||
},
|
||||
}));
|
||||
|
||||
import { resetAlertSearchNotificationTapState } from "./alertSearchNotificationTap";
|
||||
import {
|
||||
ensurePushNotificationActionListener,
|
||||
initializeNativePushAndFirebaseMessaging,
|
||||
resetNativePushMessagingStateForTests,
|
||||
} from "./firebaseMessagingClient";
|
||||
|
||||
const mockIsNativePlatform = jest.fn();
|
||||
const mockGetPlatform = jest.fn();
|
||||
const mockAddListener = jest.fn();
|
||||
const mockRequestPermissions = jest.fn();
|
||||
const mockRegister = jest.fn();
|
||||
const mockHandleReceived = jest.fn();
|
||||
const mockReplace = jest.fn();
|
||||
|
||||
const listeners = new Map<string, (_payload: unknown) => void>();
|
||||
|
||||
const CURSORS = "1234567.45678-1234567";
|
||||
|
||||
function alertSearchAction(
|
||||
c: string = CURSORS,
|
||||
id = "msg-1",
|
||||
actionId = "tap",
|
||||
) {
|
||||
return {
|
||||
actionId,
|
||||
notification: {
|
||||
id,
|
||||
data: { type: "alert_search", c },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function waitForReplace(): Promise<void> {
|
||||
for (let attempt = 0; attempt < 30; attempt += 1) {
|
||||
if (mockReplace.mock.calls.length > 0) return;
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
}
|
||||
}
|
||||
|
||||
describe("push notification action listener", () => {
|
||||
beforeEach(() => {
|
||||
resetNativePushMessagingStateForTests();
|
||||
resetAlertSearchNotificationTapState();
|
||||
listeners.clear();
|
||||
mockIsNativePlatform.mockReset();
|
||||
mockGetPlatform.mockReset();
|
||||
mockAddListener.mockReset();
|
||||
mockRequestPermissions.mockReset();
|
||||
mockRegister.mockReset();
|
||||
mockHandleReceived.mockReset();
|
||||
mockReplace.mockReset();
|
||||
|
||||
mockIsNativePlatform.mockReturnValue(true);
|
||||
mockGetPlatform.mockReturnValue("ios");
|
||||
mockRequestPermissions.mockResolvedValue({ receive: "granted" });
|
||||
mockRegister.mockResolvedValue(undefined);
|
||||
mockHandleReceived.mockResolvedValue(undefined);
|
||||
mockReplace.mockResolvedValue(undefined);
|
||||
mockAddListener.mockImplementation(
|
||||
(eventName: string, listener: (payload: unknown) => void) => {
|
||||
listeners.set(eventName, listener);
|
||||
return Promise.resolve({ remove: jest.fn() });
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("registers the tap listener without asking for permission or an FCM token", async () => {
|
||||
await ensurePushNotificationActionListener();
|
||||
|
||||
expect(mockAddListener).toHaveBeenCalledTimes(1);
|
||||
expect(mockAddListener).toHaveBeenCalledWith(
|
||||
"pushNotificationActionPerformed",
|
||||
expect.any(Function),
|
||||
);
|
||||
expect(mockRequestPermissions).not.toHaveBeenCalled();
|
||||
expect(mockRegister).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not register a listener on web", async () => {
|
||||
mockIsNativePlatform.mockReturnValue(false);
|
||||
|
||||
await ensurePushNotificationActionListener();
|
||||
|
||||
expect(mockAddListener).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("opens New Activity when a retained cold-start tap is delivered to the new listener", async () => {
|
||||
const tap = alertSearchAction();
|
||||
mockAddListener.mockImplementation(
|
||||
(eventName: string, listener: (payload: unknown) => void) => {
|
||||
if (eventName === "pushNotificationActionPerformed") {
|
||||
listener(tap);
|
||||
}
|
||||
return Promise.resolve({ remove: jest.fn() });
|
||||
},
|
||||
);
|
||||
|
||||
await ensurePushNotificationActionListener();
|
||||
await waitForReplace();
|
||||
|
||||
expect(mockReplace).toHaveBeenCalledWith({
|
||||
name: "new-activity",
|
||||
params: {},
|
||||
query: { c: CURSORS },
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps the cursor through encoding and the deep-link handler", async () => {
|
||||
const cursors = "12 34/56";
|
||||
mockAddListener.mockImplementation(
|
||||
(eventName: string, listener: (payload: unknown) => void) => {
|
||||
if (eventName === "pushNotificationActionPerformed") {
|
||||
listener(alertSearchAction(cursors));
|
||||
}
|
||||
return Promise.resolve({ remove: jest.fn() });
|
||||
},
|
||||
);
|
||||
|
||||
await ensurePushNotificationActionListener();
|
||||
await waitForReplace();
|
||||
|
||||
expect(mockReplace).toHaveBeenCalledWith({
|
||||
name: "new-activity",
|
||||
params: {},
|
||||
query: { c: cursors },
|
||||
});
|
||||
});
|
||||
|
||||
it("opens New Activity when a warm-start tap arrives after the listener exists", async () => {
|
||||
await ensurePushNotificationActionListener();
|
||||
expect(mockReplace).not.toHaveBeenCalled();
|
||||
|
||||
listeners.get("pushNotificationActionPerformed")?.(alertSearchAction());
|
||||
await waitForReplace();
|
||||
|
||||
expect(mockReplace).toHaveBeenCalledTimes(1);
|
||||
expect(mockReplace).toHaveBeenCalledWith({
|
||||
name: "new-activity",
|
||||
params: {},
|
||||
query: { c: CURSORS },
|
||||
});
|
||||
});
|
||||
|
||||
it("does not navigate when a notification arrives in the foreground", async () => {
|
||||
await initializeNativePushAndFirebaseMessaging();
|
||||
|
||||
listeners.get("pushNotificationReceived")?.({
|
||||
id: "msg-1",
|
||||
data: { type: "alert_search", c: CURSORS },
|
||||
});
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
|
||||
expect(mockHandleReceived).toHaveBeenCalledTimes(1);
|
||||
expect(mockReplace).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not navigate when the notification is dismissed", async () => {
|
||||
await ensurePushNotificationActionListener();
|
||||
|
||||
listeners.get("pushNotificationActionPerformed")?.(
|
||||
alertSearchAction(CURSORS, "msg-1", "dismiss"),
|
||||
);
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
|
||||
expect(mockReplace).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not register a second tap listener when server push is enabled later", async () => {
|
||||
await ensurePushNotificationActionListener();
|
||||
await initializeNativePushAndFirebaseMessaging();
|
||||
|
||||
const actionRegistrations = mockAddListener.mock.calls.filter(
|
||||
(call) => call[0] === "pushNotificationActionPerformed",
|
||||
);
|
||||
expect(actionRegistrations).toHaveLength(1);
|
||||
expect(mockRequestPermissions).toHaveBeenCalledTimes(1);
|
||||
expect(mockRegister).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("shares one in-flight registration among concurrent callers", async () => {
|
||||
let release: (handle: { remove: jest.Mock }) => void = () => undefined;
|
||||
mockAddListener.mockImplementation(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
release = resolve;
|
||||
}),
|
||||
);
|
||||
|
||||
const first = ensurePushNotificationActionListener();
|
||||
const second = ensurePushNotificationActionListener();
|
||||
expect(mockAddListener).toHaveBeenCalledTimes(1);
|
||||
|
||||
release({ remove: jest.fn() });
|
||||
await Promise.all([first, second]);
|
||||
await ensurePushNotificationActionListener();
|
||||
|
||||
expect(mockAddListener).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("retries listener registration after addListener fails", async () => {
|
||||
mockAddListener.mockRejectedValueOnce(new Error("bridge down"));
|
||||
|
||||
await expect(ensurePushNotificationActionListener()).rejects.toThrow(
|
||||
"bridge down",
|
||||
);
|
||||
|
||||
await ensurePushNotificationActionListener();
|
||||
|
||||
expect(mockAddListener).toHaveBeenCalledTimes(2);
|
||||
expect(mockRequestPermissions).not.toHaveBeenCalled();
|
||||
expect(mockRegister).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("retries the tap listener without repeating FCM registration", async () => {
|
||||
mockAddListener.mockRejectedValueOnce(new Error("bridge down"));
|
||||
|
||||
await initializeNativePushAndFirebaseMessaging();
|
||||
expect(mockRegister).toHaveBeenCalledTimes(1);
|
||||
|
||||
await initializeNativePushAndFirebaseMessaging();
|
||||
|
||||
const actionRegistrations = mockAddListener.mock.calls.filter(
|
||||
(call) => call[0] === "pushNotificationActionPerformed",
|
||||
);
|
||||
expect(actionRegistrations).toHaveLength(2);
|
||||
expect(mockRequestPermissions).toHaveBeenCalledTimes(1);
|
||||
expect(mockRegister).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("navigates once when Android delivers the same cold-start tap twice", async () => {
|
||||
await ensurePushNotificationActionListener();
|
||||
const listener = listeners.get("pushNotificationActionPerformed");
|
||||
const tap = alertSearchAction();
|
||||
|
||||
listener?.(tap);
|
||||
listener?.(tap);
|
||||
await waitForReplace();
|
||||
await new Promise((resolve) => setImmediate(resolve));
|
||||
|
||||
expect(mockReplace).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* Firebase Cloud Messaging (JS SDK) + Capacitor Push Notifications (native bridge).
|
||||
*
|
||||
* Initializes the Firebase web app when VITE_FIREBASE_* env vars are set, wires
|
||||
* Capacitor push listeners, requests permission before registration/token flow,
|
||||
* and attaches Firebase messaging when the browser/WebView reports support.
|
||||
* Initializes the Firebase web app when VITE_FIREBASE_* env vars are set.
|
||||
* The notification-tap listener is registered on its own
|
||||
* (`ensurePushNotificationActionListener`). Permission, FCM token registration,
|
||||
* and Firebase messaging stay on `initializeNativePushAndFirebaseMessaging`.
|
||||
*/
|
||||
|
||||
import { Capacitor } from "@capacitor/core";
|
||||
@@ -23,6 +24,7 @@ import {
|
||||
import { logger } from "@/utils/logger";
|
||||
import { NotificationInspector } from "@/plugins/NotificationInspectorPlugin";
|
||||
import { openAlertSearchFromNotificationTap } from "./alertSearchNotificationTap";
|
||||
import { readFirebaseWebEnv } from "./firebaseWebEnv";
|
||||
import { handleCapacitorPushNotificationReceived } from "./NativeNotificationService";
|
||||
import { getNotificationApiHeaders } from "./notificationApiAuth";
|
||||
import { deferFcmRegistration } from "./notificationAuthLifecycle";
|
||||
@@ -37,6 +39,11 @@ const LOG = "[FirebaseMessaging]";
|
||||
|
||||
let firebaseAppSingleton: FirebaseApp | null = null;
|
||||
let nativeInitPromise: Promise<void> | null = null;
|
||||
/**
|
||||
* Separate from `nativeInitPromise`. Permission denial and token-registration
|
||||
* failure must not block attaching the tap listener, or a later retry of it.
|
||||
*/
|
||||
let actionListenerPromise: Promise<void> | null = null;
|
||||
/** Avoid duplicate POSTs when the same token is delivered more than once. */
|
||||
let lastRegisteredFcmToken: string | null = null;
|
||||
/** Last token received from Capacitor/Firebase (may match registered). */
|
||||
@@ -127,9 +134,7 @@ export async function reregisterFcmTokenNow(): Promise<string> {
|
||||
const app = ensureFirebaseApp();
|
||||
if (app && (await isSupported())) {
|
||||
const messaging = getMessaging(app);
|
||||
const vapidKey = import.meta.env.VITE_FIREBASE_VAPID_KEY as
|
||||
| string
|
||||
| undefined;
|
||||
const vapidKey = readFirebaseWebEnv().VITE_FIREBASE_VAPID_KEY;
|
||||
const token = await getToken(
|
||||
messaging,
|
||||
vapidKey ? { vapidKey } : undefined,
|
||||
@@ -173,7 +178,7 @@ export async function reregisterFcmTokenNow(): Promise<string> {
|
||||
}
|
||||
|
||||
function readFirebaseOptions(): FirebaseOptions | null {
|
||||
const env = import.meta.env;
|
||||
const env = readFirebaseWebEnv();
|
||||
const apiKey = env.VITE_FIREBASE_API_KEY as string | undefined;
|
||||
const projectId = env.VITE_FIREBASE_PROJECT_ID as string | undefined;
|
||||
const appId = env.VITE_FIREBASE_APP_ID as string | undefined;
|
||||
@@ -240,9 +245,7 @@ async function attachFirebaseMessagingIfSupported(
|
||||
}
|
||||
|
||||
const messaging = getMessaging(app);
|
||||
const vapidKey = import.meta.env.VITE_FIREBASE_VAPID_KEY as
|
||||
| string
|
||||
| undefined;
|
||||
const vapidKey = readFirebaseWebEnv().VITE_FIREBASE_VAPID_KEY;
|
||||
|
||||
try {
|
||||
const token = await getToken(
|
||||
@@ -266,8 +269,9 @@ async function attachFirebaseMessagingIfSupported(
|
||||
}
|
||||
|
||||
/**
|
||||
* Native: register Capacitor push listeners, request permissions, register for push,
|
||||
* then initialize Firebase Messaging when env config and platform support allow.
|
||||
* Native: register token and foreground-delivery listeners, request permission,
|
||||
* register for push, then initialize Firebase Messaging when env config and
|
||||
* platform support allow. The tap listener is attached separately.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -281,6 +285,55 @@ async function openNewActivityDeepLink(url: string): Promise<void> {
|
||||
await new DeepLinkHandler(router).handleDeepLink(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* One `pushNotificationActionPerformed` listener for the process.
|
||||
*
|
||||
* Capacitor retains that event until the first listener exists, including a
|
||||
* cold-start tap. This does not request permission or register an FCM token.
|
||||
* A failed `addListener` clears the promise so the next call can retry.
|
||||
* A second call while registration is in flight shares that attempt.
|
||||
*/
|
||||
async function registerPushNotificationActionListener(): Promise<void> {
|
||||
await PushNotifications.addListener(
|
||||
"pushNotificationActionPerformed",
|
||||
(action) => {
|
||||
logger.debug(`${LOG} pushNotificationActionPerformed`, action);
|
||||
logPushNotificationActionPerformed(action);
|
||||
void openAlertSearchFromNotificationTap(
|
||||
action,
|
||||
openNewActivityDeepLink,
|
||||
).catch((err: unknown) => {
|
||||
logger.warn(`${LOG} Could not open New Activity`, err);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export function ensurePushNotificationActionListener(): Promise<void> {
|
||||
if (!Capacitor.isNativePlatform()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (!actionListenerPromise) {
|
||||
actionListenerPromise = registerPushNotificationActionListener().catch(
|
||||
(error: unknown) => {
|
||||
actionListenerPromise = null;
|
||||
logger.error(
|
||||
`${LOG} pushNotificationActionPerformed listener failed`,
|
||||
error,
|
||||
);
|
||||
throw error;
|
||||
},
|
||||
);
|
||||
}
|
||||
return actionListenerPromise;
|
||||
}
|
||||
|
||||
/** Drops listener and FCM-init promises. Tests use this between cases. */
|
||||
export function resetNativePushMessagingStateForTests(): void {
|
||||
actionListenerPromise = null;
|
||||
nativeInitPromise = null;
|
||||
}
|
||||
|
||||
async function initializeNativePushAndFirebaseMessagingImpl(): Promise<void> {
|
||||
if (!Capacitor.isNativePlatform()) {
|
||||
return;
|
||||
@@ -324,24 +377,6 @@ async function initializeNativePushAndFirebaseMessagingImpl(): Promise<void> {
|
||||
},
|
||||
);
|
||||
|
||||
// Tap only. pushNotificationReceived (above) stays a log. Cold start is this
|
||||
// same event: native code forwards the launch tap, and Capacitor retains it
|
||||
// until this listener exists. openAlertSearchFromNotificationTap ignores a
|
||||
// second delivery of that tap.
|
||||
await PushNotifications.addListener(
|
||||
"pushNotificationActionPerformed",
|
||||
(action) => {
|
||||
logger.debug(`${LOG} pushNotificationActionPerformed`, action);
|
||||
logPushNotificationActionPerformed(action);
|
||||
void openAlertSearchFromNotificationTap(
|
||||
action,
|
||||
openNewActivityDeepLink,
|
||||
).catch((err) => {
|
||||
logger.warn(`${LOG} Could not open New Activity`, err);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
const perm = await PushNotifications.requestPermissions();
|
||||
if (perm.receive !== "granted") {
|
||||
logger.warn(`${LOG} Push permission not granted`, perm);
|
||||
@@ -366,14 +401,27 @@ async function initializeNativePushAndFirebaseMessagingImpl(): Promise<void> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Idempotent startup hook for Capacitor iOS/Android.
|
||||
* Idempotent hook for permission and FCM token registration.
|
||||
*
|
||||
* The promise is kept for the process, including when this returns early
|
||||
* because notification permission was denied or this Android build has no
|
||||
* Firebase config. A later call does not retry `PushNotifications.register()`.
|
||||
* Tap handling does not use this promise; see
|
||||
* `ensurePushNotificationActionListener`.
|
||||
*/
|
||||
export function initializeNativePushAndFirebaseMessaging(): Promise<void> {
|
||||
if (!Capacitor.isNativePlatform()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
// Outside nativeInitPromise so a cached permission/token attempt cannot
|
||||
// block a retry of the tap listener, and a listener failure cannot skip
|
||||
// token registration.
|
||||
const actionListener = ensurePushNotificationActionListener().catch(() => {
|
||||
// ensurePushNotificationActionListener logged this and cleared its promise.
|
||||
});
|
||||
if (!nativeInitPromise) {
|
||||
nativeInitPromise = initializeNativePushAndFirebaseMessagingImpl();
|
||||
}
|
||||
return nativeInitPromise;
|
||||
const registration = nativeInitPromise;
|
||||
return Promise.all([actionListener, registration]).then(() => undefined);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Vite's Firebase web config. Kept in this module so the messaging client can
|
||||
* be loaded by Jest, which cannot parse `import.meta`.
|
||||
*/
|
||||
export interface FirebaseWebEnv {
|
||||
VITE_FIREBASE_API_KEY?: string;
|
||||
VITE_FIREBASE_AUTH_DOMAIN?: string;
|
||||
VITE_FIREBASE_PROJECT_ID?: string;
|
||||
VITE_FIREBASE_STORAGE_BUCKET?: string;
|
||||
VITE_FIREBASE_MESSAGING_SENDER_ID?: string;
|
||||
VITE_FIREBASE_APP_ID?: string;
|
||||
VITE_FIREBASE_MEASUREMENT_ID?: string;
|
||||
VITE_FIREBASE_VAPID_KEY?: string;
|
||||
}
|
||||
|
||||
export function readFirebaseWebEnv(): FirebaseWebEnv {
|
||||
const env = import.meta.env;
|
||||
return {
|
||||
VITE_FIREBASE_API_KEY: env.VITE_FIREBASE_API_KEY as string | undefined,
|
||||
VITE_FIREBASE_AUTH_DOMAIN: env.VITE_FIREBASE_AUTH_DOMAIN as
|
||||
| string
|
||||
| undefined,
|
||||
VITE_FIREBASE_PROJECT_ID: env.VITE_FIREBASE_PROJECT_ID as
|
||||
| string
|
||||
| undefined,
|
||||
VITE_FIREBASE_STORAGE_BUCKET: env.VITE_FIREBASE_STORAGE_BUCKET as
|
||||
| string
|
||||
| undefined,
|
||||
VITE_FIREBASE_MESSAGING_SENDER_ID: env.VITE_FIREBASE_MESSAGING_SENDER_ID as
|
||||
| string
|
||||
| undefined,
|
||||
VITE_FIREBASE_APP_ID: env.VITE_FIREBASE_APP_ID as string | undefined,
|
||||
VITE_FIREBASE_MEASUREMENT_ID: env.VITE_FIREBASE_MEASUREMENT_ID as
|
||||
| string
|
||||
| undefined,
|
||||
VITE_FIREBASE_VAPID_KEY: env.VITE_FIREBASE_VAPID_KEY as string | undefined,
|
||||
};
|
||||
}
|
||||
@@ -60,6 +60,7 @@ export {
|
||||
} from "./notificationAuthLifecycle";
|
||||
export {
|
||||
ensureFirebaseApp,
|
||||
ensurePushNotificationActionListener,
|
||||
initializeNativePushAndFirebaseMessaging,
|
||||
} from "./firebaseMessagingClient";
|
||||
export { syncStarredPlansToNativePlugin } from "./syncStarredPlansToNativePlugin";
|
||||
|
||||
@@ -19,12 +19,22 @@ import { logger } from "@/utils/logger";
|
||||
import { DEFAULT_ENDORSER_API_SERVER } from "@/constants/app";
|
||||
import { BACKGROUND_JWT_SECONDS_PER_DAY } from "@/constants/backgroundJwt";
|
||||
import { onNotificationAuthMayBeReady } from "./notificationAuthLifecycle";
|
||||
import {
|
||||
getDeviceNewActivity,
|
||||
migrateDeviceNotificationsOnce,
|
||||
} from "./deviceNotifications";
|
||||
import { serverPushSupported } from "./firebaseMessagingClient";
|
||||
|
||||
/**
|
||||
* Configure the native notification content fetcher with API credentials.
|
||||
* Call when the app has an active identity (e.g. after login, app startup, or identity change).
|
||||
* No-op on web; requires native platform and an active DID.
|
||||
*
|
||||
* Mints only for the identity that owns the on-device New Activity schedule
|
||||
* (see deviceNotifications.ts), and only while it is the active identity.
|
||||
* Anyone else gets an empty pool, which pauses the owner's schedule and
|
||||
* leaves no credential on the device that nothing uses.
|
||||
*
|
||||
* @param activeDid - Optional. If not provided, reads from active_identity table.
|
||||
* @param apiServer - Optional. If not provided, reads from settings for the active DID.
|
||||
* @returns true if configuration was attempted and succeeded, false otherwise.
|
||||
@@ -60,6 +70,18 @@ export async function configureNativeFetcherIfReady(
|
||||
did = String(row[0]);
|
||||
}
|
||||
|
||||
await migrateDeviceNotificationsOnce(await serverPushSupported());
|
||||
const deviceNewActivity = await getDeviceNewActivity();
|
||||
if (deviceNewActivity?.ownerDid !== did) {
|
||||
logger.debug(
|
||||
"[nativeFetcherConfig] Active identity does not own the on-device " +
|
||||
"New Activity schedule; leaving the native fetcher unconfigured",
|
||||
);
|
||||
await clearNativeFetcherPool();
|
||||
onNotificationAuthMayBeReady();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!apiBaseUrl) {
|
||||
const settingsRow = await service.dbGetOneRow(
|
||||
"SELECT apiServer FROM settings WHERE id = 1 OR accountDid = ? LIMIT 1",
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
/**
|
||||
* How in-app New Activity notifications arrive.
|
||||
* Which New Activity notifier a settings row's time belongs to.
|
||||
*
|
||||
* - "server": the notification service runs the daily alertSearch with the
|
||||
* person's delegated JWTs and pushes the count through FCM. The default.
|
||||
* - "device": the daily-notification-plugin fetches and notifies on the
|
||||
* device. The notification service holds no JWTs, cursors, search area or
|
||||
* device registration for the person.
|
||||
* Two notifiers work on the phone apps, and both can be on:
|
||||
*
|
||||
* Exactly one of them runs. A build without Firebase (FOSS / F-Droid) can
|
||||
* only use "device"; `serverPushSupported` in firebaseMessagingClient says
|
||||
* which build this is. "server" is offered only to a registered identity with
|
||||
* general advanced functions on; everyone else gets "device".
|
||||
* - The server push: the notification service runs the daily alertSearch
|
||||
* with the person's delegated JWTs and pushes the count through FCM. It is
|
||||
* per identity; `notifyingNewActivityTime` in the settings is its time. A
|
||||
* build without Firebase (FOSS / F-Droid) cannot receive it;
|
||||
* `serverPushSupported` in firebaseMessagingClient says which build this is.
|
||||
* - The on-device check: the daily-notification-plugin fetches and notifies
|
||||
* on the device, and the notification service holds nothing for it. It is
|
||||
* per phone; its owner and time live in the device store
|
||||
* (deviceNotifications.ts), not in the settings.
|
||||
*
|
||||
* Settings rows from versions where one switch chose between the two can hold
|
||||
* an on-device time in `notifyingNewActivityTime`, marked by
|
||||
* `newActivityDelivery: "device"`. The functions here tell those apart.
|
||||
*/
|
||||
|
||||
export type NewActivityDelivery = "server" | "device";
|
||||
|
||||
/** The stored choice, with anything unset or unknown meaning the default. */
|
||||
/** The stored marker, with anything unset or unknown meaning the push. */
|
||||
export function storedNewActivityDelivery(settings: {
|
||||
newActivityDelivery?: string;
|
||||
}): NewActivityDelivery {
|
||||
@@ -23,25 +28,22 @@ export function storedNewActivityDelivery(settings: {
|
||||
}
|
||||
|
||||
/**
|
||||
* The delivery that actually runs: "device" wherever push is unavailable, and
|
||||
* wherever "server" is not offered. A "server" delivery already on keeps
|
||||
* running, so turning it off revokes its batch.
|
||||
* The time of the server push, such as "9:00 AM", or "" when it is off: the
|
||||
* settings time, unless it is marked as an on-device time or this build
|
||||
* cannot receive pushes.
|
||||
*/
|
||||
export function effectiveNewActivityDelivery(
|
||||
export function serverPushTime(
|
||||
settings: {
|
||||
isRegistered?: boolean;
|
||||
newActivityDelivery?: string;
|
||||
notifyingNewActivityTime?: string;
|
||||
showGeneralAdvanced?: boolean;
|
||||
},
|
||||
serverPushSupported: boolean,
|
||||
): NewActivityDelivery {
|
||||
): string {
|
||||
if (
|
||||
!serverPushSupported ||
|
||||
storedNewActivityDelivery(settings) === "device"
|
||||
) {
|
||||
return "device";
|
||||
return "";
|
||||
}
|
||||
const offered = !!settings.isRegistered && !!settings.showGeneralAdvanced;
|
||||
return offered || settings.notifyingNewActivityTime ? "server" : "device";
|
||||
return settings.notifyingNewActivityTime || "";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Server AlertSearch subscription for the in-app New Activity toggle.
|
||||
* Server AlertSearch subscription for the New Activity push toggle.
|
||||
*
|
||||
* Enable uploads through `uploadAlertSearchAuthorization`. Disable revokes
|
||||
* through `revokeAlertSearchAuthorization`. Neither call registers or deletes
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
} from "./alertAuthorization";
|
||||
|
||||
/**
|
||||
* Upload the AlertSearch batch when the in-app setting is enabled or given a
|
||||
* Upload the AlertSearch batch when the push setting is enabled or given a
|
||||
* new time. A failure is reported and returned; it does not throw.
|
||||
*/
|
||||
export async function authorizeInAppNewActivity(
|
||||
@@ -40,7 +40,7 @@ export async function authorizeInAppNewActivity(
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke the push AlertSearch authorization for the in-app toggle.
|
||||
* Revoke the AlertSearch authorization for the push toggle.
|
||||
*
|
||||
* @returns false when the delete did not succeed. Callers must not persist
|
||||
* the off setting or announce that notifications are off in that case.
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import { Capacitor } from "@capacitor/core";
|
||||
|
||||
import { DailyNotification } from "@/plugins/DailyNotificationPlugin";
|
||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||
import { logger } from "@/utils/logger";
|
||||
import { ownsDeviceNewActivity } from "./deviceNotifications";
|
||||
|
||||
/**
|
||||
* Pushes starred plan handle IDs to the native Daily Notification plugin so
|
||||
* Android TimeSafariNativeFetcher uses the current list for prefetch
|
||||
* (plansLastUpdatedBetween planIds).
|
||||
*
|
||||
* No-op on web. Ignores UNIMPLEMENTED when the plugin omits the method on some builds.
|
||||
* No-op on web, and unless the active identity owns the on-device New
|
||||
* Activity schedule (see deviceNotifications.ts): another identity's starred
|
||||
* projects must not replace the owner's. Ignores UNIMPLEMENTED when the plugin
|
||||
* omits the method on some builds.
|
||||
*/
|
||||
export async function syncStarredPlansToNativePlugin(
|
||||
planIds: string[],
|
||||
@@ -17,6 +22,12 @@ export async function syncStarredPlansToNativePlugin(
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const row = await PlatformServiceFactory.getInstance().dbGetOneRow(
|
||||
"SELECT activeDid FROM active_identity WHERE id = 1",
|
||||
);
|
||||
if (!(await ownsDeviceNewActivity(row?.[0] ? String(row[0]) : ""))) {
|
||||
return;
|
||||
}
|
||||
await DailyNotification.updateStarredPlans({ planIds });
|
||||
} catch (e: unknown) {
|
||||
if ((e as { code?: string })?.code === "UNIMPLEMENTED") {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {
|
||||
effectiveNewActivityDelivery,
|
||||
serverPushTime,
|
||||
storedNewActivityDelivery,
|
||||
} from "@/services/notifications/newActivityDelivery";
|
||||
|
||||
describe("New Activity delivery", () => {
|
||||
it("defaults to the server push", () => {
|
||||
it("reads an unmarked time as the push's", () => {
|
||||
expect(storedNewActivityDelivery({})).toBe("server");
|
||||
expect(storedNewActivityDelivery({ newActivityDelivery: "bogus" })).toBe(
|
||||
"server",
|
||||
@@ -14,41 +14,28 @@ describe("New Activity delivery", () => {
|
||||
);
|
||||
});
|
||||
|
||||
const offered = { isRegistered: true, showGeneralAdvanced: true };
|
||||
|
||||
it("runs on the device wherever push is unavailable", () => {
|
||||
expect(effectiveNewActivityDelivery(offered, true)).toBe("server");
|
||||
expect(effectiveNewActivityDelivery(offered, false)).toBe("device");
|
||||
it("gives the push time where the push can run", () => {
|
||||
expect(serverPushTime({}, true)).toBe("");
|
||||
expect(serverPushTime({ notifyingNewActivityTime: "9:00 AM" }, true)).toBe(
|
||||
"9:00 AM",
|
||||
);
|
||||
expect(
|
||||
effectiveNewActivityDelivery(
|
||||
{ ...offered, newActivityDelivery: "device" },
|
||||
serverPushTime(
|
||||
{ newActivityDelivery: "server", notifyingNewActivityTime: "9:00 AM" },
|
||||
true,
|
||||
),
|
||||
).toBe("device");
|
||||
).toBe("9:00 AM");
|
||||
});
|
||||
|
||||
it("offers the server only to registered identities with advanced on", () => {
|
||||
expect(effectiveNewActivityDelivery({}, true)).toBe("device");
|
||||
it("gives no push time for an on-device time or a build without push", () => {
|
||||
expect(
|
||||
effectiveNewActivityDelivery({ showGeneralAdvanced: true }, true),
|
||||
).toBe("device");
|
||||
expect(effectiveNewActivityDelivery({ isRegistered: true }, true)).toBe(
|
||||
"device",
|
||||
serverPushTime(
|
||||
{ newActivityDelivery: "device", notifyingNewActivityTime: "9:00 AM" },
|
||||
true,
|
||||
),
|
||||
).toBe("");
|
||||
expect(serverPushTime({ notifyingNewActivityTime: "9:00 AM" }, false)).toBe(
|
||||
"",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps a server delivery that is already on", () => {
|
||||
expect(
|
||||
effectiveNewActivityDelivery(
|
||||
{ notifyingNewActivityTime: "9:00 AM" },
|
||||
true,
|
||||
),
|
||||
).toBe("server");
|
||||
expect(
|
||||
effectiveNewActivityDelivery(
|
||||
{ notifyingNewActivityTime: "9:00 AM" },
|
||||
false,
|
||||
),
|
||||
).toBe("device");
|
||||
});
|
||||
});
|
||||
|
||||
+806
-527
File diff suppressed because it is too large
Load Diff
@@ -108,7 +108,7 @@
|
||||
<script lang="ts">
|
||||
import { Buffer } from "buffer/";
|
||||
import QRCodeVue3 from "qr-code-generator-vue3";
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Component, Hook, Vue } from "vue-facing-decorator";
|
||||
import { Router } from "vue-router";
|
||||
import { copyToClipboard } from "../services/ClipboardService";
|
||||
|
||||
@@ -230,6 +230,10 @@ export default class ContactQRScanFull extends Vue {
|
||||
// Add cleanup tracking
|
||||
private isCleaningUp = false;
|
||||
private isMounted = false;
|
||||
// Incremented by stopScanning() so an in-progress startScanning() can bail out
|
||||
private scanRequestId = 0;
|
||||
private resumeScanOnResume = false;
|
||||
private pendingPauseStop: Promise<void> | null = null;
|
||||
|
||||
/**
|
||||
* Computed property for QR code container CSS classes
|
||||
@@ -333,6 +337,8 @@ export default class ContactQRScanFull extends Vue {
|
||||
return;
|
||||
}
|
||||
|
||||
const requestId = ++this.scanRequestId;
|
||||
const stopRequested = () => requestId !== this.scanRequestId;
|
||||
try {
|
||||
this.error = null;
|
||||
this.isScanning = true;
|
||||
@@ -364,6 +370,11 @@ export default class ContactQRScanFull extends Vue {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// A stop (route leave, app pause) may have arrived during the awaits above
|
||||
if (stopRequested()) {
|
||||
logger.debug("Scan stopped before camera start; not starting");
|
||||
return;
|
||||
}
|
||||
|
||||
// Add scan listener
|
||||
scanner.addListener({
|
||||
@@ -388,6 +399,7 @@ export default class ContactQRScanFull extends Vue {
|
||||
* @throws Will log error if stopping scan fails
|
||||
*/
|
||||
async stopScanning() {
|
||||
this.scanRequestId++;
|
||||
try {
|
||||
const scanner = QRScannerFactory.getInstance();
|
||||
await scanner.stopScan();
|
||||
@@ -708,10 +720,21 @@ export default class ContactQRScanFull extends Vue {
|
||||
}
|
||||
|
||||
/**
|
||||
* Vue lifecycle hook - component before destruction
|
||||
* Route guard - stops the native camera before navigating away, for every
|
||||
* exit (hardware back, swipe-back, links), not only the in-page back button.
|
||||
* Unlike beforeUnmount, a route guard can wait for the native stop.
|
||||
*/
|
||||
@Hook
|
||||
async beforeRouteLeave() {
|
||||
this.isMounted = false;
|
||||
await this.cleanupScanner();
|
||||
}
|
||||
|
||||
/**
|
||||
* Vue lifecycle hook - component before unmount
|
||||
* Cleans up event listeners and scanner resources
|
||||
*/
|
||||
beforeDestroy() {
|
||||
beforeUnmount() {
|
||||
this.isMounted = false;
|
||||
document.removeEventListener("pause", this.handleAppPause);
|
||||
document.removeEventListener("resume", this.handleAppResume);
|
||||
@@ -725,17 +748,40 @@ export default class ContactQRScanFull extends Vue {
|
||||
if (!this.isMounted) return;
|
||||
|
||||
logger.debug("App paused, stopping scanner");
|
||||
await this.stopScanning();
|
||||
// A pause can arrive mid-start, e.g. from the Android camera permission dialog
|
||||
this.resumeScanOnResume = this.isScanning;
|
||||
this.pendingPauseStop = this.stopScanning();
|
||||
await this.pendingPauseStop;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles app resume event by resetting scanner state
|
||||
* Handles app resume event by restarting the scanner if a pause stopped it
|
||||
*/
|
||||
handleAppResume() {
|
||||
async handleAppResume() {
|
||||
if (!this.isMounted) return;
|
||||
|
||||
logger.debug("App resumed, scanner can be restarted by user");
|
||||
this.isScanning = false;
|
||||
await this.pendingPauseStop;
|
||||
this.pendingPauseStop = null;
|
||||
if (!this.resumeScanOnResume || !this.isMounted) {
|
||||
this.isScanning = false;
|
||||
return;
|
||||
}
|
||||
this.resumeScanOnResume = false;
|
||||
|
||||
// The Android camera permission dialog itself pauses the app. Restart only
|
||||
// when the permission is granted: after a denial, startScanning() would
|
||||
// show the dialog a second time, and the denied start already warned.
|
||||
const scanner = QRScannerFactory.getInstance();
|
||||
if (!(await scanner.checkPermissions())) {
|
||||
logger.debug("App resumed without camera permission; not restarting");
|
||||
this.isScanning = false;
|
||||
this.error = "Camera permission denied";
|
||||
return;
|
||||
}
|
||||
if (!this.isMounted) return;
|
||||
|
||||
logger.debug("App resumed, restarting scanner");
|
||||
await this.startScanning();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
import { AxiosError } from "axios";
|
||||
import { Buffer } from "buffer/";
|
||||
import QRCodeVue3 from "qr-code-generator-vue3";
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Component, Hook, Vue } from "vue-facing-decorator";
|
||||
import { copyToClipboard } from "../services/ClipboardService";
|
||||
|
||||
import { QrcodeStream } from "vue-qrcode-reader";
|
||||
@@ -167,7 +167,7 @@ import * as libsUtil from "../libs/util";
|
||||
import { Router } from "vue-router";
|
||||
import { logger } from "../utils/logger";
|
||||
import { QRScannerFactory } from "@/services/QRScanner/QRScannerFactory";
|
||||
import { CameraState } from "@/services/QRScanner/types";
|
||||
import { CameraState, CameraStateListener } from "@/services/QRScanner/types";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers } from "@/utils/notify";
|
||||
import { showSeedPhraseReminder } from "@/utils/seedPhraseReminder";
|
||||
@@ -250,6 +250,12 @@ export default class ContactQRScanShow extends Vue {
|
||||
// Add cleanup tracking
|
||||
private isCleaningUp = false;
|
||||
private isMounted = false;
|
||||
// Incremented by stopScanning() so an in-progress startScanning() can bail out
|
||||
private scanRequestId = 0;
|
||||
// Registered once and removed on cleanup, so restarts don't pile up listeners
|
||||
private cameraStateListener: CameraStateListener | null = null;
|
||||
private resumeScanOnResume = false;
|
||||
private pendingPauseStop: Promise<void> | null = null;
|
||||
|
||||
// Add property to track if we're on desktop
|
||||
private isDesktop = false;
|
||||
@@ -350,6 +356,7 @@ export default class ContactQRScanShow extends Vue {
|
||||
return;
|
||||
}
|
||||
|
||||
const requestId = ++this.scanRequestId;
|
||||
try {
|
||||
this.error = null;
|
||||
this.isScanning = true;
|
||||
@@ -358,42 +365,48 @@ export default class ContactQRScanShow extends Vue {
|
||||
|
||||
const scanner = QRScannerFactory.getInstance();
|
||||
|
||||
// Add camera state listener
|
||||
scanner.addCameraStateListener({
|
||||
onStateChange: (state, message) => {
|
||||
this.cameraState = state;
|
||||
this.cameraStateMessage = message;
|
||||
// Add camera state listener (once; the scanner keeps them in a Set)
|
||||
if (!this.cameraStateListener) {
|
||||
this.cameraStateListener = {
|
||||
onStateChange: (state, message) => {
|
||||
this.cameraState = state;
|
||||
this.cameraStateMessage = message;
|
||||
|
||||
// Update UI based on camera state
|
||||
switch (state) {
|
||||
case "in_use":
|
||||
this.error = "Camera is in use by another application";
|
||||
this.isScanning = false;
|
||||
this.notify.warning(
|
||||
NOTIFY_QR_CAMERA_IN_USE.message,
|
||||
QR_TIMEOUT_LONG,
|
||||
);
|
||||
break;
|
||||
case "permission_denied":
|
||||
this.error = "Camera permission denied";
|
||||
this.isScanning = false;
|
||||
this.notify.warning(
|
||||
NOTIFY_QR_CAMERA_ACCESS_REQUIRED.message,
|
||||
QR_TIMEOUT_LONG,
|
||||
);
|
||||
break;
|
||||
case "not_found":
|
||||
this.error = "No camera found";
|
||||
this.isScanning = false;
|
||||
this.notify.warning(NOTIFY_QR_NO_CAMERA.message, QR_TIMEOUT_LONG);
|
||||
break;
|
||||
case "error":
|
||||
this.error = this.cameraStateMessage || "Camera error";
|
||||
this.isScanning = false;
|
||||
break;
|
||||
}
|
||||
},
|
||||
});
|
||||
// Update UI based on camera state
|
||||
switch (state) {
|
||||
case "in_use":
|
||||
this.error = "Camera is in use by another application";
|
||||
this.isScanning = false;
|
||||
this.notify.warning(
|
||||
NOTIFY_QR_CAMERA_IN_USE.message,
|
||||
QR_TIMEOUT_LONG,
|
||||
);
|
||||
break;
|
||||
case "permission_denied":
|
||||
this.error = "Camera permission denied";
|
||||
this.isScanning = false;
|
||||
this.notify.warning(
|
||||
NOTIFY_QR_CAMERA_ACCESS_REQUIRED.message,
|
||||
QR_TIMEOUT_LONG,
|
||||
);
|
||||
break;
|
||||
case "not_found":
|
||||
this.error = "No camera found";
|
||||
this.isScanning = false;
|
||||
this.notify.warning(
|
||||
NOTIFY_QR_NO_CAMERA.message,
|
||||
QR_TIMEOUT_LONG,
|
||||
);
|
||||
break;
|
||||
case "error":
|
||||
this.error = this.cameraStateMessage || "Camera error";
|
||||
this.isScanning = false;
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
scanner.addCameraStateListener(this.cameraStateListener);
|
||||
|
||||
// Check if scanning is supported first
|
||||
if (!(await scanner.isSupported())) {
|
||||
@@ -403,8 +416,12 @@ export default class ContactQRScanShow extends Vue {
|
||||
this.notify.warning(NOTIFY_QR_HTTPS_REQUIRED.message, QR_TIMEOUT_LONG);
|
||||
return;
|
||||
}
|
||||
if (requestId !== this.scanRequestId) {
|
||||
logger.debug("Scan stopped before camera start; not starting");
|
||||
return;
|
||||
}
|
||||
|
||||
// Start scanning
|
||||
// Start scanning (the scanner abandons this start if stopScan() is called)
|
||||
await scanner.startScan();
|
||||
} catch (error) {
|
||||
this.error = error instanceof Error ? error.message : String(error);
|
||||
@@ -417,6 +434,7 @@ export default class ContactQRScanShow extends Vue {
|
||||
}
|
||||
|
||||
async stopScanning() {
|
||||
this.scanRequestId++;
|
||||
try {
|
||||
const scanner = QRScannerFactory.getInstance();
|
||||
await scanner.stopScan();
|
||||
@@ -441,6 +459,11 @@ export default class ContactQRScanShow extends Vue {
|
||||
try {
|
||||
logger.debug("Cleaning up QR scanner resources");
|
||||
await this.stopScanning();
|
||||
if (this.cameraStateListener) {
|
||||
QRScannerFactory.getInstance().removeCameraStateListener(
|
||||
this.cameraStateListener,
|
||||
);
|
||||
}
|
||||
await QRScannerFactory.cleanup();
|
||||
} catch (error) {
|
||||
logger.error("Error during scanner cleanup:", {
|
||||
@@ -692,7 +715,18 @@ export default class ContactQRScanShow extends Vue {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
beforeDestroy() {
|
||||
/**
|
||||
* Stop the native camera before navigating away. This covers every exit
|
||||
* (hardware back, swipe-back, links), not only the in-page back button.
|
||||
* Unlike beforeUnmount, a route guard can wait for the native stop.
|
||||
*/
|
||||
@Hook
|
||||
async beforeRouteLeave() {
|
||||
this.isMounted = false;
|
||||
await this.cleanupScanner();
|
||||
}
|
||||
|
||||
beforeUnmount() {
|
||||
this.isMounted = false;
|
||||
document.removeEventListener("pause", this.handleAppPause);
|
||||
document.removeEventListener("resume", this.handleAppResume);
|
||||
@@ -703,14 +737,24 @@ export default class ContactQRScanShow extends Vue {
|
||||
if (!this.isMounted) return;
|
||||
|
||||
logger.debug("App paused, stopping scanner");
|
||||
await this.stopScanning();
|
||||
// A pause can arrive mid-start, e.g. from the Android camera permission dialog
|
||||
this.resumeScanOnResume = this.isScanning;
|
||||
this.pendingPauseStop = this.stopScanning();
|
||||
await this.pendingPauseStop;
|
||||
}
|
||||
|
||||
handleAppResume() {
|
||||
async handleAppResume() {
|
||||
if (!this.isMounted) return;
|
||||
|
||||
logger.debug("App resumed, scanner can be restarted by user");
|
||||
this.isScanning = false;
|
||||
await this.pendingPauseStop;
|
||||
this.pendingPauseStop = null;
|
||||
if (this.resumeScanOnResume && this.isMounted) {
|
||||
logger.debug("App resumed, restarting scanner");
|
||||
this.resumeScanOnResume = false;
|
||||
await this.startScanning();
|
||||
} else {
|
||||
this.isScanning = false;
|
||||
}
|
||||
}
|
||||
|
||||
async addNewContact(contact: Contact) {
|
||||
|
||||
@@ -110,7 +110,7 @@ export default class DeepLinkRedirectView extends Vue {
|
||||
pageError: string | null = null;
|
||||
destinationUrl: string | null = null; // full path after "/deep-link/"
|
||||
deepLinkUrl: string | null = null; // mobile link starting "timesafari://"
|
||||
webUrl: string | null = null; // web link, eg "https://timesafari.app/..."
|
||||
webUrl: string | null = null; // web link, eg "https://giftopia.me/..."
|
||||
userAgent: string = "";
|
||||
platformService = PlatformServiceFactory.getInstance();
|
||||
|
||||
|
||||
@@ -28,44 +28,82 @@
|
||||
|
||||
<!-- eslint-disable prettier/prettier -->
|
||||
<div>
|
||||
<p>There are two types of notifications:</p>
|
||||
<p>
|
||||
There are four kinds of notifications. Text messages are the default.
|
||||
The other three are advanced features: your phone's operating system
|
||||
delivers them, and it can delay or drop them.
|
||||
</p>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">Daily Reminder Notifications</h2>
|
||||
<table class="w-full text-sm mt-4 border-collapse">
|
||||
<thead>
|
||||
<tr class="text-left border-b border-slate-300">
|
||||
<th class="py-1 pr-2">Kind</th>
|
||||
<th class="py-1 pr-2">Checks</th>
|
||||
<th class="py-1 pr-2">Needs registration</th>
|
||||
<th class="py-1">Reliability</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="border-b border-slate-200 align-top">
|
||||
<td class="py-1 pr-2">Text message (default)</td>
|
||||
<td class="py-1 pr-2">New activity and interest matches, on the server</td>
|
||||
<td class="py-1 pr-2">Yes</td>
|
||||
<td class="py-1">Highest</td>
|
||||
</tr>
|
||||
<tr class="border-b border-slate-200 align-top">
|
||||
<td class="py-1 pr-2">Push from the server (advanced)</td>
|
||||
<td class="py-1 pr-2">New activity and interest matches, on the server</td>
|
||||
<td class="py-1 pr-2">Yes</td>
|
||||
<td class="py-1">Up to the phone's system</td>
|
||||
</tr>
|
||||
<tr class="border-b border-slate-200 align-top">
|
||||
<td class="py-1 pr-2">Checked on this device (advanced)</td>
|
||||
<td class="py-1 pr-2">Changes to your starred projects, on your phone</td>
|
||||
<td class="py-1 pr-2">No</td>
|
||||
<td class="py-1">Up to the phone's system</td>
|
||||
</tr>
|
||||
<tr class="align-top">
|
||||
<td class="py-1 pr-2">Daily Reminder (advanced)</td>
|
||||
<td class="py-1 pr-2">Nothing: it's your own message</td>
|
||||
<td class="py-1 pr-2">No</td>
|
||||
<td class="py-1">Up to the phone's system</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">Why Three of Them Are Advanced</h2>
|
||||
<div>
|
||||
<p>
|
||||
The Daily Reminder notification will be sent to you daily with a specific
|
||||
message, at whatever time you choose. Use it to remind
|
||||
yourself to act, for example: pause and consider who has given you
|
||||
something, so you can record thanks in here.
|
||||
A text message goes through your carrier and arrives like any other
|
||||
text, whether or not the app is running. The other three are handed
|
||||
to your phone's operating system, which decides when, and whether,
|
||||
to show them:
|
||||
</p>
|
||||
<p>
|
||||
This is your own message activated in the app, but it doesn't contain any details about
|
||||
activity that might be especially interesting to you.
|
||||
Note that the timing is not precise: the device may deliver it a bit later than scheduled.
|
||||
<ul class="list-disc list-outside ml-5 mt-1">
|
||||
<li>
|
||||
Battery savers, Focus or Do Not Disturb modes, and per-app
|
||||
notification settings can hold them back or hide them.
|
||||
</li>
|
||||
<li>
|
||||
On some Android phones, battery optimization or force-stopping the
|
||||
app blocks them until the app is opened again.
|
||||
</li>
|
||||
<li>
|
||||
On iPhone, iOS decides when apps get to work in the background, so
|
||||
the on-device check can run late or not at all. To learn more,
|
||||
search for "iOS Background App Refresh".
|
||||
</li>
|
||||
</ul>
|
||||
<p class="mt-2">
|
||||
They work well on many phones, but nobody can promise when they
|
||||
arrive. If one stops showing up,
|
||||
<router-link to="/help-notifications" class="text-blue-500">
|
||||
troubleshoot your notifications</router-link
|
||||
>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">Matches for Your Interests</h2>
|
||||
<div>
|
||||
<p>
|
||||
Both kinds of New Activity Notification below also count people and projects whose
|
||||
descriptions are close in meaning to your saved public profile. Those matches come only
|
||||
from the profile text you saved on the Profile page; interests kept only on this device
|
||||
are not used until you save them to your profile.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">New Activity Notifications -- In App</h2>
|
||||
<div>
|
||||
<p>
|
||||
The New Activity Notification will be activated in your app when there is new, relevant
|
||||
activity for you.
|
||||
It will only trigger if something involves you or a project of interest; it will not
|
||||
bug you for other, general activity.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">New Activity Notifications -- Texts From A Server</h2>
|
||||
<h2 class="text-xl font-semibold mt-4">New Activity -- Text Messages</h2>
|
||||
<div>
|
||||
<p>
|
||||
This New Activity Notification SMS will be sent to you when there is new, relevant
|
||||
@@ -112,13 +150,72 @@
|
||||
</li>
|
||||
<li>
|
||||
See our
|
||||
<a href="https://timesafari.app/help-terms" target="_blank" class="text-blue-500">
|
||||
<a href="https://giftopia.me/help-terms" target="_blank" class="text-blue-500">
|
||||
Terms & Conditions and Privacy Policy docs here.
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">New Activity -- Push From the Server</h2>
|
||||
<div>
|
||||
<p>
|
||||
The notification server checks once a day, at the time you choose,
|
||||
for new activity relevant to you: something that involves you, a
|
||||
project you starred, or a match for your interests. When it finds
|
||||
some, it sends a push through Google's push service (Apple's on
|
||||
iPhone), and your phone's system shows it. It will not bug you for
|
||||
other, general activity.
|
||||
</p>
|
||||
<p class="mt-2">
|
||||
To search for you while your phone is asleep, the server holds
|
||||
permission to search on your behalf for a limited time. Only
|
||||
registered identities can use it, and the app must have been built
|
||||
with Google's push service; F-Droid builds are not.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">New Activity -- Checked On This Device</h2>
|
||||
<div>
|
||||
<p>
|
||||
Your phone checks once a day, shortly before the time you choose,
|
||||
for changes to projects you starred, and notifies you when there are
|
||||
some. The notification server keeps nothing for it, so it is the
|
||||
most private kind. It does not look for matches to your interests.
|
||||
</p>
|
||||
<p class="mt-2">
|
||||
It works without registration. The phone runs one of these checks,
|
||||
for one identity: if you switch to another identity, the check
|
||||
pauses until you switch back, unless you turn it on for the other
|
||||
identity instead.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">Daily Reminder</h2>
|
||||
<div>
|
||||
<p>
|
||||
The Daily Reminder shows a message you choose, every day at the time
|
||||
you choose. Use it to remind yourself to act, for example: pause and
|
||||
consider who has given you something, so you can record thanks in
|
||||
here. It doesn't contain any details about activity that might be
|
||||
especially interesting to you.
|
||||
</p>
|
||||
<p class="mt-2">
|
||||
It belongs to the phone, not to an identity: it stays the same when
|
||||
you switch identities. It needs no registration.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2 class="text-xl font-semibold mt-4">Matches for Your Interests</h2>
|
||||
<div>
|
||||
<p>
|
||||
Text messages and pushes from the server also count people and
|
||||
projects whose descriptions are close in meaning to your saved public
|
||||
profile. Those matches come only from the profile text you saved on
|
||||
the Profile page; interests kept only on this device are not used
|
||||
until you save them to your profile.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- eslint-enable -->
|
||||
</section>
|
||||
|
||||
@@ -35,48 +35,21 @@
|
||||
Note that the notifications will not arrive exactly at the time you set
|
||||
(because phones don't let non-alarm-apps set exact alarms).
|
||||
|
||||
<h4>Check your in-app notification settings</h4>
|
||||
<ul>
|
||||
<li>Tap <strong>Profile</strong> in the bottom bar</li>
|
||||
<li>
|
||||
Under <strong>Notifications</strong>, confirm:
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Daily Reminder</strong> is <strong>enabled</strong>
|
||||
</li>
|
||||
<li>The <strong>time</strong> is set correctly</li>
|
||||
<li>The message looks correct</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
If it’s already enabled, try to:
|
||||
<ul>
|
||||
<li>
|
||||
Turn it <strong>off</strong> then turn it
|
||||
<strong>on</strong> again
|
||||
</li>
|
||||
<li>Re-set the time and message</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<details class="prose-details mt-2" :open="isIOS">
|
||||
<summary
|
||||
class="cursor-pointer font-semibold uppercase text-inherit list-none flex items-center gap-2 [&::-webkit-details-marker]:hidden"
|
||||
<!-- This phone's platform first and open, the other collapsed below -->
|
||||
<template v-for="platform in platformOrder" :key="platform">
|
||||
<HelpDetails
|
||||
v-if="platform === 'ios'"
|
||||
title="iOS troubleshooting"
|
||||
:open="isIOS"
|
||||
>
|
||||
<font-awesome
|
||||
icon="chevron-right"
|
||||
class="details-chevron w-[0.75em] flex-shrink-0 transition-transform duration-200"
|
||||
/>
|
||||
iOS troubleshooting
|
||||
</summary>
|
||||
<div class="pl-0 mt-2">
|
||||
<h5>Allow notifications for TimeSafari</h5>
|
||||
<h5>Allow notifications for {{ AppString.APP_NAME }}</h5>
|
||||
<ol>
|
||||
<li>
|
||||
Open <strong>Settings</strong> → <strong>Notifications</strong>
|
||||
</li>
|
||||
<li>Tap <strong>TimeSafari</strong></li>
|
||||
<li>
|
||||
Tap <strong>{{ AppString.APP_NAME }}</strong>
|
||||
</li>
|
||||
<li>Turn <strong>Allow Notifications</strong> on</li>
|
||||
<li>
|
||||
Enable at least one delivery style (recommended):
|
||||
@@ -105,35 +78,23 @@
|
||||
<li>Open <strong>Settings</strong> → <strong>Focus</strong></li>
|
||||
<li>
|
||||
Check the active Focus mode and ensure
|
||||
<strong>TimeSafari</strong> is allowed (or temporarily disable
|
||||
Focus to test)
|
||||
<strong>{{ AppString.APP_NAME }}</strong> is allowed (or
|
||||
temporarily disable Focus to test)
|
||||
</li>
|
||||
</ul>
|
||||
<h5>After restarting your phone</h5>
|
||||
<p>
|
||||
If you recently restarted iOS and don’t see the notification, open
|
||||
<strong>TimeSafari</strong> once. (You don’t need to change
|
||||
anything.)
|
||||
<strong>{{ AppString.APP_NAME }}</strong> once. (You don’t need to
|
||||
change anything.)
|
||||
</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="prose-details mt-2" :open="isAndroid">
|
||||
<summary
|
||||
class="cursor-pointer font-semibold uppercase text-inherit list-none flex items-center gap-2 [&::-webkit-details-marker]:hidden"
|
||||
>
|
||||
<font-awesome
|
||||
icon="chevron-right"
|
||||
class="details-chevron w-[0.75em] flex-shrink-0 transition-transform duration-200"
|
||||
/>
|
||||
Android troubleshooting
|
||||
</summary>
|
||||
<div class="pl-0 mt-2">
|
||||
<h5>Allow notifications for TimeSafari</h5>
|
||||
</HelpDetails>
|
||||
<HelpDetails v-else title="Android troubleshooting" :open="isAndroid">
|
||||
<h5>Allow notifications for {{ AppString.APP_NAME }}</h5>
|
||||
<ol>
|
||||
<li>Open <strong>Settings</strong> → <strong>Apps</strong></li>
|
||||
<li>
|
||||
Tap <strong>TimeSafari</strong> →
|
||||
Tap <strong>{{ AppString.APP_NAME }}</strong> →
|
||||
<strong>Manage notifications</strong> (wording varies)
|
||||
</li>
|
||||
<li>Turn notifications <strong>on</strong></li>
|
||||
@@ -149,7 +110,7 @@
|
||||
<ul>
|
||||
<li>
|
||||
Open <strong>Settings</strong> → <strong>Apps</strong> →
|
||||
<strong>TimeSafari</strong> →
|
||||
<strong>{{ AppString.APP_NAME }}</strong> →
|
||||
<strong>Battery usage</strong> (wording varies)
|
||||
</li>
|
||||
<li>
|
||||
@@ -160,12 +121,13 @@
|
||||
<strong>Unrestricted</strong>
|
||||
</li>
|
||||
<li>Turn <strong>Allow background usage</strong> on</li>
|
||||
<li>Disable optimization for TimeSafari</li>
|
||||
<li>Disable optimization for {{ AppString.APP_NAME }}</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
If your device has lists like <strong>Sleeping apps</strong> /
|
||||
<strong>Restricted apps</strong>, remove TimeSafari from them
|
||||
<strong>Restricted apps</strong>, remove
|
||||
{{ AppString.APP_NAME }} from them
|
||||
</li>
|
||||
</ul>
|
||||
<h5>After restarting your phone</h5>
|
||||
@@ -175,33 +137,64 @@
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
Open <strong>TimeSafari</strong> once (you don’t need to change
|
||||
anything)
|
||||
Open <strong>{{ AppString.APP_NAME }}</strong> once (you don’t
|
||||
need to change anything)
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</details>
|
||||
</HelpDetails>
|
||||
</template>
|
||||
|
||||
<h4>If it still doesn’t work</h4>
|
||||
<ul>
|
||||
<li>Ensure you’re on the latest TimeSafari app version.</li>
|
||||
<li>
|
||||
If you denied permission earlier, re-enable notifications in system
|
||||
settings (above).
|
||||
</li>
|
||||
<li>
|
||||
Try the <strong>Use 10-minute rollover (testing)</strong> option at
|
||||
the bottom of this screen to confirm that notifications are firing
|
||||
on your device.
|
||||
</li>
|
||||
<li>
|
||||
As a last resort, uninstall/reinstall the app (you’ll need to enable
|
||||
notifications again and reconfigure the daily reminder).
|
||||
<strong>Important:</strong> Before uninstalling, back up your
|
||||
identifier seed so you can import it back later:
|
||||
<strong>Profile → Data Management → Backup Identifier Seed</strong>.
|
||||
</li>
|
||||
</ul>
|
||||
<HelpDetails title="Daily Reminder">
|
||||
<ul>
|
||||
<li>Tap <strong>Profile</strong> in the bottom bar</li>
|
||||
<li>
|
||||
Under <strong>Notifications</strong>, tap
|
||||
<strong>Advanced</strong> and confirm:
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Daily Reminder</strong> is <strong>enabled</strong>
|
||||
</li>
|
||||
<li>The <strong>time</strong> is set correctly</li>
|
||||
<li>The message looks correct</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
If it’s already enabled, try to:
|
||||
<ul>
|
||||
<li>
|
||||
Turn it <strong>off</strong> then turn it
|
||||
<strong>on</strong> again
|
||||
</li>
|
||||
<li>Re-set the time and message</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</HelpDetails>
|
||||
|
||||
<HelpDetails title="If it still doesn’t work">
|
||||
<ul>
|
||||
<li>
|
||||
Ensure you’re on the latest {{ AppString.APP_NAME }} app version.
|
||||
</li>
|
||||
<li>
|
||||
If you denied permission earlier, re-enable notifications in
|
||||
system settings (above).
|
||||
</li>
|
||||
<li>
|
||||
Try the <strong>Use 10-minute rollover (testing)</strong> option
|
||||
at the bottom of this screen to confirm that notifications are
|
||||
firing on your device.
|
||||
</li>
|
||||
<li>
|
||||
As a last resort, uninstall/reinstall the app (you’ll need to
|
||||
enable notifications again and reconfigure the daily reminder).
|
||||
<strong>Important:</strong> Before uninstalling, back up your
|
||||
identifier seed so you can import it back later:
|
||||
<strong>Profile → Data Management → Backup Identifier Seed</strong
|
||||
>.
|
||||
</li>
|
||||
</ul>
|
||||
</HelpDetails>
|
||||
</div>
|
||||
|
||||
<!-- Fast rollover testing -->
|
||||
@@ -232,9 +225,11 @@
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Capacitor } from "@capacitor/core";
|
||||
import { getDailyReminder } from "@/services/notifications/deviceNotifications";
|
||||
|
||||
import HelpDetails from "../components/HelpDetails.vue";
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
import { AppString, NotificationIface } from "../constants/app";
|
||||
import { PlatformServiceMixin } from "../utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "../utils/notify";
|
||||
import { NotificationService } from "@/services/notifications";
|
||||
@@ -242,13 +237,18 @@ import { Router } from "vue-router";
|
||||
import { logger } from "../utils/logger";
|
||||
|
||||
@Component({
|
||||
components: { QuickNav },
|
||||
components: { HelpDetails, QuickNav },
|
||||
mixins: [PlatformServiceMixin],
|
||||
})
|
||||
export default class HelpNotificationsView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
$router!: Router;
|
||||
|
||||
/** For the template, which names the app as the phone's settings list it */
|
||||
get AppString() {
|
||||
return AppString;
|
||||
}
|
||||
|
||||
apiServer: string = "";
|
||||
notifyingReminder = false;
|
||||
notifyingReminderMessage = "";
|
||||
@@ -257,6 +257,11 @@ export default class HelpNotificationsView extends Vue {
|
||||
isIOS = false;
|
||||
isAndroid = false;
|
||||
|
||||
/** The troubleshooting sections, this phone's platform first */
|
||||
get platformOrder(): Array<"ios" | "android"> {
|
||||
return this.isAndroid ? ["android", "ios"] : ["ios", "android"];
|
||||
}
|
||||
|
||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||
|
||||
async mounted() {
|
||||
@@ -271,6 +276,13 @@ export default class HelpNotificationsView extends Vue {
|
||||
this.notifyingReminder = !!settings.notifyingReminderTime;
|
||||
this.notifyingReminderMessage = settings.notifyingReminderMessage || "";
|
||||
this.notifyingReminderTime = settings.notifyingReminderTime || "";
|
||||
if (Capacitor.isNativePlatform()) {
|
||||
// the phone's reminder, whichever identity set it
|
||||
const reminder = await getDailyReminder();
|
||||
this.notifyingReminder = !!reminder;
|
||||
this.notifyingReminderMessage = reminder?.message || "";
|
||||
this.notifyingReminderTime = reminder?.time || "";
|
||||
}
|
||||
this.reminderFastRolloverForTesting =
|
||||
!!settings.reminderFastRolloverForTesting;
|
||||
} catch (error) {
|
||||
@@ -346,9 +358,3 @@ export default class HelpNotificationsView extends Vue {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.prose-details[open] .details-chevron {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -379,12 +379,12 @@
|
||||
</li>
|
||||
<li class="list-disc list-outside ml-4">
|
||||
Firefox: Navigate to "about:preferences", Manage Data,
|
||||
find timesafari.app and select, hit Remove Selected, then Save
|
||||
find giftopia.me and select, hit Remove Selected, then Save
|
||||
Changes
|
||||
</li>
|
||||
<li class="list-disc list-outside ml-4">
|
||||
Safari: Settings -> Privacy -> Manage Website Data, search for
|
||||
timesafari.app and select, hit Remove Selected, then Done.
|
||||
giftopia.me and select, hit Remove Selected, then Done.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -447,7 +447,7 @@
|
||||
For PWAs, drag down on the screen to refresh it; do that multiple times, because
|
||||
it sometimes takes multiple tries for the app to refresh to the latest version.
|
||||
You can see the version information at the bottom of this page; the best
|
||||
way to determine the latest version is to open TimeSafari.app in an incognito/private
|
||||
way to determine the latest version is to open giftopia.me in an incognito/private
|
||||
browser window and look at the version there.
|
||||
</li>
|
||||
<li>
|
||||
@@ -466,11 +466,11 @@
|
||||
<li>
|
||||
In Chrome, open a tab to
|
||||
"chrome://serviceworker-internals",
|
||||
find "timesafari.app", and click "Unregister".</li>
|
||||
find "giftopia.me", and click "Unregister".</li>
|
||||
<li>
|
||||
In Firefox,
|
||||
open a tab to "about:serviceworkers",
|
||||
find "timesafari.app", and click "Unregister".
|
||||
find "giftopia.me", and click "Unregister".
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://duckduckgo.com/?q=unregister+service+worker" target="_blank" class="text-blue-500">Search</a>
|
||||
@@ -519,7 +519,7 @@
|
||||
<p>
|
||||
This is part of the
|
||||
<a href="https://livesofimpact.org" target="_blank" class="text-blue-500">
|
||||
Lives of Impact
|
||||
Gift Economies
|
||||
</a>
|
||||
initiative.
|
||||
</p>
|
||||
|
||||
@@ -238,6 +238,7 @@ import {
|
||||
import { retrieveAccountDids } from "../libs/util";
|
||||
import { refreshNudge } from "../utils/onboardingNudge";
|
||||
import { logger } from "../utils/logger";
|
||||
import { ownsDeviceNewActivity } from "../services/notifications/deviceNotifications";
|
||||
import { PlatformServiceMixin } from "../utils/PlatformServiceMixin";
|
||||
|
||||
/** Fewer nearby results than this, and a second search fills "Farther away". */
|
||||
@@ -464,7 +465,8 @@ export default class InterestMatchesView extends Vue {
|
||||
const isRegistered = !!settings.isRegistered;
|
||||
const alertsOn =
|
||||
!!settings.notifyingNewActivityTime ||
|
||||
!!settings.notifyingNewActivitySmsTime;
|
||||
!!settings.notifyingNewActivitySmsTime ||
|
||||
(await ownsDeviceNewActivity(this.activeDid));
|
||||
const appOffersAlerts = offersAlerts(this.capabilities);
|
||||
const profileSaved =
|
||||
isRegistered &&
|
||||
|
||||
@@ -1563,9 +1563,8 @@ export default class ProjectViewView extends Vue {
|
||||
);
|
||||
if (result) {
|
||||
this.isStarred = true;
|
||||
if (settings.notifyingNewActivityTime) {
|
||||
void syncStarredPlansToNativePlugin(newStarredIds);
|
||||
}
|
||||
// a no-op unless this identity owns the on-device schedule
|
||||
void syncStarredPlansToNativePlugin(newStarredIds);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
logger.error("Got a bad result from SQL update to star a project.");
|
||||
@@ -1588,9 +1587,7 @@ export default class ProjectViewView extends Vue {
|
||||
);
|
||||
if (result) {
|
||||
this.isStarred = false;
|
||||
if (settings.notifyingNewActivityTime) {
|
||||
void syncStarredPlansToNativePlugin(updatedIds);
|
||||
}
|
||||
void syncStarredPlansToNativePlugin(updatedIds);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
logger.error("Got a bad result from SQL update to unstar a project.");
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
recent version of this app, or that the app has not refreshed the
|
||||
service code underneath. To fix this, first make sure you have latest
|
||||
version by comparing your version at the bottom of "Help" with the
|
||||
version at the bottom of https://timesafari.app/help in a browser. After
|
||||
version at the bottom of https://giftopia.me/help in a browser. After
|
||||
that, it may eventually work, but you can speed up the process by
|
||||
clearing your data cache (in the browser on mobile, even if you
|
||||
installed it) and/or reinstalling the app (after backing up all your
|
||||
|
||||
Reference in New Issue
Block a user