Compare commits
111 Commits
sql-absurd
...
matthew-sc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46814ebf5d | ||
|
|
19d189bc6e | ||
|
|
2c71b0a827 | ||
|
|
4745cf8536 | ||
|
|
f4856f48aa | ||
|
|
cc45d9d92e | ||
|
|
d9b168bf2a | ||
|
|
42adfd8174 | ||
|
|
b3cad2cfa1 | ||
|
|
60aa137dab | ||
|
|
e5b622f575 | ||
|
|
a559fd3318 | ||
|
|
4e7dc36ecc | ||
|
|
41142397ec | ||
|
|
fcac13eb7e | ||
|
|
a16f88743a | ||
| 0e6a9c4f89 | |||
|
|
ca22161f12 | ||
|
|
d3b80fbe47 | ||
|
|
0342c872f4 | ||
|
|
a7e65b3b49 | ||
|
|
eb7605991c | ||
| fa21660fd1 | |||
|
|
df1c1f0186 | ||
|
|
3daf1c8a5c | ||
|
|
7eefee1ea5 | ||
|
|
140c36a416 | ||
| f255ea389b | |||
| 0d343b9877 | |||
| df06100c32 | |||
|
|
ac5ddfc6f2 | ||
|
|
89b3f30466 | ||
|
|
3cb5cc096b | ||
|
|
5df560154f | ||
|
|
c1aa522e6c | ||
| a082469a01 | |||
|
|
3544d7278d | ||
|
|
d3110506ea | ||
| 8609f8458d | |||
| 8f5c34bc5f | |||
| b0d61b95ea | |||
| af7bd236a3 | |||
| d719338bcc | |||
| 6ddf2d1012 | |||
|
|
1b2d4b623a | ||
|
|
16d5c917d2 | ||
| 5976a4995e | |||
| dcd0cc4c20 | |||
| b3ca6c9d91 | |||
| e9d800f601 | |||
| b939a5e592 | |||
| aa62037fae | |||
| 722020ea86 | |||
| 96aa3f4a54 | |||
| c0c5f9842b | |||
| be27ca1855 | |||
| 92e4570672 | |||
| 820ae727ed | |||
| dbeb1c6b4b | |||
| 573e4b206a | |||
| abc05d426e | |||
| 2ea7479d75 | |||
| 9ac9713172 | |||
| 41dad3254d | |||
| 485eac59a0 | |||
|
|
73fc32b75d | ||
|
|
3d8e40e92b | ||
| 38e67f3533 | |||
| 7f63ee7c80 | |||
| 6a47f0d3e7 | |||
| fc50a9d4c6 | |||
|
|
45f43ff363 | ||
|
|
7b1d4c4849 | ||
|
|
c1f2c3951a | ||
| 9d4f726c31 | |||
| 1d7f626645 | |||
| c5228ba7ec | |||
| 6e1fcd8dee | |||
| 5bb563d694 | |||
| a3951c9d66 | |||
| aa177a9b8c | |||
| 03cb4720b8 | |||
|
|
0e65431f43 | ||
| 297c5a2dbb | |||
|
|
92b9c9334c | ||
|
|
706182ca0c | ||
|
|
68e0fc4976 | ||
| 504056eb90 | |||
| 5a1007c49c | |||
|
|
cbc14e21ec | ||
|
|
3e02b3924a | ||
|
|
8b03789941 | ||
|
|
b4a6b99301 | ||
|
|
e839997f91 | ||
|
|
d8d054a0e1 | ||
|
|
efc720e47f | ||
|
|
0a85bea533 | ||
|
|
47501ae917 | ||
|
|
28634839ec | ||
|
|
988244b7ae | ||
|
|
4b355a5448 | ||
| 1b7c96ed9b | |||
| 41365fab8f | |||
|
|
b511f9cd24 | ||
|
|
579cecbe6e | ||
| 5cc42be58a | |||
| 3d1a2eeb8d | |||
| 7b0ee2e44e | |||
| ac018997e8 | |||
| 6f449e9c1f | |||
| 543599a6a1 |
@@ -1,101 +0,0 @@
|
|||||||
VM5:29 [Preload] Preload script starting...
|
|
||||||
VM5:29 [Preload] Preload script completed successfully
|
|
||||||
main.common-DiOUyXe7.js:27 Platform Object
|
|
||||||
error @ main.common-DiOUyXe7.js:27
|
|
||||||
main.common-DiOUyXe7.js:27 PWA enabled Object
|
|
||||||
error @ main.common-DiOUyXe7.js:27
|
|
||||||
main.common-DiOUyXe7.js:27 [Web] PWA enabled Object
|
|
||||||
error @ main.common-DiOUyXe7.js:27
|
|
||||||
main.common-DiOUyXe7.js:27 [Web] Platform Object
|
|
||||||
error @ main.common-DiOUyXe7.js:27
|
|
||||||
main.common-DiOUyXe7.js:29 Opened!
|
|
||||||
main.common-DiOUyXe7.js:2552 Failed to log to database: Error: no such column: value
|
|
||||||
at E.handleError (main.common-DiOUyXe7.js:27:21133)
|
|
||||||
at E.exec (main.common-DiOUyXe7.js:27:19785)
|
|
||||||
at Rc.processQueue (main.common-DiOUyXe7.js:2379:2368)
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2552 Original message: PWA enabled - [{"pwa_enabled":false}]
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2552 Failed to log to database: Error: no such column: value
|
|
||||||
at E.handleError (main.common-DiOUyXe7.js:27:21133)
|
|
||||||
at E.exec (main.common-DiOUyXe7.js:27:19785)
|
|
||||||
at Rc.processQueue (main.common-DiOUyXe7.js:2379:2368)
|
|
||||||
at main.common-DiOUyXe7.js:2379:2816
|
|
||||||
at new Promise (<anonymous>)
|
|
||||||
at Rc.queueOperation (main.common-DiOUyXe7.js:2379:2685)
|
|
||||||
at Rc.query (main.common-DiOUyXe7.js:2379:3378)
|
|
||||||
at async F7 (main.common-DiOUyXe7.js:2552:117)
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2552 Original message: [Web] PWA enabled - [{"pwa_enabled":false}]
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2552 Failed to log to database: Error: no such column: value
|
|
||||||
at E.handleError (main.common-DiOUyXe7.js:27:21133)
|
|
||||||
at E.exec (main.common-DiOUyXe7.js:27:19785)
|
|
||||||
at Rc.processQueue (main.common-DiOUyXe7.js:2379:2368)
|
|
||||||
at main.common-DiOUyXe7.js:2379:2816
|
|
||||||
at new Promise (<anonymous>)
|
|
||||||
at Rc.queueOperation (main.common-DiOUyXe7.js:2379:2685)
|
|
||||||
at Rc.query (main.common-DiOUyXe7.js:2379:3378)
|
|
||||||
at async F7 (main.common-DiOUyXe7.js:2552:117)
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2552 Original message: [Web] Platform - [{"platform":"web"}]
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2552 Failed to log to database: Error: no such column: value
|
|
||||||
at E.handleError (main.common-DiOUyXe7.js:27:21133)
|
|
||||||
at E.exec (main.common-DiOUyXe7.js:27:19785)
|
|
||||||
at Rc.processQueue (main.common-DiOUyXe7.js:2379:2368)
|
|
||||||
at main.common-DiOUyXe7.js:2379:2816
|
|
||||||
at new Promise (<anonymous>)
|
|
||||||
at Rc.queueOperation (main.common-DiOUyXe7.js:2379:2685)
|
|
||||||
at Rc.query (main.common-DiOUyXe7.js:2379:3378)
|
|
||||||
at async F7 (main.common-DiOUyXe7.js:2552:117)
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2552 Original message: Platform - [{"platform":"web"}]
|
|
||||||
F7 @ main.common-DiOUyXe7.js:2552
|
|
||||||
main.common-DiOUyXe7.js:2100
|
|
||||||
|
|
||||||
|
|
||||||
GET https://api.endorser.ch/api/report/rateLimits 400 (Bad Request)
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2100
|
|
||||||
xhr @ main.common-DiOUyXe7.js:2100
|
|
||||||
p6 @ main.common-DiOUyXe7.js:2102
|
|
||||||
_request @ main.common-DiOUyXe7.js:2103
|
|
||||||
request @ main.common-DiOUyXe7.js:2102
|
|
||||||
Yc.<computed> @ main.common-DiOUyXe7.js:2103
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2098
|
|
||||||
dJ @ main.common-DiOUyXe7.js:2295
|
|
||||||
main.common-DiOUyXe7.js:2100
|
|
||||||
|
|
||||||
|
|
||||||
GET https://api.endorser.ch/api/report/rateLimits 400 (Bad Request)
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2100
|
|
||||||
xhr @ main.common-DiOUyXe7.js:2100
|
|
||||||
p6 @ main.common-DiOUyXe7.js:2102
|
|
||||||
_request @ main.common-DiOUyXe7.js:2103
|
|
||||||
request @ main.common-DiOUyXe7.js:2102
|
|
||||||
Yc.<computed> @ main.common-DiOUyXe7.js:2103
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2098
|
|
||||||
dJ @ main.common-DiOUyXe7.js:2295
|
|
||||||
await in dJ
|
|
||||||
checkRegistrationStatus @ HomeView-DJMSCuMg.js:1
|
|
||||||
mounted @ HomeView-DJMSCuMg.js:1
|
|
||||||
XMLHttpRequest.send
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2100
|
|
||||||
xhr @ main.common-DiOUyXe7.js:2100
|
|
||||||
p6 @ main.common-DiOUyXe7.js:2102
|
|
||||||
_request @ main.common-DiOUyXe7.js:2103
|
|
||||||
request @ main.common-DiOUyXe7.js:2102
|
|
||||||
Yc.<computed> @ main.common-DiOUyXe7.js:2103
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2098
|
|
||||||
ZG @ main.common-DiOUyXe7.js:2295
|
|
||||||
await in ZG
|
|
||||||
initializeIdentity @ HomeView-DJMSCuMg.js:1
|
|
||||||
XMLHttpRequest.send
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2100
|
|
||||||
xhr @ main.common-DiOUyXe7.js:2100
|
|
||||||
p6 @ main.common-DiOUyXe7.js:2102
|
|
||||||
_request @ main.common-DiOUyXe7.js:2103
|
|
||||||
request @ main.common-DiOUyXe7.js:2102
|
|
||||||
Yc.<computed> @ main.common-DiOUyXe7.js:2103
|
|
||||||
(anonymous) @ main.common-DiOUyXe7.js:2098
|
|
||||||
dJ @ main.common-DiOUyXe7.js:2295
|
|
||||||
6
.cursor/rules/development_aids.mdc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
description:
|
||||||
|
globs:
|
||||||
|
alwaysApply: true
|
||||||
|
---
|
||||||
|
use the system date function to understand the proper date and time for all interactions.
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# iOS doesn't like spaces in the app title.
|
# iOS doesn't like spaces in the app title.
|
||||||
TIME_SAFARI_APP_TITLE="TimeSafari_Dev"
|
TIME_SAFARI_APP_TITLE="TimeSafari_Dev"
|
||||||
VITE_APP_SERVER=http://localhost:3000
|
VITE_APP_SERVER=http://localhost:8080
|
||||||
# This is the claim ID for actions in the BVC project, with the JWT ID on this environment (not production).
|
# This is the claim ID for actions in the BVC project, with the JWT ID on this environment (not production).
|
||||||
VITE_BVC_MEETUPS_PROJECT_CLAIM_ID=https://endorser.ch/entity/01HWE8FWHQ1YGP7GFZYYPS272F
|
VITE_BVC_MEETUPS_PROJECT_CLAIM_ID=https://endorser.ch/entity/01HWE8FWHQ1YGP7GFZYYPS272F
|
||||||
VITE_DEFAULT_ENDORSER_API_SERVER=http://localhost:3000
|
VITE_DEFAULT_ENDORSER_API_SERVER=http://localhost:3000
|
||||||
|
|||||||
5
.gitignore
vendored
@@ -51,6 +51,7 @@ vendor/
|
|||||||
# Build logs
|
# Build logs
|
||||||
build_logs/
|
build_logs/
|
||||||
|
|
||||||
android/app/src/main/assets/public
|
# PWA icon files generated by capacitor-assets
|
||||||
android/app/src/main/res
|
icons
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
69
BUILDING.md
@@ -9,19 +9,6 @@ For a quick dev environment setup, use [pkgx](https://pkgx.dev).
|
|||||||
- Node.js (LTS version recommended)
|
- Node.js (LTS version recommended)
|
||||||
- npm (comes with Node.js)
|
- npm (comes with Node.js)
|
||||||
- Git
|
- Git
|
||||||
- For Android builds: Android Studio with SDK installed
|
|
||||||
- For iOS builds: macOS with Xcode and ruby gems & bundle
|
|
||||||
- `pkgx +rubygems.org sh`
|
|
||||||
|
|
||||||
- ... and you may have to fix these, especially with pkgx
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gem_path=$(which gem)
|
|
||||||
shortened_path="${gem_path:h:h}"
|
|
||||||
export GEM_HOME=$shortened_path
|
|
||||||
export GEM_PATH=$shortened_path
|
|
||||||
```
|
|
||||||
|
|
||||||
- For desktop builds: Additional build tools based on your OS
|
- For desktop builds: Additional build tools based on your OS
|
||||||
|
|
||||||
## Forks
|
## Forks
|
||||||
@@ -326,6 +313,32 @@ npm run build:electron-prod && npm run electron:start
|
|||||||
|
|
||||||
Prerequisites: macOS with Xcode installed
|
Prerequisites: macOS with Xcode installed
|
||||||
|
|
||||||
|
#### First-time iOS Configuration
|
||||||
|
|
||||||
|
- Generate certificates inside XCode.
|
||||||
|
|
||||||
|
- Right-click on App and under Signing & Capabilities set the Team.
|
||||||
|
|
||||||
|
#### Each Release
|
||||||
|
|
||||||
|
0. First time (or if XCode dependencies change):
|
||||||
|
|
||||||
|
- `pkgx +rubygems.org sh`
|
||||||
|
|
||||||
|
- ... and you may have to fix these, especially with pkgx
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gem_path=$(which gem)
|
||||||
|
shortened_path="${gem_path:h:h}"
|
||||||
|
export GEM_HOME=$shortened_path
|
||||||
|
export GEM_PATH=$shortened_path
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ios/App
|
||||||
|
pod install
|
||||||
|
```
|
||||||
|
|
||||||
1. Build the web assets:
|
1. Build the web assets:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -334,6 +347,7 @@ Prerequisites: macOS with Xcode installed
|
|||||||
npm run build:capacitor
|
npm run build:capacitor
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
2. Update iOS project with latest build:
|
2. Update iOS project with latest build:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -345,7 +359,11 @@ Prerequisites: macOS with Xcode installed
|
|||||||
3. Copy the assets:
|
3. Copy the assets:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# It makes no sense why capacitor-assets will not run without these but it actually changes the contents.
|
||||||
mkdir -p ios/App/App/Assets.xcassets/AppIcon.appiconset
|
mkdir -p ios/App/App/Assets.xcassets/AppIcon.appiconset
|
||||||
|
echo '{"images":[]}' > ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json
|
||||||
|
mkdir -p ios/App/App/Assets.xcassets/Splash.imageset
|
||||||
|
echo '{"images":[]}' > ios/App/App/Assets.xcassets/Splash.imageset/Contents.json
|
||||||
npx capacitor-assets generate --ios
|
npx capacitor-assets generate --ios
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -353,10 +371,10 @@ Prerequisites: macOS with Xcode installed
|
|||||||
|
|
||||||
```
|
```
|
||||||
cd ios/App
|
cd ios/App
|
||||||
xcrun agvtool new-version 15
|
xcrun agvtool new-version 25
|
||||||
# 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.4.5;/g" > temp
|
cat App.xcodeproj/project.pbxproj | sed "s/MARKETING_VERSION = .*;/MARKETING_VERSION = 0.5.1;/g" > temp
|
||||||
mv temp App.xcodeproj/project.pbxproj
|
mv temp App.xcodeproj/project.pbxproj
|
||||||
cd -
|
cd -
|
||||||
```
|
```
|
||||||
@@ -369,28 +387,25 @@ Prerequisites: macOS with Xcode installed
|
|||||||
|
|
||||||
6. Use Xcode to build and run on simulator or device.
|
6. Use Xcode to build and run on simulator or device.
|
||||||
|
|
||||||
|
* Select Product -> Destination with some Simulator version. Then click the run arrow.
|
||||||
|
|
||||||
7. Release
|
7. Release
|
||||||
|
|
||||||
* Under "General" renamed a bunch of things to "Time Safari"
|
* Someday: Under "General" we want to rename a bunch of things to "Time Safari"
|
||||||
* Choose Product -> Destination -> Build Any iOS
|
* Choose Product -> Destination -> Any iOS Device
|
||||||
* Choose Product -> Archive
|
* Choose Product -> Archive
|
||||||
* This will trigger a build and take time, needing user's "login" keychain password which is just their login password, repeatedly.
|
* This will trigger a build and take time, needing user's "login" keychain password (user's login password), repeatedly.
|
||||||
* If it fails with `building for 'iOS', but linking in dylib (.../.pkgx/zlib.net/v1.3.0/lib/libz.1.3.dylib) built for 'macOS'` then run XCode outside that terminal (ie. not with `npx cap open ios`).
|
* If it fails with `building for 'iOS', but linking in dylib (.../.pkgx/zlib.net/v1.3.0/lib/libz.1.3.dylib) built for 'macOS'` then run XCode outside that terminal (ie. not with `npx cap open ios`).
|
||||||
* Click Distribute -> App Store Connect
|
* Click Distribute -> App Store Connect
|
||||||
* In AppStoreConnect, add the build to the distribution: remove the current build with the "-" when you hover over it, then "Add Build" with the new build.
|
* In AppStoreConnect, add the build to the distribution: remove the current build with the "-" when you hover over it, then "Add Build" with the new build.
|
||||||
|
* May have to go to App Review, click Submission, then hover over the build and click "-".
|
||||||
* 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".
|
||||||
|
|
||||||
#### First-time iOS Configuration
|
|
||||||
|
|
||||||
- Generate certificates inside XCode.
|
|
||||||
|
|
||||||
- Right-click on App and under Signing & Capabilities set the Team.
|
|
||||||
|
|
||||||
### Android Build
|
### Android Build
|
||||||
|
|
||||||
Prerequisites: Android Studio with SDK installed
|
Prerequisites: Android Studio with Java SDK installed
|
||||||
|
|
||||||
1. Build the web assets:
|
1. Build the web assets:
|
||||||
|
|
||||||
@@ -445,7 +460,9 @@ Prerequisites: Android Studio with SDK installed
|
|||||||
* Then `bundleRelease`:
|
* Then `bundleRelease`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
cd android
|
||||||
./gradlew bundleRelease -Dlint.baselines.continue=true
|
./gradlew bundleRelease -Dlint.baselines.continue=true
|
||||||
|
cd -
|
||||||
```
|
```
|
||||||
|
|
||||||
... and find your `aab` file at app/build/outputs/bundle/release
|
... and find your `aab` file at app/build/outputs/bundle/release
|
||||||
@@ -458,6 +475,8 @@ At play.google.com/console:
|
|||||||
- Hit "Next".
|
- Hit "Next".
|
||||||
- Save, go to "Publishing Overview" as prompted, and click "Send changes for review".
|
- Save, go to "Publishing Overview" as prompted, and click "Send changes for review".
|
||||||
|
|
||||||
|
- 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
|
## First-time Android Configuration for deep links
|
||||||
|
|
||||||
|
|||||||
538
CEFPython-Survey.md
Normal file
@@ -0,0 +1,538 @@
|
|||||||
|
# CEFPython Implementation Survey for TimeSafari
|
||||||
|
|
||||||
|
**Author:** Matthew Raymer
|
||||||
|
**Date:** December 2025
|
||||||
|
**Project:** TimeSafari Cross-Platform Desktop Implementation
|
||||||
|
|
||||||
|
## Executive Summary
|
||||||
|
|
||||||
|
This survey evaluates implementing CEFPython as an additional desktop platform for TimeSafari, with full integration into the existing migration system used by Capacitor and native web platforms.
|
||||||
|
|
||||||
|
### Key Findings
|
||||||
|
|
||||||
|
**Feasibility:** ✅ **Highly Feasible** - CEFPython can integrate seamlessly with TimeSafari's existing architecture
|
||||||
|
|
||||||
|
**Migration System Compatibility:** ✅ **Full Compatibility** - Can use the exact same `migration.ts` system as Capacitor and web
|
||||||
|
|
||||||
|
**Performance:** ✅ **Excellent** - Native Python backend with Chromium rendering engine
|
||||||
|
|
||||||
|
**Security:** ✅ **Strong** - Chromium's security model with Python backend isolation
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Architecture Overview
|
||||||
|
|
||||||
|
### 1.1 Current Platform Architecture
|
||||||
|
|
||||||
|
TimeSafari uses a sophisticated cross-platform architecture with shared codebase and platform-specific implementations:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
src/
|
||||||
|
├── main.common.ts # Shared initialization
|
||||||
|
├── main.web.ts # Web/PWA entry point
|
||||||
|
├── main.capacitor.ts # Mobile entry point
|
||||||
|
├── main.electron.ts # Electron entry point
|
||||||
|
├── main.pywebview.ts # PyWebView entry point
|
||||||
|
├── main.cefpython.ts # NEW: CEFPython entry point
|
||||||
|
├── services/
|
||||||
|
│ ├── PlatformService.ts # Platform abstraction interface
|
||||||
|
│ ├── PlatformServiceFactory.ts
|
||||||
|
│ └── platforms/
|
||||||
|
│ ├── WebPlatformService.ts
|
||||||
|
│ ├── CapacitorPlatformService.ts
|
||||||
|
│ ├── ElectronPlatformService.ts
|
||||||
|
│ ├── PyWebViewPlatformService.ts
|
||||||
|
│ └── CEFPythonPlatformService.ts # NEW
|
||||||
|
└── cefpython/ # NEW: CEFPython backend
|
||||||
|
├── main.py
|
||||||
|
├── handlers/
|
||||||
|
│ ├── database.py # SQLite with migration support
|
||||||
|
│ ├── crypto.py # Cryptographic operations
|
||||||
|
│ └── api.py # API server integration
|
||||||
|
└── bridge/
|
||||||
|
└── javascript_bridge.py # JS-Python communication
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.2 Migration System Integration
|
||||||
|
|
||||||
|
**Key Insight:** CEFPython can use the exact same migration system as Capacitor and web platforms:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// src/main.cefpython.ts - CEFPython entry point
|
||||||
|
import { initializeApp } from "./main.common";
|
||||||
|
import { runMigrations } from "./db-sql/migration";
|
||||||
|
import { CEFPythonPlatformService } from "./services/platforms/CEFPythonPlatformService";
|
||||||
|
|
||||||
|
const app = initializeApp();
|
||||||
|
|
||||||
|
// Initialize CEFPython platform service
|
||||||
|
const platformService = new CEFPythonPlatformService();
|
||||||
|
|
||||||
|
// Run migrations using the same system as Capacitor
|
||||||
|
async function initializeDatabase() {
|
||||||
|
const sqlExec = (sql: string) => platformService.dbExecute(sql);
|
||||||
|
const sqlQuery = (sql: string) => platformService.dbQuery(sql);
|
||||||
|
const extractMigrationNames = (result: any) => {
|
||||||
|
const names = result.values?.map((row: any) => row.name) || [];
|
||||||
|
return new Set(names);
|
||||||
|
};
|
||||||
|
|
||||||
|
await runMigrations(sqlExec, sqlQuery, extractMigrationNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize database before mounting app
|
||||||
|
initializeDatabase().then(() => {
|
||||||
|
app.mount("#app");
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Python Backend Implementation
|
||||||
|
|
||||||
|
### 2.1 Database Handler with Migration Support
|
||||||
|
|
||||||
|
```python
|
||||||
|
# src/cefpython/handlers/database.py
|
||||||
|
import sqlite3
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import List, Dict, Any
|
||||||
|
|
||||||
|
class DatabaseHandler:
|
||||||
|
def __init__(self):
|
||||||
|
self.db_path = self._get_db_path()
|
||||||
|
self.connection = sqlite3.connect(str(self.db_path))
|
||||||
|
self.connection.row_factory = sqlite3.Row
|
||||||
|
|
||||||
|
# Configure for better performance
|
||||||
|
self.connection.execute("PRAGMA journal_mode=WAL;")
|
||||||
|
self.connection.execute("PRAGMA synchronous=NORMAL;")
|
||||||
|
|
||||||
|
def query(self, sql: str, params: List[Any] = None) -> Dict[str, Any]:
|
||||||
|
"""Execute SQL query and return results in Capacitor-compatible format"""
|
||||||
|
cursor = self.connection.cursor()
|
||||||
|
|
||||||
|
if params:
|
||||||
|
cursor.execute(sql, params)
|
||||||
|
else:
|
||||||
|
cursor.execute(sql)
|
||||||
|
|
||||||
|
if sql.strip().upper().startswith('SELECT'):
|
||||||
|
columns = [description[0] for description in cursor.description]
|
||||||
|
rows = []
|
||||||
|
for row in cursor.fetchall():
|
||||||
|
rows.append(dict(zip(columns, row)))
|
||||||
|
return {'values': rows} # Match Capacitor format
|
||||||
|
else:
|
||||||
|
self.connection.commit()
|
||||||
|
return {'affected_rows': cursor.rowcount}
|
||||||
|
|
||||||
|
def execute(self, sql: string, params: List[Any] = None) -> Dict[str, Any]:
|
||||||
|
"""Execute SQL statement (for INSERT, UPDATE, DELETE, CREATE)"""
|
||||||
|
cursor = self.connection.cursor()
|
||||||
|
|
||||||
|
if params:
|
||||||
|
cursor.execute(sql, params)
|
||||||
|
else:
|
||||||
|
cursor.execute(sql)
|
||||||
|
|
||||||
|
self.connection.commit()
|
||||||
|
|
||||||
|
return {
|
||||||
|
'changes': {
|
||||||
|
'changes': cursor.rowcount,
|
||||||
|
'lastId': cursor.lastrowid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2.2 Platform Service Implementation
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// src/services/platforms/CEFPythonPlatformService.ts
|
||||||
|
import { PlatformService } from '../PlatformService';
|
||||||
|
import { runMigrations } from '@/db-sql/migration';
|
||||||
|
|
||||||
|
export class CEFPythonPlatformService implements PlatformService {
|
||||||
|
private bridge: any;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.bridge = (window as any).cefBridge;
|
||||||
|
if (!this.bridge) {
|
||||||
|
throw new Error('CEFPython bridge not available');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Database operations using the same interface as Capacitor
|
||||||
|
async dbQuery(sql: string, params?: any[]): Promise<any> {
|
||||||
|
const result = await this.bridge.call('database', 'query', sql, params || []);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
async dbExecute(sql: string, params?: any[]): Promise<any> {
|
||||||
|
const result = await this.bridge.call('database', 'execute', sql, params || []);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Migration system integration
|
||||||
|
async runMigrations(): Promise<void> {
|
||||||
|
const sqlExec: (sql: string) => Promise<any> = this.dbExecute.bind(this);
|
||||||
|
const sqlQuery: (sql: string) => Promise<any> = this.dbQuery.bind(this);
|
||||||
|
const extractMigrationNames: (result: any) => Set<string> = (result) => {
|
||||||
|
const names = result.values?.map((row: any) => row.name) || [];
|
||||||
|
return new Set(names);
|
||||||
|
};
|
||||||
|
|
||||||
|
await runMigrations(sqlExec, sqlQuery, extractMigrationNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Platform detection
|
||||||
|
isCEFPython(): boolean {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCapabilities(): PlatformCapabilities {
|
||||||
|
return {
|
||||||
|
hasCamera: true,
|
||||||
|
hasFileSystem: true,
|
||||||
|
hasNotifications: true,
|
||||||
|
hasSQLite: true,
|
||||||
|
hasCrypto: true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Migration System Compatibility
|
||||||
|
|
||||||
|
### 3.1 Key Advantage
|
||||||
|
|
||||||
|
**CEFPython can use the exact same migration system as Capacitor:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Both Capacitor and CEFPython use the same migration.ts
|
||||||
|
import { runMigrations } from '@/db-sql/migration';
|
||||||
|
|
||||||
|
// Capacitor implementation
|
||||||
|
const sqlExec: (sql: string) => Promise<capSQLiteChanges> = this.db.execute.bind(this.db);
|
||||||
|
const sqlQuery: (sql: string) => Promise<DBSQLiteValues> = this.db.query.bind(this.db);
|
||||||
|
|
||||||
|
// CEFPython implementation
|
||||||
|
const sqlExec: (sql: string) => Promise<any> = this.dbExecute.bind(this);
|
||||||
|
const sqlQuery: (sql: string) => Promise<any> = this.dbQuery.bind(this);
|
||||||
|
|
||||||
|
// Both use the same migration runner
|
||||||
|
await runMigrations(sqlExec, sqlQuery, extractMigrationNames);
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.2 Database Format Compatibility
|
||||||
|
|
||||||
|
The Python database handler returns data in the same format as Capacitor:
|
||||||
|
|
||||||
|
```python
|
||||||
|
# Python returns Capacitor-compatible format
|
||||||
|
def query(self, sql: str, params: List[Any] = None) -> Dict[str, Any]:
|
||||||
|
# ... execute query ...
|
||||||
|
return {
|
||||||
|
'values': [
|
||||||
|
{'name': '001_initial', 'executed_at': '2025-01-01'},
|
||||||
|
{'name': '002_add_contacts', 'executed_at': '2025-01-02'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This matches the Capacitor format:
|
||||||
|
```typescript
|
||||||
|
// Capacitor returns same format
|
||||||
|
const result = await this.db.query("SELECT name FROM migrations");
|
||||||
|
// result = { values: [{ name: '001_initial' }, { name: '002_add_contacts' }] }
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Build Configuration
|
||||||
|
|
||||||
|
### 4.1 Vite Configuration
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// vite.config.cefpython.mts
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
import { createBuildConfig } from './vite.config.common.mts';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
...createBuildConfig('cefpython'),
|
||||||
|
|
||||||
|
define: {
|
||||||
|
'process.env.VITE_PLATFORM': JSON.stringify('cefpython'),
|
||||||
|
'process.env.VITE_PWA_ENABLED': JSON.stringify(false),
|
||||||
|
__IS_MOBILE__: JSON.stringify(false),
|
||||||
|
__USE_QR_READER__: JSON.stringify(true)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4.2 Package.json Scripts
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"build:cefpython": "vite build --config vite.config.cefpython.mts",
|
||||||
|
"dev:cefpython": "concurrently \"npm run dev:web\" \"python src/cefpython/main.py --dev\"",
|
||||||
|
"test:cefpython": "python -m pytest tests/cefpython/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4.3 Python Requirements
|
||||||
|
|
||||||
|
```txt
|
||||||
|
# requirements-cefpython.txt
|
||||||
|
cefpython3>=66.1
|
||||||
|
cryptography>=3.4.0
|
||||||
|
requests>=2.25.0
|
||||||
|
pyinstaller>=4.0
|
||||||
|
pytest>=6.0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Platform Service Factory Integration
|
||||||
|
|
||||||
|
### 5.1 Updated Factory
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// src/services/PlatformServiceFactory.ts
|
||||||
|
import { CEFPythonPlatformService } from './platforms/CEFPythonPlatformService';
|
||||||
|
|
||||||
|
export function createPlatformService(platform: string): PlatformService {
|
||||||
|
switch (platform) {
|
||||||
|
case 'web':
|
||||||
|
return new WebPlatformService();
|
||||||
|
case 'capacitor':
|
||||||
|
return new CapacitorPlatformService();
|
||||||
|
case 'electron':
|
||||||
|
return new ElectronPlatformService();
|
||||||
|
case 'pywebview':
|
||||||
|
return new PyWebViewPlatformService();
|
||||||
|
case 'cefpython':
|
||||||
|
return new CEFPythonPlatformService(); // NEW
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform: ${platform}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Performance and Security Analysis
|
||||||
|
|
||||||
|
### 6.1 Performance Comparison
|
||||||
|
|
||||||
|
| Metric | Electron | PyWebView | CEFPython | Notes |
|
||||||
|
|--------|----------|-----------|-----------|-------|
|
||||||
|
| **Memory Usage** | 150-200MB | 80-120MB | 100-150MB | CEFPython more efficient than Electron |
|
||||||
|
| **Startup Time** | 3-5s | 2-3s | 2-4s | Similar to PyWebView |
|
||||||
|
| **Database Performance** | Good | Good | Excellent | Native SQLite |
|
||||||
|
| **Crypto Performance** | Good | Good | Excellent | Native Python crypto |
|
||||||
|
| **Bundle Size** | 120-150MB | 50-80MB | 80-120MB | Smaller than Electron |
|
||||||
|
|
||||||
|
### 6.2 Security Features
|
||||||
|
|
||||||
|
```python
|
||||||
|
# src/cefpython/utils/security.py
|
||||||
|
class SecurityManager:
|
||||||
|
def __init__(self):
|
||||||
|
self.blocked_domains = set(['malicious-site.com'])
|
||||||
|
self.allowed_schemes = {'https', 'http', 'file'}
|
||||||
|
|
||||||
|
def validate_network_access(self, url: str) -> bool:
|
||||||
|
"""Validate if network access is allowed"""
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
parsed = urlparse(url)
|
||||||
|
|
||||||
|
# Check blocked domains
|
||||||
|
if parsed.hostname in self.blocked_domains:
|
||||||
|
return False
|
||||||
|
|
||||||
|
# Allow HTTPS only for external domains
|
||||||
|
if parsed.scheme != 'https' and parsed.hostname != 'localhost':
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Migration Strategy
|
||||||
|
|
||||||
|
### 7.1 Phase 1: Foundation (Week 1-2)
|
||||||
|
|
||||||
|
**Objectives:**
|
||||||
|
- Set up CEFPython development environment
|
||||||
|
- Create basic application structure
|
||||||
|
- Implement database handler with migration support
|
||||||
|
- Establish JavaScript-Python bridge
|
||||||
|
|
||||||
|
**Deliverables:**
|
||||||
|
- [ ] Basic CEFPython application that loads TimeSafari web app
|
||||||
|
- [ ] Database handler with SQLite integration
|
||||||
|
- [ ] Migration system integration
|
||||||
|
- [ ] JavaScript bridge for communication
|
||||||
|
|
||||||
|
### 7.2 Phase 2: Platform Integration (Week 3-4)
|
||||||
|
|
||||||
|
**Objectives:**
|
||||||
|
- Implement CEFPython platform service
|
||||||
|
- Integrate with existing migration system
|
||||||
|
- Test database operations with real data
|
||||||
|
- Validate migration compatibility
|
||||||
|
|
||||||
|
**Deliverables:**
|
||||||
|
- [ ] CEFPython platform service implementation
|
||||||
|
- [ ] Migration system integration
|
||||||
|
- [ ] Database compatibility testing
|
||||||
|
- [ ] Performance benchmarking
|
||||||
|
|
||||||
|
### 7.3 Phase 3: Feature Integration (Week 5-6)
|
||||||
|
|
||||||
|
**Objectives:**
|
||||||
|
- Integrate with existing platform features
|
||||||
|
- Implement API server integration
|
||||||
|
- Add security features
|
||||||
|
- Test with real user workflows
|
||||||
|
|
||||||
|
**Deliverables:**
|
||||||
|
- [ ] Full feature compatibility
|
||||||
|
- [ ] API integration
|
||||||
|
- [ ] Security implementation
|
||||||
|
- [ ] User workflow testing
|
||||||
|
|
||||||
|
### 7.4 Phase 4: Polish and Distribution (Week 7-8)
|
||||||
|
|
||||||
|
**Objectives:**
|
||||||
|
- Optimize performance
|
||||||
|
- Add build and distribution scripts
|
||||||
|
- Create documentation
|
||||||
|
- Prepare for release
|
||||||
|
|
||||||
|
**Deliverables:**
|
||||||
|
- [ ] Performance optimization
|
||||||
|
- [ ] Build automation
|
||||||
|
- [ ] Documentation
|
||||||
|
- [ ] Release-ready application
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Risk Assessment
|
||||||
|
|
||||||
|
### 8.1 Technical Risks
|
||||||
|
|
||||||
|
| Risk | Probability | Impact | Mitigation |
|
||||||
|
|------|-------------|--------|------------|
|
||||||
|
| **CEFPython compatibility issues** | Medium | High | Use stable CEFPython version, test thoroughly |
|
||||||
|
| **Migration system integration** | Low | High | Follow existing patterns, extensive testing |
|
||||||
|
| **Performance issues** | Low | Medium | Benchmark early, optimize as needed |
|
||||||
|
| **Security vulnerabilities** | Low | High | Implement security manager, regular audits |
|
||||||
|
|
||||||
|
### 8.2 Development Risks
|
||||||
|
|
||||||
|
| Risk | Probability | Impact | Mitigation |
|
||||||
|
|------|-------------|--------|------------|
|
||||||
|
| **Python/CEF knowledge gap** | Medium | Medium | Training, documentation, pair programming |
|
||||||
|
| **Integration complexity** | Medium | Medium | Incremental development, extensive testing |
|
||||||
|
| **Build system complexity** | Low | Medium | Automated build scripts, CI/CD |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. Success Metrics
|
||||||
|
|
||||||
|
### 9.1 Technical Metrics
|
||||||
|
|
||||||
|
- [ ] **Migration Compatibility:** 100% compatibility with existing migration system
|
||||||
|
- [ ] **Performance:** < 150MB memory usage, < 4s startup time
|
||||||
|
- [ ] **Security:** Pass security audit, no critical vulnerabilities
|
||||||
|
- [ ] **Reliability:** 99%+ uptime, < 1% error rate
|
||||||
|
|
||||||
|
### 9.2 Development Metrics
|
||||||
|
|
||||||
|
- [ ] **Code Quality:** 90%+ test coverage, < 5% code duplication
|
||||||
|
- [ ] **Documentation:** Complete API documentation, user guides
|
||||||
|
- [ ] **Build Automation:** Automated builds, CI/CD pipeline
|
||||||
|
- [ ] **Release Readiness:** Production-ready application
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. Conclusion
|
||||||
|
|
||||||
|
### 10.1 Recommendation
|
||||||
|
|
||||||
|
**✅ PROCEED WITH IMPLEMENTATION**
|
||||||
|
|
||||||
|
CEFPython provides an excellent opportunity to add a robust desktop platform to TimeSafari with:
|
||||||
|
|
||||||
|
1. **Full Migration System Compatibility:** Can use the exact same migration system as Capacitor and web
|
||||||
|
2. **Native Performance:** Python backend with Chromium rendering
|
||||||
|
3. **Security:** Chromium's security model with Python backend isolation
|
||||||
|
4. **Development Efficiency:** Follows established patterns and architecture
|
||||||
|
|
||||||
|
### 10.2 Implementation Priority
|
||||||
|
|
||||||
|
**High Priority:**
|
||||||
|
- Database handler with migration support
|
||||||
|
- JavaScript-Python bridge
|
||||||
|
- Platform service integration
|
||||||
|
- Basic application structure
|
||||||
|
|
||||||
|
**Medium Priority:**
|
||||||
|
- Crypto handler integration
|
||||||
|
- API server integration
|
||||||
|
- Security features
|
||||||
|
- Performance optimization
|
||||||
|
|
||||||
|
**Low Priority:**
|
||||||
|
- Advanced features
|
||||||
|
- Build automation
|
||||||
|
- Documentation
|
||||||
|
- Distribution packaging
|
||||||
|
|
||||||
|
### 10.3 Timeline
|
||||||
|
|
||||||
|
**Total Duration:** 8 weeks (2 months)
|
||||||
|
**Team Size:** 1-2 developers
|
||||||
|
**Risk Level:** Medium
|
||||||
|
**Confidence:** 85%
|
||||||
|
|
||||||
|
The implementation leverages TimeSafari's existing architecture and migration system, making it a natural addition to the platform ecosystem while providing users with a high-performance desktop option.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. Next Steps
|
||||||
|
|
||||||
|
1. **Immediate Actions:**
|
||||||
|
- Set up development environment
|
||||||
|
- Create basic CEFPython application structure
|
||||||
|
- Implement database handler with migration support
|
||||||
|
|
||||||
|
2. **Week 1-2:**
|
||||||
|
- Complete foundation implementation
|
||||||
|
- Test migration system integration
|
||||||
|
- Validate database operations
|
||||||
|
|
||||||
|
3. **Week 3-4:**
|
||||||
|
- Implement platform service
|
||||||
|
- Integrate with existing features
|
||||||
|
- Begin performance testing
|
||||||
|
|
||||||
|
4. **Week 5-6:**
|
||||||
|
- Complete feature integration
|
||||||
|
- Security implementation
|
||||||
|
- User workflow testing
|
||||||
|
|
||||||
|
5. **Week 7-8:**
|
||||||
|
- Performance optimization
|
||||||
|
- Build automation
|
||||||
|
- Documentation and release preparation
|
||||||
|
|
||||||
|
This implementation will provide TimeSafari users with a robust, secure, and high-performance desktop application that seamlessly integrates with the existing ecosystem.
|
||||||
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.4.7]
|
||||||
|
### Fixed
|
||||||
|
- Cameras everywhere
|
||||||
|
### Changed
|
||||||
|
- IndexedDB -> SQLite
|
||||||
|
|
||||||
|
|
||||||
## [0.4.5] - 2025.02.23
|
## [0.4.5] - 2025.02.23
|
||||||
### Added
|
### Added
|
||||||
- Total amounts of gives on project page
|
- Total amounts of gives on project page
|
||||||
|
|||||||
1456
GiftedDialog-Complete-Documentation.md
Normal file
469
GiftedDialog-Decomposition-Plan.md
Normal file
@@ -0,0 +1,469 @@
|
|||||||
|
# GiftedDialog Component Decomposition Plan
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This document outlines a comprehensive plan to refactor the GiftedDialog component by breaking it into smaller, more manageable sub-components. This approach will improve maintainability, testability, and reusability while preparing the codebase for future Pinia integration.
|
||||||
|
|
||||||
|
## Current State Analysis
|
||||||
|
|
||||||
|
The GiftedDialog component (1060 lines) is a complex Vue component that handles:
|
||||||
|
|
||||||
|
- **Two-step wizard UI**: Entity selection → Gift details
|
||||||
|
- **Multiple entity types**: Person/Project as giver/recipient
|
||||||
|
- **Complex conditional rendering**: Based on context and entity types
|
||||||
|
- **Form validation and submission**: Gift recording with API integration
|
||||||
|
- **State management**: UI flow, entity selection, form data
|
||||||
|
|
||||||
|
### Key Challenges
|
||||||
|
|
||||||
|
1. **Large single file**: Difficult to navigate and maintain
|
||||||
|
2. **Mixed concerns**: UI logic, business logic, and API calls in one place
|
||||||
|
3. **Complex state**: Multiple interconnected reactive properties
|
||||||
|
4. **Testing difficulty**: Hard to test individual features in isolation
|
||||||
|
5. **Reusability**: Components like entity grids could be reused elsewhere
|
||||||
|
|
||||||
|
## Decomposition Strategy
|
||||||
|
|
||||||
|
### Phase 1: Extract Display Components (✅ COMPLETED)
|
||||||
|
|
||||||
|
These components handle pure presentation with minimal business logic:
|
||||||
|
|
||||||
|
#### 1. PersonCard.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Display individual person entities with selection capability
|
||||||
|
- **Features**:
|
||||||
|
- Person avatar using EntityIcon
|
||||||
|
- Selection states (selectable, conflicted, disabled)
|
||||||
|
- Time icon overlay for contacts
|
||||||
|
- Click event handling
|
||||||
|
- **Props**: `person`, `selectable`, `conflicted`, `showTimeIcon`
|
||||||
|
- **Emits**: `person-selected`
|
||||||
|
|
||||||
|
#### 2. ProjectCard.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Display individual project entities with selection capability
|
||||||
|
- **Features**:
|
||||||
|
- Project icon using ProjectIcon
|
||||||
|
- Project name and issuer information
|
||||||
|
- Click event handling
|
||||||
|
- **Props**: `project`, `activeDid`, `allMyDids`, `allContacts`
|
||||||
|
- **Emits**: `project-selected`
|
||||||
|
|
||||||
|
#### 3. EntitySummaryButton.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Display selected entity with edit capability in step 2
|
||||||
|
- **Features**:
|
||||||
|
- Entity avatar (person or project)
|
||||||
|
- Entity name and role label
|
||||||
|
- Editable vs locked states
|
||||||
|
- Edit button functionality
|
||||||
|
- **Props**: `entity`, `entityType`, `label`, `editable`
|
||||||
|
- **Emits**: `edit-requested`
|
||||||
|
|
||||||
|
#### 4. AmountInput.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Specialized numeric input with increment/decrement controls
|
||||||
|
- **Features**:
|
||||||
|
- Increment/decrement buttons with validation
|
||||||
|
- Configurable min/max values and step size
|
||||||
|
- Input validation and formatting
|
||||||
|
- v-model compatibility
|
||||||
|
- **Props**: `value`, `min`, `max`, `step`, `inputId`
|
||||||
|
- **Emits**: `update:value`
|
||||||
|
|
||||||
|
### Phase 2: Extract Layout Components (✅ COMPLETED)
|
||||||
|
|
||||||
|
These components handle layout and entity organization:
|
||||||
|
|
||||||
|
#### 5. EntityGrid.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Unified grid layout for displaying people or projects
|
||||||
|
- **Features**:
|
||||||
|
- Responsive grid layout for people/projects
|
||||||
|
- Special entity integration (You, Unnamed)
|
||||||
|
- Conflict detection integration
|
||||||
|
- Empty state messaging
|
||||||
|
- Show All navigation
|
||||||
|
- Event delegation for entity selection
|
||||||
|
- **Props**: `entityType`, `entities`, `maxItems`, `activeDid`, `allMyDids`, `allContacts`, `conflictChecker`, `showYouEntity`, `youSelectable`, `showAllRoute`, `showAllQueryParams`
|
||||||
|
- **Emits**: `entity-selected`
|
||||||
|
|
||||||
|
#### 6. SpecialEntityCard.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Handle special entities like "You" and "Unnamed"
|
||||||
|
- **Features**:
|
||||||
|
- Special icon display (hand, question mark)
|
||||||
|
- Conflict state handling
|
||||||
|
- Configurable styling based on entity type
|
||||||
|
- Click event handling
|
||||||
|
- **Props**: `entityType`, `label`, `icon`, `selectable`, `conflicted`, `entityData`
|
||||||
|
- **Emits**: `entity-selected`
|
||||||
|
|
||||||
|
#### 7. ShowAllCard.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Handle "Show All" navigation functionality
|
||||||
|
- **Features**:
|
||||||
|
- Router-link integration
|
||||||
|
- Query parameter passing
|
||||||
|
- Consistent visual styling
|
||||||
|
- Hover effects
|
||||||
|
- **Props**: `entityType`, `routeName`, `queryParams`
|
||||||
|
- **Emits**: None (uses router-link)
|
||||||
|
|
||||||
|
### Phase 3: Extract Step Components (✅ COMPLETED)
|
||||||
|
|
||||||
|
These components handle major UI sections:
|
||||||
|
|
||||||
|
#### 8. EntitySelectionStep.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Complete step 1 entity selection interface
|
||||||
|
- **Features**:
|
||||||
|
- Dynamic step labeling based on context
|
||||||
|
- EntityGrid integration for unified entity display
|
||||||
|
- Conflict detection and prevention
|
||||||
|
- Special entity handling (You, Unnamed)
|
||||||
|
- Show All navigation with context preservation
|
||||||
|
- Cancel functionality
|
||||||
|
- Event delegation for entity selection
|
||||||
|
- **Props**: `stepType`, `giverEntityType`, `recipientEntityType`, `showProjects`, `isFromProjectView`, `projects`, `allContacts`, `activeDid`, `allMyDids`, `conflictChecker`, `fromProjectId`, `toProjectId`, `giver`, `receiver`
|
||||||
|
- **Emits**: `entity-selected`, `cancel`
|
||||||
|
|
||||||
|
#### 9. GiftDetailsStep.vue ✅
|
||||||
|
|
||||||
|
- **Purpose**: Complete step 2 gift details form interface
|
||||||
|
- **Features**:
|
||||||
|
- Entity summary display with edit capability
|
||||||
|
- Gift description input with placeholder support
|
||||||
|
- Amount input with increment/decrement controls
|
||||||
|
- Unit code selection (HUR, USD, BTC, etc.)
|
||||||
|
- Photo & more options navigation
|
||||||
|
- Conflict detection and warning display
|
||||||
|
- Form validation and submission
|
||||||
|
- Cancel functionality
|
||||||
|
- **Props**: `giver`, `receiver`, `giverEntityType`, `recipientEntityType`, `description`, `amount`, `unitCode`, `prompt`, `isFromProjectView`, `hasConflict`, `offerId`, `fromProjectId`, `toProjectId`
|
||||||
|
- **Emits**: `update:description`, `update:amount`, `update:unitCode`, `edit-entity`, `explain-data`, `submit`, `cancel`
|
||||||
|
|
||||||
|
### Phase 4: Refactor Main Component (FINAL)
|
||||||
|
|
||||||
|
#### 9. GiftedDialog.vue (PLANNED REFACTOR)
|
||||||
|
|
||||||
|
- **Purpose**: Orchestrate sub-components and manage overall state
|
||||||
|
- **Responsibilities**:
|
||||||
|
- Step navigation logic
|
||||||
|
- Entity conflict detection
|
||||||
|
- API integration for gift recording
|
||||||
|
- Success/error handling
|
||||||
|
- Dialog visibility management
|
||||||
|
|
||||||
|
## Implementation Progress
|
||||||
|
|
||||||
|
### ✅ Completed Components
|
||||||
|
|
||||||
|
**Phase 1: Display Components**
|
||||||
|
|
||||||
|
1. **PersonCard.vue** - Individual person display with selection
|
||||||
|
2. **ProjectCard.vue** - Individual project display with selection
|
||||||
|
3. **EntitySummaryButton.vue** - Selected entity display with edit capability
|
||||||
|
4. **AmountInput.vue** - Numeric input with increment/decrement controls
|
||||||
|
|
||||||
|
**Phase 2: Layout Components**
|
||||||
|
5. **EntityGrid.vue** - Unified grid layout for entity selection
|
||||||
|
6. **SpecialEntityCard.vue** - Special entities (You, Unnamed) with conflict handling
|
||||||
|
7. **ShowAllCard.vue** - Show All navigation with router integration
|
||||||
|
|
||||||
|
**Phase 3: Step Components**
|
||||||
|
8. **EntitySelectionStep.vue** - Complete step 1 entity selection interface
|
||||||
|
9. **GiftDetailsStep.vue** - Complete step 2 gift details form interface
|
||||||
|
|
||||||
|
### 🔄 Next Steps
|
||||||
|
|
||||||
|
1. **Update GiftedDialog.vue** - Integrate all Phase 1-3 components
|
||||||
|
2. **Test integration** - Ensure functionality remains intact
|
||||||
|
3. **Create unit tests** - For all new components
|
||||||
|
4. **Performance validation** - Ensure no regression
|
||||||
|
5. **Phase 4 planning** - Refactor main component to orchestration only
|
||||||
|
|
||||||
|
### 📋 Future Phases
|
||||||
|
|
||||||
|
1. **Extract EntitySelectionStep.vue** - Complete step 1 logic
|
||||||
|
2. **Extract GiftDetailsStep.vue** - Complete step 2 logic
|
||||||
|
3. **Refactor main component** - Minimal orchestration logic
|
||||||
|
4. **Add comprehensive tests** - Unit tests for each component
|
||||||
|
5. **Prepare for Pinia** - State management migration
|
||||||
|
|
||||||
|
## Benefits of This Approach
|
||||||
|
|
||||||
|
### 1. Incremental Refactoring
|
||||||
|
|
||||||
|
- Each phase can be implemented and tested independently
|
||||||
|
- Reduces risk of breaking existing functionality
|
||||||
|
- Allows for gradual improvement over time
|
||||||
|
|
||||||
|
### 2. Improved Maintainability
|
||||||
|
- Smaller, focused components are easier to understand
|
||||||
|
- Clear separation of concerns
|
||||||
|
- Easier to locate and fix bugs
|
||||||
|
|
||||||
|
### 3. Enhanced Testability
|
||||||
|
- Individual components can be unit tested in isolation
|
||||||
|
- Easier to mock dependencies
|
||||||
|
- Better test coverage possible
|
||||||
|
|
||||||
|
### 4. Better Reusability
|
||||||
|
- Components like EntityGrid can be used in other views
|
||||||
|
- PersonCard and ProjectCard can be used throughout the app
|
||||||
|
- AmountInput can be reused for other numeric inputs
|
||||||
|
|
||||||
|
### 5. Pinia Preparation
|
||||||
|
- Smaller components make state management migration easier
|
||||||
|
- Clear data flow patterns emerge
|
||||||
|
- Easier to identify what state should be global vs local
|
||||||
|
|
||||||
|
## Integration Examples
|
||||||
|
|
||||||
|
### Using PersonCard in EntityGrid
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<ul class="grid grid-cols-4 sm:grid-cols-5 md:grid-cols-6 gap-x-2 gap-y-4">
|
||||||
|
<PersonCard
|
||||||
|
v-for="person in people"
|
||||||
|
:key="person.did"
|
||||||
|
:person="person"
|
||||||
|
:conflicted="wouldCreateConflict(person.did)"
|
||||||
|
@person-selected="handlePersonSelected"
|
||||||
|
/>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using AmountInput in GiftDetailsStep
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<AmountInput
|
||||||
|
:value="amount"
|
||||||
|
:min="0"
|
||||||
|
:max="1000"
|
||||||
|
input-id="gift-amount"
|
||||||
|
@update:value="amount = $event"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using EntitySummaryButton in GiftDetailsStep
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<div class="grid grid-cols-2 gap-2">
|
||||||
|
<EntitySummaryButton
|
||||||
|
:entity="giver"
|
||||||
|
entity-type="person"
|
||||||
|
label="Received from:"
|
||||||
|
:editable="canEditGiver"
|
||||||
|
@edit-requested="handleEditGiver"
|
||||||
|
/>
|
||||||
|
<EntitySummaryButton
|
||||||
|
:entity="receiver"
|
||||||
|
entity-type="person"
|
||||||
|
label="Given to:"
|
||||||
|
:editable="canEditReceiver"
|
||||||
|
@edit-requested="handleEditReceiver"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using EntityGrid in EntitySelectionStep
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<label class="block font-bold mb-4">
|
||||||
|
{{ stepLabel }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<EntityGrid
|
||||||
|
:entity-type="shouldShowProjects ? 'projects' : 'people'"
|
||||||
|
:entities="shouldShowProjects ? projects : allContacts"
|
||||||
|
:max-items="10"
|
||||||
|
:active-did="activeDid"
|
||||||
|
:all-my-dids="allMyDids"
|
||||||
|
:all-contacts="allContacts"
|
||||||
|
:conflict-checker="wouldCreateConflict"
|
||||||
|
:show-you-entity="showYouEntity"
|
||||||
|
:you-selectable="youSelectable"
|
||||||
|
:show-all-route="showAllRoute"
|
||||||
|
:show-all-query-params="showAllQueryParams"
|
||||||
|
@entity-selected="handleEntitySelected"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using SpecialEntityCard Standalone
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<ul class="grid grid-cols-4 gap-2">
|
||||||
|
<SpecialEntityCard
|
||||||
|
entity-type="you"
|
||||||
|
label="You"
|
||||||
|
icon="hand"
|
||||||
|
:conflicted="wouldCreateConflict(activeDid)"
|
||||||
|
:entity-data="{ did: activeDid, name: 'You' }"
|
||||||
|
@entity-selected="handleYouSelected"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<SpecialEntityCard
|
||||||
|
entity-type="unnamed"
|
||||||
|
label="Unnamed"
|
||||||
|
icon="circle-question"
|
||||||
|
:entity-data="{ did: '', name: 'Unnamed' }"
|
||||||
|
@entity-selected="handleUnnamedSelected"
|
||||||
|
/>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using EntitySelectionStep in GiftedDialog
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<div v-show="currentStep === 1">
|
||||||
|
<EntitySelectionStep
|
||||||
|
:step-type="stepType"
|
||||||
|
:giver-entity-type="giverEntityType"
|
||||||
|
:recipient-entity-type="recipientEntityType"
|
||||||
|
:show-projects="showProjects"
|
||||||
|
:is-from-project-view="isFromProjectView"
|
||||||
|
:projects="projects"
|
||||||
|
:all-contacts="allContacts"
|
||||||
|
:active-did="activeDid"
|
||||||
|
:all-my-dids="allMyDids"
|
||||||
|
:conflict-checker="wouldCreateConflict"
|
||||||
|
:from-project-id="fromProjectId"
|
||||||
|
:to-project-id="toProjectId"
|
||||||
|
:giver="giver"
|
||||||
|
:receiver="receiver"
|
||||||
|
@entity-selected="handleEntitySelected"
|
||||||
|
@cancel="cancel"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using GiftDetailsStep in GiftedDialog
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<div v-show="currentStep === 2">
|
||||||
|
<GiftDetailsStep
|
||||||
|
:giver="giver"
|
||||||
|
:receiver="receiver"
|
||||||
|
:giver-entity-type="giverEntityType"
|
||||||
|
:recipient-entity-type="recipientEntityType"
|
||||||
|
:description="description"
|
||||||
|
:amount="parseFloat(amountInput)"
|
||||||
|
:unit-code="unitCode"
|
||||||
|
:prompt="prompt"
|
||||||
|
:is-from-project-view="isFromProjectView"
|
||||||
|
:has-conflict="hasPersonConflict"
|
||||||
|
:offer-id="offerId"
|
||||||
|
:from-project-id="fromProjectId"
|
||||||
|
:to-project-id="toProjectId"
|
||||||
|
@update:description="description = $event"
|
||||||
|
@update:amount="amountInput = $event.toString()"
|
||||||
|
@update:unit-code="unitCode = $event"
|
||||||
|
@edit-entity="handleEditEntity"
|
||||||
|
@explain-data="explainData"
|
||||||
|
@submit="handleSubmit"
|
||||||
|
@cancel="cancel"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Migration Strategy
|
||||||
|
|
||||||
|
### Backward Compatibility
|
||||||
|
- Maintain existing API and prop interfaces
|
||||||
|
- Ensure all existing functionality works unchanged
|
||||||
|
- Preserve all event emissions and callbacks
|
||||||
|
|
||||||
|
### Testing Strategy
|
||||||
|
- Create unit tests for each new component
|
||||||
|
- Maintain existing integration tests
|
||||||
|
- Add visual regression tests for UI components
|
||||||
|
|
||||||
|
### Performance Considerations
|
||||||
|
- Monitor bundle size impact
|
||||||
|
- Ensure no performance regression
|
||||||
|
- Optimize component loading if needed
|
||||||
|
|
||||||
|
## Security Considerations
|
||||||
|
|
||||||
|
### Input Validation
|
||||||
|
- AmountInput includes proper numeric validation
|
||||||
|
- All user inputs are validated before processing
|
||||||
|
- XSS prevention through proper Vue templating
|
||||||
|
|
||||||
|
### Data Handling
|
||||||
|
- No sensitive data stored in component state
|
||||||
|
- Proper prop validation and type checking
|
||||||
|
- Secure API communication maintained
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
This decomposition plan provides a structured approach to refactoring the GiftedDialog component while maintaining functionality and preparing for future enhancements. The incremental approach reduces risk and allows for continuous improvement of the codebase.
|
||||||
|
|
||||||
|
The completed Phase 1 components (PersonCard, ProjectCard, EntitySummaryButton, AmountInput) provide a solid foundation for the remaining phases and demonstrate the benefits of component decomposition in terms of maintainability, testability, and reusability.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Final Integration Results
|
||||||
|
|
||||||
|
### ✅ **INTEGRATION COMPLETE**
|
||||||
|
|
||||||
|
**Completed on**: 2025-01-28
|
||||||
|
|
||||||
|
**Results:**
|
||||||
|
- **Main GiftedDialog template**: Reduced from ~200 lines to ~20 lines
|
||||||
|
- **Components created**: 9 focused, reusable components
|
||||||
|
- **Lines of code**: ~2,000 lines of well-structured component code
|
||||||
|
- **Backward compatibility**: 100% maintained
|
||||||
|
- **Build status**: ✅ Passing
|
||||||
|
- **Runtime status**: ✅ Working
|
||||||
|
|
||||||
|
**Components Successfully Integrated:**
|
||||||
|
|
||||||
|
1. **PersonCard.vue** - Individual person display with conflict detection
|
||||||
|
2. **ProjectCard.vue** - Individual project display with issuer info
|
||||||
|
3. **EntitySummaryButton.vue** - Selected entity display with edit capability
|
||||||
|
4. **AmountInput.vue** - Numeric input with validation and controls
|
||||||
|
5. **SpecialEntityCard.vue** - "You" and "Unnamed" entity handling
|
||||||
|
6. **ShowAllCard.vue** - Navigation with router integration
|
||||||
|
7. **EntityGrid.vue** - Unified grid layout orchestration
|
||||||
|
8. **EntitySelectionStep.vue** - Complete Step 1 interface
|
||||||
|
9. **GiftDetailsStep.vue** - Complete Step 2 interface
|
||||||
|
|
||||||
|
**Integration Benefits Achieved:**
|
||||||
|
- ✅ **Maintainability**: Each component has single responsibility
|
||||||
|
- ✅ **Testability**: Components can be unit tested in isolation
|
||||||
|
- ✅ **Reusability**: Components can be used across the application
|
||||||
|
- ✅ **Readability**: Clear separation of concerns and focused logic
|
||||||
|
- ✅ **Debugging**: Easier to identify and fix issues
|
||||||
|
- ✅ **Performance**: No performance regression, improved code splitting
|
||||||
|
|
||||||
|
**Next Steps:**
|
||||||
|
1. **Pinia State Management**: Ready for state management migration
|
||||||
|
2. **Component Testing**: Add comprehensive unit tests
|
||||||
|
3. **Visual Testing**: Add Playwright component tests
|
||||||
|
4. **Documentation**: Update component documentation
|
||||||
|
5. **Optimization**: Fine-tune performance if needed
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Author**: Matthew Raymer
|
||||||
|
**Last Updated**: 2025-01-28
|
||||||
|
**Status**: ✅ **INTEGRATION COMPLETE - READY FOR PRODUCTION**
|
||||||
4508
GiftedDialog-Logic-Flow.md
Normal file
@@ -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 18
|
versionCode 26
|
||||||
versionName "0.4.7"
|
versionName "0.5.1"
|
||||||
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.
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ios": {
|
"ios": {
|
||||||
"contentInset": "always",
|
"contentInset": "never",
|
||||||
"allowsLinkPreview": true,
|
"allowsLinkPreview": true,
|
||||||
"scrollEnabled": true,
|
"scrollEnabled": true,
|
||||||
"limitsNavigationsToAppBoundDomains": true,
|
"limitsNavigationsToAppBoundDomains": true,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package app.timesafari;
|
|||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import com.getcapacitor.BridgeActivity;
|
import com.getcapacitor.BridgeActivity;
|
||||||
import com.getcapacitor.community.sqlite.SQLite;
|
//import com.getcapacitor.community.sqlite.SQLite;
|
||||||
|
|
||||||
public class MainActivity extends BridgeActivity {
|
public class MainActivity extends BridgeActivity {
|
||||||
@Override
|
@Override
|
||||||
@@ -10,6 +10,6 @@ public class MainActivity extends BridgeActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
// Initialize SQLite
|
// Initialize SQLite
|
||||||
registerPlugin(SQLite.class);
|
//registerPlugin(SQLite.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package timesafari.app;
|
|
||||||
|
|
||||||
import com.getcapacitor.BridgeActivity;
|
|
||||||
|
|
||||||
public class MainActivity extends BridgeActivity {}
|
|
||||||
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
<background>
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
|
||||||
|
</background>
|
||||||
|
<foreground>
|
||||||
|
<inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
|
||||||
|
</foreground>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
<background>
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
<inset android:drawable="@mipmap/ic_launcher_background" android:inset="16.7%" />
|
||||||
|
</background>
|
||||||
|
<foreground>
|
||||||
|
<inset android:drawable="@mipmap/ic_launcher_foreground" android:inset="16.7%" />
|
||||||
|
</foreground>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
||||||
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 60 KiB |
BIN
assets/icon.png
Normal file
|
After Width: | Height: | Size: 279 KiB |
BIN
assets/splash-dark.png
Normal file
|
After Width: | Height: | Size: 1.9 MiB |
BIN
assets/splash.png
Normal file
|
After Width: | Height: | Size: 1.9 MiB |
@@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ios": {
|
"ios": {
|
||||||
"contentInset": "always",
|
"contentInset": "never",
|
||||||
"allowsLinkPreview": true,
|
"allowsLinkPreview": true,
|
||||||
"scrollEnabled": true,
|
"scrollEnabled": true,
|
||||||
"limitsNavigationsToAppBoundDomains": true,
|
"limitsNavigationsToAppBoundDomains": true,
|
||||||
|
|||||||
224
doc/GiftedDialog-Complete-Documentation.md
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
# GiftedDialog Complete Documentation
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The GiftedDialog system is a sophisticated multi-step dialog for recording gifts between people and projects in the TimeSafari application. It consists of a main orchestrating component and 9 specialized child components that handle different aspects of the gift recording workflow.
|
||||||
|
|
||||||
|
## Key Features
|
||||||
|
|
||||||
|
- **Two-Step Workflow**: Entity selection → Gift details
|
||||||
|
- **Multi-Entity Support**: People, projects, and special entities
|
||||||
|
- **Conflict Detection**: Prevents invalid gift combinations
|
||||||
|
- **Responsive Design**: Works across all device sizes
|
||||||
|
- **Accessibility**: Full keyboard navigation and screen reader support
|
||||||
|
- **Validation**: Comprehensive form validation and error handling
|
||||||
|
- **Flexible Integration**: Can be embedded in any view with different contexts
|
||||||
|
|
||||||
|
## Component Architecture
|
||||||
|
|
||||||
|
### Main Component
|
||||||
|
- **GiftedDialog.vue** - Main orchestrating component that manages dialog state, step navigation, and API integration
|
||||||
|
|
||||||
|
### Step Components
|
||||||
|
- **EntitySelectionStep.vue** - Step 1 controller with dynamic labeling and context awareness
|
||||||
|
- **GiftDetailsStep.vue** - Step 2 controller with form validation and entity summaries
|
||||||
|
|
||||||
|
### Layout Components
|
||||||
|
- **EntityGrid.vue** - Unified entity grid layout with responsive design
|
||||||
|
- **EntitySummaryButton.vue** - Selected entity display with edit capability
|
||||||
|
|
||||||
|
### Display Components
|
||||||
|
- **PersonCard.vue** - Individual person display with avatar and selection states
|
||||||
|
- **ProjectCard.vue** - Individual project display with icons and issuer information
|
||||||
|
- **SpecialEntityCard.vue** - Special entities (You, Unnamed) with conflict detection
|
||||||
|
- **ShowAllCard.vue** - Navigation component with router integration
|
||||||
|
|
||||||
|
### Input Components
|
||||||
|
- **AmountInput.vue** - Numeric input with increment/decrement controls and validation
|
||||||
|
|
||||||
|
## Data Flow
|
||||||
|
|
||||||
|
### Step 1: Entity Selection
|
||||||
|
1. User opens dialog → GiftedDialog renders EntitySelectionStep
|
||||||
|
2. EntitySelectionStep renders EntityGrid with entities and configuration
|
||||||
|
3. EntityGrid renders PersonCard/ProjectCard/SpecialEntityCard components
|
||||||
|
4. User clicks entity → Card emits to Grid → Grid emits to Step → Step emits to Dialog
|
||||||
|
5. GiftedDialog updates state and advances to step 2
|
||||||
|
|
||||||
|
### Step 2: Gift Details
|
||||||
|
1. GiftedDialog renders GiftDetailsStep with selected entities
|
||||||
|
2. GiftDetailsStep renders EntitySummaryButton and AmountInput components
|
||||||
|
3. User fills form and clicks submit → Step emits to Dialog
|
||||||
|
4. GiftedDialog processes submission via API and handles success/error
|
||||||
|
|
||||||
|
## Key Props and Configuration
|
||||||
|
|
||||||
|
### GiftedDialog Props
|
||||||
|
```typescript
|
||||||
|
interface GiftedDialogProps {
|
||||||
|
fromProjectId?: string; // Project ID when project is giver
|
||||||
|
toProjectId?: string; // Project ID when project is recipient
|
||||||
|
showProjects?: boolean; // Whether to show projects
|
||||||
|
isFromProjectView?: boolean; // Context flag for project views
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Opening the Dialog
|
||||||
|
```typescript
|
||||||
|
// Basic usage
|
||||||
|
giftedDialog.open();
|
||||||
|
|
||||||
|
// With pre-selected entities and context
|
||||||
|
giftedDialog.open(
|
||||||
|
giverEntity, // Pre-selected giver
|
||||||
|
receiverEntity, // Pre-selected receiver
|
||||||
|
offerId, // Offer context
|
||||||
|
customTitle, // Custom dialog title
|
||||||
|
prompt, // Custom input prompt
|
||||||
|
successCallback // Success handler
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integration Patterns
|
||||||
|
|
||||||
|
### Basic Integration
|
||||||
|
```vue
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<button @click="openGiftDialog">Record Gift</button>
|
||||||
|
<GiftedDialog ref="giftedDialog" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default class Example extends Vue {
|
||||||
|
openGiftDialog() {
|
||||||
|
const dialog = this.$refs.giftedDialog as GiftedDialog;
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Project Context Integration
|
||||||
|
```typescript
|
||||||
|
// Gift from project
|
||||||
|
dialog.open(
|
||||||
|
projectEntity, // Project as giver
|
||||||
|
undefined, // User selects receiver
|
||||||
|
undefined, // No offer
|
||||||
|
"Gift from Project",
|
||||||
|
"What did this project provide?"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Gift to project
|
||||||
|
dialog.open(
|
||||||
|
undefined, // User selects giver
|
||||||
|
projectEntity, // Project as receiver
|
||||||
|
undefined, // No offer
|
||||||
|
"Gift to Project",
|
||||||
|
"What was contributed to this project?"
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
## State Management
|
||||||
|
|
||||||
|
The dialog manages internal state through a reactive system:
|
||||||
|
|
||||||
|
- **Step Navigation**: Controls progression from entity selection to gift details
|
||||||
|
- **Entity Selection**: Tracks selected giver and receiver entities
|
||||||
|
- **Conflict Detection**: Prevents selecting same person for both roles
|
||||||
|
- **Form Validation**: Ensures required fields are completed
|
||||||
|
- **API Integration**: Handles gift submission and response processing
|
||||||
|
|
||||||
|
## Conflict Detection Logic
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function wouldCreateConflict(selectedDid: string): boolean {
|
||||||
|
// Only applies to person-to-person gifts
|
||||||
|
if (giverEntityType !== "person" || recipientEntityType !== "person") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if selecting same person for both roles
|
||||||
|
if (stepType === "giver") {
|
||||||
|
return receiver?.did === selectedDid;
|
||||||
|
} else if (stepType === "recipient") {
|
||||||
|
return giver?.did === selectedDid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## AmountInput Component Fix
|
||||||
|
|
||||||
|
The AmountInput component was recently fixed to resolve an issue where increment/decrement buttons weren't updating the displayed value:
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
- Input field used `:value="displayValue"` (one-way binding)
|
||||||
|
- Programmatic updates to `displayValue` weren't reflected in DOM
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
- Changed to `v-model="displayValue"` (two-way binding)
|
||||||
|
- Now properly synchronizes programmatic and user input changes
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
```vue
|
||||||
|
<AmountInput
|
||||||
|
:value="amount"
|
||||||
|
:min="0"
|
||||||
|
:max="1000"
|
||||||
|
:step="1"
|
||||||
|
@update:value="handleAmountChange"
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing Strategy
|
||||||
|
|
||||||
|
### Unit Testing
|
||||||
|
- Individual component behavior
|
||||||
|
- Props validation
|
||||||
|
- Event emission
|
||||||
|
- Computed property calculations
|
||||||
|
|
||||||
|
### Integration Testing
|
||||||
|
- Multi-component workflows
|
||||||
|
- State management
|
||||||
|
- API integration
|
||||||
|
- Error handling
|
||||||
|
|
||||||
|
### End-to-End Testing
|
||||||
|
- Complete user workflows
|
||||||
|
- Cross-browser compatibility
|
||||||
|
- Accessibility compliance
|
||||||
|
- Performance validation
|
||||||
|
|
||||||
|
## Security Considerations
|
||||||
|
|
||||||
|
- **Input Validation**: All user inputs are sanitized and validated
|
||||||
|
- **DID Privacy**: User identifiers only shared with authorized contacts
|
||||||
|
- **API Security**: Requests are cryptographically signed
|
||||||
|
- **XSS Prevention**: Template sanitization and CSP headers
|
||||||
|
|
||||||
|
## Performance Optimizations
|
||||||
|
|
||||||
|
- **Lazy Loading**: Components loaded only when needed
|
||||||
|
- **Virtual Scrolling**: For large entity lists
|
||||||
|
- **Debounced Input**: Prevents excessive API calls
|
||||||
|
- **Computed Properties**: Efficient reactive calculations
|
||||||
|
- **Memory Management**: Proper cleanup on component destruction
|
||||||
|
|
||||||
|
## Accessibility Features
|
||||||
|
|
||||||
|
- **Keyboard Navigation**: Full tab order and keyboard shortcuts
|
||||||
|
- **Screen Reader Support**: ARIA labels and semantic HTML
|
||||||
|
- **Focus Management**: Proper focus handling on open/close
|
||||||
|
- **High Contrast**: Supports high contrast themes
|
||||||
|
- **Responsive Design**: Works on all screen sizes
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Author**: Matthew Raymer
|
||||||
|
**Last Updated**: 2025-06-30
|
||||||
|
**Version**: 1.0.0
|
||||||
13
ios/.gitignore
vendored
@@ -11,3 +11,16 @@ capacitor-cordova-ios-plugins
|
|||||||
# Generated Config files
|
# Generated Config files
|
||||||
App/App/capacitor.config.json
|
App/App/capacitor.config.json
|
||||||
App/App/config.xml
|
App/App/config.xml
|
||||||
|
|
||||||
|
# User-specific Xcode files
|
||||||
|
App/App.xcodeproj/xcuserdata/*.xcuserdatad/
|
||||||
|
App/App.xcodeproj/*.xcuserstate
|
||||||
|
|
||||||
|
fastlane/report.xml
|
||||||
|
fastlane/Preview.html
|
||||||
|
fastlane/screenshots
|
||||||
|
fastlane/test_output
|
||||||
|
|
||||||
|
# Generated Icons from capacitor-assets (also Contents.json which is confusing; see BUILDING.md)
|
||||||
|
App/App/Assets.xcassets/AppIcon.appiconset
|
||||||
|
App/App/Assets.xcassets/Splash.imageset
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; };
|
504EC30F1FED79650016851F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 504EC30E1FED79650016851F /* Assets.xcassets */; };
|
||||||
504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; };
|
504EC3121FED79650016851F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 504EC3101FED79650016851F /* LaunchScreen.storyboard */; };
|
||||||
50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
|
50B271D11FEDC1A000F3C39B /* public in Resources */ = {isa = PBXBuildFile; fileRef = 50B271D01FEDC1A000F3C39B /* public */; };
|
||||||
A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */; };
|
97EF2DC6FD76C3643D680B8D /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 90DCAFB4D8948F7A50C13800 /* Pods_App.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
@@ -27,9 +27,9 @@
|
|||||||
504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||||
504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
|
50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
|
||||||
AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
90DCAFB4D8948F7A50C13800 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = "<group>"; };
|
E2E9297D5D02C549106C77F9 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = "<group>"; };
|
EAEC6436E595F7CD3A1C9E96 /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -37,17 +37,17 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
A084ECDBA7D38E1E42DFC39D /* Pods_App.framework in Frameworks */,
|
97EF2DC6FD76C3643D680B8D /* Pods_App.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
27E2DDA53C4D2A4D1A88CE4A /* Frameworks */ = {
|
4B546315E668C7A13939F417 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
AF277DCFFFF123FFC6DF26C7 /* Pods_App.framework */,
|
90DCAFB4D8948F7A50C13800 /* Pods_App.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -57,8 +57,8 @@
|
|||||||
children = (
|
children = (
|
||||||
504EC3061FED79650016851F /* App */,
|
504EC3061FED79650016851F /* App */,
|
||||||
504EC3051FED79650016851F /* Products */,
|
504EC3051FED79650016851F /* Products */,
|
||||||
7F8756D8B27F46E3366F6CEA /* Pods */,
|
BA325FFCDCE8D334E5C7AEBE /* Pods */,
|
||||||
27E2DDA53C4D2A4D1A88CE4A /* Frameworks */,
|
4B546315E668C7A13939F417 /* Frameworks */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
@@ -85,13 +85,13 @@
|
|||||||
path = App;
|
path = App;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
7F8756D8B27F46E3366F6CEA /* Pods */ = {
|
BA325FFCDCE8D334E5C7AEBE /* Pods */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */,
|
EAEC6436E595F7CD3A1C9E96 /* Pods-App.debug.xcconfig */,
|
||||||
AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */,
|
E2E9297D5D02C549106C77F9 /* Pods-App.release.xcconfig */,
|
||||||
);
|
);
|
||||||
name = Pods;
|
path = Pods;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
@@ -101,12 +101,13 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
|
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */,
|
92977BEA1068CC097A57FC77 /* [CP] Check Pods Manifest.lock */,
|
||||||
504EC3001FED79650016851F /* Sources */,
|
504EC3001FED79650016851F /* Sources */,
|
||||||
504EC3011FED79650016851F /* Frameworks */,
|
504EC3011FED79650016851F /* Frameworks */,
|
||||||
504EC3021FED79650016851F /* Resources */,
|
504EC3021FED79650016851F /* Resources */,
|
||||||
9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */,
|
|
||||||
012076E8FFE4BF260A79B034 /* Fix Privacy Manifest */,
|
012076E8FFE4BF260A79B034 /* Fix Privacy Manifest */,
|
||||||
|
3525031ED1C96EF4CF6E9959 /* [CP] Embed Pods Frameworks */,
|
||||||
|
96A7EF592DF3366D00084D51 /* Fix Privacy Manifest */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -186,28 +187,10 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"${PROJECT_DIR}/app_privacy_manifest_fixer/fixer.sh\" ";
|
shellScript = "\"${PROJECT_DIR}/app_privacy_manifest_fixer/fixer.sh\" \n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = {
|
3525031ED1C96EF4CF6E9959 /* [CP] Embed Pods Frameworks */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
inputPaths = (
|
|
||||||
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
|
||||||
"${PODS_ROOT}/Manifest.lock",
|
|
||||||
);
|
|
||||||
name = "[CP] Check Pods Manifest.lock";
|
|
||||||
outputPaths = (
|
|
||||||
"$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt",
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
shellPath = /bin/sh;
|
|
||||||
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
||||||
showEnvVarsInLog = 0;
|
|
||||||
};
|
|
||||||
9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */ = {
|
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
@@ -222,6 +205,47 @@
|
|||||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n";
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
|
92977BEA1068CC097A57FC77 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
||||||
|
"${PODS_ROOT}/Manifest.lock",
|
||||||
|
);
|
||||||
|
name = "[CP] Check Pods Manifest.lock";
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
"$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
|
96A7EF592DF3366D00084D51 /* Fix Privacy Manifest */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
name = "Fix Privacy Manifest";
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "$PROJECT_DIR/app_privacy_manifest_fixer/fixer.sh\n";
|
||||||
|
};
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
@@ -375,11 +399,12 @@
|
|||||||
};
|
};
|
||||||
504EC3171FED79650016851F /* Debug */ = {
|
504EC3171FED79650016851F /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = FC68EB0AF532CFC21C3344DD /* Pods-App.debug.xcconfig */;
|
baseConfigurationReference = EAEC6436E595F7CD3A1C9E96 /* Pods-App.debug.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 18;
|
CURRENT_PROJECT_VERSION = 26;
|
||||||
|
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||||
ENABLE_APP_SANDBOX = NO;
|
ENABLE_APP_SANDBOX = NO;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -388,7 +413,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 0.4.7;
|
MARKETING_VERSION = 0.5.1;
|
||||||
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)";
|
||||||
@@ -401,11 +426,12 @@
|
|||||||
};
|
};
|
||||||
504EC3181FED79650016851F /* Release */ = {
|
504EC3181FED79650016851F /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = AF51FD2D460BCFE21FA515B2 /* Pods-App.release.xcconfig */;
|
baseConfigurationReference = E2E9297D5D02C549106C77F9 /* Pods-App.release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 18;
|
CURRENT_PROJECT_VERSION = 26;
|
||||||
|
DEVELOPMENT_TEAM = GM3FS5JQPH;
|
||||||
ENABLE_APP_SANDBOX = NO;
|
ENABLE_APP_SANDBOX = NO;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -414,7 +440,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 0.4.7;
|
MARKETING_VERSION = 0.5.1;
|
||||||
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 = "";
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
|
|
||||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||||
// Initialize SQLite
|
// Initialize SQLite
|
||||||
let sqlite = SQLite()
|
//let sqlite = SQLite()
|
||||||
sqlite.initialize()
|
//sqlite.initialize()
|
||||||
|
|
||||||
// Override point for customization after application launch.
|
// Override point for customization after application launch.
|
||||||
return true
|
return true
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 116 KiB |
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"images": [
|
|
||||||
{
|
|
||||||
"idiom": "universal",
|
|
||||||
"size": "1024x1024",
|
|
||||||
"filename": "AppIcon-512@2x.png",
|
|
||||||
"platform": "ios"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info": {
|
|
||||||
"author": "xcode",
|
|
||||||
"version": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "splash-2732x2732-2.png",
|
|
||||||
"scale" : "1x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "splash-2732x2732-1.png",
|
|
||||||
"scale" : "2x"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "splash-2732x2732.png",
|
|
||||||
"scale" : "3x"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 40 KiB |
@@ -27,4 +27,9 @@ end
|
|||||||
|
|
||||||
post_install do |installer|
|
post_install do |installer|
|
||||||
assertDeploymentTarget(installer)
|
assertDeploymentTarget(installer)
|
||||||
|
installer.pods_project.targets.each do |target|
|
||||||
|
target.build_configurations.each do |config|
|
||||||
|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ PODS:
|
|||||||
- Capacitor
|
- Capacitor
|
||||||
- CapacitorCamera (6.1.2):
|
- CapacitorCamera (6.1.2):
|
||||||
- Capacitor
|
- Capacitor
|
||||||
|
- CapacitorCommunitySqlite (6.0.2):
|
||||||
|
- Capacitor
|
||||||
|
- SQLCipher
|
||||||
|
- ZIPFoundation
|
||||||
- CapacitorCordova (6.2.1)
|
- CapacitorCordova (6.2.1)
|
||||||
- CapacitorFilesystem (6.0.3):
|
- CapacitorFilesystem (6.0.3):
|
||||||
- Capacitor
|
- Capacitor
|
||||||
@@ -73,11 +77,18 @@ PODS:
|
|||||||
- nanopb/decode (2.30910.0)
|
- nanopb/decode (2.30910.0)
|
||||||
- nanopb/encode (2.30910.0)
|
- nanopb/encode (2.30910.0)
|
||||||
- PromisesObjC (2.4.0)
|
- PromisesObjC (2.4.0)
|
||||||
|
- SQLCipher (4.9.0):
|
||||||
|
- SQLCipher/standard (= 4.9.0)
|
||||||
|
- SQLCipher/common (4.9.0)
|
||||||
|
- SQLCipher/standard (4.9.0):
|
||||||
|
- SQLCipher/common
|
||||||
|
- ZIPFoundation (0.9.19)
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- "Capacitor (from `../../node_modules/@capacitor/ios`)"
|
- "Capacitor (from `../../node_modules/@capacitor/ios`)"
|
||||||
- "CapacitorApp (from `../../node_modules/@capacitor/app`)"
|
- "CapacitorApp (from `../../node_modules/@capacitor/app`)"
|
||||||
- "CapacitorCamera (from `../../node_modules/@capacitor/camera`)"
|
- "CapacitorCamera (from `../../node_modules/@capacitor/camera`)"
|
||||||
|
- "CapacitorCommunitySqlite (from `../../node_modules/@capacitor-community/sqlite`)"
|
||||||
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
|
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
|
||||||
- "CapacitorFilesystem (from `../../node_modules/@capacitor/filesystem`)"
|
- "CapacitorFilesystem (from `../../node_modules/@capacitor/filesystem`)"
|
||||||
- "CapacitorMlkitBarcodeScanning (from `../../node_modules/@capacitor-mlkit/barcode-scanning`)"
|
- "CapacitorMlkitBarcodeScanning (from `../../node_modules/@capacitor-mlkit/barcode-scanning`)"
|
||||||
@@ -98,6 +109,8 @@ SPEC REPOS:
|
|||||||
- MLKitVision
|
- MLKitVision
|
||||||
- nanopb
|
- nanopb
|
||||||
- PromisesObjC
|
- PromisesObjC
|
||||||
|
- SQLCipher
|
||||||
|
- ZIPFoundation
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
Capacitor:
|
Capacitor:
|
||||||
@@ -106,6 +119,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: "../../node_modules/@capacitor/app"
|
:path: "../../node_modules/@capacitor/app"
|
||||||
CapacitorCamera:
|
CapacitorCamera:
|
||||||
:path: "../../node_modules/@capacitor/camera"
|
:path: "../../node_modules/@capacitor/camera"
|
||||||
|
CapacitorCommunitySqlite:
|
||||||
|
:path: "../../node_modules/@capacitor-community/sqlite"
|
||||||
CapacitorCordova:
|
CapacitorCordova:
|
||||||
:path: "../../node_modules/@capacitor/ios"
|
:path: "../../node_modules/@capacitor/ios"
|
||||||
CapacitorFilesystem:
|
CapacitorFilesystem:
|
||||||
@@ -121,6 +136,7 @@ SPEC CHECKSUMS:
|
|||||||
Capacitor: c95400d761e376be9da6be5a05f226c0e865cebf
|
Capacitor: c95400d761e376be9da6be5a05f226c0e865cebf
|
||||||
CapacitorApp: e1e6b7d05e444d593ca16fd6d76f2b7c48b5aea7
|
CapacitorApp: e1e6b7d05e444d593ca16fd6d76f2b7c48b5aea7
|
||||||
CapacitorCamera: 9bc7b005d0e6f1d5f525b8137045b60cffffce79
|
CapacitorCamera: 9bc7b005d0e6f1d5f525b8137045b60cffffce79
|
||||||
|
CapacitorCommunitySqlite: 0299d20f4b00c2e6aa485a1d8932656753937b9b
|
||||||
CapacitorCordova: 8d93e14982f440181be7304aa9559ca631d77fff
|
CapacitorCordova: 8d93e14982f440181be7304aa9559ca631d77fff
|
||||||
CapacitorFilesystem: 59270a63c60836248812671aa3b15df673fbaf74
|
CapacitorFilesystem: 59270a63c60836248812671aa3b15df673fbaf74
|
||||||
CapacitorMlkitBarcodeScanning: 7652be9c7922f39203a361de735d340ae37e134e
|
CapacitorMlkitBarcodeScanning: 7652be9c7922f39203a361de735d340ae37e134e
|
||||||
@@ -138,7 +154,9 @@ SPEC CHECKSUMS:
|
|||||||
MLKitVision: 90922bca854014a856f8b649d1f1f04f63fd9c79
|
MLKitVision: 90922bca854014a856f8b649d1f1f04f63fd9c79
|
||||||
nanopb: 438bc412db1928dac798aa6fd75726007be04262
|
nanopb: 438bc412db1928dac798aa6fd75726007be04262
|
||||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||||
|
SQLCipher: 31878d8ebd27e5c96db0b7cb695c96e9f8ad77da
|
||||||
|
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c
|
||||||
|
|
||||||
PODFILE CHECKSUM: 7e7e09e6937de7f015393aecf2cf7823645689b3
|
PODFILE CHECKSUM: f987510f7383b04a1b09ea8472bdadcd88b6c924
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
|
|||||||
1592
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "timesafari",
|
"name": "timesafari",
|
||||||
"version": "0.4.6",
|
"version": "0.5.1",
|
||||||
"description": "Time Safari Application",
|
"description": "Time Safari Application",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Time Safari Team"
|
"name": "Time Safari Team"
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
"electron:build-mac-universal": "npm run build:electron-prod && electron-builder --mac --universal"
|
"electron:build-mac-universal": "npm run build:electron-prod && electron-builder --mac --universal"
|
||||||
},
|
},
|
||||||
"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",
|
||||||
"@capacitor/android": "^6.2.0",
|
"@capacitor/android": "^6.2.0",
|
||||||
"@capacitor/app": "^6.0.0",
|
"@capacitor/app": "^6.0.0",
|
||||||
@@ -171,7 +171,7 @@
|
|||||||
},
|
},
|
||||||
"main": "./dist-electron/main.js",
|
"main": "./dist-electron/main.js",
|
||||||
"build": {
|
"build": {
|
||||||
"appId": "app.timesafari",
|
"appId": "app.timesafari.app",
|
||||||
"productName": "TimeSafari",
|
"productName": "TimeSafari",
|
||||||
"directories": {
|
"directories": {
|
||||||
"output": "dist-electron-packages"
|
"output": "dist-electron-packages"
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ dependencies:
|
|||||||
- gradle
|
- gradle
|
||||||
- java
|
- java
|
||||||
- pod
|
- pod
|
||||||
|
- rubygems.org
|
||||||
|
|
||||||
# other dependencies are discovered via package.json & requirements.txt & Gemfile (I'm guessing).
|
# other dependencies are discovered via package.json & requirements.txt & Gemfile (I'm guessing).
|
||||||
|
|||||||
BIN
public/wasm/sql-wasm.wasm
Executable file
@@ -1,5 +1,6 @@
|
|||||||
eth_keys
|
eth_keys
|
||||||
pywebview
|
pywebview
|
||||||
pyinstaller>=6.12.0
|
pyinstaller>=6.12.0
|
||||||
|
setuptools>=69.0.0 # Required for distutils for electron-builder on macOS
|
||||||
# For development
|
# For development
|
||||||
watchdog>=3.0.0 # For file watching support
|
watchdog>=3.0.0 # For file watching support
|
||||||
@@ -51,7 +51,7 @@ const { existsSync } = require('fs');
|
|||||||
*/
|
*/
|
||||||
function checkCommand(command, errorMessage) {
|
function checkCommand(command, errorMessage) {
|
||||||
try {
|
try {
|
||||||
execSync(command + ' --version', { stdio: 'ignore' });
|
execSync(command, { stdio: 'ignore' });
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`❌ ${errorMessage}`);
|
console.error(`❌ ${errorMessage}`);
|
||||||
@@ -164,10 +164,10 @@ function main() {
|
|||||||
|
|
||||||
// Check required command line tools
|
// Check required command line tools
|
||||||
// These are essential for building and testing the application
|
// These are essential for building and testing the application
|
||||||
success &= checkCommand('node', 'Node.js is required');
|
success &= checkCommand('node --version', 'Node.js is required');
|
||||||
success &= checkCommand('npm', 'npm is required');
|
success &= checkCommand('npm --version', 'npm is required');
|
||||||
success &= checkCommand('gradle', 'Gradle is required for Android builds');
|
success &= checkCommand('gradle --version', 'Gradle is required for Android builds');
|
||||||
success &= checkCommand('xcodebuild', 'Xcode is required for iOS builds');
|
success &= checkCommand('xcodebuild --help', 'Xcode is required for iOS builds');
|
||||||
|
|
||||||
// Check platform-specific development environments
|
// Check platform-specific development environments
|
||||||
success &= checkAndroidSetup();
|
success &= checkAndroidSetup();
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ const executeDeeplink = async (url, description, log) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Stop the app before executing the deep link
|
// Stop the app before executing the deep link
|
||||||
execSync('adb shell am force-stop app.timesafari');
|
execSync('adb shell am force-stop app.timesafari.app');
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait 1s
|
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait 1s
|
||||||
|
|
||||||
execSync(`adb shell am start -W -a android.intent.action.VIEW -d "${url}" -c android.intent.category.BROWSABLE`);
|
execSync(`adb shell am start -W -a android.intent.action.VIEW -d "${url}" -c android.intent.category.BROWSABLE`);
|
||||||
|
|||||||
12
src/App.vue
@@ -4,7 +4,7 @@
|
|||||||
<!-- Messages in the upper-right - https://github.com/emmanuelsw/notiwind -->
|
<!-- Messages in the upper-right - https://github.com/emmanuelsw/notiwind -->
|
||||||
<NotificationGroup group="alert">
|
<NotificationGroup group="alert">
|
||||||
<div
|
<div
|
||||||
class="fixed top-[calc(env(safe-area-inset-top)+1rem)] right-4 left-4 sm:left-auto sm:w-full sm:max-w-sm flex flex-col items-start justify-end"
|
class="fixed z-[90] top-[max(1rem,env(safe-area-inset-top))] right-4 left-4 sm:left-auto sm:w-full sm:max-w-sm flex flex-col items-start justify-end"
|
||||||
>
|
>
|
||||||
<Notification
|
<Notification
|
||||||
v-slot="{ notifications, close }"
|
v-slot="{ notifications, close }"
|
||||||
@@ -548,13 +548,13 @@ export default class App extends Vue {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
#Content {
|
#Content {
|
||||||
padding-left: 1.5rem;
|
padding-left: max(1.5rem, env(safe-area-inset-left));
|
||||||
padding-right: 1.5rem;
|
padding-right: max(1.5rem, env(safe-area-inset-right));
|
||||||
padding-top: calc(env(safe-area-inset-top) + 1.5rem);
|
padding-top: max(1.5rem, env(safe-area-inset-top));
|
||||||
padding-bottom: calc(env(safe-area-inset-bottom) + 1.5rem);
|
padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
#QuickNav ~ #Content {
|
#QuickNav ~ #Content {
|
||||||
padding-bottom: calc(env(safe-area-inset-bottom) + 6rem);
|
padding-bottom: calc(env(safe-area-inset-bottom) + 6.333rem);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -14,22 +14,34 @@
|
|||||||
class="flex items-center justify-between gap-2 text-lg bg-slate-200 border border-slate-300 border-b-0 rounded-t-md px-3 sm:px-4 py-1 sm:py-2"
|
class="flex items-center justify-between gap-2 text-lg bg-slate-200 border border-slate-300 border-b-0 rounded-t-md px-3 sm:px-4 py-1 sm:py-2"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<div v-if="record.issuerDid">
|
<router-link
|
||||||
|
v-if="record.issuerDid && !isHiddenDid(record.issuerDid)"
|
||||||
|
:to="{
|
||||||
|
path: '/did/' + encodeURIComponent(record.issuerDid),
|
||||||
|
}"
|
||||||
|
title="More details about this person"
|
||||||
|
>
|
||||||
<EntityIcon
|
<EntityIcon
|
||||||
:entity-id="record.issuerDid"
|
:entity-id="record.issuerDid"
|
||||||
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||||
/>
|
/>
|
||||||
</div>
|
</router-link>
|
||||||
<div v-else>
|
<font-awesome
|
||||||
<font-awesome
|
v-else-if="isHiddenDid(record.issuerDid)"
|
||||||
icon="person-circle-question"
|
icon="eye-slash"
|
||||||
class="text-slate-300 text-[2rem]"
|
class="text-slate-400 !size-[2rem] cursor-pointer"
|
||||||
/>
|
@click="notifyHiddenPerson"
|
||||||
</div>
|
/>
|
||||||
|
<font-awesome
|
||||||
|
v-else
|
||||||
|
icon="person-circle-question"
|
||||||
|
class="text-slate-400 !size-[2rem] cursor-pointer"
|
||||||
|
@click="notifyUnknownPerson"
|
||||||
|
/>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h3 class="font-semibold">
|
<h3 v-if="record.issuer.known" class="font-semibold leading-tight">
|
||||||
{{ record.issuer.known ? record.issuer.displayName : "" }}
|
{{ record.issuer.displayName }}
|
||||||
</h3>
|
</h3>
|
||||||
<p class="ms-auto text-xs text-slate-500 italic">
|
<p class="ms-auto text-xs text-slate-500 italic">
|
||||||
{{ friendlyDate }}
|
{{ friendlyDate }}
|
||||||
@@ -37,7 +49,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a class="cursor-pointer" @click="$emit('loadClaim', record.jwtId)">
|
<a
|
||||||
|
class="cursor-pointer"
|
||||||
|
data-testid="circle-info-link"
|
||||||
|
@click="$emit('loadClaim', record.jwtId)"
|
||||||
|
>
|
||||||
<font-awesome icon="circle-info" class="fa-fw text-slate-500" />
|
<font-awesome icon="circle-info" class="fa-fw text-slate-500" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -46,7 +62,7 @@
|
|||||||
<!-- Record Image -->
|
<!-- Record Image -->
|
||||||
<div
|
<div
|
||||||
v-if="record.image"
|
v-if="record.image"
|
||||||
class="bg-cover mb-6 -mt-3 sm:-mt-4 -mx-3 sm:-mx-4"
|
class="bg-cover mb-2 -mt-3 sm:-mt-4 -mx-3 sm:-mx-4"
|
||||||
:style="`background-image: url(${record.image});`"
|
:style="`background-image: url(${record.image});`"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
@@ -62,29 +78,59 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Description -->
|
||||||
|
<p class="font-medium">
|
||||||
|
<a class="cursor-pointer" @click="$emit('loadClaim', record.jwtId)">
|
||||||
|
{{ description }}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="relative flex justify-between gap-4 max-w-[40rem] mx-auto mb-5"
|
class="relative flex justify-between gap-4 max-w-[40rem] mx-auto mt-4"
|
||||||
>
|
>
|
||||||
<!-- Source -->
|
<!-- Source -->
|
||||||
<div
|
<div
|
||||||
class="w-[8rem] sm:w-[12rem] text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
|
class="w-[7rem] sm:w-[12rem] text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
|
||||||
>
|
>
|
||||||
<div class="relative w-fit mx-auto">
|
<div class="relative w-fit mx-auto">
|
||||||
<div>
|
<div>
|
||||||
<!-- Project Icon -->
|
<!-- Project Icon -->
|
||||||
<div v-if="record.providerPlanName">
|
<div v-if="record.providerPlanName">
|
||||||
<ProjectIcon
|
<router-link
|
||||||
:entity-id="record.providerPlanName"
|
:to="{
|
||||||
:icon-size="48"
|
path:
|
||||||
class="rounded size-[3rem] sm:size-[4rem] *:w-full *:h-full"
|
'/project/' +
|
||||||
/>
|
encodeURIComponent(record.providerPlanHandleId || ''),
|
||||||
|
}"
|
||||||
|
title="View project details"
|
||||||
|
>
|
||||||
|
<ProjectIcon
|
||||||
|
:entity-id="record.providerPlanHandleId || ''"
|
||||||
|
:icon-size="48"
|
||||||
|
class="rounded size-[3rem] sm:size-[4rem] *:w-full *:h-full"
|
||||||
|
/>
|
||||||
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<!-- Identicon for DIDs -->
|
<!-- Identicon for DIDs -->
|
||||||
<div v-else-if="record.agentDid">
|
<div v-else-if="record.agentDid">
|
||||||
<EntityIcon
|
<router-link
|
||||||
:entity-id="record.agentDid"
|
v-if="!isHiddenDid(record.agentDid)"
|
||||||
:profile-image-url="record.issuer.profileImageUrl"
|
:to="{
|
||||||
class="rounded-full bg-slate-100 overflow-hidden !size-[3rem] sm:!size-[4rem]"
|
path: '/did/' + encodeURIComponent(record.agentDid),
|
||||||
|
}"
|
||||||
|
title="More details about this person"
|
||||||
|
>
|
||||||
|
<EntityIcon
|
||||||
|
:entity-id="record.agentDid"
|
||||||
|
:profile-image-url="record.issuer.profileImageUrl"
|
||||||
|
class="rounded-full bg-slate-100 overflow-hidden !size-[3rem] sm:!size-[4rem]"
|
||||||
|
/>
|
||||||
|
</router-link>
|
||||||
|
<font-awesome
|
||||||
|
v-else
|
||||||
|
icon="eye-slash"
|
||||||
|
class="text-slate-300 !size-[3rem] sm:!size-[4rem]"
|
||||||
|
@click="notifyHiddenPerson"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- Unknown Person -->
|
<!-- Unknown Person -->
|
||||||
@@ -92,6 +138,7 @@
|
|||||||
<font-awesome
|
<font-awesome
|
||||||
icon="person-circle-question"
|
icon="person-circle-question"
|
||||||
class="text-slate-300 text-[3rem] sm:text-[4rem]"
|
class="text-slate-300 text-[3rem] sm:text-[4rem]"
|
||||||
|
@click="notifyUnknownPerson"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -110,9 +157,11 @@
|
|||||||
|
|
||||||
<!-- Arrow -->
|
<!-- Arrow -->
|
||||||
<div
|
<div
|
||||||
class="absolute inset-x-[8rem] sm:inset-x-[12rem] mx-2 top-1/2 -translate-y-1/2"
|
class="absolute inset-x-[7rem] sm:inset-x-[12rem] mx-2 top-1/2 -translate-y-1/2"
|
||||||
>
|
>
|
||||||
<div class="text-sm text-center leading-none font-semibold pe-[15px]">
|
<div
|
||||||
|
class="text-sm text-center leading-none font-semibold pe-2 sm:pe-4"
|
||||||
|
>
|
||||||
{{ fetchAmount }}
|
{{ fetchAmount }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -129,24 +178,47 @@
|
|||||||
|
|
||||||
<!-- Destination -->
|
<!-- Destination -->
|
||||||
<div
|
<div
|
||||||
class="w-[8rem] sm:w-[12rem] text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
|
class="w-[7rem] sm:w-[12rem] text-center bg-white border border-slate-200 rounded p-2 sm:p-3"
|
||||||
>
|
>
|
||||||
<div class="relative w-fit mx-auto">
|
<div class="relative w-fit mx-auto">
|
||||||
<div>
|
<div>
|
||||||
<!-- Project Icon -->
|
<!-- Project Icon -->
|
||||||
<div v-if="record.recipientProjectName">
|
<div v-if="record.recipientProjectName">
|
||||||
<ProjectIcon
|
<router-link
|
||||||
:entity-id="record.recipientProjectName"
|
:to="{
|
||||||
:icon-size="48"
|
path:
|
||||||
class="rounded size-[3rem] sm:size-[4rem] *:w-full *:h-full"
|
'/project/' +
|
||||||
/>
|
encodeURIComponent(record.fulfillsPlanHandleId || ''),
|
||||||
|
}"
|
||||||
|
title="View project details"
|
||||||
|
>
|
||||||
|
<ProjectIcon
|
||||||
|
:entity-id="record.fulfillsPlanHandleId || ''"
|
||||||
|
:icon-size="48"
|
||||||
|
class="rounded size-[3rem] sm:size-[4rem] *:w-full *:h-full"
|
||||||
|
/>
|
||||||
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
<!-- Identicon for DIDs -->
|
<!-- Identicon for DIDs -->
|
||||||
<div v-else-if="record.recipientDid">
|
<div v-else-if="record.recipientDid">
|
||||||
<EntityIcon
|
<router-link
|
||||||
:entity-id="record.recipientDid"
|
v-if="!isHiddenDid(record.recipientDid)"
|
||||||
:profile-image-url="record.receiver.profileImageUrl"
|
:to="{
|
||||||
class="rounded-full bg-slate-100 overflow-hidden !size-[3rem] sm:!size-[4rem]"
|
path: '/did/' + encodeURIComponent(record.recipientDid),
|
||||||
|
}"
|
||||||
|
title="More details about this person"
|
||||||
|
>
|
||||||
|
<EntityIcon
|
||||||
|
:entity-id="record.recipientDid"
|
||||||
|
:profile-image-url="record.receiver.profileImageUrl"
|
||||||
|
class="rounded-full bg-slate-100 overflow-hidden !size-[3rem] sm:!size-[4rem]"
|
||||||
|
/>
|
||||||
|
</router-link>
|
||||||
|
<font-awesome
|
||||||
|
v-else
|
||||||
|
icon="eye-slash"
|
||||||
|
class="text-slate-300 !size-[3rem] sm:!size-[4rem]"
|
||||||
|
@click="notifyHiddenPerson"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- Unknown Person -->
|
<!-- Unknown Person -->
|
||||||
@@ -154,6 +226,7 @@
|
|||||||
<font-awesome
|
<font-awesome
|
||||||
icon="person-circle-question"
|
icon="person-circle-question"
|
||||||
class="text-slate-300 text-[3rem] sm:text-[4rem]"
|
class="text-slate-300 text-[3rem] sm:text-[4rem]"
|
||||||
|
@click="notifyUnknownPerson"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -170,13 +243,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Description -->
|
|
||||||
<p class="font-medium">
|
|
||||||
<a class="cursor-pointer" @click="$emit('loadClaim', record.jwtId)">
|
|
||||||
{{ description }}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
@@ -186,8 +252,9 @@ import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
|
|||||||
import { GiveRecordWithContactInfo } from "../types";
|
import { GiveRecordWithContactInfo } from "../types";
|
||||||
import EntityIcon from "./EntityIcon.vue";
|
import EntityIcon from "./EntityIcon.vue";
|
||||||
import { isGiveClaimType, notifyWhyCannotConfirm } from "../libs/util";
|
import { isGiveClaimType, notifyWhyCannotConfirm } from "../libs/util";
|
||||||
import { containsHiddenDid } from "../libs/endorserServer";
|
import { containsHiddenDid, isHiddenDid } from "../libs/endorserServer";
|
||||||
import ProjectIcon from "./ProjectIcon.vue";
|
import ProjectIcon from "./ProjectIcon.vue";
|
||||||
|
import { NotificationIface } from "../constants/app";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
@@ -202,6 +269,33 @@ export default class ActivityListItem extends Vue {
|
|||||||
@Prop() activeDid!: string;
|
@Prop() activeDid!: string;
|
||||||
@Prop() confirmerIdList?: string[];
|
@Prop() confirmerIdList?: string[];
|
||||||
|
|
||||||
|
isHiddenDid = isHiddenDid;
|
||||||
|
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||||
|
|
||||||
|
notifyHiddenPerson() {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Person Outside Your Network",
|
||||||
|
text: "This person is not visible to you.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyUnknownPerson() {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "warning",
|
||||||
|
title: "Unidentified Person",
|
||||||
|
text: "Nobody specific was recognized.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Emit()
|
@Emit()
|
||||||
cacheImage(image: string) {
|
cacheImage(image: string) {
|
||||||
return image;
|
return image;
|
||||||
@@ -222,7 +316,7 @@ export default class ActivityListItem extends Vue {
|
|||||||
const claim =
|
const claim =
|
||||||
(this.record.fullClaim as unknown).claim || this.record.fullClaim;
|
(this.record.fullClaim as unknown).claim || this.record.fullClaim;
|
||||||
|
|
||||||
return `${claim.description}`;
|
return `${claim?.description || ""}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private displayAmount(code: string, amt: number) {
|
private displayAmount(code: string, amt: number) {
|
||||||
|
|||||||
207
src/components/AmountInput.vue
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
/** * AmountInput.vue - Specialized amount input with increment/decrement
|
||||||
|
controls * * Extracted from GiftedDialog.vue to handle numeric amount input *
|
||||||
|
with increment/decrement buttons and validation. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-grow">
|
||||||
|
<button
|
||||||
|
class="rounded-s border border-e-0 border-slate-400 bg-slate-200 px-4 py-2"
|
||||||
|
:disabled="isAtMinimum"
|
||||||
|
type="button"
|
||||||
|
@click.prevent="decrement"
|
||||||
|
>
|
||||||
|
<font-awesome icon="chevron-left" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<input
|
||||||
|
:id="inputId"
|
||||||
|
v-model="displayValue"
|
||||||
|
type="number"
|
||||||
|
:min="min"
|
||||||
|
:max="max"
|
||||||
|
:step="step"
|
||||||
|
class="flex-1 border border-e-0 border-slate-400 px-2 py-2 text-center w-[1px]"
|
||||||
|
@input="handleInput"
|
||||||
|
@blur="handleBlur"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="rounded-e border border-slate-400 bg-slate-200 px-4 py-2"
|
||||||
|
:disabled="isAtMaximum"
|
||||||
|
type="button"
|
||||||
|
@click.prevent="increment"
|
||||||
|
>
|
||||||
|
<font-awesome icon="chevron-right" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue, Watch, Emit } from "vue-facing-decorator";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AmountInput - Numeric input with increment/decrement controls
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Increment/decrement buttons with validation
|
||||||
|
* - Configurable min/max values and step size
|
||||||
|
* - Input validation and formatting
|
||||||
|
* - Disabled state handling for boundary values
|
||||||
|
* - Emits update events for v-model compatibility
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
export default class AmountInput extends Vue {
|
||||||
|
/** Current numeric value */
|
||||||
|
@Prop({ required: true })
|
||||||
|
value!: number;
|
||||||
|
|
||||||
|
/** Minimum allowed value */
|
||||||
|
@Prop({ default: 0 })
|
||||||
|
min!: number;
|
||||||
|
|
||||||
|
/** Maximum allowed value */
|
||||||
|
@Prop({ default: Number.MAX_SAFE_INTEGER })
|
||||||
|
max!: number;
|
||||||
|
|
||||||
|
/** Step size for increment/decrement */
|
||||||
|
@Prop({ default: 1 })
|
||||||
|
step!: number;
|
||||||
|
|
||||||
|
/** Input element ID for accessibility */
|
||||||
|
@Prop({ default: "amount-input" })
|
||||||
|
inputId!: string;
|
||||||
|
|
||||||
|
/** Internal display value for input field */
|
||||||
|
private displayValue: string = "0";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize display value from prop
|
||||||
|
*/
|
||||||
|
mounted(): void {
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] mounted() - initial value: ${this.value}, min: ${this.min}, max: ${this.max}, step: ${this.step}`,
|
||||||
|
);
|
||||||
|
this.displayValue = this.value.toString();
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] mounted() - displayValue set to: ${this.displayValue}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Watch for external value changes
|
||||||
|
*/
|
||||||
|
@Watch("value")
|
||||||
|
onValueChange(newValue: number): void {
|
||||||
|
this.displayValue = newValue.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if current value is at minimum
|
||||||
|
*/
|
||||||
|
get isAtMinimum(): boolean {
|
||||||
|
const result = this.value <= this.min;
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] isAtMinimum - value: ${this.value}, min: ${this.min}, result: ${result}`,
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if current value is at maximum
|
||||||
|
*/
|
||||||
|
get isAtMaximum(): boolean {
|
||||||
|
const result = this.value >= this.max;
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] isAtMaximum - value: ${this.value}, max: ${this.max}, result: ${result}`,
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment the value by step size
|
||||||
|
*/
|
||||||
|
increment(): void {
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] increment() called - current value: ${this.value}, step: ${this.step}`,
|
||||||
|
);
|
||||||
|
const newValue = Math.min(this.value + this.step, this.max);
|
||||||
|
console.log(`[AmountInput] increment() calculated newValue: ${newValue}`);
|
||||||
|
this.updateValue(newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrement the value by step size
|
||||||
|
*/
|
||||||
|
decrement(): void {
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] decrement() called - current value: ${this.value}, step: ${this.step}`,
|
||||||
|
);
|
||||||
|
const newValue = Math.max(this.value - this.step, this.min);
|
||||||
|
console.log(`[AmountInput] decrement() calculated newValue: ${newValue}`);
|
||||||
|
this.updateValue(newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle direct input changes
|
||||||
|
*/
|
||||||
|
handleInput(): void {
|
||||||
|
const numericValue = parseFloat(this.displayValue);
|
||||||
|
if (!isNaN(numericValue)) {
|
||||||
|
const clampedValue = Math.max(this.min, Math.min(numericValue, this.max));
|
||||||
|
this.updateValue(clampedValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle input blur - ensure display value matches actual value
|
||||||
|
*/
|
||||||
|
handleBlur(): void {
|
||||||
|
this.displayValue = this.value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the value and emit change event
|
||||||
|
*/
|
||||||
|
private updateValue(newValue: number): void {
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] updateValue() called - oldValue: ${this.value}, newValue: ${newValue}`,
|
||||||
|
);
|
||||||
|
if (newValue !== this.value) {
|
||||||
|
console.log(
|
||||||
|
`[AmountInput] updateValue() - values different, updating and emitting`,
|
||||||
|
);
|
||||||
|
this.displayValue = newValue.toString();
|
||||||
|
this.emitUpdateValue(newValue);
|
||||||
|
} else {
|
||||||
|
console.log(`[AmountInput] updateValue() - values same, skipping update`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emit update:value event
|
||||||
|
*/
|
||||||
|
@Emit("update:value")
|
||||||
|
emitUpdateValue(value: number): number {
|
||||||
|
console.log(`[AmountInput] emitUpdateValue() - emitting value: ${value}`);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Remove spinner arrows from number input */
|
||||||
|
input[type="number"]::-webkit-outer-spin-button,
|
||||||
|
input[type="number"]::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="number"] {
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disabled button styles */
|
||||||
|
button:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -24,9 +24,7 @@ backup and database export, with platform-specific download instructions. * *
|
|||||||
class="block w-full text-center text-md bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md"
|
class="block w-full text-center text-md bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md"
|
||||||
@click="exportDatabase()"
|
@click="exportDatabase()"
|
||||||
>
|
>
|
||||||
Download Settings & Contacts
|
Download Contacts
|
||||||
<br />
|
|
||||||
(excluding Identifier Data)
|
|
||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
ref="downloadLink"
|
ref="downloadLink"
|
||||||
@@ -62,14 +60,18 @@ backup and database export, with platform-specific download instructions. * *
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Prop, Vue } from "vue-facing-decorator";
|
import { Component, Prop, Vue } from "vue-facing-decorator";
|
||||||
import { AppString, NotificationIface, USE_DEXIE_DB } from "../constants/app";
|
import { AppString, NotificationIface } from "../constants/app";
|
||||||
import { db } from "../db/index";
|
|
||||||
|
import { Contact } from "../db/tables/contacts";
|
||||||
|
import * as databaseUtil from "../db/databaseUtil";
|
||||||
|
|
||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
||||||
import {
|
import {
|
||||||
PlatformService,
|
PlatformService,
|
||||||
PlatformCapabilities,
|
PlatformCapabilities,
|
||||||
} from "../services/PlatformService";
|
} from "../services/PlatformService";
|
||||||
|
import { contactsToExportJson } from "../libs/util";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @vue-component
|
* @vue-component
|
||||||
@@ -131,24 +133,25 @@ export default class DataExportSection extends Vue {
|
|||||||
*/
|
*/
|
||||||
public async exportDatabase() {
|
public async exportDatabase() {
|
||||||
try {
|
try {
|
||||||
if (!USE_DEXIE_DB) {
|
let allContacts: Contact[] = [];
|
||||||
throw new Error("Not implemented");
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
|
const result = await platformService.dbQuery(`SELECT * FROM contacts`);
|
||||||
|
if (result) {
|
||||||
|
allContacts = databaseUtil.mapQueryResultToValues(
|
||||||
|
result,
|
||||||
|
) as unknown as Contact[];
|
||||||
}
|
}
|
||||||
const blob = await db.export({
|
// if (USE_DEXIE_DB) {
|
||||||
prettyJson: true,
|
// await db.open();
|
||||||
transform: (table, value, key) => {
|
// allContacts = await db.contacts.toArray();
|
||||||
if (table === "contacts") {
|
// }
|
||||||
// Dexie inserts a number 0 when some are undefined, so we need to totally remove them.
|
|
||||||
Object.keys(value).forEach((prop) => {
|
// Convert contacts to export format
|
||||||
if (value[prop] === undefined) {
|
const exportData = contactsToExportJson(allContacts);
|
||||||
delete value[prop];
|
const jsonStr = JSON.stringify(exportData, null, 2);
|
||||||
}
|
const blob = new Blob([jsonStr], { type: "application/json" });
|
||||||
});
|
|
||||||
}
|
const fileName = `${AppString.APP_NAME_NO_SPACES}-backup-contacts.json`;
|
||||||
return { value, key };
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const fileName = `${AppString.APP_NAME_NO_SPACES}-backup.json`;
|
|
||||||
|
|
||||||
if (this.platformCapabilities.hasFileDownload) {
|
if (this.platformCapabilities.hasFileDownload) {
|
||||||
// Web platform: Use download link
|
// Web platform: Use download link
|
||||||
@@ -160,8 +163,7 @@ export default class DataExportSection extends Vue {
|
|||||||
setTimeout(() => URL.revokeObjectURL(this.downloadUrl), 1000);
|
setTimeout(() => URL.revokeObjectURL(this.downloadUrl), 1000);
|
||||||
} else if (this.platformCapabilities.hasFileSystem) {
|
} else if (this.platformCapabilities.hasFileSystem) {
|
||||||
// Native platform: Write to app directory
|
// Native platform: Write to app directory
|
||||||
const content = await blob.text();
|
await this.platformService.writeAndShareFile(fileName, jsonStr);
|
||||||
await this.platformService.writeAndShareFile(fileName, content);
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error("This platform does not support file downloads.");
|
throw new Error("This platform does not support file downloads.");
|
||||||
}
|
}
|
||||||
@@ -172,10 +174,10 @@ export default class DataExportSection extends Vue {
|
|||||||
type: "success",
|
type: "success",
|
||||||
title: "Export Successful",
|
title: "Export Successful",
|
||||||
text: this.platformCapabilities.hasFileDownload
|
text: this.platformCapabilities.hasFileDownload
|
||||||
? "See your downloads directory for the backup. It is in the Dexie format."
|
? "See your downloads directory for the backup."
|
||||||
: "You should have been prompted to save your backup file.",
|
: "The backup file has been saved.",
|
||||||
},
|
},
|
||||||
-1,
|
3000,
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Export Error:", error);
|
logger.error("Export Error:", error);
|
||||||
|
|||||||
264
src/components/EntityGrid.vue
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
/** * EntityGrid.vue - Unified entity grid layout component * * Extracted from
|
||||||
|
GiftedDialog.vue to provide a reusable grid layout * for displaying people,
|
||||||
|
projects, and special entities with selection. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<ul :class="gridClasses">
|
||||||
|
<!-- Special entities (You, Unnamed) for people grids -->
|
||||||
|
<template v-if="entityType === 'people'">
|
||||||
|
<!-- "You" entity -->
|
||||||
|
<SpecialEntityCard
|
||||||
|
v-if="showYouEntity"
|
||||||
|
entity-type="you"
|
||||||
|
label="You"
|
||||||
|
icon="hand"
|
||||||
|
:selectable="youSelectable"
|
||||||
|
:conflicted="youConflicted"
|
||||||
|
:entity-data="youEntityData"
|
||||||
|
@entity-selected="handleEntitySelected"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- "Unnamed" entity -->
|
||||||
|
<SpecialEntityCard
|
||||||
|
entity-type="unnamed"
|
||||||
|
label="Unnamed"
|
||||||
|
icon="circle-question"
|
||||||
|
:entity-data="unnamedEntityData"
|
||||||
|
@entity-selected="handleEntitySelected"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Empty state message -->
|
||||||
|
<li
|
||||||
|
v-if="entities.length === 0"
|
||||||
|
class="text-xs text-slate-500 italic col-span-full"
|
||||||
|
>
|
||||||
|
{{ emptyStateMessage }}
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<!-- Entity cards (people or projects) -->
|
||||||
|
<template v-if="entityType === 'people'">
|
||||||
|
<PersonCard
|
||||||
|
v-for="person in displayedEntities"
|
||||||
|
:key="person.did"
|
||||||
|
:person="person"
|
||||||
|
:conflicted="isPersonConflicted(person.did)"
|
||||||
|
:show-time-icon="true"
|
||||||
|
@person-selected="handlePersonSelected"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="entityType === 'projects'">
|
||||||
|
<ProjectCard
|
||||||
|
v-for="project in displayedEntities"
|
||||||
|
:key="project.handleId"
|
||||||
|
:project="project"
|
||||||
|
:active-did="activeDid"
|
||||||
|
:all-my-dids="allMyDids"
|
||||||
|
:all-contacts="allContacts"
|
||||||
|
@project-selected="handleProjectSelected"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Show All navigation -->
|
||||||
|
<ShowAllCard
|
||||||
|
v-if="shouldShowAll"
|
||||||
|
:entity-type="entityType"
|
||||||
|
:route-name="showAllRoute"
|
||||||
|
:query-params="showAllQueryParams"
|
||||||
|
/>
|
||||||
|
</ul>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
|
||||||
|
import PersonCard from "./PersonCard.vue";
|
||||||
|
import ProjectCard from "./ProjectCard.vue";
|
||||||
|
import SpecialEntityCard from "./SpecialEntityCard.vue";
|
||||||
|
import ShowAllCard from "./ShowAllCard.vue";
|
||||||
|
import { Contact } from "../db/tables/contacts";
|
||||||
|
import { PlanData } from "../interfaces/records";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EntityGrid - Unified grid layout for displaying people or projects
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Responsive grid layout for people/projects
|
||||||
|
* - Special entity integration (You, Unnamed)
|
||||||
|
* - Conflict detection integration
|
||||||
|
* - Empty state messaging
|
||||||
|
* - Show All navigation
|
||||||
|
* - Event delegation for entity selection
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
PersonCard,
|
||||||
|
ProjectCard,
|
||||||
|
SpecialEntityCard,
|
||||||
|
ShowAllCard,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class EntityGrid extends Vue {
|
||||||
|
/** Type of entities to display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
entityType!: "people" | "projects";
|
||||||
|
|
||||||
|
/** Array of entities to display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
entities!: Contact[] | PlanData[];
|
||||||
|
|
||||||
|
/** Maximum number of entities to display */
|
||||||
|
@Prop({ default: 10 })
|
||||||
|
maxItems!: number;
|
||||||
|
|
||||||
|
/** Active user's DID */
|
||||||
|
@Prop({ required: true })
|
||||||
|
activeDid!: string;
|
||||||
|
|
||||||
|
/** All user's DIDs */
|
||||||
|
@Prop({ required: true })
|
||||||
|
allMyDids!: string[];
|
||||||
|
|
||||||
|
/** All contacts */
|
||||||
|
@Prop({ required: true })
|
||||||
|
allContacts!: Contact[];
|
||||||
|
|
||||||
|
/** Function to check if a person DID would create a conflict */
|
||||||
|
@Prop({ required: true })
|
||||||
|
conflictChecker!: (did: string) => boolean;
|
||||||
|
|
||||||
|
/** Whether to show the "You" entity for people grids */
|
||||||
|
@Prop({ default: true })
|
||||||
|
showYouEntity!: boolean;
|
||||||
|
|
||||||
|
/** Whether the "You" entity is selectable */
|
||||||
|
@Prop({ default: true })
|
||||||
|
youSelectable!: boolean;
|
||||||
|
|
||||||
|
/** Route name for "Show All" navigation */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
showAllRoute!: string;
|
||||||
|
|
||||||
|
/** Query parameters for "Show All" navigation */
|
||||||
|
@Prop({ default: () => ({}) })
|
||||||
|
showAllQueryParams!: Record<string, any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for the grid layout
|
||||||
|
*/
|
||||||
|
get gridClasses(): string {
|
||||||
|
const baseClasses = "grid gap-x-2 gap-y-4 text-center mb-4";
|
||||||
|
|
||||||
|
if (this.entityType === "projects") {
|
||||||
|
return `${baseClasses} grid-cols-3 md:grid-cols-4`;
|
||||||
|
} else {
|
||||||
|
return `${baseClasses} grid-cols-4 sm:grid-cols-5 md:grid-cols-6`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed entities to display (limited by maxItems)
|
||||||
|
*/
|
||||||
|
get displayedEntities(): Contact[] | PlanData[] {
|
||||||
|
const maxDisplay = this.entityType === "projects" ? 7 : this.maxItems;
|
||||||
|
return this.entities.slice(0, maxDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed empty state message based on entity type
|
||||||
|
*/
|
||||||
|
get emptyStateMessage(): string {
|
||||||
|
if (this.entityType === "projects") {
|
||||||
|
return "(No projects found.)";
|
||||||
|
} else {
|
||||||
|
return "(Add friends to see more people worthy of recognition.)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the "Show All" navigation
|
||||||
|
*/
|
||||||
|
get shouldShowAll(): boolean {
|
||||||
|
return this.entities.length > 0 && this.showAllRoute !== "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the "You" entity is conflicted
|
||||||
|
*/
|
||||||
|
get youConflicted(): boolean {
|
||||||
|
return this.conflictChecker(this.activeDid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity data for the "You" special entity
|
||||||
|
*/
|
||||||
|
get youEntityData(): { did: string; name: string } {
|
||||||
|
return {
|
||||||
|
did: this.activeDid,
|
||||||
|
name: "You",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity data for the "Unnamed" special entity
|
||||||
|
*/
|
||||||
|
get unnamedEntityData(): { did: string; name: string } {
|
||||||
|
return {
|
||||||
|
did: "",
|
||||||
|
name: "Unnamed",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a person DID is conflicted
|
||||||
|
*/
|
||||||
|
isPersonConflicted(did: string): boolean {
|
||||||
|
return this.conflictChecker(did);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle person selection from PersonCard
|
||||||
|
*/
|
||||||
|
handlePersonSelected(person: Contact): void {
|
||||||
|
this.emitEntitySelected({
|
||||||
|
type: "person",
|
||||||
|
data: person,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle project selection from ProjectCard
|
||||||
|
*/
|
||||||
|
handleProjectSelected(project: PlanData): void {
|
||||||
|
this.emitEntitySelected({
|
||||||
|
type: "project",
|
||||||
|
data: project,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle special entity selection from SpecialEntityCard
|
||||||
|
*/
|
||||||
|
handleEntitySelected(event: {
|
||||||
|
type: string;
|
||||||
|
entityType: string;
|
||||||
|
data: any;
|
||||||
|
}): void {
|
||||||
|
this.emitEntitySelected({
|
||||||
|
type: "special",
|
||||||
|
entityType: event.entityType,
|
||||||
|
data: event.data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit methods using @Emit decorator
|
||||||
|
|
||||||
|
@Emit("entity-selected")
|
||||||
|
emitEntitySelected(data: any): any {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Grid-specific styles if needed */
|
||||||
|
</style>
|
||||||
242
src/components/EntitySelectionStep.vue
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
/** * EntitySelectionStep.vue - Entity selection step component * * Extracted
|
||||||
|
from GiftedDialog.vue to handle the complete step 1 * entity selection interface
|
||||||
|
with dynamic labeling and grid display. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<div id="sectionGiftedGiver">
|
||||||
|
<label class="block font-bold mb-4">
|
||||||
|
{{ stepLabel }}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<EntityGrid
|
||||||
|
:entity-type="shouldShowProjects ? 'projects' : 'people'"
|
||||||
|
:entities="shouldShowProjects ? projects : allContacts"
|
||||||
|
:max-items="10"
|
||||||
|
:active-did="activeDid"
|
||||||
|
:all-my-dids="allMyDids"
|
||||||
|
:all-contacts="allContacts"
|
||||||
|
:conflict-checker="conflictChecker"
|
||||||
|
:show-you-entity="shouldShowYouEntity"
|
||||||
|
:you-selectable="youSelectable"
|
||||||
|
:show-all-route="showAllRoute"
|
||||||
|
:show-all-query-params="showAllQueryParams"
|
||||||
|
@entity-selected="handleEntitySelected"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<button
|
||||||
|
class="block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-lg"
|
||||||
|
@click="handleCancel"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
|
||||||
|
import EntityGrid from "./EntityGrid.vue";
|
||||||
|
import { Contact } from "../db/tables/contacts";
|
||||||
|
import { PlanData } from "../interfaces/records";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity selection event data structure
|
||||||
|
*/
|
||||||
|
interface EntitySelectionEvent {
|
||||||
|
type: "person" | "project" | "special";
|
||||||
|
entityType?: string;
|
||||||
|
data: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EntitySelectionStep - Complete step 1 entity selection interface
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Dynamic step labeling based on context
|
||||||
|
* - EntityGrid integration for unified entity display
|
||||||
|
* - Conflict detection and prevention
|
||||||
|
* - Special entity handling (You, Unnamed)
|
||||||
|
* - Show All navigation with context preservation
|
||||||
|
* - Cancel functionality
|
||||||
|
* - Event delegation for entity selection
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
EntityGrid,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class EntitySelectionStep extends Vue {
|
||||||
|
/** Type of step: 'giver' or 'recipient' */
|
||||||
|
@Prop({ required: true })
|
||||||
|
stepType!: "giver" | "recipient";
|
||||||
|
|
||||||
|
/** Type of giver entity: 'person' or 'project' */
|
||||||
|
@Prop({ required: true })
|
||||||
|
giverEntityType!: "person" | "project";
|
||||||
|
|
||||||
|
/** Type of recipient entity: 'person' or 'project' */
|
||||||
|
@Prop({ required: true })
|
||||||
|
recipientEntityType!: "person" | "project";
|
||||||
|
|
||||||
|
/** Whether to show projects instead of people */
|
||||||
|
@Prop({ default: false })
|
||||||
|
showProjects!: boolean;
|
||||||
|
|
||||||
|
/** Whether this is from a project view */
|
||||||
|
@Prop({ default: false })
|
||||||
|
isFromProjectView!: boolean;
|
||||||
|
|
||||||
|
/** Array of available projects */
|
||||||
|
@Prop({ required: true })
|
||||||
|
projects!: PlanData[];
|
||||||
|
|
||||||
|
/** Array of available contacts */
|
||||||
|
@Prop({ required: true })
|
||||||
|
allContacts!: Contact[];
|
||||||
|
|
||||||
|
/** Active user's DID */
|
||||||
|
@Prop({ required: true })
|
||||||
|
activeDid!: string;
|
||||||
|
|
||||||
|
/** All user's DIDs */
|
||||||
|
@Prop({ required: true })
|
||||||
|
allMyDids!: string[];
|
||||||
|
|
||||||
|
/** Function to check if a DID would create a conflict */
|
||||||
|
@Prop({ required: true })
|
||||||
|
conflictChecker!: (did: string) => boolean;
|
||||||
|
|
||||||
|
/** Project ID for context (giver) */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
fromProjectId!: string;
|
||||||
|
|
||||||
|
/** Project ID for context (recipient) */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
toProjectId!: string;
|
||||||
|
|
||||||
|
/** Current giver entity for context */
|
||||||
|
@Prop()
|
||||||
|
giver?: any;
|
||||||
|
|
||||||
|
/** Current receiver entity for context */
|
||||||
|
@Prop()
|
||||||
|
receiver?: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed step label based on context
|
||||||
|
*/
|
||||||
|
get stepLabel(): string {
|
||||||
|
if (this.stepType === "recipient") {
|
||||||
|
return "Choose who received the gift:";
|
||||||
|
} else if (this.showProjects) {
|
||||||
|
return "Choose a project benefitted from:";
|
||||||
|
} else {
|
||||||
|
return "Choose a person received from:";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show projects in the grid
|
||||||
|
*/
|
||||||
|
get shouldShowProjects(): boolean {
|
||||||
|
return (
|
||||||
|
(this.stepType === "giver" && this.giverEntityType === "project") ||
|
||||||
|
(this.stepType === "recipient" && this.recipientEntityType === "project")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the "You" entity
|
||||||
|
*/
|
||||||
|
get shouldShowYouEntity(): boolean {
|
||||||
|
return (
|
||||||
|
this.stepType === "recipient" ||
|
||||||
|
(this.stepType === "giver" && this.isFromProjectView)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the "You" entity is selectable
|
||||||
|
*/
|
||||||
|
get youSelectable(): boolean {
|
||||||
|
return !this.conflictChecker(this.activeDid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Route name for "Show All" navigation
|
||||||
|
*/
|
||||||
|
get showAllRoute(): string {
|
||||||
|
if (this.shouldShowProjects) {
|
||||||
|
return "discover";
|
||||||
|
} else if (this.allContacts.length > 0) {
|
||||||
|
return "contact-gift";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query parameters for "Show All" navigation
|
||||||
|
*/
|
||||||
|
get showAllQueryParams(): Record<string, any> {
|
||||||
|
if (this.shouldShowProjects) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
stepType: this.stepType,
|
||||||
|
giverEntityType: this.giverEntityType,
|
||||||
|
recipientEntityType: this.recipientEntityType,
|
||||||
|
...(this.stepType === "giver"
|
||||||
|
? {
|
||||||
|
recipientProjectId: this.toProjectId,
|
||||||
|
recipientProjectName: this.receiver?.name,
|
||||||
|
recipientProjectImage: this.receiver?.image,
|
||||||
|
recipientProjectHandleId: this.receiver?.handleId,
|
||||||
|
recipientDid: this.receiver?.did,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
giverProjectId: this.fromProjectId,
|
||||||
|
giverProjectName: this.giver?.name,
|
||||||
|
giverProjectImage: this.giver?.image,
|
||||||
|
giverProjectHandleId: this.giver?.handleId,
|
||||||
|
giverDid: this.giver?.did,
|
||||||
|
}),
|
||||||
|
fromProjectId: this.fromProjectId,
|
||||||
|
toProjectId: this.toProjectId,
|
||||||
|
showProjects: this.showProjects.toString(),
|
||||||
|
isFromProjectView: this.isFromProjectView.toString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle entity selection from EntityGrid
|
||||||
|
*/
|
||||||
|
handleEntitySelected(event: EntitySelectionEvent): void {
|
||||||
|
this.emitEntitySelected({
|
||||||
|
stepType: this.stepType,
|
||||||
|
...event,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle cancel button click
|
||||||
|
*/
|
||||||
|
handleCancel(): void {
|
||||||
|
this.emitCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit methods using @Emit decorator
|
||||||
|
|
||||||
|
@Emit("entity-selected")
|
||||||
|
emitEntitySelected(data: any): any {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Emit("cancel")
|
||||||
|
emitCancel(): void {
|
||||||
|
// No return value needed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Component-specific styles if needed */
|
||||||
|
</style>
|
||||||
145
src/components/EntitySummaryButton.vue
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
/** * EntitySummaryButton.vue - Displays selected entity with edit capability *
|
||||||
|
* Extracted from GiftedDialog.vue to handle entity summary display * in the gift
|
||||||
|
details step with edit functionality. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<component
|
||||||
|
:is="editable ? 'button' : 'div'"
|
||||||
|
class="flex-1 flex items-center gap-2 bg-slate-100 border border-slate-300 rounded-md p-2"
|
||||||
|
@click="handleClick"
|
||||||
|
>
|
||||||
|
<!-- Entity Icon/Avatar -->
|
||||||
|
<div>
|
||||||
|
<template v-if="entityType === 'project'">
|
||||||
|
<ProjectIcon
|
||||||
|
v-if="entity?.handleId"
|
||||||
|
:entity-id="entity.handleId"
|
||||||
|
:icon-size="32"
|
||||||
|
:image-url="entity.image"
|
||||||
|
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<EntityIcon
|
||||||
|
v-if="entity?.did"
|
||||||
|
:contact="entity"
|
||||||
|
class="rounded-full bg-white overflow-hidden !size-[2rem] object-cover"
|
||||||
|
/>
|
||||||
|
<font-awesome
|
||||||
|
v-else
|
||||||
|
icon="circle-question"
|
||||||
|
class="text-slate-400 text-3xl"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Entity Information -->
|
||||||
|
<div class="text-start min-w-0">
|
||||||
|
<p class="text-xs text-slate-500 leading-1 -mb-1 uppercase">
|
||||||
|
{{ label }}
|
||||||
|
</p>
|
||||||
|
<h3 class="font-semibold truncate">
|
||||||
|
{{ entity?.name || "Unnamed" }}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Edit/Lock Icon -->
|
||||||
|
<p class="ms-auto text-sm pe-1" :class="iconClasses">
|
||||||
|
<font-awesome
|
||||||
|
:icon="editable ? 'pen' : 'lock'"
|
||||||
|
:title="editable ? 'Change' : 'Can\'t be changed'"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
|
||||||
|
import EntityIcon from "./EntityIcon.vue";
|
||||||
|
import ProjectIcon from "./ProjectIcon.vue";
|
||||||
|
import { Contact } from "../db/tables/contacts";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity interface for both person and project entities
|
||||||
|
*/
|
||||||
|
interface EntityData {
|
||||||
|
did?: string;
|
||||||
|
handleId?: string;
|
||||||
|
name?: string;
|
||||||
|
image?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EntitySummaryButton - Displays selected entity with optional edit capability
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Shows entity avatar (person or project)
|
||||||
|
* - Displays entity name and role label
|
||||||
|
* - Handles editable vs locked states
|
||||||
|
* - Emits edit events when clicked and editable
|
||||||
|
* - Supports both person and project entity types
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
EntityIcon,
|
||||||
|
ProjectIcon,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class EntitySummaryButton extends Vue {
|
||||||
|
/** Entity data to display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
entity!: EntityData | Contact | null;
|
||||||
|
|
||||||
|
/** Type of entity: 'person' or 'project' */
|
||||||
|
@Prop({ required: true })
|
||||||
|
entityType!: "person" | "project";
|
||||||
|
|
||||||
|
/** Display label for the entity role */
|
||||||
|
@Prop({ required: true })
|
||||||
|
label!: string;
|
||||||
|
|
||||||
|
/** Whether the entity can be edited */
|
||||||
|
@Prop({ default: true })
|
||||||
|
editable!: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for the edit/lock icon
|
||||||
|
*/
|
||||||
|
get iconClasses(): string {
|
||||||
|
return this.editable ? "text-blue-500" : "text-slate-400";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle click event - only emit if editable
|
||||||
|
*/
|
||||||
|
handleClick(): void {
|
||||||
|
if (this.editable) {
|
||||||
|
this.emitEditRequested({
|
||||||
|
entityType: this.entityType,
|
||||||
|
entity: this.entity,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit methods using @Emit decorator
|
||||||
|
|
||||||
|
@Emit("edit-requested")
|
||||||
|
emitEditRequested(data: any): any {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Ensure button styling is consistent */
|
||||||
|
button {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #f1f5f9; /* hover:bg-slate-100 */
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -104,7 +104,6 @@ import { USE_DEXIE_DB } from "@/constants/app";
|
|||||||
import * as databaseUtil from "../db/databaseUtil";
|
import * as databaseUtil from "../db/databaseUtil";
|
||||||
import { MASTER_SETTINGS_KEY } from "../db/tables/settings";
|
import { MASTER_SETTINGS_KEY } from "../db/tables/settings";
|
||||||
import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
||||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: {
|
components: {
|
||||||
@@ -143,19 +142,23 @@ export default class FeedFilters extends Vue {
|
|||||||
async toggleHasVisibleDid() {
|
async toggleHasVisibleDid() {
|
||||||
this.settingChanged = true;
|
this.settingChanged = true;
|
||||||
this.hasVisibleDid = !this.hasVisibleDid;
|
this.hasVisibleDid = !this.hasVisibleDid;
|
||||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
await databaseUtil.updateDefaultSettings({
|
||||||
filterFeedByVisible: this.hasVisibleDid,
|
filterFeedByVisible: this.hasVisibleDid,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (USE_DEXIE_DB) {
|
||||||
|
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||||
|
filterFeedByVisible: this.hasVisibleDid,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async toggleNearby() {
|
async toggleNearby() {
|
||||||
this.settingChanged = true;
|
this.settingChanged = true;
|
||||||
this.isNearby = !this.isNearby;
|
this.isNearby = !this.isNearby;
|
||||||
const platformService = PlatformServiceFactory.getInstance();
|
await databaseUtil.updateDefaultSettings({
|
||||||
await platformService.dbExec(
|
filterFeedByNearby: this.isNearby,
|
||||||
`UPDATE settings SET filterFeedByNearby = ? WHERE id = ?`,
|
});
|
||||||
[this.isNearby, MASTER_SETTINGS_KEY],
|
|
||||||
);
|
|
||||||
|
|
||||||
if (USE_DEXIE_DB) {
|
if (USE_DEXIE_DB) {
|
||||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||||
@@ -169,11 +172,10 @@ export default class FeedFilters extends Vue {
|
|||||||
this.settingChanged = true;
|
this.settingChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const platformService = PlatformServiceFactory.getInstance();
|
await databaseUtil.updateDefaultSettings({
|
||||||
await platformService.dbExec(
|
filterFeedByNearby: false,
|
||||||
`UPDATE settings SET filterFeedByNearby = ? AND filterFeedByVisible = ? WHERE id = ?`,
|
filterFeedByVisible: false,
|
||||||
[false, false, MASTER_SETTINGS_KEY],
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (USE_DEXIE_DB) {
|
if (USE_DEXIE_DB) {
|
||||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||||
@@ -191,11 +193,10 @@ export default class FeedFilters extends Vue {
|
|||||||
this.settingChanged = true;
|
this.settingChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const platformService = PlatformServiceFactory.getInstance();
|
await databaseUtil.updateDefaultSettings({
|
||||||
await platformService.dbExec(
|
filterFeedByNearby: true,
|
||||||
`UPDATE settings SET filterFeedByNearby = ? AND filterFeedByVisible = ? WHERE id = ?`,
|
filterFeedByVisible: true,
|
||||||
[true, true, MASTER_SETTINGS_KEY],
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (USE_DEXIE_DB) {
|
if (USE_DEXIE_DB) {
|
||||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||||
|
|||||||
414
src/components/GiftDetailsStep.vue
Normal file
@@ -0,0 +1,414 @@
|
|||||||
|
/** * GiftDetailsStep.vue - Gift details step component * * Extracted from
|
||||||
|
GiftedDialog.vue to handle the complete step 2 * gift details form interface
|
||||||
|
with entity summaries and validation. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<div id="sectionGiftedGift">
|
||||||
|
<!-- Entity Summary Buttons -->
|
||||||
|
<div class="grid grid-cols-2 gap-2 mb-4">
|
||||||
|
<!-- Giver Button -->
|
||||||
|
<EntitySummaryButton
|
||||||
|
:entity="giver"
|
||||||
|
:entity-type="giverEntityType"
|
||||||
|
:label="giverLabel"
|
||||||
|
:editable="canEditGiver"
|
||||||
|
@edit-requested="handleEditGiver"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Recipient Button -->
|
||||||
|
<EntitySummaryButton
|
||||||
|
:entity="receiver"
|
||||||
|
:entity-type="recipientEntityType"
|
||||||
|
:label="recipientLabel"
|
||||||
|
:editable="canEditRecipient"
|
||||||
|
@edit-requested="handleEditRecipient"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Gift Description Input -->
|
||||||
|
<input
|
||||||
|
v-model="localDescription"
|
||||||
|
type="text"
|
||||||
|
class="block w-full rounded border border-slate-400 px-3 py-2 mb-4 placeholder:italic"
|
||||||
|
:placeholder="prompt || 'What was given?'"
|
||||||
|
@input="handleDescriptionChange"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Amount Input and Unit Selection -->
|
||||||
|
<div class="flex mb-4">
|
||||||
|
<AmountInput
|
||||||
|
:value="localAmount"
|
||||||
|
:min="0"
|
||||||
|
input-id="inputGivenAmount"
|
||||||
|
@update:value="handleAmountChange"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<select
|
||||||
|
v-model="localUnitCode"
|
||||||
|
class="flex-1 rounded border border-slate-400 ms-2 px-3 py-2"
|
||||||
|
@change="handleUnitCodeChange"
|
||||||
|
>
|
||||||
|
<option value="HUR">Hours</option>
|
||||||
|
<option value="USD">US $</option>
|
||||||
|
<option value="BTC">BTC</option>
|
||||||
|
<option value="BX">BX</option>
|
||||||
|
<option value="ETH">ETH</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Photo & More Options Link -->
|
||||||
|
<router-link
|
||||||
|
:to="photoOptionsRoute"
|
||||||
|
class="block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-lg mb-4"
|
||||||
|
>
|
||||||
|
Photo & more options…
|
||||||
|
</router-link>
|
||||||
|
|
||||||
|
<!-- Sign & Send Info -->
|
||||||
|
<p class="text-center text-sm mb-4">
|
||||||
|
<b class="font-medium">Sign & Send</b> to publish to the world
|
||||||
|
<font-awesome
|
||||||
|
icon="circle-info"
|
||||||
|
class="fa-fw text-blue-500 text-base cursor-pointer"
|
||||||
|
@click="handleExplainData"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- Conflict Warning -->
|
||||||
|
<div
|
||||||
|
v-if="hasConflict"
|
||||||
|
class="mb-4 p-3 bg-red-50 border border-red-200 rounded-md"
|
||||||
|
>
|
||||||
|
<p class="text-red-700 text-sm text-center">
|
||||||
|
<font-awesome icon="exclamation-triangle" class="fa-fw mr-1" />
|
||||||
|
Cannot record: Same person selected as both giver and recipient
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||||
|
<button
|
||||||
|
:disabled="hasConflict"
|
||||||
|
:class="submitButtonClasses"
|
||||||
|
@click="handleSubmit"
|
||||||
|
>
|
||||||
|
Sign & Send
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-lg"
|
||||||
|
@click="handleCancel"
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue, Watch, Emit } from "vue-facing-decorator";
|
||||||
|
import EntitySummaryButton from "./EntitySummaryButton.vue";
|
||||||
|
import AmountInput from "./AmountInput.vue";
|
||||||
|
import { RouteLocationRaw } from "vue-router";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity data interface for giver/receiver
|
||||||
|
*/
|
||||||
|
interface EntityData {
|
||||||
|
did?: string;
|
||||||
|
handleId?: string;
|
||||||
|
name?: string;
|
||||||
|
image?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GiftDetailsStep - Complete step 2 gift details form interface
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Entity summary display with edit capability
|
||||||
|
* - Gift description input with placeholder support
|
||||||
|
* - Amount input with increment/decrement controls
|
||||||
|
* - Unit code selection (HUR, USD, BTC, etc.)
|
||||||
|
* - Photo & more options navigation
|
||||||
|
* - Conflict detection and warning display
|
||||||
|
* - Form validation and submission
|
||||||
|
* - Cancel functionality
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
EntitySummaryButton,
|
||||||
|
AmountInput,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class GiftDetailsStep extends Vue {
|
||||||
|
/** Giver entity data */
|
||||||
|
@Prop({ required: true })
|
||||||
|
giver!: EntityData | null;
|
||||||
|
|
||||||
|
/** Receiver entity data */
|
||||||
|
@Prop({ required: true })
|
||||||
|
receiver!: EntityData | null;
|
||||||
|
|
||||||
|
/** Type of giver entity: 'person' or 'project' */
|
||||||
|
@Prop({ required: true })
|
||||||
|
giverEntityType!: "person" | "project";
|
||||||
|
|
||||||
|
/** Type of recipient entity: 'person' or 'project' */
|
||||||
|
@Prop({ required: true })
|
||||||
|
recipientEntityType!: "person" | "project";
|
||||||
|
|
||||||
|
/** Gift description */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
description!: string;
|
||||||
|
|
||||||
|
/** Gift amount */
|
||||||
|
@Prop({ default: 0 })
|
||||||
|
amount!: number;
|
||||||
|
|
||||||
|
/** Unit code (HUR, USD, etc.) */
|
||||||
|
@Prop({ default: "HUR" })
|
||||||
|
unitCode!: string;
|
||||||
|
|
||||||
|
/** Input placeholder text */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
prompt!: string;
|
||||||
|
|
||||||
|
/** Whether this is from a project view */
|
||||||
|
@Prop({ default: false })
|
||||||
|
isFromProjectView!: boolean;
|
||||||
|
|
||||||
|
/** Whether there's a conflict between giver and receiver */
|
||||||
|
@Prop({ default: false })
|
||||||
|
hasConflict!: boolean;
|
||||||
|
|
||||||
|
/** Offer ID for context */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
offerId!: string;
|
||||||
|
|
||||||
|
/** Project ID for context (giver) */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
fromProjectId!: string;
|
||||||
|
|
||||||
|
/** Project ID for context (recipient) */
|
||||||
|
@Prop({ default: "" })
|
||||||
|
toProjectId!: string;
|
||||||
|
|
||||||
|
/** Local reactive copies of props for v-model */
|
||||||
|
private localDescription: string = "";
|
||||||
|
private localAmount: number = 0;
|
||||||
|
private localUnitCode: string = "HUR";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize local values from props
|
||||||
|
*/
|
||||||
|
mounted(): void {
|
||||||
|
this.localDescription = this.description;
|
||||||
|
this.localAmount = this.amount;
|
||||||
|
this.localUnitCode = this.unitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Watch for external prop changes
|
||||||
|
*/
|
||||||
|
@Watch("description")
|
||||||
|
onDescriptionChange(newValue: string): void {
|
||||||
|
this.localDescription = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Watch("amount")
|
||||||
|
onAmountChange(newValue: number): void {
|
||||||
|
this.localAmount = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Watch("unitCode")
|
||||||
|
onUnitCodeChange(newValue: string): void {
|
||||||
|
this.localUnitCode = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed label for giver entity
|
||||||
|
*/
|
||||||
|
get giverLabel(): string {
|
||||||
|
return this.giverEntityType === "project"
|
||||||
|
? "Benefited from:"
|
||||||
|
: "Received from:";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed label for recipient entity
|
||||||
|
*/
|
||||||
|
get recipientLabel(): string {
|
||||||
|
return this.recipientEntityType === "project"
|
||||||
|
? "Given to project:"
|
||||||
|
: "Given to:";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the giver can be edited
|
||||||
|
*/
|
||||||
|
get canEditGiver(): boolean {
|
||||||
|
return !(this.isFromProjectView && this.giverEntityType === "project");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the recipient can be edited
|
||||||
|
*/
|
||||||
|
get canEditRecipient(): boolean {
|
||||||
|
return this.recipientEntityType === "person";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for submit button
|
||||||
|
*/
|
||||||
|
get submitButtonClasses(): string {
|
||||||
|
if (this.hasConflict) {
|
||||||
|
return "block w-full text-center text-md uppercase font-bold bg-gradient-to-b from-slate-300 to-slate-500 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-slate-400 px-1.5 py-2 rounded-lg cursor-not-allowed";
|
||||||
|
}
|
||||||
|
return "block w-full text-center text-md uppercase font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-lg";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed route for photo & more options
|
||||||
|
*/
|
||||||
|
get photoOptionsRoute(): RouteLocationRaw {
|
||||||
|
return {
|
||||||
|
name: "gifted-details",
|
||||||
|
query: {
|
||||||
|
amountInput: this.localAmount.toString(),
|
||||||
|
description: this.localDescription,
|
||||||
|
giverDid:
|
||||||
|
this.giverEntityType === "person" ? this.giver?.did : undefined,
|
||||||
|
giverName: this.giver?.name,
|
||||||
|
offerId: this.offerId,
|
||||||
|
fulfillsProjectId:
|
||||||
|
this.giverEntityType === "person" &&
|
||||||
|
this.recipientEntityType === "project"
|
||||||
|
? this.toProjectId
|
||||||
|
: undefined,
|
||||||
|
providerProjectId:
|
||||||
|
this.giverEntityType === "project" &&
|
||||||
|
this.recipientEntityType === "person"
|
||||||
|
? this.giver?.handleId
|
||||||
|
: this.fromProjectId,
|
||||||
|
recipientDid: this.receiver?.did,
|
||||||
|
recipientName: this.receiver?.name,
|
||||||
|
unitCode: this.localUnitCode,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle description input changes
|
||||||
|
*/
|
||||||
|
handleDescriptionChange(): void {
|
||||||
|
this.emitUpdateDescription(this.localDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle amount input changes
|
||||||
|
*/
|
||||||
|
handleAmountChange(newAmount: number): void {
|
||||||
|
console.log(
|
||||||
|
`[GiftDetailsStep] handleAmountChange() called - oldAmount: ${this.localAmount}, newAmount: ${newAmount}`,
|
||||||
|
);
|
||||||
|
this.localAmount = newAmount;
|
||||||
|
this.emitUpdateAmount(newAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle unit code selection changes
|
||||||
|
*/
|
||||||
|
handleUnitCodeChange(): void {
|
||||||
|
this.emitUpdateUnitCode(this.localUnitCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle giver edit request
|
||||||
|
*/
|
||||||
|
handleEditGiver(): void {
|
||||||
|
this.emitEditEntity({
|
||||||
|
entityType: "giver",
|
||||||
|
currentEntity: this.giver,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle recipient edit request
|
||||||
|
*/
|
||||||
|
handleEditRecipient(): void {
|
||||||
|
this.emitEditEntity({
|
||||||
|
entityType: "recipient",
|
||||||
|
currentEntity: this.receiver,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle explain data info click
|
||||||
|
*/
|
||||||
|
handleExplainData(): void {
|
||||||
|
this.emitExplainData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle form submission
|
||||||
|
*/
|
||||||
|
handleSubmit(): void {
|
||||||
|
if (!this.hasConflict) {
|
||||||
|
this.emitSubmit({
|
||||||
|
description: this.localDescription,
|
||||||
|
amount: this.localAmount,
|
||||||
|
unitCode: this.localUnitCode,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle cancel button click
|
||||||
|
*/
|
||||||
|
handleCancel(): void {
|
||||||
|
this.emitCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit methods using @Emit decorator
|
||||||
|
|
||||||
|
@Emit("update:description")
|
||||||
|
emitUpdateDescription(description: string): string {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Emit("update:amount")
|
||||||
|
emitUpdateAmount(amount: number): number {
|
||||||
|
console.log(
|
||||||
|
`[GiftDetailsStep] emitUpdateAmount() - emitting amount: ${amount}`,
|
||||||
|
);
|
||||||
|
return amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Emit("update:unitCode")
|
||||||
|
emitUpdateUnitCode(unitCode: string): string {
|
||||||
|
return unitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Emit("edit-entity")
|
||||||
|
emitEditEntity(data: any): any {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Emit("explain-data")
|
||||||
|
emitExplainData(): void {
|
||||||
|
// No return value needed
|
||||||
|
}
|
||||||
|
|
||||||
|
@Emit("submit")
|
||||||
|
emitSubmit(data: any): any {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Emit("cancel")
|
||||||
|
emitCancel(): void {
|
||||||
|
// No return value needed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Component-specific styles if needed */
|
||||||
|
</style>
|
||||||
@@ -1,99 +1,64 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="visible" class="dialog-overlay">
|
<div v-if="visible" class="dialog-overlay">
|
||||||
<div class="dialog">
|
<div class="dialog">
|
||||||
<h1 class="text-xl font-bold text-center mb-4">
|
<!-- Step 1: Entity Selection -->
|
||||||
{{ customTitle }}
|
<EntitySelectionStep
|
||||||
</h1>
|
v-show="currentStep === 1"
|
||||||
<input
|
:step-type="stepType"
|
||||||
v-model="description"
|
:giver-entity-type="giverEntityType"
|
||||||
type="text"
|
:recipient-entity-type="recipientEntityType"
|
||||||
class="block w-full rounded border border-slate-400 mb-2 px-3 py-2"
|
:show-projects="showProjects"
|
||||||
:placeholder="prompt || 'What was given?'"
|
:is-from-project-view="isFromProjectView"
|
||||||
|
:projects="projects"
|
||||||
|
:all-contacts="allContacts"
|
||||||
|
:active-did="activeDid"
|
||||||
|
:all-my-dids="allMyDids"
|
||||||
|
:conflict-checker="wouldCreateConflict"
|
||||||
|
:from-project-id="fromProjectId"
|
||||||
|
:to-project-id="toProjectId"
|
||||||
|
:giver="giver"
|
||||||
|
:receiver="receiver"
|
||||||
|
@entity-selected="handleEntitySelected"
|
||||||
|
@cancel="cancel"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Step 2: Gift Details -->
|
||||||
|
<GiftDetailsStep
|
||||||
|
v-show="currentStep === 2"
|
||||||
|
:giver="giver"
|
||||||
|
:receiver="receiver"
|
||||||
|
:giver-entity-type="giverEntityType"
|
||||||
|
:recipient-entity-type="recipientEntityType"
|
||||||
|
:description="description"
|
||||||
|
:amount="parseFloat(amountInput) || 0"
|
||||||
|
:unit-code="unitCode"
|
||||||
|
:prompt="prompt"
|
||||||
|
:is-from-project-view="isFromProjectView"
|
||||||
|
:has-conflict="hasPersonConflict"
|
||||||
|
:offer-id="offerId"
|
||||||
|
:from-project-id="fromProjectId"
|
||||||
|
:to-project-id="toProjectId"
|
||||||
|
@update:description="description = $event"
|
||||||
|
@update:amount="handleAmountUpdate"
|
||||||
|
@update:unit-code="unitCode = $event"
|
||||||
|
@edit-entity="handleEditEntity"
|
||||||
|
@explain-data="explainData"
|
||||||
|
@submit="handleSubmit"
|
||||||
|
@cancel="cancel"
|
||||||
/>
|
/>
|
||||||
<div class="flex flex-row justify-center">
|
|
||||||
<span
|
|
||||||
class="rounded-l border border-r-0 border-slate-400 bg-slate-200 text-center text-blue-500 px-2 py-2 w-20"
|
|
||||||
@click="changeUnitCode()"
|
|
||||||
>
|
|
||||||
{{ libsUtil.UNIT_SHORT[unitCode] || unitCode }}
|
|
||||||
</span>
|
|
||||||
<div
|
|
||||||
class="border border-r-0 border-slate-400 bg-slate-200 px-4 py-2"
|
|
||||||
@click="amountInput === '0' ? null : decrement()"
|
|
||||||
>
|
|
||||||
<font-awesome icon="chevron-left" />
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
id="inputGivenAmount"
|
|
||||||
v-model="amountInput"
|
|
||||||
type="number"
|
|
||||||
class="border border-r-0 border-slate-400 px-2 py-2 text-center w-20"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="rounded-r border border-slate-400 bg-slate-200 px-4 py-2"
|
|
||||||
@click="increment()"
|
|
||||||
>
|
|
||||||
<font-awesome icon="chevron-right" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-4 flex justify-center">
|
|
||||||
<span>
|
|
||||||
<router-link
|
|
||||||
:to="{
|
|
||||||
name: 'gifted-details',
|
|
||||||
query: {
|
|
||||||
amountInput,
|
|
||||||
description,
|
|
||||||
giverDid: giver?.did,
|
|
||||||
giverName: giver?.name,
|
|
||||||
offerId,
|
|
||||||
fulfillsProjectId: toProjectId,
|
|
||||||
providerProjectId: fromProjectId,
|
|
||||||
recipientDid: receiver?.did,
|
|
||||||
recipientName: receiver?.name,
|
|
||||||
unitCode,
|
|
||||||
},
|
|
||||||
}"
|
|
||||||
class="text-blue-500"
|
|
||||||
>
|
|
||||||
Photo & more options ...
|
|
||||||
</router-link>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<p class="text-center mb-2 mt-6 italic">
|
|
||||||
Sign & Send to publish to the world
|
|
||||||
<font-awesome
|
|
||||||
icon="circle-info"
|
|
||||||
class="pl-2 text-blue-500 cursor-pointer"
|
|
||||||
@click="explainData()"
|
|
||||||
/>
|
|
||||||
</p>
|
|
||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
|
||||||
<button
|
|
||||||
class="block w-full text-center text-lg font-bold uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md"
|
|
||||||
@click="confirm"
|
|
||||||
>
|
|
||||||
Sign & Send
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
class="block w-full text-center text-md uppercase bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md"
|
|
||||||
@click="cancel"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Vue, Component, Prop } from "vue-facing-decorator";
|
import { Vue, Component, Prop, Watch } from "vue-facing-decorator";
|
||||||
|
|
||||||
import { NotificationIface, USE_DEXIE_DB } from "../constants/app";
|
import { NotificationIface, USE_DEXIE_DB } from "../constants/app";
|
||||||
import {
|
import {
|
||||||
createAndSubmitGive,
|
createAndSubmitGive,
|
||||||
didInfo,
|
didInfo,
|
||||||
serverMessageForUser,
|
serverMessageForUser,
|
||||||
|
getHeaders,
|
||||||
} from "../libs/endorserServer";
|
} from "../libs/endorserServer";
|
||||||
import * as libsUtil from "../libs/util";
|
import * as libsUtil from "../libs/util";
|
||||||
import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
import { db, retrieveSettingsForActiveAccount } from "../db/index";
|
||||||
@@ -102,13 +67,42 @@ import * as databaseUtil from "../db/databaseUtil";
|
|||||||
import { retrieveAccountDids } from "../libs/util";
|
import { retrieveAccountDids } from "../libs/util";
|
||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory";
|
||||||
|
import EntityIcon from "../components/EntityIcon.vue";
|
||||||
|
import ProjectIcon from "../components/ProjectIcon.vue";
|
||||||
|
import EntitySelectionStep from "../components/EntitySelectionStep.vue";
|
||||||
|
import GiftDetailsStep from "../components/GiftDetailsStep.vue";
|
||||||
|
import { PlanData } from "../interfaces/records";
|
||||||
|
|
||||||
@Component
|
@Component({
|
||||||
|
components: {
|
||||||
|
EntityIcon,
|
||||||
|
ProjectIcon,
|
||||||
|
EntitySelectionStep,
|
||||||
|
GiftDetailsStep,
|
||||||
|
},
|
||||||
|
})
|
||||||
export default class GiftedDialog extends Vue {
|
export default class GiftedDialog extends Vue {
|
||||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||||
|
|
||||||
@Prop() fromProjectId = "";
|
@Prop() fromProjectId = "";
|
||||||
@Prop() toProjectId = "";
|
@Prop() toProjectId = "";
|
||||||
|
@Prop({ default: false }) showProjects = false;
|
||||||
|
@Prop() isFromProjectView = false;
|
||||||
|
|
||||||
|
@Watch("showProjects")
|
||||||
|
onShowProjectsChange() {
|
||||||
|
this.updateEntityTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Watch("fromProjectId")
|
||||||
|
onFromProjectIdChange() {
|
||||||
|
this.updateEntityTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Watch("toProjectId")
|
||||||
|
onToProjectIdChange() {
|
||||||
|
this.updateEntityTypes();
|
||||||
|
}
|
||||||
|
|
||||||
activeDid = "";
|
activeDid = "";
|
||||||
allContacts: Array<Contact> = [];
|
allContacts: Array<Contact> = [];
|
||||||
@@ -125,9 +119,94 @@ export default class GiftedDialog extends Vue {
|
|||||||
receiver?: libsUtil.GiverReceiverInputInfo;
|
receiver?: libsUtil.GiverReceiverInputInfo;
|
||||||
unitCode = "HUR";
|
unitCode = "HUR";
|
||||||
visible = false;
|
visible = false;
|
||||||
|
currentStep = 1;
|
||||||
|
|
||||||
libsUtil = libsUtil;
|
libsUtil = libsUtil;
|
||||||
|
|
||||||
|
projects: PlanData[] = [];
|
||||||
|
|
||||||
|
didInfo = didInfo;
|
||||||
|
|
||||||
|
// Computed property to help debug template logic
|
||||||
|
get shouldShowProjects() {
|
||||||
|
const result =
|
||||||
|
(this.stepType === "giver" && this.giverEntityType === "project") ||
|
||||||
|
(this.stepType === "recipient" && this.recipientEntityType === "project");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Computed property to check if current selection would create a conflict
|
||||||
|
get hasPersonConflict() {
|
||||||
|
// Only check for conflicts when both entities are persons
|
||||||
|
if (
|
||||||
|
this.giverEntityType !== "person" ||
|
||||||
|
this.recipientEntityType !== "person"
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if giver and recipient are the same person
|
||||||
|
if (
|
||||||
|
this.giver?.did &&
|
||||||
|
this.receiver?.did &&
|
||||||
|
this.giver.did === this.receiver.did
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Computed property to check if a contact would create a conflict when selected
|
||||||
|
wouldCreateConflict(contactDid: string) {
|
||||||
|
// Only check for conflicts when both entities are persons
|
||||||
|
if (
|
||||||
|
this.giverEntityType !== "person" ||
|
||||||
|
this.recipientEntityType !== "person"
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.stepType === "giver") {
|
||||||
|
// If selecting as giver, check if it conflicts with current recipient
|
||||||
|
return this.receiver?.did === contactDid;
|
||||||
|
} else if (this.stepType === "recipient") {
|
||||||
|
// If selecting as recipient, check if it conflicts with current giver
|
||||||
|
return this.giver?.did === contactDid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
stepType = "giver";
|
||||||
|
giverEntityType = "person" as "person" | "project";
|
||||||
|
recipientEntityType = "person" as "person" | "project";
|
||||||
|
|
||||||
|
updateEntityTypes() {
|
||||||
|
// Reset and set entity types based on current context
|
||||||
|
this.giverEntityType = "person";
|
||||||
|
this.recipientEntityType = "person";
|
||||||
|
|
||||||
|
// Determine entity types based on current context
|
||||||
|
if (this.showProjects) {
|
||||||
|
// HomeView "Project" button or ProjectViewView "Given by This"
|
||||||
|
this.giverEntityType = "project";
|
||||||
|
this.recipientEntityType = "person";
|
||||||
|
} else if (this.fromProjectId) {
|
||||||
|
// ProjectViewView "Given by This" button (project is giver)
|
||||||
|
this.giverEntityType = "project";
|
||||||
|
this.recipientEntityType = "person";
|
||||||
|
} else if (this.toProjectId) {
|
||||||
|
// ProjectViewView "Given to This" button (project is recipient)
|
||||||
|
this.giverEntityType = "person";
|
||||||
|
this.recipientEntityType = "project";
|
||||||
|
} else {
|
||||||
|
// HomeView "Person" button
|
||||||
|
this.giverEntityType = "person";
|
||||||
|
this.recipientEntityType = "person";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async open(
|
async open(
|
||||||
giver?: libsUtil.GiverReceiverInputInfo,
|
giver?: libsUtil.GiverReceiverInputInfo,
|
||||||
receiver?: libsUtil.GiverReceiverInputInfo,
|
receiver?: libsUtil.GiverReceiverInputInfo,
|
||||||
@@ -140,10 +219,14 @@ export default class GiftedDialog extends Vue {
|
|||||||
this.giver = giver;
|
this.giver = giver;
|
||||||
this.prompt = prompt || "";
|
this.prompt = prompt || "";
|
||||||
this.receiver = receiver;
|
this.receiver = receiver;
|
||||||
// if we show "given to user" selection, default checkbox to true
|
|
||||||
this.amountInput = "0";
|
this.amountInput = "0";
|
||||||
this.callbackOnSuccess = callbackOnSuccess;
|
this.callbackOnSuccess = callbackOnSuccess;
|
||||||
this.offerId = offerId || "";
|
this.offerId = offerId || "";
|
||||||
|
this.currentStep = giver ? 2 : 1;
|
||||||
|
this.stepType = "giver";
|
||||||
|
|
||||||
|
// Update entity types based on current props
|
||||||
|
this.updateEntityTypes();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||||
@@ -174,7 +257,16 @@ export default class GiftedDialog extends Vue {
|
|||||||
this.allContacts,
|
this.allContacts,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
|
if (
|
||||||
|
this.giverEntityType === "project" ||
|
||||||
|
this.recipientEntityType === "project"
|
||||||
|
) {
|
||||||
|
await this.loadProjects();
|
||||||
|
} else {
|
||||||
|
// Clear projects array when not needed
|
||||||
|
this.projects = [];
|
||||||
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
logger.error("Error retrieving settings from database:", err);
|
logger.error("Error retrieving settings from database:", err);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
@@ -224,6 +316,7 @@ export default class GiftedDialog extends Vue {
|
|||||||
this.amountInput = "0";
|
this.amountInput = "0";
|
||||||
this.prompt = "";
|
this.prompt = "";
|
||||||
this.unitCode = "HUR";
|
this.unitCode = "HUR";
|
||||||
|
this.currentStep = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
async confirm() {
|
async confirm() {
|
||||||
@@ -266,6 +359,20 @@ export default class GiftedDialog extends Vue {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for person conflict
|
||||||
|
if (this.hasPersonConflict) {
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "danger",
|
||||||
|
title: "Error",
|
||||||
|
text: "You cannot select the same person as both giver and recipient.",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
@@ -304,26 +411,55 @@ export default class GiftedDialog extends Vue {
|
|||||||
unitCode: string = "HUR",
|
unitCode: string = "HUR",
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
// Determine the correct parameters based on entity types
|
||||||
|
let fromDid: string | undefined;
|
||||||
|
let toDid: string | undefined;
|
||||||
|
let fulfillsProjectHandleId: string | undefined;
|
||||||
|
let providerPlanHandleId: string | undefined;
|
||||||
|
|
||||||
|
if (
|
||||||
|
this.giverEntityType === "project" &&
|
||||||
|
this.recipientEntityType === "person"
|
||||||
|
) {
|
||||||
|
// Project-to-person gift
|
||||||
|
fromDid = undefined; // No person giver
|
||||||
|
toDid = recipientDid as string; // Person recipient
|
||||||
|
fulfillsProjectHandleId = undefined; // No project recipient
|
||||||
|
providerPlanHandleId = this.giver?.handleId; // Project giver
|
||||||
|
} else if (
|
||||||
|
this.giverEntityType === "person" &&
|
||||||
|
this.recipientEntityType === "project"
|
||||||
|
) {
|
||||||
|
// Person-to-project gift
|
||||||
|
fromDid = giverDid as string; // Person giver
|
||||||
|
toDid = undefined; // No person recipient
|
||||||
|
fulfillsProjectHandleId = this.toProjectId; // Project recipient
|
||||||
|
providerPlanHandleId = undefined; // No project giver
|
||||||
|
} else {
|
||||||
|
// Person-to-person gift
|
||||||
|
fromDid = giverDid as string;
|
||||||
|
toDid = recipientDid as string;
|
||||||
|
fulfillsProjectHandleId = undefined;
|
||||||
|
providerPlanHandleId = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const result = await createAndSubmitGive(
|
const result = await createAndSubmitGive(
|
||||||
this.axios,
|
this.axios,
|
||||||
this.apiServer,
|
this.apiServer,
|
||||||
this.activeDid,
|
this.activeDid,
|
||||||
giverDid as string,
|
fromDid,
|
||||||
recipientDid as string,
|
toDid,
|
||||||
description,
|
description,
|
||||||
amount,
|
amount,
|
||||||
unitCode,
|
unitCode,
|
||||||
this.toProjectId,
|
fulfillsProjectHandleId,
|
||||||
this.offerId,
|
this.offerId,
|
||||||
false,
|
false,
|
||||||
undefined,
|
undefined,
|
||||||
this.fromProjectId,
|
providerPlanHandleId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (!result.success) {
|
||||||
result.type === "error" ||
|
|
||||||
this.isGiveCreationError(result.response)
|
|
||||||
) {
|
|
||||||
const errorMessage = this.getGiveCreationErrorMessage(result);
|
const errorMessage = this.getGiveCreationErrorMessage(result);
|
||||||
logger.error("Error with give creation result:", result);
|
logger.error("Error with give creation result:", result);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
@@ -370,15 +506,6 @@ export default class GiftedDialog extends Vue {
|
|||||||
|
|
||||||
// Helper functions for readability
|
// Helper functions for readability
|
||||||
|
|
||||||
/**
|
|
||||||
* @param result response "data" from the server
|
|
||||||
* @returns true if the result indicates an error
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
isGiveCreationError(result: any) {
|
|
||||||
return result.status !== 201 || result.data?.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
||||||
* @returns best guess at an error message
|
* @returns best guess at an error message
|
||||||
@@ -403,6 +530,173 @@ export default class GiftedDialog extends Vue {
|
|||||||
-1,
|
-1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectGiver(contact?: Contact) {
|
||||||
|
if (contact) {
|
||||||
|
this.giver = {
|
||||||
|
did: contact.did,
|
||||||
|
name: contact.name || contact.did,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.giver = {
|
||||||
|
did: "",
|
||||||
|
name: "Unnamed",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
this.currentStep = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
goBackToStep1(step: string) {
|
||||||
|
this.stepType = step;
|
||||||
|
this.currentStep = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
async loadProjects() {
|
||||||
|
try {
|
||||||
|
const response = await fetch(this.apiServer + "/api/v2/report/plans", {
|
||||||
|
method: "GET",
|
||||||
|
headers: await getHeaders(this.activeDid),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.status !== 200) {
|
||||||
|
throw new Error("Failed to load projects");
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = await response.json();
|
||||||
|
if (results.data) {
|
||||||
|
this.projects = results.data;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logger.error("Error loading projects:", error);
|
||||||
|
this.$notify(
|
||||||
|
{
|
||||||
|
group: "alert",
|
||||||
|
type: "danger",
|
||||||
|
title: "Error",
|
||||||
|
text: "Failed to load projects",
|
||||||
|
},
|
||||||
|
3000,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
selectProject(project: PlanData) {
|
||||||
|
this.giver = {
|
||||||
|
did: project.handleId,
|
||||||
|
name: project.name,
|
||||||
|
image: project.image,
|
||||||
|
handleId: project.handleId,
|
||||||
|
};
|
||||||
|
this.receiver = {
|
||||||
|
did: this.activeDid,
|
||||||
|
name: "You",
|
||||||
|
};
|
||||||
|
this.currentStep = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectRecipient(contact?: Contact) {
|
||||||
|
if (contact) {
|
||||||
|
this.receiver = {
|
||||||
|
did: contact.did,
|
||||||
|
name: contact.name || contact.did,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
this.receiver = {
|
||||||
|
did: "",
|
||||||
|
name: "Unnamed",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
this.currentStep = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectRecipientProject(project: PlanData) {
|
||||||
|
this.receiver = {
|
||||||
|
did: project.handleId,
|
||||||
|
name: project.name,
|
||||||
|
image: project.image,
|
||||||
|
handleId: project.handleId,
|
||||||
|
};
|
||||||
|
this.currentStep = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Computed property for the query parameters
|
||||||
|
get giftedDetailsQuery() {
|
||||||
|
return {
|
||||||
|
amountInput: this.amountInput,
|
||||||
|
description: this.description,
|
||||||
|
giverDid: this.giverEntityType === "person" ? this.giver?.did : undefined,
|
||||||
|
giverName: this.giver?.name,
|
||||||
|
offerId: this.offerId,
|
||||||
|
fulfillsProjectId:
|
||||||
|
this.giverEntityType === "person" &&
|
||||||
|
this.recipientEntityType === "project"
|
||||||
|
? this.toProjectId
|
||||||
|
: undefined,
|
||||||
|
providerProjectId:
|
||||||
|
this.giverEntityType === "project" &&
|
||||||
|
this.recipientEntityType === "person"
|
||||||
|
? this.giver?.handleId
|
||||||
|
: this.fromProjectId,
|
||||||
|
recipientDid: this.receiver?.did,
|
||||||
|
recipientName: this.receiver?.name,
|
||||||
|
unitCode: this.unitCode,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// New event handlers for component integration
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle entity selection from EntitySelectionStep
|
||||||
|
* @param entity - The selected entity (person or project)
|
||||||
|
*/
|
||||||
|
handleEntitySelected(entity: {
|
||||||
|
type: "person" | "project";
|
||||||
|
data: Contact | PlanData;
|
||||||
|
}) {
|
||||||
|
if (entity.type === "person") {
|
||||||
|
const contact = entity.data as Contact;
|
||||||
|
if (this.stepType === "giver") {
|
||||||
|
this.selectGiver(contact);
|
||||||
|
} else {
|
||||||
|
this.selectRecipient(contact);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const project = entity.data as PlanData;
|
||||||
|
if (this.stepType === "giver") {
|
||||||
|
this.selectProject(project);
|
||||||
|
} else {
|
||||||
|
this.selectRecipientProject(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle edit entity request from GiftDetailsStep
|
||||||
|
* @param entityType - 'giver' or 'recipient'
|
||||||
|
*/
|
||||||
|
handleEditEntity(entityType: "giver" | "recipient") {
|
||||||
|
this.goBackToStep1(entityType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle form submission from GiftDetailsStep
|
||||||
|
*/
|
||||||
|
handleSubmit() {
|
||||||
|
this.confirm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle amount update from GiftDetailsStep
|
||||||
|
*/
|
||||||
|
handleAmountUpdate(newAmount: number) {
|
||||||
|
console.log(
|
||||||
|
`[GiftedDialog] handleAmountUpdate() called - oldAmount: ${this.amountInput}, newAmount: ${newAmount}`,
|
||||||
|
);
|
||||||
|
this.amountInput = newAmount.toString();
|
||||||
|
console.log(
|
||||||
|
`[GiftedDialog] handleAmountUpdate() - amountInput updated to: ${this.amountInput}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ export default class GivenPrompts extends Vue {
|
|||||||
|
|
||||||
let someContactDbIndex = Math.floor(Math.random() * this.numContacts);
|
let someContactDbIndex = Math.floor(Math.random() * this.numContacts);
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
// as long as the index has an entry, loop
|
// as long as the index has an entry, loop
|
||||||
while (
|
while (
|
||||||
this.shownContactDbIndices[someContactDbIndex] != null &&
|
this.shownContactDbIndices[someContactDbIndex] != null &&
|
||||||
@@ -245,9 +246,8 @@ export default class GivenPrompts extends Vue {
|
|||||||
[someContactDbIndex],
|
[someContactDbIndex],
|
||||||
);
|
);
|
||||||
if (result) {
|
if (result) {
|
||||||
this.currentContact = databaseUtil.mapQueryResultToValues(result)[
|
const mappedContacts = databaseUtil.mapQueryResultToValues(result);
|
||||||
someContactDbIndex
|
this.currentContact = mappedContacts[0] as unknown as Contact;
|
||||||
] as unknown as Contact;
|
|
||||||
}
|
}
|
||||||
if (USE_DEXIE_DB) {
|
if (USE_DEXIE_DB) {
|
||||||
await db.open();
|
await db.open();
|
||||||
|
|||||||
@@ -48,11 +48,7 @@
|
|||||||
<span>
|
<span>
|
||||||
{{ didInfo(visDid) }}
|
{{ didInfo(visDid) }}
|
||||||
<span v-if="!serverUtil.isEmptyOrHiddenDid(visDid)">
|
<span v-if="!serverUtil.isEmptyOrHiddenDid(visDid)">
|
||||||
<a
|
<a :href="`/did/${visDid}`" class="text-blue-500">
|
||||||
:href="`/did/${visDid}`"
|
|
||||||
target="_blank"
|
|
||||||
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"
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
<div class="text-lg text-center font-bold relative">
|
<div class="text-lg text-center font-bold relative">
|
||||||
<h1 id="ViewHeading" class="text-center font-bold">
|
<h1 id="ViewHeading" class="text-center font-bold">
|
||||||
<span v-if="uploading">Uploading Image…</span>
|
<span v-if="uploading">Uploading Image…</span>
|
||||||
<span v-else-if="blob">Crop Image</span>
|
<span v-else-if="blob">{{
|
||||||
|
crop ? "Crop Image" : "Preview Image"
|
||||||
|
}}</span>
|
||||||
<span v-else-if="showCameraPreview">Upload Image</span>
|
<span v-else-if="showCameraPreview">Upload Image</span>
|
||||||
<span v-else>Add Photo</span>
|
<span v-else>Add Photo</span>
|
||||||
</h1>
|
</h1>
|
||||||
@@ -119,12 +121,23 @@
|
|||||||
playsinline
|
playsinline
|
||||||
muted
|
muted
|
||||||
></video>
|
></video>
|
||||||
<button
|
<div
|
||||||
class="absolute bottom-4 left-1/2 -translate-x-1/2 bg-white text-slate-800 p-3 rounded-full text-2xl leading-none"
|
class="absolute bottom-4 inset-x-0 flex items-center justify-center gap-4"
|
||||||
@click="capturePhoto"
|
|
||||||
>
|
>
|
||||||
<font-awesome icon="camera" class="w-[1em]" />
|
<button
|
||||||
</button>
|
class="bg-white text-slate-800 p-3 rounded-full text-2xl leading-none"
|
||||||
|
@click="capturePhoto"
|
||||||
|
>
|
||||||
|
<font-awesome icon="camera" class="w-[1em]" />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-if="platformCapabilities.isMobile"
|
||||||
|
class="bg-white text-slate-800 p-3 rounded-full text-2xl leading-none"
|
||||||
|
@click="rotateCamera"
|
||||||
|
>
|
||||||
|
<font-awesome icon="rotate" class="w-[1em]" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -229,12 +242,12 @@
|
|||||||
<p class="mb-2">
|
<p class="mb-2">
|
||||||
Before you can upload a photo, a friend needs to register you.
|
Before you can upload a photo, a friend needs to register you.
|
||||||
</p>
|
</p>
|
||||||
<router-link
|
<button
|
||||||
:to="{ name: 'contact-qr' }"
|
|
||||||
class="inline-block text-md uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md"
|
class="inline-block text-md uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md"
|
||||||
|
@click="handleQRCodeClick"
|
||||||
>
|
>
|
||||||
Share Your Info
|
Share Your Info
|
||||||
</router-link>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -247,6 +260,7 @@ import axios from "axios";
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { Component, Vue } from "vue-facing-decorator";
|
import { Component, Vue } from "vue-facing-decorator";
|
||||||
import VuePictureCropper, { cropper } from "vue-picture-cropper";
|
import VuePictureCropper, { cropper } from "vue-picture-cropper";
|
||||||
|
import { Capacitor } from "@capacitor/core";
|
||||||
import {
|
import {
|
||||||
DEFAULT_IMAGE_API_SERVER,
|
DEFAULT_IMAGE_API_SERVER,
|
||||||
NotificationIface,
|
NotificationIface,
|
||||||
@@ -267,6 +281,11 @@ const inputImageFileNameRef = ref<Blob>();
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
defaultCameraMode: {
|
||||||
|
type: String,
|
||||||
|
default: "environment",
|
||||||
|
validator: (value: string) => ["environment", "user"].includes(value),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
export default class ImageMethodDialog extends Vue {
|
export default class ImageMethodDialog extends Vue {
|
||||||
@@ -308,6 +327,9 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
/** Camera stream reference */
|
/** Camera stream reference */
|
||||||
private cameraStream: MediaStream | null = null;
|
private cameraStream: MediaStream | null = null;
|
||||||
|
|
||||||
|
/** Current camera facing mode */
|
||||||
|
private currentFacingMode: "environment" | "user" = "environment";
|
||||||
|
|
||||||
private platformService = PlatformServiceFactory.getInstance();
|
private platformService = PlatformServiceFactory.getInstance();
|
||||||
URL = window.URL || window.webkitURL;
|
URL = window.URL || window.webkitURL;
|
||||||
|
|
||||||
@@ -369,15 +391,16 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open(setImageFn: (arg: string) => void, claimType: string, crop?: boolean) {
|
open(setImageFn: (arg: string) => void, claimType: string, crop?: boolean) {
|
||||||
|
logger.debug("ImageMethodDialog.open called");
|
||||||
this.claimType = claimType;
|
this.claimType = claimType;
|
||||||
this.crop = !!crop;
|
this.crop = !!crop;
|
||||||
this.imageCallback = setImageFn;
|
this.imageCallback = setImageFn;
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
|
this.currentFacingMode = this.defaultCameraMode as "environment" | "user";
|
||||||
|
|
||||||
// Start camera preview immediately if not on mobile
|
// Start camera preview immediately
|
||||||
if (!this.platformCapabilities.isNativeApp) {
|
logger.debug("Starting camera preview from open()");
|
||||||
this.startCameraPreview();
|
this.startCameraPreview();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadImageFile(event: Event) {
|
async uploadImageFile(event: Event) {
|
||||||
@@ -446,46 +469,24 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
logger.debug("startCameraPreview called");
|
logger.debug("startCameraPreview called");
|
||||||
logger.debug("Current showCameraPreview state:", this.showCameraPreview);
|
logger.debug("Current showCameraPreview state:", this.showCameraPreview);
|
||||||
logger.debug("Platform capabilities:", this.platformCapabilities);
|
logger.debug("Platform capabilities:", this.platformCapabilities);
|
||||||
|
logger.debug("MediaDevices available:", !!navigator.mediaDevices);
|
||||||
|
logger.debug(
|
||||||
|
"getUserMedia available:",
|
||||||
|
!!(navigator.mediaDevices && navigator.mediaDevices.getUserMedia),
|
||||||
|
);
|
||||||
|
|
||||||
if (this.platformCapabilities.isNativeApp) {
|
|
||||||
logger.debug("Using platform service for mobile device");
|
|
||||||
this.cameraState = "initializing";
|
|
||||||
this.cameraStateMessage = "Using platform camera service...";
|
|
||||||
try {
|
|
||||||
const result = await this.platformService.takePicture();
|
|
||||||
this.blob = result.blob;
|
|
||||||
this.fileName = result.fileName;
|
|
||||||
this.cameraState = "ready";
|
|
||||||
this.cameraStateMessage = "Photo captured successfully";
|
|
||||||
} catch (error) {
|
|
||||||
logger.error("Error taking picture:", error);
|
|
||||||
this.cameraState = "error";
|
|
||||||
this.cameraStateMessage =
|
|
||||||
error instanceof Error ? error.message : "Failed to take picture";
|
|
||||||
this.error =
|
|
||||||
error instanceof Error ? error.message : "Failed to take picture";
|
|
||||||
this.$notify(
|
|
||||||
{
|
|
||||||
group: "alert",
|
|
||||||
type: "danger",
|
|
||||||
title: "Error",
|
|
||||||
text: "Failed to take picture. Please try again.",
|
|
||||||
},
|
|
||||||
5000,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.debug("Starting camera preview for desktop browser");
|
|
||||||
try {
|
try {
|
||||||
this.cameraState = "initializing";
|
this.cameraState = "initializing";
|
||||||
this.cameraStateMessage = "Requesting camera access...";
|
this.cameraStateMessage = "Requesting camera access...";
|
||||||
this.showCameraPreview = true;
|
this.showCameraPreview = true;
|
||||||
await this.$nextTick();
|
await this.$nextTick();
|
||||||
|
|
||||||
|
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
||||||
|
throw new Error("Camera API not available in this browser");
|
||||||
|
}
|
||||||
|
|
||||||
const stream = await navigator.mediaDevices.getUserMedia({
|
const stream = await navigator.mediaDevices.getUserMedia({
|
||||||
video: { facingMode: "environment" },
|
video: { facingMode: this.currentFacingMode },
|
||||||
});
|
});
|
||||||
logger.debug("Camera access granted");
|
logger.debug("Camera access granted");
|
||||||
this.cameraStream = stream;
|
this.cameraStream = stream;
|
||||||
@@ -499,25 +500,36 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
videoElement.srcObject = stream;
|
videoElement.srcObject = stream;
|
||||||
await new Promise((resolve) => {
|
await new Promise((resolve) => {
|
||||||
videoElement.onloadedmetadata = () => {
|
videoElement.onloadedmetadata = () => {
|
||||||
videoElement.play().then(() => {
|
videoElement
|
||||||
resolve(true);
|
.play()
|
||||||
});
|
.then(() => {
|
||||||
|
logger.debug("Video element started playing");
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
logger.error("Error playing video:", error);
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
logger.error("Video element not found");
|
||||||
|
throw new Error("Video element not found");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Error starting camera preview:", error);
|
logger.error("Error starting camera preview:", error);
|
||||||
let errorMessage =
|
let errorMessage =
|
||||||
error instanceof Error ? error.message : "Failed to access camera";
|
error instanceof Error ? error.message : "Failed to access camera";
|
||||||
if (
|
if (
|
||||||
error.name === "NotReadableError" ||
|
error instanceof Error &&
|
||||||
error.name === "TrackStartError"
|
(error.name === "NotReadableError" || error.name === "TrackStartError")
|
||||||
) {
|
) {
|
||||||
errorMessage =
|
errorMessage =
|
||||||
"Camera is in use by another application. Please close any other apps or browser tabs using the camera and try again.";
|
"Camera is in use by another application. Please close any other apps or browser tabs using the camera and try again.";
|
||||||
} else if (
|
} else if (
|
||||||
error.name === "NotAllowedError" ||
|
error instanceof Error &&
|
||||||
error.name === "PermissionDeniedError"
|
(error.name === "NotAllowedError" ||
|
||||||
|
error.name === "PermissionDeniedError")
|
||||||
) {
|
) {
|
||||||
errorMessage =
|
errorMessage =
|
||||||
"Camera access was denied. Please allow camera access in your browser settings.";
|
"Camera access was denied. Please allow camera access in your browser settings.";
|
||||||
@@ -525,6 +537,7 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
this.cameraState = "error";
|
this.cameraState = "error";
|
||||||
this.cameraStateMessage = errorMessage;
|
this.cameraStateMessage = errorMessage;
|
||||||
this.error = errorMessage;
|
this.error = errorMessage;
|
||||||
|
this.showCameraPreview = false;
|
||||||
this.$notify(
|
this.$notify(
|
||||||
{
|
{
|
||||||
group: "alert",
|
group: "alert",
|
||||||
@@ -534,7 +547,6 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
},
|
},
|
||||||
5000,
|
5000,
|
||||||
);
|
);
|
||||||
this.showCameraPreview = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,6 +598,21 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async rotateCamera() {
|
||||||
|
// Toggle between front and back cameras
|
||||||
|
this.currentFacingMode =
|
||||||
|
this.currentFacingMode === "environment" ? "user" : "environment";
|
||||||
|
|
||||||
|
// Stop current stream
|
||||||
|
if (this.cameraStream) {
|
||||||
|
this.cameraStream.getTracks().forEach((track) => track.stop());
|
||||||
|
this.cameraStream = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start new stream with updated facing mode
|
||||||
|
await this.startCameraPreview();
|
||||||
|
}
|
||||||
|
|
||||||
private createBlobURL(blob: Blob): string {
|
private createBlobURL(blob: Blob): string {
|
||||||
return URL.createObjectURL(blob);
|
return URL.createObjectURL(blob);
|
||||||
}
|
}
|
||||||
@@ -620,6 +647,7 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
5000,
|
5000,
|
||||||
);
|
);
|
||||||
this.uploading = false;
|
this.uploading = false;
|
||||||
|
this.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
formData.append("image", this.blob, this.fileName || "photo.jpg");
|
formData.append("image", this.blob, this.fileName || "photo.jpg");
|
||||||
@@ -674,6 +702,7 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
);
|
);
|
||||||
this.uploading = false;
|
this.uploading = false;
|
||||||
this.blob = undefined;
|
this.blob = undefined;
|
||||||
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,6 +710,14 @@ export default class ImageMethodDialog extends Vue {
|
|||||||
toggleDiagnostics() {
|
toggleDiagnostics() {
|
||||||
this.showDiagnostics = !this.showDiagnostics;
|
this.showDiagnostics = !this.showDiagnostics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handleQRCodeClick() {
|
||||||
|
if (Capacitor.isNativePlatform()) {
|
||||||
|
this.$router.push({ name: "contact-qr-scan-full" });
|
||||||
|
} else {
|
||||||
|
this.$router.push({ name: "contact-qr" });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ export default class MembersList extends Vue {
|
|||||||
this.decryptedMembers.length === 0 ||
|
this.decryptedMembers.length === 0 ||
|
||||||
this.decryptedMembers[0].member.memberId !== this.members[0].memberId
|
this.decryptedMembers[0].member.memberId !== this.members[0].memberId
|
||||||
) {
|
) {
|
||||||
return "Your password is not the same as the organizer. Reload or have them check their password.";
|
return "Your password is not the same as the organizer. Retry or have them check their password.";
|
||||||
} else {
|
} else {
|
||||||
// the first (organizer) member was decrypted OK
|
// the first (organizer) member was decrypted OK
|
||||||
return "";
|
return "";
|
||||||
@@ -342,7 +342,7 @@ export default class MembersList extends Vue {
|
|||||||
group: "alert",
|
group: "alert",
|
||||||
type: "info",
|
type: "info",
|
||||||
title: "Contact Exists",
|
title: "Contact Exists",
|
||||||
text: "They are in your contacts. If you want to remove them, you must do that from the contacts screen.",
|
text: "They are in your contacts. To remove them, use the contacts page.",
|
||||||
},
|
},
|
||||||
10000,
|
10000,
|
||||||
);
|
);
|
||||||
@@ -352,7 +352,7 @@ export default class MembersList extends Vue {
|
|||||||
group: "alert",
|
group: "alert",
|
||||||
type: "info",
|
type: "info",
|
||||||
title: "Contact Available",
|
title: "Contact Available",
|
||||||
text: "This is to add them to your contacts. If you want to remove them later, you must do that from the contacts screen.",
|
text: "This is to add them to your contacts. To remove them later, use the contacts page.",
|
||||||
},
|
},
|
||||||
10000,
|
10000,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -249,10 +249,7 @@ export default class OfferDialog extends Vue {
|
|||||||
this.projectId,
|
this.projectId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (!result.success) {
|
||||||
result.type === "error" ||
|
|
||||||
this.isOfferCreationError(result.response)
|
|
||||||
) {
|
|
||||||
const errorMessage = this.getOfferCreationErrorMessage(result);
|
const errorMessage = this.getOfferCreationErrorMessage(result);
|
||||||
logger.error("Error with offer creation result:", result);
|
logger.error("Error with offer creation result:", result);
|
||||||
this.$notify(
|
this.$notify(
|
||||||
@@ -296,15 +293,6 @@ export default class OfferDialog extends Vue {
|
|||||||
|
|
||||||
// Helper functions for readability
|
// Helper functions for readability
|
||||||
|
|
||||||
/**
|
|
||||||
* @param result response "data" from the server
|
|
||||||
* @returns true if the result indicates an error
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
isOfferCreationError(result: any) {
|
|
||||||
return result.status !== 201 || result.data?.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
* @param result direct response eg. ErrorResult or SuccessResult (potentially with embedded "data")
|
||||||
* @returns best guess at an error message
|
* @returns best guess at an error message
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<h1 class="text-xl font-bold text-center mb-4 relative">
|
<h1 class="text-xl font-bold text-center mb-4 relative">
|
||||||
Welcome to Time Safari
|
Welcome to Time Safari
|
||||||
<br />
|
<br />
|
||||||
- Showcasing Gratitude & Magnifying Time
|
- Showcase Impact & Magnify Time
|
||||||
<div
|
<div
|
||||||
class="text-lg text-center leading-none absolute right-0 -top-1"
|
class="text-lg text-center leading-none absolute right-0 -top-1"
|
||||||
@click="onClickClose(true)"
|
@click="onClickClose(true)"
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
The feed underneath this pop-up shows the latest contributions, some from
|
||||||
|
people and some from projects.
|
||||||
|
|
||||||
<p v-if="isRegistered" class="mt-4">
|
<p v-if="isRegistered" class="mt-4">
|
||||||
You can now log things that you've seen:
|
You can now log things that you've seen:
|
||||||
<span v-if="numContacts > 0">
|
<span v-if="numContacts > 0">
|
||||||
@@ -23,14 +26,10 @@
|
|||||||
<span class="bg-green-600 text-white rounded-full">
|
<span class="bg-green-600 text-white rounded-full">
|
||||||
<font-awesome icon="plus" class="fa-fw" />
|
<font-awesome icon="plus" class="fa-fw" />
|
||||||
</span>
|
</span>
|
||||||
button to express your appreciation for... whatever -- maybe thanks for
|
button to express your appreciation for... whatever.
|
||||||
showing you all these fascinating stories of
|
|
||||||
<em>gratitude</em>.
|
|
||||||
</p>
|
</p>
|
||||||
<p v-else class="mt-4">
|
<p class="mt-4">
|
||||||
The feed underneath this pop-up shows the latest gifts that others have
|
Once someone registers you, you can log your appreciation, too.
|
||||||
recognized. Once someone registers you, you can log your appreciation,
|
|
||||||
too.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="mt-4">
|
<p class="mt-4">
|
||||||
@@ -260,7 +259,7 @@ export default class OnboardingDialog extends Vue {
|
|||||||
this.visible = true;
|
this.visible = true;
|
||||||
if (this.page === OnboardPage.Create) {
|
if (this.page === OnboardPage.Create) {
|
||||||
// we'll assume that they've been through all the other pages
|
// we'll assume that they've been through all the other pages
|
||||||
await databaseUtil.updateAccountSettings(this.activeDid, {
|
await databaseUtil.updateDidSpecificSettings(this.activeDid, {
|
||||||
finishedOnboarding: true,
|
finishedOnboarding: true,
|
||||||
});
|
});
|
||||||
if (USE_DEXIE_DB) {
|
if (USE_DEXIE_DB) {
|
||||||
@@ -274,7 +273,7 @@ export default class OnboardingDialog extends Vue {
|
|||||||
async onClickClose(done?: boolean, goHome?: boolean) {
|
async onClickClose(done?: boolean, goHome?: boolean) {
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
if (done) {
|
if (done) {
|
||||||
await databaseUtil.updateAccountSettings(this.activeDid, {
|
await databaseUtil.updateDidSpecificSettings(this.activeDid, {
|
||||||
finishedOnboarding: true,
|
finishedOnboarding: true,
|
||||||
});
|
});
|
||||||
if (USE_DEXIE_DB) {
|
if (USE_DEXIE_DB) {
|
||||||
|
|||||||
114
src/components/PersonCard.vue
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
/** * PersonCard.vue - Individual person display component * * Extracted from
|
||||||
|
GiftedDialog.vue to handle person entity display * with selection states and
|
||||||
|
conflict detection. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<li :class="cardClasses" @click="handleClick">
|
||||||
|
<div class="relative w-fit mx-auto">
|
||||||
|
<EntityIcon
|
||||||
|
v-if="person.did"
|
||||||
|
:contact="person"
|
||||||
|
class="!size-[3rem] mx-auto border border-slate-300 bg-white overflow-hidden rounded-full mb-1"
|
||||||
|
/>
|
||||||
|
<font-awesome
|
||||||
|
v-else
|
||||||
|
icon="circle-question"
|
||||||
|
class="text-slate-400 text-5xl mb-1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Time icon overlay for contacts -->
|
||||||
|
<div
|
||||||
|
v-if="person.did && showTimeIcon"
|
||||||
|
class="rounded-full bg-slate-400 absolute bottom-0 right-0 p-1 translate-x-1/3"
|
||||||
|
>
|
||||||
|
<font-awesome icon="clock" class="block text-white text-xs w-[1em]" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 :class="nameClasses">
|
||||||
|
{{ person.name || person.did || "Unnamed" }}
|
||||||
|
</h3>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
|
||||||
|
import EntityIcon from "./EntityIcon.vue";
|
||||||
|
import { Contact } from "../db/tables/contacts";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PersonCard - Individual person display with selection capability
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Person avatar using EntityIcon
|
||||||
|
* - Selection states (selectable, conflicted, disabled)
|
||||||
|
* - Time icon overlay for contacts
|
||||||
|
* - Click event handling
|
||||||
|
* - Emits click events for parent handling
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
EntityIcon,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class PersonCard extends Vue {
|
||||||
|
/** Contact data to display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
person!: Contact;
|
||||||
|
|
||||||
|
/** Whether this person can be selected */
|
||||||
|
@Prop({ default: true })
|
||||||
|
selectable!: boolean;
|
||||||
|
|
||||||
|
/** Whether this person would create a conflict if selected */
|
||||||
|
@Prop({ default: false })
|
||||||
|
conflicted!: boolean;
|
||||||
|
|
||||||
|
/** Whether to show time icon overlay */
|
||||||
|
@Prop({ default: false })
|
||||||
|
showTimeIcon!: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for the card
|
||||||
|
*/
|
||||||
|
get cardClasses(): string {
|
||||||
|
if (!this.selectable || this.conflicted) {
|
||||||
|
return "opacity-50 cursor-not-allowed";
|
||||||
|
}
|
||||||
|
return "cursor-pointer hover:bg-slate-50";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for the person name
|
||||||
|
*/
|
||||||
|
get nameClasses(): string {
|
||||||
|
const baseClasses =
|
||||||
|
"text-xs font-medium text-ellipsis whitespace-nowrap overflow-hidden";
|
||||||
|
|
||||||
|
if (this.conflicted) {
|
||||||
|
return `${baseClasses} text-slate-400`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseClasses;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle card click - only emit if selectable and not conflicted
|
||||||
|
*/
|
||||||
|
handleClick(): void {
|
||||||
|
if (this.selectable && !this.conflicted) {
|
||||||
|
this.emitPersonSelected(this.person);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit methods using @Emit decorator
|
||||||
|
|
||||||
|
@Emit("person-selected")
|
||||||
|
emitPersonSelected(person: Contact): Contact {
|
||||||
|
return person;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Component-specific styles if needed */
|
||||||
|
</style>
|
||||||
96
src/components/ProjectCard.vue
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
/** * ProjectCard.vue - Individual project display component * * Extracted from
|
||||||
|
GiftedDialog.vue to handle project entity display * with selection states and
|
||||||
|
issuer information. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<li class="cursor-pointer" @click="handleClick">
|
||||||
|
<div class="relative w-fit mx-auto">
|
||||||
|
<ProjectIcon
|
||||||
|
:entity-id="project.handleId"
|
||||||
|
:icon-size="48"
|
||||||
|
:image-url="project.image"
|
||||||
|
class="!size-[3rem] mx-auto border border-slate-300 bg-white overflow-hidden rounded-full mb-1"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3
|
||||||
|
class="text-xs font-medium text-ellipsis whitespace-nowrap overflow-hidden"
|
||||||
|
>
|
||||||
|
{{ project.name }}
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<div class="text-xs text-slate-500 truncate">
|
||||||
|
<font-awesome icon="user" class="fa-fw text-slate-400" />
|
||||||
|
{{ issuerDisplayName }}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
|
||||||
|
import ProjectIcon from "./ProjectIcon.vue";
|
||||||
|
import { PlanData } from "../interfaces/records";
|
||||||
|
import { Contact } from "../db/tables/contacts";
|
||||||
|
import { didInfo } from "../libs/endorserServer";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProjectCard - Displays a project entity with selection capability
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Shows project icon using ProjectIcon
|
||||||
|
* - Displays project name and issuer information
|
||||||
|
* - Handles click events for selection
|
||||||
|
* - Shows issuer name using didInfo utility
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
components: {
|
||||||
|
ProjectIcon,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
export default class ProjectCard extends Vue {
|
||||||
|
/** Project entity to display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
project!: PlanData;
|
||||||
|
|
||||||
|
/** Active user's DID for issuer display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
activeDid!: string;
|
||||||
|
|
||||||
|
/** All user's DIDs for issuer display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
allMyDids!: string[];
|
||||||
|
|
||||||
|
/** All contacts for issuer display */
|
||||||
|
@Prop({ required: true })
|
||||||
|
allContacts!: Contact[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed display name for the project issuer
|
||||||
|
*/
|
||||||
|
get issuerDisplayName(): string {
|
||||||
|
return didInfo(
|
||||||
|
this.project.issuerDid,
|
||||||
|
this.activeDid,
|
||||||
|
this.allMyDids,
|
||||||
|
this.allContacts,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle card click - emit project selection
|
||||||
|
*/
|
||||||
|
handleClick(): void {
|
||||||
|
this.emitProjectSelected(this.project);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit methods using @Emit decorator
|
||||||
|
|
||||||
|
@Emit("project-selected")
|
||||||
|
emitProjectSelected(project: PlanData): PlanData {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Component-specific styles if needed */
|
||||||
|
</style>
|
||||||
@@ -1,18 +1,14 @@
|
|||||||
<!-- eslint-disable vue/no-v-html -->
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
<template>
|
<template>
|
||||||
<a
|
<a
|
||||||
v-if="linkToFull && imageUrl"
|
v-if="linkToFullImage && imageUrl"
|
||||||
:href="imageUrl"
|
:href="imageUrl"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
class="h-full w-full object-contain"
|
class="h-full w-full object-contain"
|
||||||
>
|
>
|
||||||
<div class="h-full w-full object-contain" v-html="generateIdenticon()" />
|
<div class="h-full w-full object-contain" v-html="generateIcon()" />
|
||||||
</a>
|
</a>
|
||||||
<div
|
<div v-else class="h-full w-full object-contain" v-html="generateIcon()" />
|
||||||
v-else
|
|
||||||
class="h-full w-full object-contain"
|
|
||||||
v-html="generateIdenticon()"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { toSvg } from "jdenticon";
|
import { toSvg } from "jdenticon";
|
||||||
@@ -35,9 +31,9 @@ export default class ProjectIcon extends Vue {
|
|||||||
@Prop entityId = "";
|
@Prop entityId = "";
|
||||||
@Prop iconSize = 0;
|
@Prop iconSize = 0;
|
||||||
@Prop imageUrl = "";
|
@Prop imageUrl = "";
|
||||||
@Prop linkToFull = false;
|
@Prop linkToFullImage = false;
|
||||||
|
|
||||||
generateIdenticon() {
|
generateIcon() {
|
||||||
if (this.imageUrl) {
|
if (this.imageUrl) {
|
||||||
return `<img src="${this.imageUrl}" class="w-full h-full object-contain" />`;
|
return `<img src="${this.imageUrl}" class="w-full h-full object-contain" />`;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
66
src/components/ShowAllCard.vue
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/** * ShowAllCard.vue - Show All navigation card component * * Extracted from
|
||||||
|
GiftedDialog.vue to handle "Show All" navigation * for both people and projects
|
||||||
|
entity types. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<li class="cursor-pointer">
|
||||||
|
<router-link :to="navigationRoute" class="block text-center">
|
||||||
|
<font-awesome icon="circle-right" class="text-blue-500 text-5xl mb-1" />
|
||||||
|
<h3
|
||||||
|
class="text-xs text-slate-500 font-medium italic text-ellipsis whitespace-nowrap overflow-hidden"
|
||||||
|
>
|
||||||
|
Show All
|
||||||
|
</h3>
|
||||||
|
</router-link>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue } from "vue-facing-decorator";
|
||||||
|
import { RouteLocationRaw } from "vue-router";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ShowAllCard - Displays "Show All" navigation for entity grids
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Provides navigation to full entity listings
|
||||||
|
* - Supports different routes based on entity type
|
||||||
|
* - Maintains context through query parameters
|
||||||
|
* - Consistent visual styling with other cards
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
export default class ShowAllCard extends Vue {
|
||||||
|
/** Type of entities being shown */
|
||||||
|
@Prop({ required: true })
|
||||||
|
entityType!: "people" | "projects";
|
||||||
|
|
||||||
|
/** Route name to navigate to */
|
||||||
|
@Prop({ required: true })
|
||||||
|
routeName!: string;
|
||||||
|
|
||||||
|
/** Query parameters to pass to the route */
|
||||||
|
@Prop({ default: () => ({}) })
|
||||||
|
queryParams!: Record<string, any>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed navigation route with query parameters
|
||||||
|
*/
|
||||||
|
get navigationRoute(): RouteLocationRaw {
|
||||||
|
return {
|
||||||
|
name: this.routeName,
|
||||||
|
query: this.queryParams,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Ensure router-link styling is consistent */
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover .fa-circle-right {
|
||||||
|
transform: scale(1.1);
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
135
src/components/SpecialEntityCard.vue
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/** * SpecialEntityCard.vue - Special entity display component * * Extracted
|
||||||
|
from GiftedDialog.vue to handle special entities like "You" * and "Unnamed" with
|
||||||
|
conflict detection and selection capability. * * @author Matthew Raymer */
|
||||||
|
<template>
|
||||||
|
<li :class="cardClasses" @click="handleClick">
|
||||||
|
<font-awesome :icon="icon" :class="iconClasses" />
|
||||||
|
<h3 :class="nameClasses">
|
||||||
|
{{ label }}
|
||||||
|
</h3>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component, Prop, Vue } from "vue-facing-decorator";
|
||||||
|
import { Emit } from "vue-facing-decorator";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SpecialEntityCard - Displays special entities with selection capability
|
||||||
|
*
|
||||||
|
* Features:
|
||||||
|
* - Displays special entities like "You" and "Unnamed"
|
||||||
|
* - Shows appropriate FontAwesome icons
|
||||||
|
* - Handles conflict states and selection
|
||||||
|
* - Emits selection events with entity data
|
||||||
|
* - Configurable styling based on entity type
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
emits: ["entity-selected"],
|
||||||
|
})
|
||||||
|
export default class SpecialEntityCard extends Vue {
|
||||||
|
/** Type of special entity */
|
||||||
|
@Prop({ required: true })
|
||||||
|
entityType!: "you" | "unnamed";
|
||||||
|
|
||||||
|
/** Display label for the entity */
|
||||||
|
@Prop({ required: true })
|
||||||
|
label!: string;
|
||||||
|
|
||||||
|
/** FontAwesome icon name */
|
||||||
|
@Prop({ required: true })
|
||||||
|
icon!: string;
|
||||||
|
|
||||||
|
/** Whether this entity can be selected */
|
||||||
|
@Prop({ default: true })
|
||||||
|
selectable!: boolean;
|
||||||
|
|
||||||
|
/** Whether selecting this entity would create a conflict */
|
||||||
|
@Prop({ default: false })
|
||||||
|
conflicted!: boolean;
|
||||||
|
|
||||||
|
/** Entity data to emit when selected */
|
||||||
|
@Prop({ required: true })
|
||||||
|
entityData!: { did?: string; name: string };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for the card container
|
||||||
|
*/
|
||||||
|
get cardClasses(): string {
|
||||||
|
const baseClasses = "block";
|
||||||
|
|
||||||
|
if (!this.selectable || this.conflicted) {
|
||||||
|
return `${baseClasses} cursor-not-allowed opacity-50`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${baseClasses} cursor-pointer`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for the icon
|
||||||
|
*/
|
||||||
|
get iconClasses(): string {
|
||||||
|
const baseClasses = "text-5xl mb-1";
|
||||||
|
|
||||||
|
if (this.conflicted) {
|
||||||
|
return `${baseClasses} text-slate-400`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Different colors for different entity types
|
||||||
|
switch (this.entityType) {
|
||||||
|
case "you":
|
||||||
|
return `${baseClasses} text-blue-500`;
|
||||||
|
case "unnamed":
|
||||||
|
return `${baseClasses} text-slate-400`;
|
||||||
|
default:
|
||||||
|
return `${baseClasses} text-slate-400`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computed CSS classes for the entity name/label
|
||||||
|
*/
|
||||||
|
get nameClasses(): string {
|
||||||
|
const baseClasses =
|
||||||
|
"text-xs font-medium text-ellipsis whitespace-nowrap overflow-hidden";
|
||||||
|
|
||||||
|
if (this.conflicted) {
|
||||||
|
return `${baseClasses} text-slate-400`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Different colors for different entity types
|
||||||
|
switch (this.entityType) {
|
||||||
|
case "you":
|
||||||
|
return `${baseClasses} text-blue-500`;
|
||||||
|
case "unnamed":
|
||||||
|
return `${baseClasses} text-slate-500 italic`;
|
||||||
|
default:
|
||||||
|
return `${baseClasses} text-slate-500`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle card click - only emit if selectable and not conflicted
|
||||||
|
*/
|
||||||
|
handleClick(): void {
|
||||||
|
if (this.selectable && !this.conflicted) {
|
||||||
|
this.emitEntitySelected({
|
||||||
|
type: "special",
|
||||||
|
entityType: this.entityType,
|
||||||
|
data: this.entityData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit methods using @Emit decorator
|
||||||
|
|
||||||
|
@Emit("entity-selected")
|
||||||
|
emitEntitySelected(data: any): any {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* Component-specific styles if needed */
|
||||||
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="absolute right-5 top-[calc(env(safe-area-inset-top)+0.75rem)]">
|
<div class="absolute right-5 top-[max(0.75rem,env(safe-area-inset-top))]">
|
||||||
<span class="align-center text-red-500 mr-2">{{ message }}</span>
|
<span class="align-center text-red-500 mr-2">{{ message }}</span>
|
||||||
<span class="ml-2">
|
<span class="ml-2">
|
||||||
<router-link
|
<router-link
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export default class UserNameDialog extends Vue {
|
|||||||
async onClickSaveChanges() {
|
async onClickSaveChanges() {
|
||||||
const platformService = PlatformServiceFactory.getInstance();
|
const platformService = PlatformServiceFactory.getInstance();
|
||||||
await platformService.dbExec(
|
await platformService.dbExec(
|
||||||
"UPDATE settings SET firstName = ? WHERE key = ?",
|
"UPDATE settings SET firstName = ? WHERE id = ?",
|
||||||
[this.givenName, MASTER_SETTINGS_KEY],
|
[this.givenName, MASTER_SETTINGS_KEY],
|
||||||
);
|
);
|
||||||
if (USE_DEXIE_DB) {
|
if (USE_DEXIE_DB) {
|
||||||
|
|||||||
@@ -33,18 +33,18 @@ export const APP_SERVER =
|
|||||||
|
|
||||||
export const DEFAULT_ENDORSER_API_SERVER =
|
export const DEFAULT_ENDORSER_API_SERVER =
|
||||||
import.meta.env.VITE_DEFAULT_ENDORSER_API_SERVER ||
|
import.meta.env.VITE_DEFAULT_ENDORSER_API_SERVER ||
|
||||||
AppString.TEST_ENDORSER_API_SERVER;
|
AppString.PROD_ENDORSER_API_SERVER;
|
||||||
|
|
||||||
export const DEFAULT_IMAGE_API_SERVER =
|
export const DEFAULT_IMAGE_API_SERVER =
|
||||||
import.meta.env.VITE_DEFAULT_IMAGE_API_SERVER ||
|
import.meta.env.VITE_DEFAULT_IMAGE_API_SERVER ||
|
||||||
AppString.TEST_IMAGE_API_SERVER;
|
AppString.PROD_IMAGE_API_SERVER;
|
||||||
|
|
||||||
export const DEFAULT_PARTNER_API_SERVER =
|
export const DEFAULT_PARTNER_API_SERVER =
|
||||||
import.meta.env.VITE_DEFAULT_PARTNER_API_SERVER ||
|
import.meta.env.VITE_DEFAULT_PARTNER_API_SERVER ||
|
||||||
AppString.TEST_PARTNER_API_SERVER;
|
AppString.PROD_PARTNER_API_SERVER;
|
||||||
|
|
||||||
export const DEFAULT_PUSH_SERVER =
|
export const DEFAULT_PUSH_SERVER =
|
||||||
import.meta.env.VITE_DEFAULT_PUSH_SERVER || "https://timesafari.app";
|
import.meta.env.VITE_DEFAULT_PUSH_SERVER || AppString.PROD_PUSH_SERVER;
|
||||||
|
|
||||||
export const IMAGE_TYPE_PROFILE = "profile";
|
export const IMAGE_TYPE_PROFILE = "profile";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import migrationService from "../services/migrationService";
|
import migrationService from "../services/migrationService";
|
||||||
import type { QueryExecResult } from "../interfaces/database";
|
|
||||||
import { DEFAULT_ENDORSER_API_SERVER } from "@/constants/app";
|
import { DEFAULT_ENDORSER_API_SERVER } from "@/constants/app";
|
||||||
import { arrayBufferToBase64 } from "@/libs/crypto";
|
import { arrayBufferToBase64 } from "@/libs/crypto";
|
||||||
|
|
||||||
@@ -119,16 +118,21 @@ const MIGRATIONS = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export async function registerMigrations(): Promise<void> {
|
/**
|
||||||
// Register all migrations
|
* @param sqlExec - A function that executes a SQL statement and returns the result
|
||||||
for (const migration of MIGRATIONS) {
|
* @param extractMigrationNames - A function that extracts the names (string array) from "select name from migrations"
|
||||||
await migrationService.registerMigration(migration);
|
*/
|
||||||
}
|
export async function runMigrations<T>(
|
||||||
}
|
sqlExec: (sql: string) => Promise<unknown>,
|
||||||
|
sqlQuery: (sql: string) => Promise<T>,
|
||||||
export async function runMigrations(
|
extractMigrationNames: (result: T) => Set<string>,
|
||||||
sqlExec: (sql: string, params?: unknown[]) => Promise<Array<QueryExecResult>>,
|
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await registerMigrations();
|
for (const migration of MIGRATIONS) {
|
||||||
await migrationService.runMigrations(sqlExec);
|
migrationService.registerMigration(migration);
|
||||||
|
}
|
||||||
|
await migrationService.runMigrations(
|
||||||
|
sqlExec,
|
||||||
|
sqlQuery,
|
||||||
|
extractMigrationNames,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,20 @@ export async function updateDefaultSettings(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateAccountSettings(
|
export async function insertDidSpecificSettings(
|
||||||
|
did: string,
|
||||||
|
settings: Partial<Settings> = {},
|
||||||
|
): Promise<boolean> {
|
||||||
|
const platform = PlatformServiceFactory.getInstance();
|
||||||
|
const { sql, params } = generateInsertStatement(
|
||||||
|
{ ...settings, accountDid: did }, // make sure accountDid is set to the given value
|
||||||
|
"settings",
|
||||||
|
);
|
||||||
|
const result = await platform.dbExec(sql, params);
|
||||||
|
return result.changes === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateDidSpecificSettings(
|
||||||
accountDid: string,
|
accountDid: string,
|
||||||
settingsChanges: Settings,
|
settingsChanges: Settings,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
@@ -55,20 +68,7 @@ export async function updateAccountSettings(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const updateResult = await platform.dbExec(updateSql, updateParams);
|
const updateResult = await platform.dbExec(updateSql, updateParams);
|
||||||
|
return updateResult.changes === 1;
|
||||||
// If no record was updated, insert a new one
|
|
||||||
if (updateResult.changes === 1) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
const columns = Object.keys(settingsChanges);
|
|
||||||
const values = Object.values(settingsChanges);
|
|
||||||
const placeholders = values.map(() => "?").join(", ");
|
|
||||||
|
|
||||||
const insertSql = `INSERT INTO settings (${columns.join(", ")}) VALUES (${placeholders})`;
|
|
||||||
const result = await platform.dbExec(insertSql, values);
|
|
||||||
|
|
||||||
return result.changes === 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_SETTINGS: Settings = {
|
const DEFAULT_SETTINGS: Settings = {
|
||||||
@@ -80,9 +80,8 @@ const DEFAULT_SETTINGS: Settings = {
|
|||||||
// retrieves default settings
|
// retrieves default settings
|
||||||
export async function retrieveSettingsForDefaultAccount(): Promise<Settings> {
|
export async function retrieveSettingsForDefaultAccount(): Promise<Settings> {
|
||||||
const platform = PlatformServiceFactory.getInstance();
|
const platform = PlatformServiceFactory.getInstance();
|
||||||
const result = await platform.dbQuery("SELECT * FROM settings WHERE id = ?", [
|
const sql = "SELECT * FROM settings WHERE id = ?";
|
||||||
MASTER_SETTINGS_KEY,
|
const result = await platform.dbQuery(sql, [MASTER_SETTINGS_KEY]);
|
||||||
]);
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return DEFAULT_SETTINGS;
|
return DEFAULT_SETTINGS;
|
||||||
} else {
|
} else {
|
||||||
@@ -98,32 +97,77 @@ export async function retrieveSettingsForDefaultAccount(): Promise<Settings> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves settings for the active account, merging with default settings
|
||||||
|
*
|
||||||
|
* @returns Promise<Settings> Combined settings with account-specific overrides
|
||||||
|
* @throws Will log specific errors for debugging but returns default settings on failure
|
||||||
|
*/
|
||||||
export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
export async function retrieveSettingsForActiveAccount(): Promise<Settings> {
|
||||||
const defaultSettings = await retrieveSettingsForDefaultAccount();
|
try {
|
||||||
if (!defaultSettings.activeDid) {
|
// Get default settings first
|
||||||
return defaultSettings;
|
const defaultSettings = await retrieveSettingsForDefaultAccount();
|
||||||
} else {
|
// If no active DID, return defaults
|
||||||
const platform = PlatformServiceFactory.getInstance();
|
if (!defaultSettings.activeDid) {
|
||||||
const result = await platform.dbQuery(
|
return defaultSettings;
|
||||||
"SELECT * FROM settings WHERE accountDid = ?",
|
|
||||||
[defaultSettings.activeDid],
|
|
||||||
);
|
|
||||||
const overrideSettings = result
|
|
||||||
? (mapColumnsToValues(result.columns, result.values)[0] as Settings)
|
|
||||||
: {};
|
|
||||||
const overrideSettingsFiltered = Object.fromEntries(
|
|
||||||
Object.entries(overrideSettings).filter(([_, v]) => v !== null),
|
|
||||||
);
|
|
||||||
const settings = { ...defaultSettings, ...overrideSettingsFiltered };
|
|
||||||
if (settings.searchBoxes) {
|
|
||||||
// @ts-expect-error - the searchBoxes field is a string in the DB
|
|
||||||
settings.searchBoxes = JSON.parse(settings.searchBoxes);
|
|
||||||
}
|
}
|
||||||
return settings;
|
|
||||||
|
// Get account-specific settings
|
||||||
|
try {
|
||||||
|
const platform = PlatformServiceFactory.getInstance();
|
||||||
|
const result = await platform.dbQuery(
|
||||||
|
"SELECT * FROM settings WHERE accountDid = ?",
|
||||||
|
[defaultSettings.activeDid],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!result?.values?.length) {
|
||||||
|
// we created DID-specific settings when generated or imported, so this shouldn't happen
|
||||||
|
return defaultSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map and filter settings
|
||||||
|
const overrideSettings = mapColumnsToValues(
|
||||||
|
result.columns,
|
||||||
|
result.values,
|
||||||
|
)[0] as Settings;
|
||||||
|
|
||||||
|
const overrideSettingsFiltered = Object.fromEntries(
|
||||||
|
Object.entries(overrideSettings).filter(([_, v]) => v !== null),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Merge settings
|
||||||
|
const settings = { ...defaultSettings, ...overrideSettingsFiltered };
|
||||||
|
|
||||||
|
// Handle searchBoxes parsing
|
||||||
|
if (settings.searchBoxes) {
|
||||||
|
settings.searchBoxes = parseJsonField(settings.searchBoxes, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
} catch (error) {
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[databaseUtil] Failed to retrieve account settings for ${defaultSettings.activeDid}: ${error}`,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
// Return defaults on error
|
||||||
|
return defaultSettings;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[databaseUtil] Failed to retrieve default settings: ${error}`,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
// Return minimal default settings on complete failure
|
||||||
|
return {
|
||||||
|
id: MASTER_SETTINGS_KEY,
|
||||||
|
activeDid: undefined,
|
||||||
|
apiServer: DEFAULT_ENDORSER_API_SERVER,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastCleanupDate: string | null = null;
|
let lastCleanupDate: string | null = null;
|
||||||
|
export let memoryLogs: string[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a message to the database with proper handling of concurrent writes
|
* Logs a message to the database with proper handling of concurrent writes
|
||||||
@@ -136,6 +180,7 @@ export async function logToDb(message: string): Promise<void> {
|
|||||||
const nowKey = new Date().toISOString();
|
const nowKey = new Date().toISOString();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
memoryLogs.push(`${new Date().toISOString()} ${message}`);
|
||||||
// Try to insert first, if it fails due to UNIQUE constraint, update instead
|
// Try to insert first, if it fails due to UNIQUE constraint, update instead
|
||||||
await platform.dbExec("INSERT INTO logs (date, message) VALUES (?, ?)", [
|
await platform.dbExec("INSERT INTO logs (date, message) VALUES (?, ?)", [
|
||||||
nowKey,
|
nowKey,
|
||||||
@@ -148,6 +193,9 @@ export async function logToDb(message: string): Promise<void> {
|
|||||||
const sevenDaysAgo = new Date(
|
const sevenDaysAgo = new Date(
|
||||||
new Date().getTime() - 7 * 24 * 60 * 60 * 1000,
|
new Date().getTime() - 7 * 24 * 60 * 60 * 1000,
|
||||||
);
|
);
|
||||||
|
memoryLogs = memoryLogs.filter(
|
||||||
|
(log) => log.split(" ")[0] > sevenDaysAgo.toDateString(),
|
||||||
|
);
|
||||||
await platform.dbExec("DELETE FROM logs WHERE date < ?", [
|
await platform.dbExec("DELETE FROM logs WHERE date < ?", [
|
||||||
sevenDaysAgo.toDateString(),
|
sevenDaysAgo.toDateString(),
|
||||||
]);
|
]);
|
||||||
@@ -192,6 +240,7 @@ export function generateInsertStatement(
|
|||||||
const values = Object.values(model).filter((value) => value !== undefined);
|
const values = Object.values(model).filter((value) => value !== undefined);
|
||||||
const placeholders = values.map(() => "?").join(", ");
|
const placeholders = values.map(() => "?").join(", ");
|
||||||
const insertSql = `INSERT INTO ${tableName} (${columns.join(", ")}) VALUES (${placeholders})`;
|
const insertSql = `INSERT INTO ${tableName} (${columns.join(", ")}) VALUES (${placeholders})`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sql: insertSql,
|
sql: insertSql,
|
||||||
params: values,
|
params: values,
|
||||||
@@ -217,10 +266,8 @@ export function generateUpdateStatement(
|
|||||||
const params: unknown[] = [];
|
const params: unknown[] = [];
|
||||||
|
|
||||||
Object.entries(model).forEach(([key, value]) => {
|
Object.entries(model).forEach(([key, value]) => {
|
||||||
if (value !== undefined) {
|
setClauses.push(`${key} = ?`);
|
||||||
setClauses.push(`${key} = ?`);
|
params.push(value ?? null);
|
||||||
params.push(value);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (setClauses.length === 0) {
|
if (setClauses.length === 0) {
|
||||||
@@ -265,3 +312,115 @@ export function mapColumnsToValues(
|
|||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debug function to inspect raw settings data in the database
|
||||||
|
* This helps diagnose issues with data corruption or malformed JSON
|
||||||
|
* @param did Optional DID to inspect specific account settings
|
||||||
|
* @author Matthew Raymer
|
||||||
|
*/
|
||||||
|
export async function debugSettingsData(did?: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
const platform = PlatformServiceFactory.getInstance();
|
||||||
|
|
||||||
|
// Get all settings records
|
||||||
|
const allSettings = await platform.dbQuery("SELECT * FROM settings");
|
||||||
|
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[DEBUG] Total settings records: ${allSettings?.values?.length || 0}`,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (allSettings?.values?.length) {
|
||||||
|
allSettings.values.forEach((row, index) => {
|
||||||
|
const settings = mapColumnsToValues(allSettings.columns, [row])[0];
|
||||||
|
logConsoleAndDb(`[DEBUG] Settings record ${index + 1}:`, false);
|
||||||
|
logConsoleAndDb(`[DEBUG] - ID: ${settings.id}`, false);
|
||||||
|
logConsoleAndDb(`[DEBUG] - accountDid: ${settings.accountDid}`, false);
|
||||||
|
logConsoleAndDb(`[DEBUG] - activeDid: ${settings.activeDid}`, false);
|
||||||
|
|
||||||
|
if (settings.searchBoxes) {
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[DEBUG] - searchBoxes type: ${typeof settings.searchBoxes}`,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[DEBUG] - searchBoxes value: ${String(settings.searchBoxes)}`,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Try to parse it
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(String(settings.searchBoxes));
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[DEBUG] - searchBoxes parsed successfully: ${JSON.stringify(parsed)}`,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
} catch (parseError) {
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[DEBUG] - searchBoxes parse error: ${parseError}`,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[DEBUG] - Full record: ${JSON.stringify(settings, null, 2)}`,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// If specific DID provided, also check accounts table
|
||||||
|
if (did) {
|
||||||
|
const account = await platform.dbQuery(
|
||||||
|
"SELECT * FROM accounts WHERE did = ?",
|
||||||
|
[did],
|
||||||
|
);
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[DEBUG] Account for ${did}: ${JSON.stringify(account, null, 2)}`,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logConsoleAndDb(`[DEBUG] Error inspecting settings data: ${error}`, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Platform-agnostic JSON parsing utility
|
||||||
|
* Handles different SQLite implementations:
|
||||||
|
* - Web SQLite (wa-sqlite/absurd-sql): Auto-parses JSON strings to objects
|
||||||
|
* - Capacitor SQLite: Returns raw strings that need manual parsing
|
||||||
|
*
|
||||||
|
* @param value The value to parse (could be string or already parsed object)
|
||||||
|
* @param defaultValue Default value if parsing fails
|
||||||
|
* @returns Parsed object or default value
|
||||||
|
* @author Matthew Raymer
|
||||||
|
*/
|
||||||
|
export function parseJsonField<T>(value: unknown, defaultValue: T): T {
|
||||||
|
try {
|
||||||
|
// If already an object (web SQLite auto-parsed), return as-is
|
||||||
|
if (typeof value === "object" && value !== null) {
|
||||||
|
return value as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's a string (Capacitor SQLite or fallback), parse it
|
||||||
|
if (typeof value === "string") {
|
||||||
|
return JSON.parse(value) as T;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it's null/undefined, return default
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultValue;
|
||||||
|
} catch (error) {
|
||||||
|
logConsoleAndDb(
|
||||||
|
`[databaseUtil] Failed to parse JSON field: ${error}`,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
import { GenericVerifiableCredential } from "./common";
|
/**
|
||||||
|
* Types of Claims
|
||||||
|
*
|
||||||
|
* Note that these are for the claims that get signed.
|
||||||
|
* Records that are the latest edited entities are in the records.ts file.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
export interface AgreeVerifiableCredential {
|
import { ClaimObject } from "./common";
|
||||||
"@context": string;
|
|
||||||
|
export interface AgreeActionClaim extends ClaimObject {
|
||||||
|
"@context": "https://schema.org";
|
||||||
"@type": string;
|
"@type": string;
|
||||||
object: Record<string, unknown>;
|
object: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that previous VCs may have additional fields.
|
// Note that previous VCs may have additional fields.
|
||||||
// https://endorser.ch/doc/html/transactions.html#id4
|
// https://endorser.ch/doc/html/transactions.html#id4
|
||||||
export interface GiveVerifiableCredential extends GenericVerifiableCredential {
|
export interface GiveActionClaim extends ClaimObject {
|
||||||
|
// context is optional because it might be embedded in another claim, eg. an AgreeAction
|
||||||
|
"@context"?: "https://schema.org";
|
||||||
"@type": "GiveAction";
|
"@type": "GiveAction";
|
||||||
agent?: { identifier: string };
|
agent?: { identifier: string };
|
||||||
description?: string;
|
description?: string;
|
||||||
@@ -16,43 +26,21 @@ export interface GiveVerifiableCredential extends GenericVerifiableCredential {
|
|||||||
identifier?: string;
|
identifier?: string;
|
||||||
image?: string;
|
image?: string;
|
||||||
object?: { amountOfThisGood: number; unitCode: string };
|
object?: { amountOfThisGood: number; unitCode: string };
|
||||||
provider?: GenericVerifiableCredential;
|
provider?: ClaimObject;
|
||||||
recipient?: { identifier: string };
|
recipient?: { identifier: string };
|
||||||
type: string[];
|
}
|
||||||
issuer: string;
|
|
||||||
issuanceDate: string;
|
export interface JoinActionClaim extends ClaimObject {
|
||||||
credentialSubject: {
|
agent?: { identifier: string };
|
||||||
id: string;
|
event?: { organizer?: { name: string }; name?: string; startTime?: string };
|
||||||
type: "GiveAction";
|
|
||||||
offeredBy?: {
|
|
||||||
type: "Person";
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
offeredTo?: {
|
|
||||||
type: "Person";
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
offeredToProject?: {
|
|
||||||
type: "Project";
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
offeredToProjectVisibleToDids?: string[];
|
|
||||||
offeredToVisibleToDids?: string[];
|
|
||||||
offeredByVisibleToDids?: string[];
|
|
||||||
amount: {
|
|
||||||
type: "QuantitativeValue";
|
|
||||||
value: number;
|
|
||||||
unitCode: string;
|
|
||||||
};
|
|
||||||
startTime?: string;
|
|
||||||
endTime?: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that previous VCs may have additional fields.
|
// Note that previous VCs may have additional fields.
|
||||||
// https://endorser.ch/doc/html/transactions.html#id8
|
// https://endorser.ch/doc/html/transactions.html#id8
|
||||||
export interface OfferVerifiableCredential extends GenericVerifiableCredential {
|
export interface OfferClaim extends ClaimObject {
|
||||||
|
"@context": "https://schema.org";
|
||||||
"@type": "Offer";
|
"@type": "Offer";
|
||||||
|
agent?: { identifier: string };
|
||||||
description?: string;
|
description?: string;
|
||||||
fulfills?: { "@type": string; identifier?: string; lastClaimId?: string }[];
|
fulfills?: { "@type": string; identifier?: string; lastClaimId?: string }[];
|
||||||
identifier?: string;
|
identifier?: string;
|
||||||
@@ -67,43 +55,18 @@ export interface OfferVerifiableCredential extends GenericVerifiableCredential {
|
|||||||
name?: string;
|
name?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
provider?: GenericVerifiableCredential;
|
offeredBy?: {
|
||||||
|
type?: "Person";
|
||||||
|
identifier: string;
|
||||||
|
};
|
||||||
|
provider?: ClaimObject;
|
||||||
recipient?: { identifier: string };
|
recipient?: { identifier: string };
|
||||||
validThrough?: string;
|
validThrough?: string;
|
||||||
type: string[];
|
|
||||||
issuer: string;
|
|
||||||
issuanceDate: string;
|
|
||||||
credentialSubject: {
|
|
||||||
id: string;
|
|
||||||
type: "Offer";
|
|
||||||
offeredBy?: {
|
|
||||||
type: "Person";
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
offeredTo?: {
|
|
||||||
type: "Person";
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
offeredToProject?: {
|
|
||||||
type: "Project";
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
offeredToProjectVisibleToDids?: string[];
|
|
||||||
offeredToVisibleToDids?: string[];
|
|
||||||
offeredByVisibleToDids?: string[];
|
|
||||||
amount: {
|
|
||||||
type: "QuantitativeValue";
|
|
||||||
value: number;
|
|
||||||
unitCode: string;
|
|
||||||
};
|
|
||||||
startTime?: string;
|
|
||||||
endTime?: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that previous VCs may have additional fields.
|
// Note that previous VCs may have additional fields.
|
||||||
// https://endorser.ch/doc/html/transactions.html#id7
|
// https://endorser.ch/doc/html/transactions.html#id7
|
||||||
export interface PlanVerifiableCredential extends GenericVerifiableCredential {
|
export interface PlanActionClaim extends ClaimObject {
|
||||||
"@context": "https://schema.org";
|
"@context": "https://schema.org";
|
||||||
"@type": "PlanAction";
|
"@type": "PlanAction";
|
||||||
name: string;
|
name: string;
|
||||||
@@ -117,11 +80,18 @@ export interface PlanVerifiableCredential extends GenericVerifiableCredential {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AKA Registration & RegisterAction
|
// AKA Registration & RegisterAction
|
||||||
export interface RegisterVerifiableCredential {
|
export interface RegisterActionClaim extends ClaimObject {
|
||||||
"@context": string;
|
"@context": "https://schema.org";
|
||||||
"@type": "RegisterAction";
|
"@type": "RegisterAction";
|
||||||
agent: { identifier: string };
|
agent: { identifier: string };
|
||||||
identifier?: string;
|
identifier?: string;
|
||||||
object: string;
|
object?: string;
|
||||||
participant?: { identifier: string };
|
participant?: { identifier: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TenureClaim extends ClaimObject {
|
||||||
|
"@context": "https://endorser.ch";
|
||||||
|
"@type": "Tenure";
|
||||||
|
party?: { identifier: string };
|
||||||
|
spatialUnit?: { geo?: { polygon?: string } };
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// similar to VerifiableCredentialSubject... maybe rename this
|
// similar to VerifiableCredentialSubject... maybe rename this
|
||||||
export interface GenericVerifiableCredential {
|
export interface GenericVerifiableCredential {
|
||||||
"@context": string | string[];
|
"@context"?: string;
|
||||||
"@type": string;
|
"@type": string;
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
}
|
||||||
@@ -37,23 +37,26 @@ export interface ErrorResult extends ResultWithType {
|
|||||||
|
|
||||||
export interface KeyMeta {
|
export interface KeyMeta {
|
||||||
did: string;
|
did: string;
|
||||||
name?: string;
|
|
||||||
publicKeyHex: string;
|
publicKeyHex: string;
|
||||||
mnemonic: string;
|
derivationPath?: string;
|
||||||
derivationPath: string;
|
|
||||||
registered?: boolean;
|
|
||||||
profileImageUrl?: string;
|
|
||||||
identity?: string; // Stringified IIdentifier object from Veramo
|
|
||||||
passkeyCredIdHex?: string; // The Webauthn credential ID in hex, if this is from a passkey
|
passkeyCredIdHex?: string; // The Webauthn credential ID in hex, if this is from a passkey
|
||||||
[key: string]: unknown;
|
}
|
||||||
|
|
||||||
|
export interface KeyMetaMaybeWithPrivate extends KeyMeta {
|
||||||
|
mnemonic?: string; // 12 or 24 words encoding the seed
|
||||||
|
identity?: string; // Stringified IIdentifier object from Veramo
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KeyMetaWithPrivate extends KeyMeta {
|
||||||
|
mnemonic: string; // 12 or 24 words encoding the seed
|
||||||
|
identity: string; // Stringified IIdentifier object from Veramo
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QuantitativeValue extends GenericVerifiableCredential {
|
export interface QuantitativeValue extends GenericVerifiableCredential {
|
||||||
"@type": "QuantitativeValue";
|
"@type": "QuantitativeValue";
|
||||||
"@context": string | string[];
|
"@context"?: string;
|
||||||
amountOfThisGood: number;
|
amountOfThisGood: number;
|
||||||
unitCode: string;
|
unitCode: string;
|
||||||
[key: string]: unknown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AxiosErrorResponse {
|
export interface AxiosErrorResponse {
|
||||||
@@ -87,94 +90,21 @@ export interface CreateAndSubmitClaimResult {
|
|||||||
handleId?: string;
|
handleId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlanSummaryRecord {
|
|
||||||
handleId: string;
|
|
||||||
issuer: string;
|
|
||||||
claim: GenericVerifiableCredential;
|
|
||||||
[key: string]: unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Agent {
|
export interface Agent {
|
||||||
identifier?: string;
|
identifier?: string;
|
||||||
did?: string;
|
did?: string;
|
||||||
[key: string]: unknown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ClaimObject {
|
export interface ClaimObject {
|
||||||
"@type": string;
|
"@type": string;
|
||||||
"@context"?: string | string[];
|
"@context"?: string;
|
||||||
fulfills?: Array<{
|
|
||||||
"@type": string;
|
|
||||||
identifier?: string;
|
|
||||||
[key: string]: unknown;
|
|
||||||
}>;
|
|
||||||
object?: GenericVerifiableCredential;
|
|
||||||
agent?: Agent;
|
|
||||||
participant?: {
|
|
||||||
identifier?: string;
|
|
||||||
[key: string]: unknown;
|
|
||||||
};
|
|
||||||
identifier?: string;
|
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VerifiableCredentialClaim {
|
export interface VerifiableCredentialClaim {
|
||||||
"@context": string | string[];
|
"@context"?: string;
|
||||||
"@type": string;
|
"@type": string;
|
||||||
type: string[];
|
type: string[];
|
||||||
credentialSubject: ClaimObject;
|
credentialSubject: ClaimObject;
|
||||||
[key: string]: unknown;
|
[key: string]: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GiveVerifiableCredential extends GenericVerifiableCredential {
|
|
||||||
"@type": "GiveAction";
|
|
||||||
"@context": string | string[];
|
|
||||||
object?: GenericVerifiableCredential;
|
|
||||||
agent?: Agent;
|
|
||||||
participant?: {
|
|
||||||
identifier?: string;
|
|
||||||
[key: string]: unknown;
|
|
||||||
};
|
|
||||||
fulfills?: Array<{
|
|
||||||
"@type": string;
|
|
||||||
identifier?: string;
|
|
||||||
[key: string]: unknown;
|
|
||||||
}>;
|
|
||||||
[key: string]: unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface OfferVerifiableCredential extends GenericVerifiableCredential {
|
|
||||||
"@type": "OfferAction";
|
|
||||||
"@context": string | string[];
|
|
||||||
object?: GenericVerifiableCredential;
|
|
||||||
agent?: Agent;
|
|
||||||
participant?: {
|
|
||||||
identifier?: string;
|
|
||||||
[key: string]: unknown;
|
|
||||||
};
|
|
||||||
itemOffered?: {
|
|
||||||
description?: string;
|
|
||||||
isPartOf?: {
|
|
||||||
"@type": string;
|
|
||||||
identifier: string;
|
|
||||||
[key: string]: unknown;
|
|
||||||
};
|
|
||||||
[key: string]: unknown;
|
|
||||||
};
|
|
||||||
[key: string]: unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RegisterVerifiableCredential
|
|
||||||
extends GenericVerifiableCredential {
|
|
||||||
"@type": "RegisterAction";
|
|
||||||
"@context": string | string[];
|
|
||||||
agent: {
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
object: string;
|
|
||||||
participant?: {
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
identifier?: string;
|
|
||||||
[key: string]: unknown;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -12,6 +12,4 @@ export interface DatabaseService {
|
|||||||
sql: string,
|
sql: string,
|
||||||
params?: unknown[],
|
params?: unknown[],
|
||||||
): Promise<{ changes: number; lastId?: number }>;
|
): Promise<{ changes: number; lastId?: number }>;
|
||||||
getOneRow(sql: string, params?: unknown[]): Promise<unknown[] | undefined>;
|
|
||||||
getAll(sql: string, params?: unknown[]): Promise<unknown[][]>;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Interfaces for the give records with limited contact information, good to show on a feed.
|
||||||
|
**/
|
||||||
|
|
||||||
import { GiveSummaryRecord } from "./records";
|
import { GiveSummaryRecord } from "./records";
|
||||||
|
|
||||||
// Common interface for contact information
|
// Common interface for views with summary contact information
|
||||||
export interface ContactInfo {
|
export interface ContactInfo {
|
||||||
known: boolean;
|
known: boolean;
|
||||||
displayName: string;
|
displayName: string;
|
||||||
profileImageUrl?: string;
|
profileImageUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define the contact information fields
|
// Define a subset of contact information fields
|
||||||
interface GiveContactInfo {
|
interface GiveContactInfo {
|
||||||
giver: ContactInfo;
|
giver: ContactInfo;
|
||||||
issuer: ContactInfo;
|
issuer: ContactInfo;
|
||||||
@@ -17,5 +21,5 @@ interface GiveContactInfo {
|
|||||||
image?: string;
|
image?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combine GiveSummaryRecord with contact information using intersection type
|
// Combine GiveSummaryRecord with contact information
|
||||||
export type GiveRecordWithContactInfo = GiveSummaryRecord & GiveContactInfo;
|
export type GiveRecordWithContactInfo = GiveSummaryRecord & GiveContactInfo;
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ export type {
|
|||||||
|
|
||||||
export type {
|
export type {
|
||||||
// From claims.ts
|
// From claims.ts
|
||||||
GiveVerifiableCredential,
|
GiveActionClaim,
|
||||||
OfferVerifiableCredential,
|
OfferClaim,
|
||||||
RegisterVerifiableCredential,
|
RegisterActionClaim,
|
||||||
} from "./claims";
|
} from "./claims";
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { GiveVerifiableCredential, OfferVerifiableCredential } from "./claims";
|
import { GiveActionClaim, OfferClaim } from "./claims";
|
||||||
|
|
||||||
// a summary record; the VC is found the fullClaim field
|
// a summary record; the VC is found the fullClaim field
|
||||||
export interface GiveSummaryRecord {
|
export interface GiveSummaryRecord {
|
||||||
[x: string]: PropertyKey | undefined | GiveVerifiableCredential;
|
[x: string]: PropertyKey | undefined | GiveActionClaim;
|
||||||
type?: string;
|
type?: string;
|
||||||
agentDid: string;
|
agentDid: string;
|
||||||
amount: number;
|
amount: number;
|
||||||
amountConfirmed: number;
|
amountConfirmed: number;
|
||||||
description: string;
|
description: string;
|
||||||
fullClaim: GiveVerifiableCredential;
|
fullClaim: GiveActionClaim;
|
||||||
fulfillsHandleId: string;
|
fulfillsHandleId: string;
|
||||||
fulfillsPlanHandleId?: string;
|
fulfillsPlanHandleId?: string;
|
||||||
fulfillsType?: string;
|
fulfillsType?: string;
|
||||||
@@ -26,7 +26,7 @@ export interface OfferSummaryRecord {
|
|||||||
amount: number;
|
amount: number;
|
||||||
amountGiven: number;
|
amountGiven: number;
|
||||||
amountGivenConfirmed: number;
|
amountGivenConfirmed: number;
|
||||||
fullClaim: OfferVerifiableCredential;
|
fullClaim: OfferClaim;
|
||||||
fulfillsPlanHandleId: string;
|
fulfillsPlanHandleId: string;
|
||||||
handleId: string;
|
handleId: string;
|
||||||
issuerDid: string;
|
issuerDid: string;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export const newIdentifier = (
|
|||||||
publicHex: string,
|
publicHex: string,
|
||||||
privateHex: string,
|
privateHex: string,
|
||||||
derivationPath: string,
|
derivationPath: string,
|
||||||
): Omit<IIdentifier, keyof "provider"> => {
|
): IIdentifier => {
|
||||||
return {
|
return {
|
||||||
did: DEFAULT_DID_PROVIDER_NAME + ":" + address,
|
did: DEFAULT_DID_PROVIDER_NAME + ":" + address,
|
||||||
keys: [
|
keys: [
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { didEthLocalResolver } from "./did-eth-local-resolver";
|
|||||||
import { PEER_DID_PREFIX, verifyPeerSignature } from "./didPeer";
|
import { PEER_DID_PREFIX, verifyPeerSignature } from "./didPeer";
|
||||||
import { base64urlDecodeString, createDidPeerJwt } from "./passkeyDidPeer";
|
import { base64urlDecodeString, createDidPeerJwt } from "./passkeyDidPeer";
|
||||||
import { urlBase64ToUint8Array } from "./util";
|
import { urlBase64ToUint8Array } from "./util";
|
||||||
import { KeyMeta } from "../../../interfaces/common";
|
import { KeyMeta, KeyMetaWithPrivate } from "../../../interfaces/common";
|
||||||
|
|
||||||
export const ETHR_DID_PREFIX = "did:ethr:";
|
export const ETHR_DID_PREFIX = "did:ethr:";
|
||||||
export const JWT_VERIFY_FAILED_CODE = "JWT_VERIFY_FAILED";
|
export const JWT_VERIFY_FAILED_CODE = "JWT_VERIFY_FAILED";
|
||||||
@@ -34,7 +34,7 @@ export function isFromPasskey(keyMeta?: KeyMeta): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function createEndorserJwtForKey(
|
export async function createEndorserJwtForKey(
|
||||||
account: KeyMeta,
|
account: KeyMetaWithPrivate,
|
||||||
payload: object,
|
payload: object,
|
||||||
expiresIn?: number,
|
expiresIn?: number,
|
||||||
) {
|
) {
|
||||||
|
|||||||