Compare commits
12 Commits
gifting-ui
...
android-15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d49be45ca | ||
| e240c2940a | |||
| 54dca9e745 | |||
| 9f0fed0a60 | |||
| 0d152adbf2 | |||
| cead308800 | |||
| 676a301331 | |||
| d6db81cc36 | |||
|
|
f2ddcd2541 | ||
| fb81f7b96e | |||
| a23416ead1 | |||
| 530c7c1a13 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -55,3 +55,4 @@ build_logs/
|
|||||||
icons
|
icons
|
||||||
|
|
||||||
|
|
||||||
|
android/app/src/main/res/
|
||||||
31
BUILDING.md
31
BUILDING.md
@@ -321,11 +321,11 @@ Prerequisites: macOS with Xcode installed
|
|||||||
|
|
||||||
#### Each Release
|
#### Each Release
|
||||||
|
|
||||||
0. First time (or if XCode dependencies change):
|
0. First time (or if dependencies change):
|
||||||
|
|
||||||
- `pkgx +rubygems.org sh`
|
- `pkgx +rubygems.org sh`
|
||||||
|
|
||||||
- ... 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)
|
||||||
@@ -334,12 +334,9 @@ Prerequisites: macOS with Xcode installed
|
|||||||
export GEM_PATH=$shortened_path
|
export GEM_PATH=$shortened_path
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
1. Check the iOS flag isIOS in CapacitorPlatformService (currently hard-coded for iOS build).
|
||||||
cd ios/App
|
|
||||||
pod install
|
|
||||||
```
|
|
||||||
|
|
||||||
1. Build the web assets:
|
2. Build the web assets:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
@@ -347,8 +344,7 @@ Prerequisites: macOS with Xcode installed
|
|||||||
npm run build:capacitor
|
npm run build:capacitor
|
||||||
```
|
```
|
||||||
|
|
||||||
|
3. Update iOS project with latest build:
|
||||||
2. Update iOS project with latest build:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx cap sync ios
|
npx cap sync ios
|
||||||
@@ -356,7 +352,7 @@ Prerequisites: macOS with Xcode installed
|
|||||||
|
|
||||||
- If that fails with "Could not find..." then look at the "gem_path" instructions above.
|
- If that fails with "Could not find..." then look at the "gem_path" instructions above.
|
||||||
|
|
||||||
3. Copy the assets:
|
4. Copy the assets:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# It makes no sense why capacitor-assets will not run without these but it actually changes the contents.
|
# It makes no sense why capacitor-assets will not run without these but it actually changes the contents.
|
||||||
@@ -367,15 +363,14 @@ Prerequisites: macOS with Xcode installed
|
|||||||
npx capacitor-assets generate --ios
|
npx capacitor-assets generate --ios
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Bump the version to match Android:
|
4. Bump the version to match Android & package.json:
|
||||||
|
|
||||||
```
|
```
|
||||||
cd ios/App
|
cd ios/App
|
||||||
xcrun agvtool new-version 25
|
xcrun agvtool new-version 30
|
||||||
# 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
|
||||||
cat App.xcodeproj/project.pbxproj | sed "s/MARKETING_VERSION = .*;/MARKETING_VERSION = 0.5.1;/g" > temp
|
cat App.xcodeproj/project.pbxproj | sed "s/MARKETING_VERSION = .*;/MARKETING_VERSION = 0.5.4;/g" > temp && mv temp App.xcodeproj/project.pbxproj
|
||||||
mv temp App.xcodeproj/project.pbxproj
|
|
||||||
cd -
|
cd -
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -403,6 +398,8 @@ Prerequisites: macOS with Xcode installed
|
|||||||
* 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".
|
||||||
|
|
||||||
|
8. Revert the iOS flag isIOS in CapacitorPlatformService.
|
||||||
|
|
||||||
### Android Build
|
### Android Build
|
||||||
|
|
||||||
Prerequisites: Android Studio with Java SDK installed
|
Prerequisites: Android Studio with Java SDK installed
|
||||||
@@ -427,7 +424,7 @@ Prerequisites: Android Studio with Java SDK installed
|
|||||||
npx capacitor-assets generate --android
|
npx capacitor-assets generate --android
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Bump version to match iOS: android/app/build.gradle
|
4. Bump version to match iOS & package.json: android/app/build.gradle
|
||||||
|
|
||||||
5. Open the project in Android Studio:
|
5. Open the project in Android Studio:
|
||||||
|
|
||||||
@@ -478,7 +475,7 @@ At play.google.com/console:
|
|||||||
- 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.
|
- 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.
|
||||||
|
|
||||||
|
|
||||||
## First-time Android Configuration for deep links
|
## Android Configuration for deep links
|
||||||
|
|
||||||
You must add the following intent filter to the `android/app/src/main/AndroidManifest.xml` file:
|
You must add the following intent filter to the `android/app/src/main/AndroidManifest.xml` file:
|
||||||
|
|
||||||
@@ -490,3 +487,5 @@ You must add the following intent filter to the `android/app/src/main/AndroidMan
|
|||||||
<data android:scheme="timesafari" />
|
<data android:scheme="timesafari" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
... though when we tried that most recently it failed to 'build' the APK with: http(s) scheme and host attribute are missing, but are required for Android App Links [AppLinkUrlError]
|
||||||
|
|||||||
@@ -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 26
|
versionCode 30
|
||||||
versionName "0.5.1"
|
versionName "0.5.4"
|
||||||
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.
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
},
|
},
|
||||||
"SQLite": {
|
"SQLite": {
|
||||||
"iosDatabaseLocation": "Library/CapacitorDatabase",
|
"iosDatabaseLocation": "Library/CapacitorDatabase",
|
||||||
"iosIsEncryption": true,
|
"iosIsEncryption": false,
|
||||||
"iosBiometric": {
|
"iosBiometric": {
|
||||||
"biometricAuth": true,
|
"biometricAuth": false,
|
||||||
"biometricTitle": "Biometric login for TimeSafari"
|
"biometricTitle": "Biometric login for TimeSafari"
|
||||||
},
|
},
|
||||||
"androidIsEncryption": true,
|
"androidIsEncryption": false,
|
||||||
"androidBiometric": {
|
"androidBiometric": {
|
||||||
"biometricAuth": true,
|
"biometricAuth": false,
|
||||||
"biometricTitle": "Biometric login for TimeSafari"
|
"biometricTitle": "Biometric login for TimeSafari"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
},
|
},
|
||||||
"SQLite": {
|
"SQLite": {
|
||||||
"iosDatabaseLocation": "Library/CapacitorDatabase",
|
"iosDatabaseLocation": "Library/CapacitorDatabase",
|
||||||
"iosIsEncryption": true,
|
"iosIsEncryption": false,
|
||||||
"iosBiometric": {
|
"iosBiometric": {
|
||||||
"biometricAuth": true,
|
"biometricAuth": false,
|
||||||
"biometricTitle": "Biometric login for TimeSafari"
|
"biometricTitle": "Biometric login for TimeSafari"
|
||||||
},
|
},
|
||||||
"androidIsEncryption": true,
|
"androidIsEncryption": false,
|
||||||
"androidBiometric": {
|
"androidBiometric": {
|
||||||
"biometricAuth": true,
|
"biometricAuth": false,
|
||||||
"biometricTitle": "Biometric login for TimeSafari"
|
"biometricTitle": "Biometric login for TimeSafari"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
221
docs/DATABASE_CONNECTION_FIXES.md
Normal file
221
docs/DATABASE_CONNECTION_FIXES.md
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
# Database Connection Fixes for TimeSafari
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This document outlines the fixes implemented to resolve database connection issues in the TimeSafari application, particularly for Capacitor SQLite on Android devices.
|
||||||
|
|
||||||
|
## Issues Identified
|
||||||
|
|
||||||
|
### 1. CapacitorSQLitePlugin Errors
|
||||||
|
- Multiple `*** ERROR CapacitorSQLitePlugin: null` messages in Android logs
|
||||||
|
- Database connection conflicts and initialization failures
|
||||||
|
- Connection leaks causing "Connection timesafari.sqlite already exists" errors
|
||||||
|
|
||||||
|
### 2. Performance Issues
|
||||||
|
- App skipping 57 frames due to main thread blocking
|
||||||
|
- Null pointer exceptions in garbage collection
|
||||||
|
- Memory management issues
|
||||||
|
|
||||||
|
### 3. Connection Management
|
||||||
|
- Lack of proper connection cleanup on app lifecycle events
|
||||||
|
- No retry logic for failed connections
|
||||||
|
- Missing error handling and recovery mechanisms
|
||||||
|
|
||||||
|
## Implemented Fixes
|
||||||
|
|
||||||
|
### 1. Enhanced Database Initialization
|
||||||
|
|
||||||
|
#### Connection Cleanup
|
||||||
|
- Added `cleanupExistingConnections()` method to properly close existing connections
|
||||||
|
- Implemented connection consistency checks before creating new connections
|
||||||
|
- Added proper error handling for connection cleanup failures
|
||||||
|
|
||||||
|
#### Retry Logic
|
||||||
|
- Implemented exponential backoff retry mechanism for database connections
|
||||||
|
- Maximum of 3 retry attempts with increasing delays
|
||||||
|
- Comprehensive error logging for each attempt
|
||||||
|
|
||||||
|
#### Database Configuration
|
||||||
|
- Configured optimal SQLite settings for performance and stability:
|
||||||
|
- `PRAGMA journal_mode=WAL` for better concurrency
|
||||||
|
- `PRAGMA synchronous=NORMAL` for balanced performance
|
||||||
|
- `PRAGMA cache_size=10000` for improved caching
|
||||||
|
- `PRAGMA temp_store=MEMORY` for faster temporary operations
|
||||||
|
- `PRAGMA mmap_size=268435456` (256MB) for memory mapping
|
||||||
|
|
||||||
|
### 2. Lifecycle Management
|
||||||
|
|
||||||
|
#### App Lifecycle Listeners
|
||||||
|
- Added event listeners for `beforeunload` and `visibilitychange`
|
||||||
|
- Automatic database cleanup when app goes to background
|
||||||
|
- Proper resource management to prevent connection leaks
|
||||||
|
|
||||||
|
#### Health Monitoring
|
||||||
|
- Implemented `healthCheck()` method for connection status monitoring
|
||||||
|
- Added `reinitializeDatabase()` for forced reconnection
|
||||||
|
- Performance metrics tracking for database operations
|
||||||
|
|
||||||
|
### 3. Error Handling and Diagnostics
|
||||||
|
|
||||||
|
#### Comprehensive Error Handling
|
||||||
|
- Enhanced error logging with detailed context
|
||||||
|
- Graceful degradation when database operations fail
|
||||||
|
- User-friendly error messages with recovery suggestions
|
||||||
|
|
||||||
|
#### Diagnostic Tools
|
||||||
|
- Created `databaseDiagnostics.ts` utility for troubleshooting
|
||||||
|
- Database stress testing capabilities
|
||||||
|
- Performance monitoring and reporting
|
||||||
|
- System information collection for debugging
|
||||||
|
|
||||||
|
### 4. Configuration Changes
|
||||||
|
|
||||||
|
#### Capacitor Configuration
|
||||||
|
- Temporarily disabled encryption to isolate connection issues
|
||||||
|
- Disabled biometric authentication to reduce complexity
|
||||||
|
- Maintained proper database location settings
|
||||||
|
|
||||||
|
#### Camera Integration Fixes
|
||||||
|
- Fixed `CameraDirection` enum usage for Capacitor Camera v6
|
||||||
|
- Updated from string literals to proper enum values
|
||||||
|
- Resolved TypeScript compilation errors
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Running Diagnostics
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { runDatabaseDiagnostics, stressTestDatabase } from '@/utils/databaseDiagnostics';
|
||||||
|
|
||||||
|
// Run comprehensive diagnostics
|
||||||
|
const diagnosticInfo = await runDatabaseDiagnostics();
|
||||||
|
console.log('Database status:', diagnosticInfo.connectionStatus);
|
||||||
|
|
||||||
|
// Run stress test
|
||||||
|
await stressTestDatabase(20);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Health Checks
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { PlatformServiceFactory } from '@/services/PlatformServiceFactory';
|
||||||
|
|
||||||
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
|
const health = await platformService.healthCheck();
|
||||||
|
|
||||||
|
if (!health.healthy) {
|
||||||
|
console.error('Database health check failed:', health.error);
|
||||||
|
// Attempt reinitialization
|
||||||
|
await platformService.reinitializeDatabase();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Performance Monitoring
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { logDatabasePerformance } from '@/utils/databaseDiagnostics';
|
||||||
|
|
||||||
|
// Wrap database operations with performance monitoring
|
||||||
|
const start = Date.now();
|
||||||
|
await platformService.dbQuery("SELECT * FROM users");
|
||||||
|
const duration = Date.now() - start;
|
||||||
|
logDatabasePerformance("User query", duration);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting Guide
|
||||||
|
|
||||||
|
### Common Issues and Solutions
|
||||||
|
|
||||||
|
#### 1. "Connection timesafari.sqlite already exists"
|
||||||
|
**Cause**: Multiple database connections not properly closed
|
||||||
|
**Solution**:
|
||||||
|
- Use the enhanced cleanup methods
|
||||||
|
- Check for existing connections before creating new ones
|
||||||
|
- Implement proper app lifecycle management
|
||||||
|
|
||||||
|
#### 2. CapacitorSQLitePlugin null errors
|
||||||
|
**Cause**: Database initialization failures or connection conflicts
|
||||||
|
**Solution**:
|
||||||
|
- Use retry logic with exponential backoff
|
||||||
|
- Check connection consistency
|
||||||
|
- Verify database configuration settings
|
||||||
|
|
||||||
|
#### 3. Performance Issues
|
||||||
|
**Cause**: Main thread blocking or inefficient database operations
|
||||||
|
**Solution**:
|
||||||
|
- Use WAL journal mode for better concurrency
|
||||||
|
- Implement proper connection pooling
|
||||||
|
- Monitor and optimize query performance
|
||||||
|
|
||||||
|
#### 4. Memory Leaks
|
||||||
|
**Cause**: Database connections not properly closed
|
||||||
|
**Solution**:
|
||||||
|
- Implement proper cleanup on app lifecycle events
|
||||||
|
- Use health checks to monitor connection status
|
||||||
|
- Force reinitialization when issues are detected
|
||||||
|
|
||||||
|
### Debugging Steps
|
||||||
|
|
||||||
|
1. **Check Logs**: Look for database-related error messages
|
||||||
|
2. **Run Diagnostics**: Use `runDatabaseDiagnostics()` to get system status
|
||||||
|
3. **Monitor Performance**: Track query execution times
|
||||||
|
4. **Test Connections**: Use stress testing to identify issues
|
||||||
|
5. **Verify Configuration**: Check Capacitor and SQLite settings
|
||||||
|
|
||||||
|
### Recovery Procedures
|
||||||
|
|
||||||
|
#### Automatic Recovery
|
||||||
|
- Health checks run periodically
|
||||||
|
- Automatic reinitialization on connection failures
|
||||||
|
- Graceful degradation for non-critical operations
|
||||||
|
|
||||||
|
#### Manual Recovery
|
||||||
|
- Force app restart to clear all connections
|
||||||
|
- Clear app data if persistent issues occur
|
||||||
|
- Check device storage and permissions
|
||||||
|
|
||||||
|
## Security Considerations
|
||||||
|
|
||||||
|
### Data Protection
|
||||||
|
- Encryption can be re-enabled once connection issues are resolved
|
||||||
|
- Biometric authentication can be restored after stability is confirmed
|
||||||
|
- Proper error handling prevents data corruption
|
||||||
|
|
||||||
|
### Privacy
|
||||||
|
- Diagnostic information is logged locally only
|
||||||
|
- No sensitive data is exposed in error messages
|
||||||
|
- User data remains protected during recovery procedures
|
||||||
|
|
||||||
|
## Performance Impact
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
- Reduced connection initialization time
|
||||||
|
- Better memory usage through proper cleanup
|
||||||
|
- Improved app responsiveness with background processing
|
||||||
|
- Enhanced error recovery reduces user impact
|
||||||
|
|
||||||
|
### Monitoring
|
||||||
|
- Performance metrics are tracked automatically
|
||||||
|
- Slow operations are logged with warnings
|
||||||
|
- System resource usage is monitored
|
||||||
|
|
||||||
|
## Future Enhancements
|
||||||
|
|
||||||
|
### Planned Improvements
|
||||||
|
1. **Connection Pooling**: Implement proper connection pooling for better performance
|
||||||
|
2. **Encryption Re-enablement**: Restore encryption once stability is confirmed
|
||||||
|
3. **Advanced Monitoring**: Add real-time performance dashboards
|
||||||
|
4. **Automated Recovery**: Implement self-healing mechanisms
|
||||||
|
|
||||||
|
### Research Areas
|
||||||
|
1. **Alternative Storage**: Investigate other storage solutions for specific use cases
|
||||||
|
2. **Migration Tools**: Develop tools for seamless data migration
|
||||||
|
3. **Cross-Platform Optimization**: Optimize for different device capabilities
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
These fixes address the core database connection issues while maintaining application stability and user experience. The enhanced error handling, monitoring, and recovery mechanisms provide a robust foundation for reliable database operations across all platforms.
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
Matthew Raymer - Database Architecture and Mobile Platform Development
|
||||||
@@ -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 = 26;
|
CURRENT_PROJECT_VERSION = 30;
|
||||||
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 = 0.5.1;
|
MARKETING_VERSION = 0.5.4;
|
||||||
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 = 26;
|
CURRENT_PROJECT_VERSION = 30;
|
||||||
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 = 0.5.1;
|
MARKETING_VERSION = 0.5.4;
|
||||||
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": "0.4.8",
|
"version": "0.5.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "timesafari",
|
"name": "timesafari",
|
||||||
"version": "0.4.8",
|
"version": "0.5.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@capacitor-community/sqlite": "6.0.2",
|
"@capacitor-community/sqlite": "6.0.2",
|
||||||
"@capacitor-mlkit/barcode-scanning": "^6.0.0",
|
"@capacitor-mlkit/barcode-scanning": "^6.0.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "timesafari",
|
"name": "timesafari",
|
||||||
"version": "0.5.1",
|
"version": "0.5.4",
|
||||||
"description": "Time Safari Application",
|
"description": "Time Safari Application",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Time Safari Team"
|
"name": "Time Safari Team"
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ export default class GiftedDialog extends Vue {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
const errorMessage = this.getGiveCreationErrorMessage(result);
|
const errorMessage = result.error;
|
||||||
logger.error("Error with give creation result:", result);
|
logger.error("Error with give creation result:", result);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
@@ -367,19 +367,6 @@ export default class GiftedDialog extends Vue {
|
|||||||
|
|
||||||
// Helper functions for readability
|
// Helper functions for readability
|
||||||
|
|
||||||
/**
|
|
||||||
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
|
||||||
* @returns best guess at an error message
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
getGiveCreationErrorMessage(result: any) {
|
|
||||||
return (
|
|
||||||
result.error?.userMessage ||
|
|
||||||
result.error?.error ||
|
|
||||||
result.response?.data?.error?.message
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
explainData() {
|
explainData() {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,12 +48,15 @@
|
|||||||
<span>
|
<span>
|
||||||
{{ didInfo(visDid) }}
|
{{ didInfo(visDid) }}
|
||||||
<span v-if="!serverUtil.isEmptyOrHiddenDid(visDid)">
|
<span v-if="!serverUtil.isEmptyOrHiddenDid(visDid)">
|
||||||
<a :href="`/did/${visDid}`" class="text-blue-500">
|
<router-link
|
||||||
|
:to="{ path: '/did/' + encodeURIComponent(visDid) }"
|
||||||
|
class="text-blue-500"
|
||||||
|
>
|
||||||
<font-awesome
|
<font-awesome
|
||||||
icon="arrow-up-right-from-square"
|
icon="arrow-up-right-from-square"
|
||||||
class="fa-fw"
|
class="fa-fw"
|
||||||
/>
|
/>
|
||||||
</a>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ export default class OfferDialog extends Vue {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
const errorMessage = this.getOfferCreationErrorMessage(result);
|
const errorMessage = result.error;
|
||||||
logger.error("Error with offer creation result:", result);
|
logger.error("Error with offer creation result:", result);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
@@ -290,21 +290,6 @@ export default class OfferDialog extends Vue {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions for readability
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
|
||||||
* @returns best guess at an error message
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
getOfferCreationErrorMessage(result: any) {
|
|
||||||
return (
|
|
||||||
serverMessageForUser(result) ||
|
|
||||||
result.error?.userMessage ||
|
|
||||||
result.error?.error
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -38,14 +38,14 @@ export default class TopMessage extends Vue {
|
|||||||
settings.apiServer !== AppString.PROD_ENDORSER_API_SERVER
|
settings.apiServer !== AppString.PROD_ENDORSER_API_SERVER
|
||||||
) {
|
) {
|
||||||
const didPrefix = settings.activeDid?.slice(11, 15);
|
const didPrefix = settings.activeDid?.slice(11, 15);
|
||||||
this.message = "You're linked to a non-prod server, user " + didPrefix;
|
this.message = "You're not using prod, user " + didPrefix;
|
||||||
} else if (
|
} else if (
|
||||||
settings.warnIfProdServer &&
|
settings.warnIfProdServer &&
|
||||||
settings.apiServer === AppString.PROD_ENDORSER_API_SERVER
|
settings.apiServer === AppString.PROD_ENDORSER_API_SERVER
|
||||||
) {
|
) {
|
||||||
const didPrefix = settings.activeDid?.slice(11, 15);
|
const didPrefix = settings.activeDid?.slice(11, 15);
|
||||||
this.message =
|
this.message =
|
||||||
"You're linked to the production server, user " + didPrefix;
|
"You are using prod, user " + didPrefix;
|
||||||
}
|
}
|
||||||
} catch (err: unknown) {
|
} catch (err: unknown) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import { AxiosResponse } from "axios";
|
|
||||||
import { GiverReceiverInputInfo } from "../libs/util";
|
import { GiverReceiverInputInfo } from "../libs/util";
|
||||||
import { ErrorResult, ResultWithType } from "./common";
|
|
||||||
|
|
||||||
export interface GiverOutputInfo {
|
export interface GiverOutputInfo {
|
||||||
action: string;
|
action: string;
|
||||||
@@ -47,12 +45,3 @@ export interface ProviderInfo {
|
|||||||
*/
|
*/
|
||||||
linkConfirmed: boolean;
|
linkConfirmed: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type for createAndSubmitClaim result
|
|
||||||
export type CreateAndSubmitClaimResult = SuccessResult | ErrorResult;
|
|
||||||
|
|
||||||
// Update SuccessResult to use ClaimResult
|
|
||||||
export interface SuccessResult extends ResultWithType {
|
|
||||||
type: "success";
|
|
||||||
response: AxiosResponse<ClaimResult>;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,10 +15,6 @@ export interface GenericCredWrapper<T extends GenericVerifiableCredential> {
|
|||||||
publicUrls?: Record<string, string>;
|
publicUrls?: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ResultWithType {
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ErrorResponse {
|
export interface ErrorResponse {
|
||||||
error?: {
|
error?: {
|
||||||
message?: string;
|
message?: string;
|
||||||
@@ -30,11 +26,6 @@ export interface InternalError {
|
|||||||
userMessage?: string;
|
userMessage?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ErrorResult extends ResultWithType {
|
|
||||||
type: "error";
|
|
||||||
error: InternalError;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface KeyMeta {
|
export interface KeyMeta {
|
||||||
did: string;
|
did: string;
|
||||||
publicKeyHex: string;
|
publicKeyHex: string;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export type {
|
export type {
|
||||||
// From common.ts
|
// From common.ts
|
||||||
|
CreateAndSubmitClaimResult,
|
||||||
GenericCredWrapper,
|
GenericCredWrapper,
|
||||||
GenericVerifiableCredential,
|
GenericVerifiableCredential,
|
||||||
KeyMeta,
|
KeyMeta,
|
||||||
@@ -18,11 +19,6 @@ export type {
|
|||||||
RegisterActionClaim,
|
RegisterActionClaim,
|
||||||
} from "./claims";
|
} from "./claims";
|
||||||
|
|
||||||
export type {
|
|
||||||
// From claims-result.ts
|
|
||||||
CreateAndSubmitClaimResult,
|
|
||||||
} from "./claims-result";
|
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
// From records.ts
|
// From records.ts
|
||||||
PlanSummaryRecord,
|
PlanSummaryRecord,
|
||||||
|
|||||||
@@ -979,7 +979,7 @@ export const createAndSubmitConfirmation = async (
|
|||||||
handleId: string | undefined,
|
handleId: string | undefined,
|
||||||
apiServer: string,
|
apiServer: string,
|
||||||
axios: Axios,
|
axios: Axios,
|
||||||
) => {
|
): Promise<CreateAndSubmitClaimResult> => {
|
||||||
const goodClaim = removeSchemaContext(
|
const goodClaim = removeSchemaContext(
|
||||||
removeVisibleToDids(
|
removeVisibleToDids(
|
||||||
addLastClaimOrHandleAsIdIfMissing(claim, lastClaimId, handleId),
|
addLastClaimOrHandleAsIdIfMissing(claim, lastClaimId, handleId),
|
||||||
|
|||||||
@@ -81,18 +81,16 @@ export class DeepLinkHandler {
|
|||||||
string,
|
string,
|
||||||
{ name: string; paramKey?: string }
|
{ name: string; paramKey?: string }
|
||||||
> = {
|
> = {
|
||||||
"user-profile": { name: "user-profile" },
|
"claim": { name: "claim" },
|
||||||
"project-details": { name: "project-details" },
|
|
||||||
"onboard-meeting-setup": { name: "onboard-meeting-setup" },
|
|
||||||
"invite-one-accept": { name: "invite-one-accept" },
|
|
||||||
"contact-import": { name: "contact-import" },
|
|
||||||
"confirm-gift": { name: "confirm-gift" },
|
|
||||||
claim: { name: "claim" },
|
|
||||||
"claim-cert": { name: "claim-cert" },
|
|
||||||
"claim-add-raw": { name: "claim-add-raw" },
|
"claim-add-raw": { name: "claim-add-raw" },
|
||||||
"contact-edit": { name: "contact-edit", paramKey: "did" },
|
"claim-cert": { name: "claim-cert" },
|
||||||
contacts: { name: "contacts" },
|
"confirm-gift": { name: "confirm-gift" },
|
||||||
did: { name: "did", paramKey: "did" },
|
"did": { name: "did", paramKey: "did" },
|
||||||
|
"invite-one-accept": { name: "invite-one-accept" },
|
||||||
|
"onboard-meeting-members": { name: "onboard-meeting-members" },
|
||||||
|
"onboard-meeting-setup": { name: "onboard-meeting-setup" },
|
||||||
|
"project": { name: "project" },
|
||||||
|
"user-profile": { name: "user-profile" },
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
CameraSource,
|
CameraSource,
|
||||||
CameraDirection,
|
CameraDirection,
|
||||||
} from "@capacitor/camera";
|
} from "@capacitor/camera";
|
||||||
|
import { Capacitor } from "@capacitor/core";
|
||||||
import { Share } from "@capacitor/share";
|
import { Share } from "@capacitor/share";
|
||||||
import {
|
import {
|
||||||
SQLiteConnection,
|
SQLiteConnection,
|
||||||
@@ -41,7 +42,7 @@ interface QueuedOperation {
|
|||||||
*/
|
*/
|
||||||
export class CapacitorPlatformService implements PlatformService {
|
export class CapacitorPlatformService implements PlatformService {
|
||||||
/** Current camera direction */
|
/** Current camera direction */
|
||||||
private currentDirection: CameraDirection = "BACK";
|
private currentDirection: CameraDirection = CameraDirection.Rear;
|
||||||
|
|
||||||
private sqlite: SQLiteConnection;
|
private sqlite: SQLiteConnection;
|
||||||
private db: SQLiteDBConnection | null = null;
|
private db: SQLiteDBConnection | null = null;
|
||||||
@@ -53,6 +54,29 @@ export class CapacitorPlatformService implements PlatformService {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.sqlite = new SQLiteConnection(CapacitorSQLite);
|
this.sqlite = new SQLiteConnection(CapacitorSQLite);
|
||||||
|
|
||||||
|
// Set up app lifecycle listeners for proper cleanup
|
||||||
|
this.setupLifecycleListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up app lifecycle listeners for proper database cleanup
|
||||||
|
*/
|
||||||
|
private setupLifecycleListeners(): void {
|
||||||
|
if (typeof window !== 'undefined' && window.addEventListener) {
|
||||||
|
// Handle app pause/resume events
|
||||||
|
window.addEventListener('beforeunload', () => {
|
||||||
|
this.cleanupDatabase();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle visibility change (app going to background)
|
||||||
|
document.addEventListener('visibilitychange', () => {
|
||||||
|
if (document.hidden) {
|
||||||
|
// App going to background - ensure database is properly closed
|
||||||
|
this.cleanupDatabase();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initializeDatabase(): Promise<void> {
|
private async initializeDatabase(): Promise<void> {
|
||||||
@@ -86,19 +110,14 @@ export class CapacitorPlatformService implements PlatformService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Create/Open database
|
// Check if database connection already exists and close it
|
||||||
this.db = await this.sqlite.createConnection(
|
await this.cleanupExistingConnections();
|
||||||
this.dbName,
|
|
||||||
false,
|
|
||||||
"no-encryption",
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
|
|
||||||
await this.db.open();
|
// Create/Open database with retry logic
|
||||||
|
this.db = await this.createDatabaseConnection();
|
||||||
|
|
||||||
// Set journal mode to WAL for better performance
|
// Configure database for better performance and stability
|
||||||
// await this.db.execute("PRAGMA journal_mode=WAL;");
|
await this.configureDatabase();
|
||||||
|
|
||||||
// Run migrations
|
// Run migrations
|
||||||
await this.runCapacitorMigrations();
|
await this.runCapacitorMigrations();
|
||||||
@@ -115,6 +134,8 @@ export class CapacitorPlatformService implements PlatformService {
|
|||||||
"[CapacitorPlatformService] Error initializing SQLite database:",
|
"[CapacitorPlatformService] Error initializing SQLite database:",
|
||||||
error,
|
error,
|
||||||
);
|
);
|
||||||
|
// Clean up on failure
|
||||||
|
await this.cleanupDatabase();
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"[CapacitorPlatformService] Failed to initialize database",
|
"[CapacitorPlatformService] Failed to initialize database",
|
||||||
);
|
);
|
||||||
@@ -247,7 +268,7 @@ export class CapacitorPlatformService implements PlatformService {
|
|||||||
hasFileSystem: true,
|
hasFileSystem: true,
|
||||||
hasCamera: true,
|
hasCamera: true,
|
||||||
isMobile: true,
|
isMobile: true,
|
||||||
isIOS: /iPad|iPhone|iPod/.test(navigator.userAgent),
|
isIOS: Capacitor.getPlatform() === "ios",
|
||||||
hasFileDownload: false,
|
hasFileDownload: false,
|
||||||
needsFileHandlingInstructions: true,
|
needsFileHandlingInstructions: true,
|
||||||
isNativeApp: true,
|
isNativeApp: true,
|
||||||
@@ -701,7 +722,7 @@ export class CapacitorPlatformService implements PlatformService {
|
|||||||
* @returns Promise that resolves when the camera is rotated
|
* @returns Promise that resolves when the camera is rotated
|
||||||
*/
|
*/
|
||||||
async rotateCamera(): Promise<void> {
|
async rotateCamera(): Promise<void> {
|
||||||
this.currentDirection = this.currentDirection === "BACK" ? "FRONT" : "BACK";
|
this.currentDirection = this.currentDirection === CameraDirection.Rear ? CameraDirection.Front : CameraDirection.Rear;
|
||||||
logger.debug(`Camera rotated to ${this.currentDirection} camera`);
|
logger.debug(`Camera rotated to ${this.currentDirection} camera`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,4 +759,179 @@ export class CapacitorPlatformService implements PlatformService {
|
|||||||
params || [],
|
params || [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up any existing database connections to prevent conflicts
|
||||||
|
*/
|
||||||
|
private async cleanupExistingConnections(): Promise<void> {
|
||||||
|
try {
|
||||||
|
// Check if we have an existing connection
|
||||||
|
if (this.db) {
|
||||||
|
try {
|
||||||
|
await this.db.close();
|
||||||
|
} catch (closeError) {
|
||||||
|
logger.warn(
|
||||||
|
"[CapacitorPlatformService] Error closing existing connection:",
|
||||||
|
closeError,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
this.db = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for existing connections with the same name
|
||||||
|
const connections = await this.sqlite.checkConnectionsConsistency();
|
||||||
|
const isConn = await this.sqlite.isConnection(this.dbName, false);
|
||||||
|
|
||||||
|
if (isConn.result) {
|
||||||
|
logger.log(
|
||||||
|
"[CapacitorPlatformService] Found existing connection, closing it",
|
||||||
|
);
|
||||||
|
await this.sqlite.closeConnection(this.dbName, false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logger.warn(
|
||||||
|
"[CapacitorPlatformService] Error during connection cleanup:",
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create database connection with retry logic
|
||||||
|
*/
|
||||||
|
private async createDatabaseConnection(): Promise<SQLiteDBConnection> {
|
||||||
|
const maxRetries = 3;
|
||||||
|
let lastError: Error | null = null;
|
||||||
|
|
||||||
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||||
|
try {
|
||||||
|
logger.log(
|
||||||
|
`[CapacitorPlatformService] Creating database connection (attempt ${attempt}/${maxRetries})`,
|
||||||
|
);
|
||||||
|
|
||||||
|
const db = await this.sqlite.createConnection(
|
||||||
|
this.dbName,
|
||||||
|
false,
|
||||||
|
"no-encryption",
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
await db.open();
|
||||||
|
|
||||||
|
logger.log(
|
||||||
|
`[CapacitorPlatformService] Database connection created successfully on attempt ${attempt}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
return db;
|
||||||
|
} catch (error) {
|
||||||
|
lastError = error as Error;
|
||||||
|
logger.error(
|
||||||
|
`[CapacitorPlatformService] Database connection attempt ${attempt} failed:`,
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (attempt < maxRetries) {
|
||||||
|
// Wait before retry with exponential backoff
|
||||||
|
const delay = Math.min(1000 * Math.pow(2, attempt - 1), 5000);
|
||||||
|
logger.log(
|
||||||
|
`[CapacitorPlatformService] Waiting ${delay}ms before retry...`,
|
||||||
|
);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, delay));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(
|
||||||
|
`[CapacitorPlatformService] Failed to create database connection after ${maxRetries} attempts: ${lastError?.message}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure database settings for optimal performance and stability
|
||||||
|
*/
|
||||||
|
private async configureDatabase(): Promise<void> {
|
||||||
|
if (!this.db) {
|
||||||
|
throw new Error("Database not initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Configure for better performance and stability
|
||||||
|
await this.db.execute("PRAGMA journal_mode=WAL;");
|
||||||
|
await this.db.execute("PRAGMA synchronous=NORMAL;");
|
||||||
|
await this.db.execute("PRAGMA cache_size=10000;");
|
||||||
|
await this.db.execute("PRAGMA temp_store=MEMORY;");
|
||||||
|
await this.db.execute("PRAGMA mmap_size=268435456;"); // 256MB
|
||||||
|
|
||||||
|
logger.log(
|
||||||
|
"[CapacitorPlatformService] Database configuration applied successfully",
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
logger.warn(
|
||||||
|
"[CapacitorPlatformService] Error applying database configuration:",
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
// Don't throw here as the database is still functional
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean up database resources
|
||||||
|
*/
|
||||||
|
private async cleanupDatabase(): Promise<void> {
|
||||||
|
try {
|
||||||
|
if (this.db) {
|
||||||
|
await this.db.close();
|
||||||
|
this.db = null;
|
||||||
|
}
|
||||||
|
this.initialized = false;
|
||||||
|
this.initializationPromise = null;
|
||||||
|
logger.log(
|
||||||
|
"[CapacitorPlatformService] Database cleanup completed",
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(
|
||||||
|
"[CapacitorPlatformService] Error during database cleanup:",
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Health check for database connection
|
||||||
|
*/
|
||||||
|
async healthCheck(): Promise<{ healthy: boolean; error?: string }> {
|
||||||
|
try {
|
||||||
|
if (!this.initialized || !this.db) {
|
||||||
|
return { healthy: false, error: "Database not initialized" };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try a simple query to test the connection
|
||||||
|
await this.db.query("SELECT 1 as test");
|
||||||
|
return { healthy: true };
|
||||||
|
} catch (error) {
|
||||||
|
logger.error("[CapacitorPlatformService] Health check failed:", error);
|
||||||
|
return {
|
||||||
|
healthy: false,
|
||||||
|
error: error instanceof Error ? error.message : String(error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force reinitialize the database connection
|
||||||
|
*/
|
||||||
|
async reinitializeDatabase(): Promise<void> {
|
||||||
|
logger.log("[CapacitorPlatformService] Forcing database reinitialization");
|
||||||
|
|
||||||
|
// Clean up existing connection
|
||||||
|
await this.cleanupDatabase();
|
||||||
|
|
||||||
|
// Reset initialization state
|
||||||
|
this.initialized = false;
|
||||||
|
this.initializationPromise = null;
|
||||||
|
|
||||||
|
// Reinitialize
|
||||||
|
await this.initializeDatabase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
158
src/utils/databaseDiagnostics.ts
Normal file
158
src/utils/databaseDiagnostics.ts
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
/**
|
||||||
|
* Database Diagnostics Utility
|
||||||
|
*
|
||||||
|
* This utility provides diagnostic tools for troubleshooting database connection
|
||||||
|
* issues in the TimeSafari application, particularly for Capacitor SQLite.
|
||||||
|
*
|
||||||
|
* @author Matthew Raymer
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { logger } from "./logger";
|
||||||
|
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||||
|
|
||||||
|
export interface DatabaseDiagnosticInfo {
|
||||||
|
platform: string;
|
||||||
|
timestamp: string;
|
||||||
|
databaseName: string;
|
||||||
|
connectionStatus: string;
|
||||||
|
errorDetails?: string;
|
||||||
|
performanceMetrics?: {
|
||||||
|
initializationTime?: number;
|
||||||
|
queryTime?: number;
|
||||||
|
};
|
||||||
|
systemInfo?: {
|
||||||
|
userAgent: string;
|
||||||
|
platform: string;
|
||||||
|
memory?: {
|
||||||
|
used: number;
|
||||||
|
total: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs comprehensive database diagnostics
|
||||||
|
*/
|
||||||
|
export async function runDatabaseDiagnostics(): Promise<DatabaseDiagnosticInfo> {
|
||||||
|
const startTime = Date.now();
|
||||||
|
const diagnosticInfo: DatabaseDiagnosticInfo = {
|
||||||
|
platform: "unknown",
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
databaseName: "timesafari.sqlite",
|
||||||
|
connectionStatus: "unknown",
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Get platform service
|
||||||
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
|
const capabilities = platformService.getCapabilities();
|
||||||
|
|
||||||
|
diagnosticInfo.platform = capabilities.isIOS ? "iOS" :
|
||||||
|
capabilities.isMobile ? "Android" : "Web";
|
||||||
|
|
||||||
|
// Add system information
|
||||||
|
diagnosticInfo.systemInfo = {
|
||||||
|
userAgent: navigator.userAgent,
|
||||||
|
platform: navigator.platform,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add memory information if available
|
||||||
|
if ('memory' in performance) {
|
||||||
|
const memory = (performance as any).memory;
|
||||||
|
diagnosticInfo.systemInfo.memory = {
|
||||||
|
used: memory.usedJSHeapSize,
|
||||||
|
total: memory.totalJSHeapSize,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test database connection
|
||||||
|
const initStart = Date.now();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Test a simple query
|
||||||
|
const queryStart = Date.now();
|
||||||
|
const result = await platformService.dbQuery("SELECT 1 as test");
|
||||||
|
const queryTime = Date.now() - queryStart;
|
||||||
|
|
||||||
|
diagnosticInfo.connectionStatus = "healthy";
|
||||||
|
diagnosticInfo.performanceMetrics = {
|
||||||
|
queryTime,
|
||||||
|
};
|
||||||
|
|
||||||
|
logger.log("[DatabaseDiagnostics] Database connection test successful");
|
||||||
|
} catch (error) {
|
||||||
|
diagnosticInfo.connectionStatus = "error";
|
||||||
|
diagnosticInfo.errorDetails = error instanceof Error ? error.message : String(error);
|
||||||
|
|
||||||
|
logger.error("[DatabaseDiagnostics] Database connection test failed:", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
const totalTime = Date.now() - startTime;
|
||||||
|
if (diagnosticInfo.performanceMetrics) {
|
||||||
|
diagnosticInfo.performanceMetrics.initializationTime = totalTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
diagnosticInfo.connectionStatus = "critical";
|
||||||
|
diagnosticInfo.errorDetails = error instanceof Error ? error.message : String(error);
|
||||||
|
logger.error("[DatabaseDiagnostics] Diagnostic run failed:", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log the complete diagnostic information
|
||||||
|
logger.log("[DatabaseDiagnostics] Diagnostic results:", diagnosticInfo);
|
||||||
|
|
||||||
|
return diagnosticInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs database performance metrics
|
||||||
|
*/
|
||||||
|
export function logDatabasePerformance(operation: string, duration: number): void {
|
||||||
|
logger.log(`[DatabasePerformance] ${operation}: ${duration}ms`);
|
||||||
|
|
||||||
|
// Log warning for slow operations
|
||||||
|
if (duration > 1000) {
|
||||||
|
logger.warn(`[DatabasePerformance] Slow operation detected: ${operation} took ${duration}ms`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a database connection stress test
|
||||||
|
*/
|
||||||
|
export async function stressTestDatabase(iterations: number = 10): Promise<void> {
|
||||||
|
logger.log(`[DatabaseStressTest] Starting stress test with ${iterations} iterations`);
|
||||||
|
|
||||||
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
|
const results: number[] = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < iterations; i++) {
|
||||||
|
const start = Date.now();
|
||||||
|
try {
|
||||||
|
await platformService.dbQuery("SELECT 1 as test");
|
||||||
|
const duration = Date.now() - start;
|
||||||
|
results.push(duration);
|
||||||
|
|
||||||
|
logger.log(`[DatabaseStressTest] Iteration ${i + 1}: ${duration}ms`);
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(`[DatabaseStressTest] Iteration ${i + 1} failed:`, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Small delay between iterations
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.length > 0) {
|
||||||
|
const avg = results.reduce((a, b) => a + b, 0) / results.length;
|
||||||
|
const min = Math.min(...results);
|
||||||
|
const max = Math.max(...results);
|
||||||
|
|
||||||
|
logger.log(`[DatabaseStressTest] Results - Avg: ${avg.toFixed(2)}ms, Min: ${min}ms, Max: ${max}ms`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports diagnostic information for debugging
|
||||||
|
*/
|
||||||
|
export function exportDiagnosticInfo(info: DatabaseDiagnosticInfo): string {
|
||||||
|
return JSON.stringify(info, null, 2);
|
||||||
|
}
|
||||||
@@ -198,7 +198,7 @@ export default class ClaimAddRawView extends Vue {
|
|||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.axios,
|
this.axios,
|
||||||
);
|
);
|
||||||
if (result.type === "success") {
|
if (result.success) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<div class="flex justify-center w-full">
|
<div class="flex justify-center w-full">
|
||||||
<router-link
|
<router-link
|
||||||
|
v-if="veriClaim.id"
|
||||||
:to="'/claim-cert/' + encodeURIComponent(veriClaim.id)"
|
:to="'/claim-cert/' + encodeURIComponent(veriClaim.id)"
|
||||||
class="text-blue-500 mt-2"
|
class="text-blue-500 mt-2"
|
||||||
title="Printable Certificate"
|
title="Printable Certificate"
|
||||||
@@ -292,12 +293,17 @@
|
|||||||
<div class="text-sm">
|
<div class="text-sm">
|
||||||
{{ didInfo(confirmerId) }}
|
{{ didInfo(confirmerId) }}
|
||||||
<span v-if="!serverUtil.isEmptyOrHiddenDid(confirmerId)">
|
<span v-if="!serverUtil.isEmptyOrHiddenDid(confirmerId)">
|
||||||
<a :href="`/did/${confirmerId}`" class="text-blue-500">
|
<router-link
|
||||||
|
:to="{
|
||||||
|
path: '/did/' + encodeURIComponent(confirmerId),
|
||||||
|
}"
|
||||||
|
class="text-blue-500"
|
||||||
|
>
|
||||||
<font-awesome
|
<font-awesome
|
||||||
icon="arrow-up-right-from-square"
|
icon="arrow-up-right-from-square"
|
||||||
class="fa-fw"
|
class="fa-fw"
|
||||||
/>
|
/>
|
||||||
</a>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -329,12 +335,17 @@
|
|||||||
<div class="text-sm">
|
<div class="text-sm">
|
||||||
{{ didInfo(confsVisibleTo) }}
|
{{ didInfo(confsVisibleTo) }}
|
||||||
<span v-if="!serverUtil.isEmptyOrHiddenDid(confsVisibleTo)">
|
<span v-if="!serverUtil.isEmptyOrHiddenDid(confsVisibleTo)">
|
||||||
<a :href="`/did/${confsVisibleTo}`" class="text-blue-500">
|
<router-link
|
||||||
|
:to="{
|
||||||
|
path: '/did/' + encodeURIComponent(confsVisibleTo),
|
||||||
|
}"
|
||||||
|
class="text-blue-500"
|
||||||
|
>
|
||||||
<font-awesome
|
<font-awesome
|
||||||
icon="arrow-up-right-from-square"
|
icon="arrow-up-right-from-square"
|
||||||
class="fa-fw"
|
class="fa-fw"
|
||||||
/>
|
/>
|
||||||
</a>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -443,12 +454,17 @@
|
|||||||
<span>
|
<span>
|
||||||
{{ didInfo(visDid) }}
|
{{ didInfo(visDid) }}
|
||||||
<span v-if="!serverUtil.isEmptyOrHiddenDid(visDid)">
|
<span v-if="!serverUtil.isEmptyOrHiddenDid(visDid)">
|
||||||
<a :href="`/did/${visDid}`" class="text-blue-500">
|
<router-link
|
||||||
|
:to="{
|
||||||
|
path: '/did/' + encodeURIComponent(visDid),
|
||||||
|
}"
|
||||||
|
class="text-blue-500"
|
||||||
|
>
|
||||||
<font-awesome
|
<font-awesome
|
||||||
icon="arrow-up-right-from-square"
|
icon="arrow-up-right-from-square"
|
||||||
class="fa-fw"
|
class="fa-fw"
|
||||||
/>
|
/>
|
||||||
</a>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="veriClaim.publicUrls?.[visDid]"
|
<span v-if="veriClaim.publicUrls?.[visDid]"
|
||||||
>, found at <a
|
>, found at <a
|
||||||
@@ -925,7 +941,7 @@ export default class ClaimView extends Vue {
|
|||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.axios,
|
this.axios,
|
||||||
);
|
);
|
||||||
if (result.type === "success") {
|
if (result.success) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
|
|||||||
@@ -407,14 +407,14 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2 ml-2">
|
<div class="mt-2 ml-2">
|
||||||
<a
|
<router-link
|
||||||
v-if="isRegistered"
|
v-if="isRegistered"
|
||||||
class="text-blue-500 cursor-pointer"
|
class="text-blue-500 cursor-pointer"
|
||||||
:href="urlForNewGive"
|
:to="urlForNewGive"
|
||||||
>
|
>
|
||||||
<font-awesome icon="file-lines" />
|
<font-awesome icon="file-lines" />
|
||||||
Record a Give Similar to the Original
|
Record a Give Similar to the Original
|
||||||
</a>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -831,7 +831,7 @@ export default class ConfirmGiftView extends Vue {
|
|||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.axios,
|
this.axios,
|
||||||
);
|
);
|
||||||
if (result.type === "success") {
|
if (result.success) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
|
|||||||
@@ -788,7 +788,7 @@ export default class DiscoverView extends Vue {
|
|||||||
const route = {
|
const route = {
|
||||||
path: this.isProjectsActive
|
path: this.isProjectsActive
|
||||||
? "/project/" + encodeURIComponent(id)
|
? "/project/" + encodeURIComponent(id)
|
||||||
: "/userProfile/" + encodeURIComponent(id),
|
: "/user-profile/" + encodeURIComponent(id),
|
||||||
};
|
};
|
||||||
this.$router.push(route);
|
this.$router.push(route);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -826,7 +826,7 @@ export default class GiftedDetails extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
const errorMessage = this.getGiveCreationErrorMessage(result);
|
const errorMessage = result.error;
|
||||||
logger.error("Error with give creation result:", result);
|
logger.error("Error with give creation result:", result);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
@@ -899,19 +899,6 @@ export default class GiftedDetails extends Vue {
|
|||||||
|
|
||||||
// Helper functions for readability
|
// Helper functions for readability
|
||||||
|
|
||||||
/**
|
|
||||||
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
|
||||||
* @returns best guess at an error message
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
getGiveCreationErrorMessage(result: any) {
|
|
||||||
return (
|
|
||||||
result.error?.userMessage ||
|
|
||||||
result.error?.error ||
|
|
||||||
result.response?.data?.error?.message
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
explainData() {
|
explainData() {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
<!-- eslint-disable prettier/prettier max-len -->
|
<!-- eslint-disable prettier/prettier max-len -->
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p>
|
||||||
This app focuses on gifts & gratitude, using them to build cool things together with your network.
|
This app focuses on raw gratitude, using it to build cool things together with your network.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="ml-4">
|
<p class="ml-4">
|
||||||
If you'd like to see the page-by-page help,
|
If you'd like to see the page-by-page help again,
|
||||||
<span
|
<span
|
||||||
class="text-blue-500 cursor-pointer"
|
class="text-blue-500 cursor-pointer"
|
||||||
@click="unsetFinishedOnboarding()"
|
@click="unsetFinishedOnboarding()"
|
||||||
@@ -555,9 +555,6 @@
|
|||||||
initiative.
|
initiative.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 class="text-xl font-semibold">What app version is this?</h2>
|
|
||||||
<p>{{ package.version }} ({{ commitHash }})</p>
|
|
||||||
|
|
||||||
<h2 class="text-xl font-semibold">
|
<h2 class="text-xl font-semibold">
|
||||||
I have other questions or feedback, like getting a new profile or removing my data or requesting an improvement.
|
I have other questions or feedback, like getting a new profile or removing my data or requesting an improvement.
|
||||||
</h2>
|
</h2>
|
||||||
@@ -567,6 +564,28 @@
|
|||||||
>info@TimeSafari.app</a
|
>info@TimeSafari.app</a
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h2 class="text-xl font-semibold">What app version is this?</h2>
|
||||||
|
<p>{{ package.version }} ({{ commitHash }})</p>
|
||||||
|
|
||||||
|
<div v-if="Capacitor.isNativePlatform()">
|
||||||
|
<h2 class="text-xl font-semibold">
|
||||||
|
Do I have the latest version?
|
||||||
|
</h2>
|
||||||
|
<p v-if="Capacitor.getPlatform() === 'ios'">
|
||||||
|
<a href="https://apps.apple.com/us/app/time-safari/id6742664907" target="_blank" class="text-blue-500">
|
||||||
|
Check the App Store.
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p v-else-if="Capacitor.getPlatform() === 'android'">
|
||||||
|
<a href="https://timesafari.app/app.apk" target="_blank" class="text-blue-500">
|
||||||
|
Download the latest APK to see.
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p v-else>
|
||||||
|
Sorry, your platform of '{{ Capacitor.getPlatform() }}' is not recognized.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- eslint enable -->
|
<!-- eslint enable -->
|
||||||
</section>
|
</section>
|
||||||
@@ -603,6 +622,7 @@ export default class HelpView extends Vue {
|
|||||||
showVerifiable = false;
|
showVerifiable = false;
|
||||||
|
|
||||||
APP_SERVER = APP_SERVER;
|
APP_SERVER = APP_SERVER;
|
||||||
|
Capacitor = Capacitor;
|
||||||
|
|
||||||
// Ideally, we put no functionality in here, especially in the setup,
|
// Ideally, we put no functionality in here, especially in the setup,
|
||||||
// because we never want this page to have a chance of throwing an error.
|
// because we never want this page to have a chance of throwing an error.
|
||||||
|
|||||||
@@ -1843,7 +1843,7 @@ export default class HomeView extends Vue {
|
|||||||
this.axios,
|
this.axios,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.type === "success") {
|
if (result.success) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
|
|||||||
@@ -52,16 +52,24 @@
|
|||||||
icon="user"
|
icon="user"
|
||||||
class="fa-fw text-slate-400"
|
class="fa-fw text-slate-400"
|
||||||
></font-awesome>
|
></font-awesome>
|
||||||
|
<span class="truncate inline-block max-w-[calc(100%-2rem)]">
|
||||||
{{ issuerInfoObject?.displayName }}
|
{{ issuerInfoObject?.displayName }}
|
||||||
<span v-if="!serverUtil.isEmptyOrHiddenDid(issuer)">
|
</span>
|
||||||
<a :href="`/did/${issuer}`" class="text-blue-500">
|
<span class="inline-flex items-center">
|
||||||
|
<router-link
|
||||||
|
:to="{
|
||||||
|
path: '/did/' + encodeURIComponent(issuer),
|
||||||
|
}"
|
||||||
|
class="text-blue-500 ml-1"
|
||||||
|
title="See more about this person"
|
||||||
|
>
|
||||||
<font-awesome
|
<font-awesome
|
||||||
icon="arrow-up-right-from-square"
|
icon="arrow-up-right-from-square"
|
||||||
class="fa-fw"
|
class="fa-fw"
|
||||||
/>
|
/>
|
||||||
</a>
|
</router-link>
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="serverUtil.isHiddenDid(issuer)">
|
<span v-if="serverUtil.isHiddenDid(issuer)" class="ml-1">
|
||||||
<font-awesome
|
<font-awesome
|
||||||
icon="info-circle"
|
icon="info-circle"
|
||||||
class="fa-fw text-blue-500 cursor-pointer"
|
class="fa-fw text-blue-500 cursor-pointer"
|
||||||
@@ -1425,7 +1433,7 @@ export default class ProjectViewView extends Vue {
|
|||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.axios,
|
this.axios,
|
||||||
);
|
);
|
||||||
if (result.type === "success") {
|
if (result.success) {
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ import { Contact } from "../db/tables/contacts";
|
|||||||
import {
|
import {
|
||||||
GenericCredWrapper,
|
GenericCredWrapper,
|
||||||
GenericVerifiableCredential,
|
GenericVerifiableCredential,
|
||||||
ErrorResult,
|
CreateAndSubmitClaimResult,
|
||||||
} from "../interfaces";
|
} from "../interfaces";
|
||||||
import {
|
import {
|
||||||
BVC_MEETUPS_PROJECT_CLAIM_ID,
|
BVC_MEETUPS_PROJECT_CLAIM_ID,
|
||||||
@@ -298,13 +298,13 @@ export default class QuickActionBvcBeginView extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// in parallel, make a confirmation for each selected claim and send them all to the server
|
// in parallel, make a confirmation for each selected claim and send them all to the server
|
||||||
const confirmResults = await Promise.allSettled(
|
const confirmResults: PromiseSettledResult<CreateAndSubmitClaimResult>[] = await Promise.allSettled(
|
||||||
this.claimsToConfirmSelected.map(async (jwtId) => {
|
this.claimsToConfirmSelected.map(async (jwtId) => {
|
||||||
const record = this.claimsToConfirm.find(
|
const record = this.claimsToConfirm.find(
|
||||||
(claim) => claim.id === jwtId,
|
(claim) => claim.id === jwtId,
|
||||||
);
|
);
|
||||||
if (!record) {
|
if (!record) {
|
||||||
return { type: "error", error: "Record not found." };
|
return { success: false, error: "Record not found." };
|
||||||
}
|
}
|
||||||
return createAndSubmitConfirmation(
|
return createAndSubmitConfirmation(
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
@@ -318,8 +318,8 @@ export default class QuickActionBvcBeginView extends Vue {
|
|||||||
);
|
);
|
||||||
// check for any rejected confirmations
|
// check for any rejected confirmations
|
||||||
const confirmsSucceeded = confirmResults.filter(
|
const confirmsSucceeded = confirmResults.filter(
|
||||||
(result) =>
|
// 'fulfilled' is the status in a successful PromiseFulfilledResult
|
||||||
result.status === "fulfilled" && result.value.type === "success",
|
(result) => result.status === "fulfilled" && result.value.success,
|
||||||
);
|
);
|
||||||
if (confirmsSucceeded.length < this.claimsToConfirmSelected.length) {
|
if (confirmsSucceeded.length < this.claimsToConfirmSelected.length) {
|
||||||
logger.error("Error sending confirmations:", confirmResults);
|
logger.error("Error sending confirmations:", confirmResults);
|
||||||
@@ -353,7 +353,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
|||||||
undefined,
|
undefined,
|
||||||
BVC_MEETUPS_PROJECT_CLAIM_ID,
|
BVC_MEETUPS_PROJECT_CLAIM_ID,
|
||||||
);
|
);
|
||||||
giveSucceeded = giveResult.type === "success";
|
giveSucceeded = giveResult.success;
|
||||||
if (!giveSucceeded) {
|
if (!giveSucceeded) {
|
||||||
logger.error("Error sending give:", giveResult);
|
logger.error("Error sending give:", giveResult);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
@@ -362,7 +362,7 @@ export default class QuickActionBvcBeginView extends Vue {
|
|||||||
type: "danger",
|
type: "danger",
|
||||||
title: "Error",
|
title: "Error",
|
||||||
text:
|
text:
|
||||||
(giveResult as ErrorResult)?.error?.userMessage ||
|
(giveResult as CreateAndSubmitClaimResult)?.error ||
|
||||||
"There was an error sending that give.",
|
"There was an error sending that give.",
|
||||||
},
|
},
|
||||||
5000,
|
5000,
|
||||||
|
|||||||
Reference in New Issue
Block a user