Compare commits
22 Commits
entity-sel
...
refactor-i
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ca2c1d4b3 | |||
|
|
cb8d8bed4c | ||
|
|
11658140ae | ||
|
|
85a64b06d7 | ||
|
|
72e23a9109 | ||
|
|
ceaf4ede11 | ||
|
|
523f88fd0d | ||
|
|
ee57fe9ea6 | ||
| 5050156beb | |||
|
|
471bdd6b92 | ||
|
|
c26b8daaf7 | ||
|
|
16db790c5f | ||
|
|
59434ff5f7 | ||
|
|
239666e137 | ||
| d265a9f78c | |||
| f848de15f1 | |||
| ebaf2dedf0 | |||
|
|
749204f96b | ||
| 1053bb6e4c | |||
| 88f46787e5 | |||
|
|
c06ffec466 | ||
|
|
8b199ec76c |
60
BUILDING.md
60
BUILDING.md
@@ -1151,28 +1151,31 @@ If you need to build manually or want to understand the individual steps:
|
|||||||
|
|
||||||
- ... and you may have to fix these, especially with pkgx:
|
- ... and you may have to fix these, especially with pkgx:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gem_path=$(which gem)
|
gem_path=$(which gem)
|
||||||
shortened_path="${gem_path:h:h}"
|
shortened_path="${gem_path:h:h}"
|
||||||
export GEM_HOME=$shortened_path
|
export GEM_HOME=$shortened_path
|
||||||
export GEM_PATH=$shortened_path
|
export GEM_PATH=$shortened_path
|
||||||
```
|
|
||||||
|
cd ios/App
|
||||||
|
pod install
|
||||||
|
```
|
||||||
|
|
||||||
##### 1. Bump the version in package.json for `MARKETING_VERSION`, then `grep CURRENT_PROJECT_VERSION ios/App/App.xcodeproj/project.pbxproj` and add 1 for the numbered version;
|
##### 1. Bump the version in package.json for `MARKETING_VERSION`, then `grep CURRENT_PROJECT_VERSION ios/App/App.xcodeproj/project.pbxproj` and add 1 for the numbered version;
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ios/App && xcrun agvtool new-version 46 && perl -p -i -e "s/MARKETING_VERSION = .*;/MARKETING_VERSION = 1.1.1;/g" App.xcodeproj/project.pbxproj && cd -
|
cd ios/App && xcrun agvtool new-version 47 && perl -p -i -e "s/MARKETING_VERSION = .*;/MARKETING_VERSION = 1.1.2;/g" App.xcodeproj/project.pbxproj && cd -
|
||||||
# Unfortunately this edits Info.plist directly.
|
# Unfortunately this edits Info.plist directly.
|
||||||
#xcrun agvtool new-marketing-version 0.4.5
|
#xcrun agvtool new-marketing-version 0.4.5
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 2. Build
|
##### 2. Build
|
||||||
|
|
||||||
Here's prod. Also available: test, dev
|
Here's prod. Also available: test, dev
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build:ios:prod
|
npm run build:ios:prod
|
||||||
```
|
```
|
||||||
|
|
||||||
3.1. Use Xcode to build and run on simulator or device.
|
3.1. Use Xcode to build and run on simulator or device.
|
||||||
|
|
||||||
@@ -1197,7 +1200,8 @@ If you need to build manually or want to understand the individual steps:
|
|||||||
- It can take 15 minutes for the build to show up in the list of builds.
|
- It can take 15 minutes for the build to show up in the list of builds.
|
||||||
- You'll probably have to "Manage" something about encryption, disallowed in France.
|
- You'll probably have to "Manage" something about encryption, disallowed in France.
|
||||||
- Then "Save" and "Add to Review" and "Resubmit to App Review".
|
- Then "Save" and "Add to Review" and "Resubmit to App Review".
|
||||||
- Eventually it'll be "Ready for Distribution" which means
|
- Eventually it'll be "Ready for Distribution" which means it's live
|
||||||
|
- When finished, bump package.json version
|
||||||
|
|
||||||
### Android Build
|
### Android Build
|
||||||
|
|
||||||
@@ -1315,26 +1319,26 @@ The recommended way to build for Android is using the automated build script:
|
|||||||
|
|
||||||
#### Android Manual Build Process
|
#### Android Manual Build Process
|
||||||
|
|
||||||
##### 1. Bump the version in package.json, then here: android/app/build.gradle
|
##### 1. Bump the version in package.json, then update these versions & run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
perl -p -i -e 's/versionCode .*/versionCode 46/g' android/app/build.gradle
|
perl -p -i -e 's/versionCode .*/versionCode 47/g' android/app/build.gradle
|
||||||
perl -p -i -e 's/versionName .*/versionName "1.1.1"/g' android/app/build.gradle
|
perl -p -i -e 's/versionName .*/versionName "1.1.2"/g' android/app/build.gradle
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 2. Build
|
##### 2. Build
|
||||||
|
|
||||||
Here's prod. Also available: test, dev
|
Here's prod. Also available: test, dev
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build:android:prod
|
npm run build:android:prod
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 3. Open the project in Android Studio
|
##### 3. Open the project in Android Studio
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx cap open android
|
npx cap open android
|
||||||
```
|
```
|
||||||
|
|
||||||
##### 4. Use Android Studio to build and run on emulator or device
|
##### 4. Use Android Studio to build and run on emulator or device
|
||||||
|
|
||||||
@@ -1379,6 +1383,8 @@ At play.google.com/console:
|
|||||||
- Note that if you add testers, you have to go to "Publishing Overview" and send
|
- Note that if you add testers, you have to go to "Publishing Overview" and send
|
||||||
those changes or your (closed) testers won't see it.
|
those changes or your (closed) testers won't see it.
|
||||||
|
|
||||||
|
- When finished, bump package.json version
|
||||||
|
|
||||||
### Capacitor Operations
|
### Capacitor Operations
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ 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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
|
||||||
|
## [1.1.2] - 2025.11.06
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Bad page when user follows prompt to backup seed
|
||||||
|
|
||||||
|
|
||||||
## [1.1.1] - 2025.11.03
|
## [1.1.1] - 2025.11.03
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ android {
|
|||||||
applicationId "app.timesafari.app"
|
applicationId "app.timesafari.app"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 46
|
versionCode 48
|
||||||
versionName "1.1.1"
|
versionName "1.1.3-beta"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||||
|
|||||||
@@ -403,7 +403,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 46;
|
CURRENT_PROJECT_VERSION = 47;
|
||||||
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||||
ENABLE_APP_SANDBOX = NO;
|
ENABLE_APP_SANDBOX = NO;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
@@ -413,7 +413,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1.1;
|
MARKETING_VERSION = 1.1.2;
|
||||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari;
|
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -430,7 +430,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 46;
|
CURRENT_PROJECT_VERSION = 47;
|
||||||
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||||
ENABLE_APP_SANDBOX = NO;
|
ENABLE_APP_SANDBOX = NO;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
@@ -440,7 +440,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.1.1;
|
MARKETING_VERSION = 1.1.2;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari;
|
PRODUCT_BUNDLE_IDENTIFIER = app.timesafari;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "timesafari",
|
"name": "timesafari",
|
||||||
"version": "1.1.2-beta",
|
"version": "1.1.3-beta",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "timesafari",
|
"name": "timesafari",
|
||||||
"version": "1.1.2-beta",
|
"version": "1.1.3-beta",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor-community/electron": "^5.0.1",
|
"@capacitor-community/electron": "^5.0.1",
|
||||||
"@capacitor-community/sqlite": "6.0.2",
|
"@capacitor-community/sqlite": "6.0.2",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "timesafari",
|
"name": "timesafari",
|
||||||
"version": "1.1.2-beta",
|
"version": "1.1.3-beta",
|
||||||
"description": "Time Safari Application",
|
"description": "Time Safari Application",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Time Safari Team"
|
"name": "Time Safari Team"
|
||||||
|
|||||||
@@ -436,7 +436,21 @@ fi
|
|||||||
log_info "Cleaning dist directory..."
|
log_info "Cleaning dist directory..."
|
||||||
clean_build_artifacts "dist"
|
clean_build_artifacts "dist"
|
||||||
|
|
||||||
# Step 4: Build Capacitor version with mode
|
# Step 4: Run TypeScript type checking for test and production builds
|
||||||
|
if [ "$BUILD_MODE" = "production" ] || [ "$BUILD_MODE" = "test" ]; then
|
||||||
|
log_info "Running TypeScript type checking for $BUILD_MODE mode..."
|
||||||
|
|
||||||
|
if ! measure_time npm run type-check; then
|
||||||
|
log_error "TypeScript type checking failed for $BUILD_MODE mode!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_success "TypeScript type checking completed for $BUILD_MODE mode"
|
||||||
|
else
|
||||||
|
log_debug "Skipping TypeScript type checking for development mode"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 5: Build Capacitor version with mode
|
||||||
if [ "$BUILD_MODE" = "development" ]; then
|
if [ "$BUILD_MODE" = "development" ]; then
|
||||||
safe_execute "Building Capacitor version (development)" "npm run build:capacitor" || exit 3
|
safe_execute "Building Capacitor version (development)" "npm run build:capacitor" || exit 3
|
||||||
elif [ "$BUILD_MODE" = "test" ]; then
|
elif [ "$BUILD_MODE" = "test" ]; then
|
||||||
@@ -445,23 +459,23 @@ elif [ "$BUILD_MODE" = "production" ]; then
|
|||||||
safe_execute "Building Capacitor version (production)" "npm run build:capacitor -- --mode production" || exit 3
|
safe_execute "Building Capacitor version (production)" "npm run build:capacitor -- --mode production" || exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 5: Clean Gradle build
|
# Step 6: Clean Gradle build
|
||||||
safe_execute "Cleaning Gradle build" "cd android && ./gradlew clean && cd .." || exit 4
|
safe_execute "Cleaning Gradle build" "cd android && ./gradlew clean && cd .." || exit 4
|
||||||
|
|
||||||
# Step 6: Build based on type
|
# Step 7: Build based on type
|
||||||
if [ "$BUILD_TYPE" = "debug" ]; then
|
if [ "$BUILD_TYPE" = "debug" ]; then
|
||||||
safe_execute "Assembling debug build" "cd android && ./gradlew assembleDebug && cd .." || exit 5
|
safe_execute "Assembling debug build" "cd android && ./gradlew assembleDebug && cd .." || exit 5
|
||||||
elif [ "$BUILD_TYPE" = "release" ]; then
|
elif [ "$BUILD_TYPE" = "release" ]; then
|
||||||
safe_execute "Assembling release build" "cd android && ./gradlew assembleRelease && cd .." || exit 5
|
safe_execute "Assembling release build" "cd android && ./gradlew assembleRelease && cd .." || exit 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 7: Sync with Capacitor
|
# Step 8: Sync with Capacitor
|
||||||
safe_execute "Syncing with Capacitor" "npx cap sync android" || exit 6
|
safe_execute "Syncing with Capacitor" "npx cap sync android" || exit 6
|
||||||
|
|
||||||
# Step 8: Generate assets
|
# Step 9: Generate assets
|
||||||
safe_execute "Generating assets" "npx capacitor-assets generate --android" || exit 7
|
safe_execute "Generating assets" "npx capacitor-assets generate --android" || exit 7
|
||||||
|
|
||||||
# Step 9: Build APK/AAB if requested
|
# Step 10: Build APK/AAB if requested
|
||||||
if [ "$BUILD_APK" = true ]; then
|
if [ "$BUILD_APK" = true ]; then
|
||||||
if [ "$BUILD_TYPE" = "debug" ]; then
|
if [ "$BUILD_TYPE" = "debug" ]; then
|
||||||
safe_execute "Building debug APK" "cd android && ./gradlew assembleDebug && cd .." || exit 5
|
safe_execute "Building debug APK" "cd android && ./gradlew assembleDebug && cd .." || exit 5
|
||||||
@@ -474,7 +488,7 @@ if [ "$BUILD_AAB" = true ]; then
|
|||||||
safe_execute "Building AAB" "cd android && ./gradlew bundleRelease && cd .." || exit 5
|
safe_execute "Building AAB" "cd android && ./gradlew bundleRelease && cd .." || exit 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 10: Auto-run app if requested
|
# Step 11: Auto-run app if requested
|
||||||
if [ "$AUTO_RUN" = true ]; then
|
if [ "$AUTO_RUN" = true ]; then
|
||||||
log_step "Auto-running Android app..."
|
log_step "Auto-running Android app..."
|
||||||
safe_execute "Launching app" "npx cap run android" || {
|
safe_execute "Launching app" "npx cap run android" || {
|
||||||
@@ -485,7 +499,7 @@ if [ "$AUTO_RUN" = true ]; then
|
|||||||
log_success "Android app launched successfully!"
|
log_success "Android app launched successfully!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 11: Open Android Studio if requested
|
# Step 12: Open Android Studio if requested
|
||||||
if [ "$OPEN_STUDIO" = true ]; then
|
if [ "$OPEN_STUDIO" = true ]; then
|
||||||
safe_execute "Opening Android Studio" "npx cap open android" || exit 8
|
safe_execute "Opening Android Studio" "npx cap open android" || exit 8
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -381,7 +381,21 @@ safe_execute "Cleaning iOS build" "clean_ios_build" || exit 1
|
|||||||
log_info "Cleaning dist directory..."
|
log_info "Cleaning dist directory..."
|
||||||
clean_build_artifacts "dist"
|
clean_build_artifacts "dist"
|
||||||
|
|
||||||
# Step 4: Build Capacitor version with mode
|
# Step 4: Run TypeScript type checking for test and production builds
|
||||||
|
if [ "$BUILD_MODE" = "production" ] || [ "$BUILD_MODE" = "test" ]; then
|
||||||
|
log_info "Running TypeScript type checking for $BUILD_MODE mode..."
|
||||||
|
|
||||||
|
if ! measure_time npm run type-check; then
|
||||||
|
log_error "TypeScript type checking failed for $BUILD_MODE mode!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
log_success "TypeScript type checking completed for $BUILD_MODE mode"
|
||||||
|
else
|
||||||
|
log_debug "Skipping TypeScript type checking for development mode"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Step 5: Build Capacitor version with mode
|
||||||
if [ "$BUILD_MODE" = "development" ]; then
|
if [ "$BUILD_MODE" = "development" ]; then
|
||||||
safe_execute "Building Capacitor version (development)" "npm run build:capacitor" || exit 3
|
safe_execute "Building Capacitor version (development)" "npm run build:capacitor" || exit 3
|
||||||
elif [ "$BUILD_MODE" = "test" ]; then
|
elif [ "$BUILD_MODE" = "test" ]; then
|
||||||
@@ -390,16 +404,16 @@ elif [ "$BUILD_MODE" = "production" ]; then
|
|||||||
safe_execute "Building Capacitor version (production)" "npm run build:capacitor -- --mode production" || exit 3
|
safe_execute "Building Capacitor version (production)" "npm run build:capacitor -- --mode production" || exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 5: Sync with Capacitor
|
# Step 6: Sync with Capacitor
|
||||||
safe_execute "Syncing with Capacitor" "npx cap sync ios" || exit 6
|
safe_execute "Syncing with Capacitor" "npx cap sync ios" || exit 6
|
||||||
|
|
||||||
# Step 6: Generate assets
|
# Step 7: Generate assets
|
||||||
safe_execute "Generating assets" "npx capacitor-assets generate --ios" || exit 7
|
safe_execute "Generating assets" "npx capacitor-assets generate --ios" || exit 7
|
||||||
|
|
||||||
# Step 7: Build iOS app
|
# Step 8: Build iOS app
|
||||||
safe_execute "Building iOS app" "build_ios_app" || exit 5
|
safe_execute "Building iOS app" "build_ios_app" || exit 5
|
||||||
|
|
||||||
# Step 8: Build IPA/App if requested
|
# Step 9: Build IPA/App if requested
|
||||||
if [ "$BUILD_IPA" = true ]; then
|
if [ "$BUILD_IPA" = true ]; then
|
||||||
log_info "Building IPA package..."
|
log_info "Building IPA package..."
|
||||||
cd ios/App
|
cd ios/App
|
||||||
@@ -426,12 +440,12 @@ if [ "$BUILD_APP" = true ]; then
|
|||||||
log_success "App bundle built successfully"
|
log_success "App bundle built successfully"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 9: Auto-run app if requested
|
# Step 10: Auto-run app if requested
|
||||||
if [ "$AUTO_RUN" = true ]; then
|
if [ "$AUTO_RUN" = true ]; then
|
||||||
safe_execute "Auto-running iOS app" "auto_run_ios_app" || exit 9
|
safe_execute "Auto-running iOS app" "auto_run_ios_app" || exit 9
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 10: Open Xcode if requested
|
# Step 11: Open Xcode if requested
|
||||||
if [ "$OPEN_STUDIO" = true ]; then
|
if [ "$OPEN_STUDIO" = true ]; then
|
||||||
safe_execute "Opening Xcode" "npx cap open ios" || exit 8
|
safe_execute "Opening Xcode" "npx cap open ios" || exit 8
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
? 'bg-blue-600 text-white cursor-pointer'
|
? 'bg-blue-600 text-white cursor-pointer'
|
||||||
: 'bg-slate-400 text-slate-200 cursor-not-allowed',
|
: 'bg-slate-400 text-slate-200 cursor-not-allowed',
|
||||||
]"
|
]"
|
||||||
@click="handleMainAction"
|
@click="processSelectedMembers"
|
||||||
>
|
>
|
||||||
{{ buttonText }}
|
{{ buttonText }}
|
||||||
</button>
|
</button>
|
||||||
@@ -145,7 +145,7 @@ import { Contact } from "@/db/tables/contacts";
|
|||||||
export default class BulkMembersDialog extends Vue {
|
export default class BulkMembersDialog extends Vue {
|
||||||
@Prop({ default: "" }) activeDid!: string;
|
@Prop({ default: "" }) activeDid!: string;
|
||||||
@Prop({ default: "" }) apiServer!: string;
|
@Prop({ default: "" }) apiServer!: string;
|
||||||
@Prop({ required: true }) dialogType!: "admit" | "visibility";
|
// isOrganizer: true = organizer mode (admit members), false = member mode (set visibility)
|
||||||
@Prop({ required: true }) isOrganizer!: boolean;
|
@Prop({ required: true }) isOrganizer!: boolean;
|
||||||
|
|
||||||
// Vue notification system
|
// Vue notification system
|
||||||
@@ -252,15 +252,7 @@ export default class BulkMembersDialog extends Vue {
|
|||||||
return this.selectedMembers.includes(memberDid);
|
return this.selectedMembers.includes(memberDid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async handleMainAction() {
|
async processSelectedMembers() {
|
||||||
if (this.dialogType === "admit") {
|
|
||||||
await this.organizerAdmitAndAddWithVisibility();
|
|
||||||
} else {
|
|
||||||
await this.memberAddContactWithVisibility();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async organizerAdmitAndAddWithVisibility() {
|
|
||||||
try {
|
try {
|
||||||
const selectedMembers: MemberData[] = this.membersData.filter((member) =>
|
const selectedMembers: MemberData[] = this.membersData.filter((member) =>
|
||||||
this.selectedMembers.includes(member.did),
|
this.selectedMembers.includes(member.did),
|
||||||
@@ -275,16 +267,20 @@ export default class BulkMembersDialog extends Vue {
|
|||||||
|
|
||||||
for (const member of selectedMembers) {
|
for (const member of selectedMembers) {
|
||||||
try {
|
try {
|
||||||
// First, admit the member
|
// Organizer mode: admit and register the member first
|
||||||
|
if (this.isOrganizer) {
|
||||||
await this.admitMember(member);
|
await this.admitMember(member);
|
||||||
|
|
||||||
// Register them
|
|
||||||
await this.registerMember(member);
|
await this.registerMember(member);
|
||||||
admittedCount++;
|
admittedCount++;
|
||||||
|
}
|
||||||
|
|
||||||
// If they're not a contact yet, add them as a contact
|
// If they're not a contact yet, add them as a contact
|
||||||
if (!member.isContact) {
|
if (!member.isContact) {
|
||||||
await this.addAsContact(member, true);
|
// Organizer mode: set isRegistered to true, member mode: undefined
|
||||||
|
await this.addAsContact(
|
||||||
|
member,
|
||||||
|
this.isOrganizer ? true : undefined,
|
||||||
|
);
|
||||||
contactAddedCount++;
|
contactAddedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,6 +295,7 @@ export default class BulkMembersDialog extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show success notification
|
// Show success notification
|
||||||
|
if (this.isOrganizer) {
|
||||||
if (admittedCount > 0) {
|
if (admittedCount > 0) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
@@ -307,7 +304,7 @@ export default class BulkMembersDialog extends Vue {
|
|||||||
title: "Members Admitted Successfully",
|
title: "Members Admitted Successfully",
|
||||||
text: `${admittedCount} member${admittedCount === 1 ? "" : "s"} admitted and registered${contactAddedCount === 0 ? "" : admittedCount === contactAddedCount ? " and" : `, ${contactAddedCount}`}${contactAddedCount === 0 ? "" : ` added as contact${contactAddedCount === 1 ? "" : "s"}`}.`,
|
text: `${admittedCount} member${admittedCount === 1 ? "" : "s"} admitted and registered${contactAddedCount === 0 ? "" : admittedCount === contactAddedCount ? " and" : `, ${contactAddedCount}`}${contactAddedCount === 0 ? "" : ` added as contact${contactAddedCount === 1 ? "" : "s"}`}.`,
|
||||||
},
|
},
|
||||||
10000,
|
5000,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (errors > 0) {
|
if (errors > 0) {
|
||||||
@@ -321,66 +318,28 @@ export default class BulkMembersDialog extends Vue {
|
|||||||
5000,
|
5000,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
this.close(notSelectedMembers.map((member) => member.did));
|
// Member mode: show contacts added notification
|
||||||
} catch (error) {
|
if (contactAddedCount > 0) {
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.error("Error admitting members:", error);
|
|
||||||
this.$notify(
|
|
||||||
{
|
|
||||||
group: "alert",
|
|
||||||
type: "danger",
|
|
||||||
title: "Error",
|
|
||||||
text: "Some errors occurred. Work with members individually below.",
|
|
||||||
},
|
|
||||||
5000,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async memberAddContactWithVisibility() {
|
|
||||||
try {
|
|
||||||
const selectedMembers: MemberData[] = this.membersData.filter((member) =>
|
|
||||||
this.selectedMembers.includes(member.did),
|
|
||||||
);
|
|
||||||
const notSelectedMembers: MemberData[] = this.membersData.filter(
|
|
||||||
(member) => !this.selectedMembers.includes(member.did),
|
|
||||||
);
|
|
||||||
|
|
||||||
let contactsAddedCount = 0;
|
|
||||||
|
|
||||||
for (const member of selectedMembers) {
|
|
||||||
try {
|
|
||||||
// If they're not a contact yet, add them as a contact first
|
|
||||||
if (!member.isContact) {
|
|
||||||
await this.addAsContact(member, undefined);
|
|
||||||
contactsAddedCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set their seesMe to true
|
|
||||||
await this.updateContactVisibility(member.did, true);
|
|
||||||
} catch (error) {
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.error(`Error processing member ${member.did}:`, error);
|
|
||||||
// Continue with other members even if one fails
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show success notification
|
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
type: "success",
|
type: "success",
|
||||||
title: "Contacts Added Successfully",
|
title: "Contacts Added Successfully",
|
||||||
text: `${contactsAddedCount} member${contactsAddedCount === 1 ? "" : "s"} added as contact${contactsAddedCount === 1 ? "" : "s"}.`,
|
text: `${contactAddedCount} member${contactAddedCount === 1 ? "" : "s"} added as contact${contactAddedCount === 1 ? "" : "s"}.`,
|
||||||
},
|
},
|
||||||
5000,
|
5000,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.close(notSelectedMembers.map((member) => member.did));
|
this.close(notSelectedMembers.map((member) => member.did));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error("Error adding contacts:", error);
|
console.error(
|
||||||
|
`Error ${this.isOrganizer ? "admitting members" : "adding contacts"}:`,
|
||||||
|
error,
|
||||||
|
);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
@@ -487,8 +446,8 @@ export default class BulkMembersDialog extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showContactInfo() {
|
showContactInfo() {
|
||||||
const message =
|
// isOrganizer: true = admit mode, false = visibility mode
|
||||||
this.dialogType === "admit"
|
const message = this.isOrganizer
|
||||||
? "This user is already your contact, but they are not yet admitted to the meeting."
|
? "This user is already your contact, but they are not yet admitted to the meeting."
|
||||||
: "This user is already your contact, but your activities are not visible to them yet.";
|
: "This user is already your contact, but your activities are not visible to them yet.";
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,6 @@
|
|||||||
ref="bulkMembersDialog"
|
ref="bulkMembersDialog"
|
||||||
:active-did="activeDid"
|
:active-did="activeDid"
|
||||||
:api-server="apiServer"
|
:api-server="apiServer"
|
||||||
:dialog-type="isOrganizer ? 'admit' : 'visibility'"
|
|
||||||
:is-organizer="isOrganizer"
|
:is-organizer="isOrganizer"
|
||||||
@close="closeBulkMembersDialogCallback"
|
@close="closeBulkMembersDialogCallback"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1686,7 +1686,10 @@ export async function register(
|
|||||||
"Registration thrown error:",
|
"Registration thrown error:",
|
||||||
errorMessage || JSON.stringify(err),
|
errorMessage || JSON.stringify(err),
|
||||||
);
|
);
|
||||||
return { error: errorMessage || "Got a server error when registering." };
|
return {
|
||||||
|
error:
|
||||||
|
(errorMessage as string) || "Got a server error when registering.",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return { error: "Got a server error when registering." };
|
return { error: "Got a server error when registering." };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,8 @@ import IndexedDBBackend from "absurd-sql/dist/indexeddb-backend";
|
|||||||
import { runMigrations } from "../db-sql/migration";
|
import { runMigrations } from "../db-sql/migration";
|
||||||
import type { DatabaseService, QueryExecResult } from "../interfaces/database";
|
import type { DatabaseService, QueryExecResult } from "../interfaces/database";
|
||||||
import { logger } from "@/utils/logger";
|
import { logger } from "@/utils/logger";
|
||||||
|
import { OperationQueue, QueueExecutor } from "./platforms/OperationQueue";
|
||||||
interface QueuedOperation {
|
import { QueuedOperation } from "./platforms/types";
|
||||||
type: "run" | "query";
|
|
||||||
sql: string;
|
|
||||||
params: unknown[];
|
|
||||||
resolve: (value: unknown) => void;
|
|
||||||
reject: (reason: unknown) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AbsurdSqlDatabase {
|
interface AbsurdSqlDatabase {
|
||||||
exec: (sql: string, params?: unknown[]) => Promise<QueryExecResult[]>;
|
exec: (sql: string, params?: unknown[]) => Promise<QueryExecResult[]>;
|
||||||
@@ -43,8 +37,7 @@ class AbsurdSqlDatabaseService implements DatabaseService {
|
|||||||
private db: AbsurdSqlDatabase | null;
|
private db: AbsurdSqlDatabase | null;
|
||||||
private initialized: boolean;
|
private initialized: boolean;
|
||||||
private initializationPromise: Promise<void> | null = null;
|
private initializationPromise: Promise<void> | null = null;
|
||||||
private operationQueue: Array<QueuedOperation> = [];
|
private operationQueue = new OperationQueue<AbsurdSqlDatabase>();
|
||||||
private isProcessingQueue: boolean = false;
|
|
||||||
|
|
||||||
private constructor() {
|
private constructor() {
|
||||||
this.db = null;
|
this.db = null;
|
||||||
@@ -161,42 +154,30 @@ class AbsurdSqlDatabaseService implements DatabaseService {
|
|||||||
this.processQueue();
|
this.processQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create executor adapter for AbsurdSQL API
|
||||||
|
*/
|
||||||
|
private createExecutor(): QueueExecutor<AbsurdSqlDatabase> {
|
||||||
|
return {
|
||||||
|
executeRun: async (db, sql, params) => {
|
||||||
|
return await db.run(sql, params);
|
||||||
|
},
|
||||||
|
executeQuery: async (db, sql, params) => {
|
||||||
|
return await db.exec(sql, params);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private async processQueue(): Promise<void> {
|
private async processQueue(): Promise<void> {
|
||||||
if (this.isProcessingQueue || !this.initialized || !this.db) {
|
if (!this.initialized || !this.db) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isProcessingQueue = true;
|
await this.operationQueue.processQueue(
|
||||||
|
this.db,
|
||||||
while (this.operationQueue.length > 0) {
|
this.createExecutor(),
|
||||||
const operation = this.operationQueue.shift();
|
"AbsurdSqlDatabaseService",
|
||||||
if (!operation) continue;
|
|
||||||
|
|
||||||
try {
|
|
||||||
let result: unknown;
|
|
||||||
switch (operation.type) {
|
|
||||||
case "run":
|
|
||||||
result = await this.db.run(operation.sql, operation.params);
|
|
||||||
break;
|
|
||||||
case "query":
|
|
||||||
result = await this.db.exec(operation.sql, operation.params);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
operation.resolve(result);
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(
|
|
||||||
"Error while processing SQL queue:",
|
|
||||||
error,
|
|
||||||
" ... for sql:",
|
|
||||||
operation.sql,
|
|
||||||
" ... with params:",
|
|
||||||
operation.params,
|
|
||||||
);
|
);
|
||||||
operation.reject(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isProcessingQueue = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async queueOperation<R>(
|
private async queueOperation<R>(
|
||||||
@@ -204,21 +185,24 @@ class AbsurdSqlDatabaseService implements DatabaseService {
|
|||||||
sql: string,
|
sql: string,
|
||||||
params: unknown[] = [],
|
params: unknown[] = [],
|
||||||
): Promise<R> {
|
): Promise<R> {
|
||||||
return new Promise<R>((resolve, reject) => {
|
|
||||||
const operation: QueuedOperation = {
|
const operation: QueuedOperation = {
|
||||||
type,
|
type,
|
||||||
sql,
|
sql,
|
||||||
params,
|
params,
|
||||||
resolve: (value: unknown) => resolve(value as R),
|
resolve: (_value: unknown) => {
|
||||||
reject,
|
// No-op, will be wrapped by OperationQueue
|
||||||
|
},
|
||||||
|
reject: () => {
|
||||||
|
// No-op, will be wrapped by OperationQueue
|
||||||
|
},
|
||||||
};
|
};
|
||||||
this.operationQueue.push(operation);
|
|
||||||
|
|
||||||
// If we're already initialized, start processing the queue
|
return this.operationQueue.queueOperation<R>(
|
||||||
if (this.initialized && this.db) {
|
operation,
|
||||||
this.processQueue();
|
this.initialized,
|
||||||
}
|
this.db,
|
||||||
});
|
() => this.processQueue(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async waitForInitialization(): Promise<void> {
|
private async waitForInitialization(): Promise<void> {
|
||||||
|
|||||||
@@ -4,76 +4,144 @@ import { CapacitorPlatformService } from "./platforms/CapacitorPlatformService";
|
|||||||
import { ElectronPlatformService } from "./platforms/ElectronPlatformService";
|
import { ElectronPlatformService } from "./platforms/ElectronPlatformService";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory class for creating platform-specific service implementations.
|
* HMR-safe global singleton storage for PlatformService
|
||||||
* Implements the Singleton pattern to ensure only one instance of PlatformService exists.
|
|
||||||
*
|
*
|
||||||
* The factory determines which platform implementation to use based on the VITE_PLATFORM
|
* Uses multiple fallbacks to ensure persistence across module reloads:
|
||||||
* environment variable. Supported platforms are:
|
* 1. globalThis (standard, works in most environments)
|
||||||
* - capacitor: Mobile platform using Capacitor
|
* 2. window (browser fallback)
|
||||||
* - electron: Desktop platform using Electron with Capacitor
|
* 3. self (web worker fallback)
|
||||||
* - web: Default web platform (fallback)
|
*/
|
||||||
|
declare global {
|
||||||
|
// eslint-disable-next-line no-var
|
||||||
|
var __PLATFORM_SERVICE_SINGLETON__: PlatformService | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the global object for singleton storage
|
||||||
|
* Uses multiple fallbacks to ensure compatibility
|
||||||
|
*/
|
||||||
|
function getGlobal(): typeof globalThis {
|
||||||
|
if (typeof globalThis !== "undefined") return globalThis;
|
||||||
|
if (typeof window !== "undefined") return window as typeof globalThis;
|
||||||
|
if (typeof self !== "undefined") return self as typeof globalThis;
|
||||||
|
// Fallback for Node.js environments
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
return {} as any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory function to create platform-specific service implementation
|
||||||
|
*
|
||||||
|
* Uses console.log instead of logger to avoid circular dependency
|
||||||
|
* (logger imports PlatformServiceFactory)
|
||||||
|
*/
|
||||||
|
function create(): PlatformService {
|
||||||
|
const which = import.meta.env?.VITE_PLATFORM ?? "web";
|
||||||
|
|
||||||
|
if (which === "capacitor") return new CapacitorPlatformService();
|
||||||
|
if (which === "electron") return new ElectronPlatformService();
|
||||||
|
return new WebPlatformService();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get or create the HMR-safe singleton instance of PlatformService
|
||||||
|
*
|
||||||
|
* Uses lazy initialization to avoid circular dependency issues at module load time.
|
||||||
|
*/
|
||||||
|
function getPlatformSvc(): PlatformService {
|
||||||
|
const global = getGlobal();
|
||||||
|
|
||||||
|
const exists = global.__PLATFORM_SERVICE_SINGLETON__ !== undefined;
|
||||||
|
|
||||||
|
if (!exists) {
|
||||||
|
global.__PLATFORM_SERVICE_SINGLETON__ = create();
|
||||||
|
// Verify it was stored
|
||||||
|
if (!global.__PLATFORM_SERVICE_SINGLETON__) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(
|
||||||
|
"[PlatformServiceFactory] ERROR: Singleton creation failed - storage returned undefined",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type guard: ensure singleton exists (should never be undefined at this point)
|
||||||
|
const singleton = global.__PLATFORM_SERVICE_SINGLETON__;
|
||||||
|
if (!singleton) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(
|
||||||
|
"[PlatformServiceFactory] CRITICAL: Singleton is undefined after creation/retrieval",
|
||||||
|
);
|
||||||
|
// Fallback: create a new one
|
||||||
|
global.__PLATFORM_SERVICE_SINGLETON__ = create();
|
||||||
|
return global.__PLATFORM_SERVICE_SINGLETON__;
|
||||||
|
}
|
||||||
|
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HMR-safe singleton instance of PlatformService
|
||||||
|
*
|
||||||
|
* This is the ONLY way to access PlatformService throughout the application.
|
||||||
|
* Do not create new instances of platform services directly.
|
||||||
|
*
|
||||||
|
* Uses lazy initialization via Proxy to avoid circular dependency issues at module load time.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```typescript
|
* ```typescript
|
||||||
* const platformService = PlatformServiceFactory.getInstance();
|
* import { PlatformSvc } from "./services/PlatformServiceFactory";
|
||||||
* await platformService.takePicture();
|
* await PlatformSvc.takePicture();
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export class PlatformServiceFactory {
|
export const PlatformSvc = new Proxy({} as PlatformService, {
|
||||||
private static instance: PlatformService | null = null;
|
get(_target, prop) {
|
||||||
private static callCount = 0; // Debug counter
|
const svc = getPlatformSvc();
|
||||||
private static creationLogged = false; // Only log creation once
|
const value = (svc as unknown as Record<string, unknown>)[prop as string];
|
||||||
|
// Bind methods to maintain 'this' context
|
||||||
|
if (typeof value === "function") {
|
||||||
|
return value.bind(svc);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Preserve singleton across Vite HMR
|
||||||
|
if (import.meta?.hot) {
|
||||||
|
import.meta.hot.accept(() => {
|
||||||
|
// Don't recreate on HMR - keep existing instance
|
||||||
|
const global = getGlobal();
|
||||||
|
if (!global.__PLATFORM_SERVICE_SINGLETON__) {
|
||||||
|
// Restore singleton if it was lost during HMR
|
||||||
|
global.__PLATFORM_SERVICE_SINGLETON__ = getPlatformSvc();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
import.meta.hot.dispose(() => {
|
||||||
|
// Don't delete - keep the global instance
|
||||||
|
// The singleton will persist in globalThis/window/self
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legacy factory class for backward compatibility
|
||||||
|
* @deprecated Use `PlatformSvc` directly instead
|
||||||
|
*/
|
||||||
|
export class PlatformServiceFactory {
|
||||||
/**
|
/**
|
||||||
* Gets or creates the singleton instance of PlatformService.
|
* Gets the singleton instance of PlatformService.
|
||||||
* Creates the appropriate platform-specific implementation based on environment.
|
* @deprecated Use `PlatformSvc` directly instead
|
||||||
*
|
|
||||||
* @returns {PlatformService} The singleton instance of PlatformService
|
|
||||||
*/
|
*/
|
||||||
public static getInstance(): PlatformService {
|
public static getInstance(): PlatformService {
|
||||||
PlatformServiceFactory.callCount++;
|
return PlatformSvc;
|
||||||
|
|
||||||
if (PlatformServiceFactory.instance) {
|
|
||||||
// Normal case - return existing instance silently
|
|
||||||
return PlatformServiceFactory.instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only log when actually creating the instance
|
|
||||||
const platform = process.env.VITE_PLATFORM || "web";
|
|
||||||
|
|
||||||
if (!PlatformServiceFactory.creationLogged) {
|
|
||||||
// Use console for critical startup message to avoid circular dependency
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(
|
|
||||||
`[PlatformServiceFactory] Creating singleton instance for platform: ${platform}`,
|
|
||||||
);
|
|
||||||
PlatformServiceFactory.creationLogged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (platform) {
|
|
||||||
case "capacitor":
|
|
||||||
PlatformServiceFactory.instance = new CapacitorPlatformService();
|
|
||||||
break;
|
|
||||||
case "electron":
|
|
||||||
// Use a specialized electron service that extends CapacitorPlatformService
|
|
||||||
PlatformServiceFactory.instance = new ElectronPlatformService();
|
|
||||||
break;
|
|
||||||
case "web":
|
|
||||||
default:
|
|
||||||
PlatformServiceFactory.instance = new WebPlatformService();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PlatformServiceFactory.instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug method to check singleton usage stats
|
* Debug method to check singleton usage stats
|
||||||
*/
|
*/
|
||||||
public static getStats(): { callCount: number; instanceExists: boolean } {
|
public static getStats(): { callCount: number; instanceExists: boolean } {
|
||||||
|
const global = getGlobal();
|
||||||
return {
|
return {
|
||||||
callCount: PlatformServiceFactory.callCount,
|
callCount: 0, // Deprecated - no longer tracking
|
||||||
instanceExists: PlatformServiceFactory.instance !== null,
|
instanceExists: global.__PLATFORM_SERVICE_SINGLETON__ !== undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
135
src/services/platforms/OperationQueue.ts
Normal file
135
src/services/platforms/OperationQueue.ts
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/**
|
||||||
|
* Shared operation queue handler for database services
|
||||||
|
*
|
||||||
|
* Provides a reusable queue mechanism for database operations that need to
|
||||||
|
* wait for initialization before execution.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { QueuedOperation } from "./types";
|
||||||
|
import { logger } from "../../utils/logger";
|
||||||
|
|
||||||
|
export interface QueueExecutor<TDb> {
|
||||||
|
executeRun(db: TDb, sql: string, params: unknown[]): Promise<unknown>;
|
||||||
|
executeQuery(db: TDb, sql: string, params: unknown[]): Promise<unknown>;
|
||||||
|
executeRawQuery?(db: TDb, sql: string, params: unknown[]): Promise<unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class OperationQueue<TDb> {
|
||||||
|
private operationQueue: Array<QueuedOperation> = [];
|
||||||
|
private isProcessingQueue: boolean = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process queued operations
|
||||||
|
*/
|
||||||
|
async processQueue(
|
||||||
|
db: TDb,
|
||||||
|
executor: QueueExecutor<TDb>,
|
||||||
|
serviceName: string,
|
||||||
|
): Promise<void> {
|
||||||
|
if (this.isProcessingQueue || !db) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isProcessingQueue = true;
|
||||||
|
|
||||||
|
while (this.operationQueue.length > 0) {
|
||||||
|
const operation = this.operationQueue.shift();
|
||||||
|
if (!operation) continue;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let result: unknown;
|
||||||
|
switch (operation.type) {
|
||||||
|
case "run":
|
||||||
|
result = await executor.executeRun(
|
||||||
|
db,
|
||||||
|
operation.sql,
|
||||||
|
operation.params,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "query":
|
||||||
|
result = await executor.executeQuery(
|
||||||
|
db,
|
||||||
|
operation.sql,
|
||||||
|
operation.params,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "rawQuery":
|
||||||
|
if (executor.executeRawQuery) {
|
||||||
|
result = await executor.executeRawQuery(
|
||||||
|
db,
|
||||||
|
operation.sql,
|
||||||
|
operation.params,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Fallback to query if rawQuery not supported
|
||||||
|
result = await executor.executeQuery(
|
||||||
|
db,
|
||||||
|
operation.sql,
|
||||||
|
operation.params,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
operation.resolve(result);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(
|
||||||
|
`[${serviceName}] Error while processing SQL queue:`,
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
logger.error(
|
||||||
|
`[${serviceName}] Failed operation - Type: ${operation.type}, SQL: ${operation.sql}`,
|
||||||
|
);
|
||||||
|
logger.error(
|
||||||
|
`[${serviceName}] Failed operation - Params:`,
|
||||||
|
operation.params,
|
||||||
|
);
|
||||||
|
operation.reject(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isProcessingQueue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Queue an operation for later execution
|
||||||
|
*
|
||||||
|
* @param operation - Pre-constructed operation object (allows platform-specific parameter conversion)
|
||||||
|
* @param initialized - Whether the database is initialized
|
||||||
|
* @param db - Database connection (if available)
|
||||||
|
* @param onQueue - Callback to trigger queue processing
|
||||||
|
*/
|
||||||
|
queueOperation<R>(
|
||||||
|
operation: QueuedOperation,
|
||||||
|
initialized: boolean,
|
||||||
|
db: TDb | null,
|
||||||
|
onQueue: () => void,
|
||||||
|
): Promise<R> {
|
||||||
|
return new Promise<R>((resolve, reject) => {
|
||||||
|
// Wrap the operation's resolve/reject to match our Promise
|
||||||
|
const wrappedOperation: QueuedOperation = {
|
||||||
|
...operation,
|
||||||
|
resolve: (value: unknown) => {
|
||||||
|
operation.resolve(value);
|
||||||
|
resolve(value as R);
|
||||||
|
},
|
||||||
|
reject: (reason: unknown) => {
|
||||||
|
operation.reject(reason);
|
||||||
|
reject(reason);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
this.operationQueue.push(wrappedOperation);
|
||||||
|
|
||||||
|
// If already initialized, trigger queue processing
|
||||||
|
if (initialized && db) {
|
||||||
|
onQueue();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current queue length (for debugging)
|
||||||
|
*/
|
||||||
|
getQueueLength(): number {
|
||||||
|
return this.operationQueue.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
20
src/services/platforms/sqlite.ts
Normal file
20
src/services/platforms/sqlite.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Shared SQLite connection manager for Capacitor platform
|
||||||
|
*
|
||||||
|
* Ensures only one SQLiteConnection instance exists across the application,
|
||||||
|
* preventing connection desync issues and unnecessary connection recreation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { CapacitorSQLite, SQLiteConnection } from "@capacitor-community/sqlite";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Native Capacitor SQLite plugin instance
|
||||||
|
* This is the bridge to the native SQLite implementation
|
||||||
|
*/
|
||||||
|
export const CAP_SQLITE = CapacitorSQLite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shared SQLite connection manager
|
||||||
|
* Use this instance throughout the application - do not create new SQLiteConnection instances
|
||||||
|
*/
|
||||||
|
export const SQLITE = new SQLiteConnection(CAP_SQLITE);
|
||||||
13
src/services/platforms/types.ts
Normal file
13
src/services/platforms/types.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Types for platform services
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface QueuedOperation {
|
||||||
|
type: "run" | "query" | "rawQuery";
|
||||||
|
sql: string;
|
||||||
|
params: unknown[];
|
||||||
|
resolve: (value: unknown) => void;
|
||||||
|
reject: (reason: unknown) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueuedOperationType = QueuedOperation["type"];
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { NotificationIface } from "@/constants/app";
|
import { NotificationIface } from "@/constants/app";
|
||||||
|
import router from "@/router";
|
||||||
|
|
||||||
const SEED_REMINDER_KEY = "seedPhraseReminderLastShown";
|
const SEED_REMINDER_KEY = "seedPhraseReminderLastShown";
|
||||||
const REMINDER_COOLDOWN_MS = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
|
const REMINDER_COOLDOWN_MS = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
|
||||||
@@ -53,8 +54,8 @@ export function createSeedReminderNotification(): NotificationIface {
|
|||||||
yesText: "Backup Identifier Seed",
|
yesText: "Backup Identifier Seed",
|
||||||
noText: "Remind me Later",
|
noText: "Remind me Later",
|
||||||
onYes: async () => {
|
onYes: async () => {
|
||||||
// Navigate to seed backup page
|
// Navigate to seed backup page using SPA routing
|
||||||
window.location.href = "/seed-backup";
|
await router.push({ path: "/seed-backup" });
|
||||||
},
|
},
|
||||||
onNo: async () => {
|
onNo: async () => {
|
||||||
// Mark as shown so it won't appear again for 24 hours
|
// Mark as shown so it won't appear again for 24 hours
|
||||||
|
|||||||
@@ -157,11 +157,27 @@ export default class DeepLinkRedirectView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const capabilities = this.platformService.getCapabilities();
|
||||||
|
|
||||||
|
// If we're already in the native app, use router navigation instead
|
||||||
|
// of window.location.href (which doesn't work properly in Capacitor)
|
||||||
|
if (capabilities.isNativeApp) {
|
||||||
|
// Navigate directly using the router
|
||||||
|
const destinationPath = `/${this.destinationUrl}`;
|
||||||
|
this.$router.push(destinationPath).catch((error) => {
|
||||||
|
logger.error("Router navigation failed: " + errorStringForLog(error));
|
||||||
|
this.pageError =
|
||||||
|
"Unable to navigate to the destination. Please use a manual option below.";
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For web contexts, use window.location.href to redirect to app
|
||||||
// For mobile, try the deep link URL; for desktop, use the web URL
|
// For mobile, try the deep link URL; for desktop, use the web URL
|
||||||
const redirectUrl = this.isMobile ? this.deepLinkUrl : this.webUrl;
|
const redirectUrl = this.isMobile ? this.deepLinkUrl : this.webUrl;
|
||||||
|
|
||||||
// Method 1: Try window.location.href (works on most browsers)
|
// Method 1: Try window.location.href (works on most browsers)
|
||||||
window.location.href = redirectUrl;
|
window.location.href = redirectUrl; // Do not use this on native apps! The channel to Capacitor gets messed up.
|
||||||
|
|
||||||
// Method 2: Fallback - create and click a link element
|
// Method 2: Fallback - create and click a link element
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user