From d2157a7d8c90ee14911d49a257a6212ee60dcda3 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 19 Feb 2025 13:07:08 +0000 Subject: [PATCH] feat(mobile): add deep linking support for Capacitor apps Adds native deep linking capabilities: - Configure timesafari:// URL scheme for iOS and Android - Add @capacitor/app dependency and configuration - Implement deep link handler with improved error logging - Support parameterized routes like claim/:id - Add debug logging for native platforms - Handle app mounting state for deep links Technical changes: - Update AndroidManifest.xml with intent filters - Add URL scheme to iOS Info.plist - Add @capacitor/app to Podfile and Gradle - Enhance main.capacitor.ts with robust deep link handling --- BUILDING.md | 54 ++- CHANGELOG.md | 559 +++++++++++++++-------- android/app/capacitor.build.gradle | 2 +- android/app/src/main/AndroidManifest.xml | 7 + android/capacitor.settings.gradle | 3 + capacitor.config.ts | 12 + id: | 0 index.html | 17 +- ios/App/App/Info.plist | 9 + ios/App/Podfile | 2 +- src/main.capacitor.ts | 75 ++- src/services/api.ts | 13 + src/services/plan.ts | 19 + 13 files changed, 565 insertions(+), 207 deletions(-) create mode 100644 id: create mode 100644 src/services/api.ts create mode 100644 src/services/plan.ts diff --git a/BUILDING.md b/BUILDING.md index cb6c3db..7b94097 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -14,12 +14,14 @@ This guide explains how to build TimeSafari for different platforms. ## Initial Setup 1. Clone the repository: + ```bash git clone [repository-url] cd TimeSafari ``` 2. Install dependencies: + ```bash npm install ``` @@ -29,6 +31,7 @@ This guide explains how to build TimeSafari for different platforms. To build for web deployment: 1. Run the production build: + ```bash npm run build ``` @@ -36,6 +39,7 @@ To build for web deployment: 2. The built files will be in the `dist` directory. 3. To test the production build locally: + ```bash npm run serve ``` @@ -45,11 +49,13 @@ To build for web deployment: ### Building for Linux 1. Build the electron app in production mode: + ```bash npm run build:electron-prod ``` 2. Package the Electron app for Linux: + ```bash # For AppImage (recommended) npm run electron:build-linux @@ -65,12 +71,14 @@ To build for web deployment: ### Running the Packaged App - AppImage: Make executable and run + ```bash chmod +x dist-electron-packages/TimeSafari-*.AppImage ./dist-electron-packages/TimeSafari-*.AppImage ``` - DEB: Install and run + ```bash sudo dpkg -i dist-electron-packages/timesafari_*_amd64.deb timesafari @@ -95,21 +103,25 @@ npm run build:electron-prod && npm run electron:start Prerequisites: macOS with Xcode installed 1. Build the web assets: + ```bash npm run build -- --mode capacitor ``` 2. Add iOS platform if not already added: + ```bash npx cap add ios ``` 3. Update iOS project with latest build: + ```bash npx cap sync ios ``` 4. Open the project in Xcode: + ```bash npx cap open ios ``` @@ -121,21 +133,25 @@ Prerequisites: macOS with Xcode installed Prerequisites: Android Studio with SDK installed 1. Build the web assets: + ```bash npm run build -- --mode capacitor ``` 2. Add Android platform if not already added: + ```bash npx cap add android ``` 3. Update Android project with latest build: + ```bash npx cap sync android ``` 4. Open the project in Android Studio: + ```bash npx cap open android ``` @@ -147,25 +163,29 @@ Prerequisites: Android Studio with SDK installed To run the application in development mode: 1. Start the development server: + ```bash npm run dev ``` + ## PyWebView Desktop Build -### Prerequisites +### Prerequisites for PyWebView + - Python 3.8 or higher - pip (Python package manager) - virtualenv (recommended) - System dependencies: + ```bash # For Ubuntu/Debian sudo apt-get install python3-webview # or sudo apt-get install python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-webkit2-4.0 - + # For Arch Linux sudo pacman -S webkit2gtk python-gobject python-cairo - + # For Fedora sudo dnf install python3-webview # or @@ -173,7 +193,9 @@ To run the application in development mode: ``` ### Setup + 1. Create and activate a virtual environment (recommended): + ```bash python -m venv .venv source .venv/bin/activate # On Linux/macOS @@ -182,6 +204,7 @@ To run the application in development mode: ``` 2. Install Python dependencies: + ```bash pip install -r requirements.txt ``` @@ -189,13 +212,16 @@ To run the application in development mode: ### Troubleshooting If encountering PyInstaller version errors: + ```bash # Try installing the latest stable version pip install --upgrade pyinstaller ``` -### Development +### Development of PyWebView + 1. Start the PyWebView development build: + ```bash npm run pywebview:dev ``` @@ -203,31 +229,39 @@ pip install --upgrade pyinstaller ### Building for Distribution #### Linux + ```bash npm run pywebview:package-linux ``` + The packaged application will be in `dist/TimeSafari` #### Windows + ```bash npm run pywebview:package-win ``` + The packaged application will be in `dist/TimeSafari` -#### macOS +#### macOS + ```bash npm run pywebview:package-mac ``` + The packaged application will be in `dist/TimeSafari` ## Testing Run local tests: + ```bash npm run test-local ``` Run all tests (includes building): + ```bash npm run test-all ``` @@ -235,11 +269,13 @@ npm run test-all ## Linting Check code style: + ```bash npm run lint ``` Fix code style issues: + ```bash npm run lint-fix ``` @@ -260,16 +296,20 @@ See `.env.*` files for configuration. ## Deployment ### Version Management + 1. Update CHANGELOG.md with new changes 2. Update version in package.json 3. Commit changes and tag release: + ```bash git tag git push origin ``` + 4. After deployment, update package.json with next version + "-beta" ### Test Server + ```bash # Build using staging environment npm run build -- --mode staging @@ -279,6 +319,7 @@ rsync -azvu -e "ssh -i ~/.ssh/" dist ubuntutest@test.timesafari.app:ti ``` ### Production Server + ```bash # On the production server: pkgx +npm sh @@ -293,7 +334,7 @@ cd - mv time-safari/dist time-safari-dist-prev.0 && mv crowd-funder-for-time-pwa/dist time-safari/ ``` -## Troubleshooting +## Troubleshooting Builds ### Common Build Issues @@ -310,4 +351,3 @@ mv time-safari/dist time-safari-dist-prev.0 && mv crowd-funder-for-time-pwa/dist - For iOS: Xcode command line tools must be installed - For Android: Correct SDK version must be installed - Check Capacitor configuration in capacitor.config.ts - diff --git a/CHANGELOG.md b/CHANGELOG.md index dafcf0d..3f6c083 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,272 +5,348 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.4.4] - 2025.02.17 +### Fixed in 0.4.4 -## [0.4.4] - 2025.02.17 -### Fixed - On production (due to data?) the search results would disappear after scrolling down. Now we don't show any results when going to the people map with a shortcut. - ## [0.4.3] - 2025.02.17 -### Added -- Discover query parameter searchPeople to go directly to the people map +### Added in 0.4.3 + +- Discover query parameter searchPeople to go directly to the people map ## [0.4.2] - 2025.02.17 + ### Added -- Capacitor build to Android + +- Capacitor on iOS and Android + ### Fixed -- Path issues +- Path issues ## [0.4.1] - 2025.02.16 -### Fixed + +### Fixed in 0.4.1 + - nostr build issue - Linting - ## [0.4.0] - 2025.02.14 + ### Changed + - Images in the home feed now take up the full width of the card. - Clicking the image previously, would open the image in a new tab. Now, clicking the image opens the image in a lightbox view. -### Added + +### Added in 0.4.0 + - Clicking an image also now displays an in-app lightbox view of the image. - The lightbox view includes a download button for the image in mobile view. - ## [0.3.57] - 2025.02.11 -### Added -- Automatic user creation in onboarding meetings +### Added in 0.3.57 + +- Automatic user creation in onboarding meetings ## [0.3.55] - 2025.02.07 -### Added -- End time for projects +### Added in 0.3.55 + +- End time for projects ## [0.3.54] - 2025.02.06 -### Added -- Group onboarding meetings +### Added in 0.3.54 + +- Group onboarding meetings ## [0.3.53] - 2025.01.30 -### Added -- Hints for contacting the creator of a project +### Added in 0.3.53 + +- Hints for contacting the creator of a project ## [0.3.52] - 2025.01.22 -### Fixed -- User profile endpoint server for map was broken. +### Fixed in 0.3.52 + +- User profile endpoint server for map was broken. ## [0.3.51] - 2025.01.22 -### Fixed -- User profile map jumped on first zoom. +### Fixed in 0.3.51 + +- User profile map jumped on first zoom. ## [0.3.50] - 2025.01.20 - b9fedcd3fd3e34c3fb0fc79150d1a81a76eaeb40 -### Added -- User public profiles +### Added in 0.3.50 + +- User public profiles ## [0.3.49] - 2025.01.09 - 36301ed238ff84df25bb11a8d44a295ee7eaf0f8 -### Changed + +### Changed in 0.3.49 + - Make all external contact links direct to the contact-import page. - Handle all new-single-contact JWTs in the contacts page, and multiple-contact JWTs in the contacts-import page. - ## [0.3.48] - 2025.01.08 - 398f3e64a376789f7eb1c400cd886f5a2cacd588 (but app shows 07c4e58) -### Added -- More sanity-checks on contact-import JWT +### Added in 0.3.48 + +- More sanity-checks on contact-import JWT ## [0.3.47] - 2025.01.06 - 5bf6dd1ee32ca7cc46d39bd7afca58365b422f93 -### Added + +### Added in 0.3.47 + - Notes on contacts page with new contact-edit page - Contact methods (only on contact-edit page and under DID details) - DID view with no DID shows user's info. -### Changed + +### Changed in 0.3.47 + - URL for user's contact info is now URL to this app (not endorser.ch). - Extended details (eg. full claim) is beneath details link on claim page. - ## [0.3.46] - 2025.01.03 - 9e7056616b5e5acc51e5a8cf7354d408029fefb3 -### Added + +### Added in 0.3.46 + - More action-oriented questions for the gift prompts -### Fixed -- Contact-list import set visibility for all, even if not chosen. +### Fixed in 0.3.46 + +- Contact-list import set visibility for all, even if not chosen. ## [0.3.45] - 2025.01.01 - 65402dc68ce69ccc6cb9aa8d2e7a9249bf4298e0 -### Fixed -- Previous project links stayed when following a link. +### Fixed in 0.3.45 + +- Previous project links stayed when following a link. ## [0.3.44] - 2024.12.31 - 694b22987b05482e4527c2478bbe15e6b6f3b532 -### Added -- Project counts on a map +### Added in 0.3.44 + +- Project counts on a map ## [0.3.42] - 2024.12.27 - 9751934bc24a1040415a8cfeacbae59ed91f92a5 -### Added + +### Added in 0.3.42 + - Link from certificate page to the claim -### Changed + +### Changed in 0.3.42 + - Contact data sharing is now a verified JWT. - Feed pictures are larger. - ## [0.3.41] - 2024.12.21 - ff6d14138f26daea6216b051562f0a04681f69fc -### Added -- Link from certificate page to the claim +### Added in 0.3.41 + +- Link from certificate page to the claim ## [0.3.40] - 2024.12.20 - 77290d9fed3c364243793dc3e9bfe2e994a016b8 -### Added -- Only show issuer on certificate if it's not the agent. +### Added in 0.3.40 + +- Only show issuer on certificate if it's not the agent. ## [0.3.39] - 2024.12.20 - d8819155e2acd2b57fdab523168fa5d1d09e80cc -### Added -- Page for a framed claim certificate +### Added in 0.3.39 + +- Page for a framed claim certificate ## [0.3.38] - 2024.12.14 - f8cae5ad4fee1f114320dcce052299eab12108b2 -### Fixed -- Error on BVC confirmation screen (from IndexedDB refactor) +### Fixed in 0.3.38 + +- Error on BVC confirmation screen (from IndexedDB refactor) ## [0.3.37] - 2024.12.13 - 4d805b43cd25eed73cdd6651f36ad1ec8c109555 -### Added + +### Added in 0.3.37 + - Record a give from a project on the project page. - New button on home page opens the gifted dialog. - On confirmation buttons on the project page gives, mark when unavailable and explain why. -### Changed + +### Changed in 0.3.37 + - Moved the secret into IndexedDB (and out of localStorage) for more reliability. - New "invite" destination page helps troubleshoot when JWT link doesn't come through. -### Fixed + +### Fixed in 0.3.37 + - Problem showing claim issuer name - Problem going "back" from a project page - ## [0.3.36] - 2024.11.24 - c8d23647d165016f8a8f575e13d32583242e53ac -### Changed + +### Changed in 0.3.36 + - More friendly default reminder message - Blue borders around people to indicate clickability - ## [0.3.35] - 2024.11.24 - bff7d0a6320b70349185e26bfac72e3bb17f76df -### Added + +### Added in 0.3.35 + - Daily reliable, hard-coded notification message - Setting to change the partner API server - ## [0.3.33] - 2024.11.07 - adb7b16ecf1343c39cba71a7d6bb0e7a973e1102 -### Fixed + +### Fixed in 0.3.33 + - Affirm Delivery button on offer claim page didn't work. - Plans were not showing by default on project page. - ## [0.3.32] - 2024.11.06 - 9a3fa38a3fd28f977e06f0265fc39e635c9c5ccd -### Added -- Highlight in green new offers to user & to user's projects on the front page. +### Added in 0.3.32 + +- Highlight in green new offers to user & to user's projects on the front page. ## [0.3.31] - 2024.10.25 - 07c02ab98a09d293dd90d9289a7872e7d681d296 -### Changed -- Onboarding messages about offers +### Changed in 0.3.31 + +- Onboarding messages about offers ## [0.3.30] -### Added -- Onboarding messages +### Added in 0.3.30 + +- Onboarding messages ## [0.3.29] - 2024.10.09 - babd3832bdfe0c40eaa3869de1b41399a51713c1 -### Added + +### Added in 0.3.29 + - Invite for a contact to join immediately -### Changed + +### Changed in 0.3.29 + - Send signed data to nostr endpoints to verify public key ownership. - Enhanced help & help onboarding. + ### Changed in DB or environment -- Uses Endorser.ch version 4.1.1 +- Uses Endorser.ch version 4.1.1 ## [0.3.28] - 2024.09.30 - 84720b94049d29cc0ddd99c50cef2e7176130133 -### Added + +### Added in 0.3.28 + - Posting to nostr apps Trustroots & TripHopping - Display of providers on claim view page -### Changed + +### Changed in 0.3.28 + - Switched BVC-meeting-ending gift to be a gift from the group. -### Changed in DB or environment -- Requires Endorser.ch version 4.1.0 +### Changed in DB or environment in 0.3.28 + +- Requires Endorser.ch version 4.1.0 ## [0.3.27] - 2024.09.22 - ee23e6f005e47f5bd6f04d804599f6395371b0e4 -### Fixed + +### Fixed in 0.3.27 + - Error loading BVC claims to confirm - Really allow visibility of bulk-imported contacts - ## [0.3.26] - 2024.09.16 - 8263ed2b29947b3ccc6f3133bbc9454c222bce28 -### Added + +### Added in 0.3.26 + - Separate 'isRegistered' flag for each account -### Fixed + +### Fixed in 0.3.26 + - Failure to assign offers to their project - Alert when looking at one's own activity if not in contacts. - ## [0.3.25] - 2024.08.30 - dcbe02d877aecb4cdef2643d90e6595d246a9f82 -### Added + +### Added in 0.3.25 + - "Ideas" now jumps directly to giving prompt or contact list. -### Fixed + +### Fixed in 0.3.25 + - Empty giver name on gifted-details view - Previously visited project would show up on the giving-details page. -### Removed -- All unnecessary localStorage for project IDs +### Removed in 0.3.25 + +- All unnecessary localStorage for project IDs ## [0.3.23] - 2024.08.30 -### Added + +### Added in 0.3.23 + - Sections in Help for different kinds of users - Discovery page parameters so that links with search text work - Message when no projects are found - ## [0.3.21] - 2024.08.24 - a7b89f4bb6da928d56daeffaae7741fa74cc80bf -### Added + +### Added in 0.3.21 + - Send list of contacts to someone, and move individual contact actions to detail page. - Prompt for name in pop-up, and send to different contact-sharing screens. -### Changed -- Moved contact actions from list onto detail page +### Changed in 0.3.21 + +- Moved contact actions from list onto detail page ## [0.3.20] - 2024.08.18 - 4064eb75a9743ca268bf00016fa0a5fc5dec4e30 -### Fixed + +### Fixed in 0.3.20 + - Bad "give" verbiage on offer page - Failing offer test - ## [0.3.19] - 2024.08.18 - ee9c14942ceba993bf21a11249601f205158ec71 -### Added + +### Added in 0.3.19 + - Update of an offer - Recipient description in offer list -### Fixed + +### Fixed in 0.3.19 + - List of offers wasn't showing. - Destination page after sharing photo was wrong. - ## [0.3.17] - 2024.07.11 - cefa384ff1a2d922848c370640c096c529920fab -### Added + +### Added in 0.3.17 + - Photos on more screens -### Fixed + +### Fixed in 0.3.17 + - Share of a photo, including sharing a photo from webkit/Safari which never worked -### Changed in DB or environment -- Nothing (though there's a new temp field in IndexedDB) +### Changed in DB or environment in 0.3.17 + +- Nothing (though there's a new temp field in IndexedDB) ## [0.3.15] - 2024.08.04 - c8f0f2c2b16b9f0b4b47d40f7bf29058c7baa68e -### Added + +### Added in 0.3.15 + - Edit gives - Page to edit claim JSON before submitting - Update of imported contacts @@ -281,263 +357,364 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Cache signatures for reports for passkey-signed requests - Refactor: consolidate alternative signing, eg. for passkeys & did:peer - Playwright tests -### Changed + +### Changed in 0.3.15 + - Linked projects display below description (instead of at bottom) -### Fixed + +### Fixed in 0.3.15 + - Visibility toggle appearance -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.15 + +- Nothing ## [0.3.14] - 2024.06.22 - 1611d22892f683f43856d2503eee7f391b6bbce8 -### Added + +### Added in 0.3.14 + - Clearer give-confirmation screen -- BX currency https://thebx.medium.com/ +- BX currency - Deselection of project on gifted details page -### Fixed + +### Fixed in 0.3.14 + - Don't show registration pop-up for a new contact that is registered -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.14 + +- Nothing ## [0.3.13] - 2024.05.24 - 08b67984e443c58d9178ad3776013b0bce7afddc -### Added + +### Added in 0.3.13 + - Photos on projects -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.13 + +- Nothing ## [0.3.12] - 2024.05.19 - 141fb39ad19c44d82fe1a33bf85115beacf50870 -### Fixed + +### Fixed in 0.3.12 + - Photo share (share_target) failed because requests were sent to server -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.12 + +- Nothing ## [0.3.11] - 2024.05.19 - 567bcad88dfb7e9ac8fea72530d1163985e4a7cc -### Added + +### Added in 0.3.11 + - Choose a file for gifts, and a URL for gifts & profiles -### Fixed + +### Fixed in 0.3.11 + - Multiple button pushes were required to switch camera -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.11 + +- Nothing ## [0.3.10] - 2024.05.11 - 03ac31d98110f7828cf9acb366db8d01b185f64c -### Added + +### Added in 0.3.10 + - Share an image - Choose a file on the device for a profile image -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.10 + +- Nothing ## [0.3.9] - 2024.04.28 - 874e717e698b93a1ace9f588e675b8a3dccd7617 -### Added + +### Added in 0.3.9 + - Offers on contacts page - Checks on front page until they show as registered -### Changed + +### Changed in 0.3.9 + - Scanned contacts now add immediately and prompt for registration. - Better UI for gives on contact page - Better UI for all confirmation messages -### Fixed + +### Fixed in 0.3.9 + - Repeated elements at top of main feed -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.9 + +- Nothing ## [0.3.8] - 2024.04.20 - 15c026c80ce03a26cae3ff80b0888934c101c7e2 -### Added + +### Added in 0.3.8 + - Profile image for user -### Fixed + +### Fixed in 0.3.8 + - Slow loading of home page feed -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.8 + +- Nothing ## [0.3.7] - 2024.04.10 - cf18f1543a700d62a5f9e764905a4aafe1fb229b -### Added + +### Added in 0.3.7 + - Filter on home page feed - Ability to set time of daily notification - Jump to app on click of notification -### Changed + +### Changed in 0.3.7 + - Built with vite - Descriptions on home page to include projects -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.7 + +- Nothing ## [0.3.6] - 2024.03.24 - 3a07e31d6313ab95711265562d9023c42916e141 -### Added + +### Added in 0.3.6 + - Button to mirror photo during video - More detailed onboarding help screen - Public-data blurb -### Changed in DB or environment -- Nothing +### Changed in DB or environment in 0.3.6 + +- Nothing ## [0.3.5] - 2024.03.23 - 28754bdfb1e11aa221dd49a5dce4219b69cf6a9d -### Added + +### Added in 0.3.5 + - Photo on gift records -### Fixed + +### Fixed in 0.3.5 + - Environment variable for BVC meetings project - Environment variables and build enhancements for test vs prod -### Changed in DB or environment + +### Changed in DB or environment in 0.3.5 + - New environment variable for image API server - Test that a new browser session will get the right default APIs. - Test that a new browser session will send the right BVC meetings project. - ## [0.2.17] - 2024.03.01 - 3612ea42240c5e1b7d7eff29a39ff18f1b869b36 -### Added + +### Added in 0.2.17 + - Shortcut page for Bountiful Voluntaryist Community -### Changed + +### Changed in 0.2.17 + - More readable, targeted summaries in home-page feed items + ### Changed in DB -- Nothing +- Nothing ## [0.2.14] - 2024.02.14 - 5f9edea1167dbfb64e16648764eed8c09b24eaeb -### Changed + +### Changed in 0.2.14 + - Combine all service worker scripts into a single file. -### Changed in DB -- Nothing +### Changed in DB in 0.2.14 + +- Nothing ## [0.2.13] - 2024.02.07 -### Added + +### Added in 0.2.13 + - Display of user's offers - Check for valid DIDs -### Fixed + +### Fixed in 0.2.13 + - Name display on give prompt - Non-numbers on number input & autocapitalize on URL input -### Changed in DB -- Nothing +### Changed in DB in 0.2.13 + +- Nothing ## [0.2.12] - 2024.02.01 -### Added -- Prompts for gratitude +### Added in 0.2.12 + +- Prompts for gratitude ## [0.2.11] - 2024.01.28 -### Added + +### Added in 0.2.11 + - Actions to share claim data with contacts - Bulk CSV import from Endorser Mobile export - Dates on give summaries - ## [0.2.10] - 2024.01.18 - 667e1e8890b42de59cd939caca1a01c7a7a702be -### Added + +### Added in 0.2.10 + - Person identicons for contacts - Confirmation & delivery directly from project page - Offer dialog now allows units - Links from claim detail page to the fulfilled project or offer - Link to project from home feed - Copy to clipboard in more places -### Fixed -- "More Contacts" for give on project page now links correctly. +### Fixed in 0.2.10 + +- "More Contacts" for give on project page now links correctly. ## [0.2.9] - 2024.01.15 - e5e702f8a5a53a6efbed48d35f0bc3cee63024a0 -### Fixed -- Set visibility for new contact. +### Fixed in 0.2.9 + +- Set visibility for new contact. ## [0.2.8] - 2024.01.14 -### Added + +### Added in 0.2.8 + - Automatic ID creation from home page - Agent who can also edit a project -### Fixed -- Cannot declare anonymous gift +### Fixed in 0.2.8 + +- Cannot declare anonymous gift ## [0.2.7] - 2024.01.12 -### Added + +### Added in 0.2.7 + - Give to fulfill a particular offer - Give as part of a trade as opposed to a donation - Error notifications on import -### Changed + +### Changed in 0.2.7 + - Library security updates - Visibility of actions & confirmations on claim page -### Fixed -- Name of offerer +### Fixed in 0.2.7 + +- Name of offerer ## [0.2.2] - 2024.01.05 -### Added + +### Added in 0.2.2 + - Check for notification capability on front screen - Contact next-public-key-hash in manual textual input - Confirmation for contact visibility change - YAML rendering of full claim details - Hints for onboarding on the contact screen - ## [0.2.0] - 2024.01.04 -### Added + +### Added in 0.2.0 + - Contact next-public-key-hash - Icon for Android - More thorough messaging and testing for notifications - ## [0.1.9] - 2024.01.01 -### Added + +### Added in 0.1.9 + - Import for contacts and settings - Second download button for DuckDuckGo -### Changed -- Removed some keys from Dexie's IndexedDB declarations +### Changed in 0.1.9 + +- Removed some keys from Dexie's IndexedDB declarations ## [0.1.8] - 2023.12.27- d26d1d360152a7d0e559b68486e85b72b88bd9ff -### Added + +### Added in 0.1.8 + - DB logging for service-worker events - Help page for notifications - Test notification & web-push triggers inside app - Check that the app is installed -### Fixed -- Project issuer display name +### Fixed in 0.1.8 + +- Project issuer display name ## [0.1.7] - 2023.12.19 - 91c6c7c11c71f96006cc876fc946f1f98a274ba2 -### Changed + +### Changed in 0.1.7 + - Icons -### Fixed + +### Fixed in 0.1.7 + - Notification switch now shows message - Prod/test server warning message at top of page - ## [0.1.6] - 2023.12.17 - b445b1234fbfcf6b37d695373f259aab0eda1118 -### Added + +### Added in 0.1.6 + - Infinite scroll on home page -### Changed + +### Changed in 0.1.6 + - UI improvements - Show web-push subscription info - Icon - ## [0.1.5] - 2023.12.09 - 9c36bb509a9bae9bb3306d3bd9eeb144b67aa8ad -### Added + +### Added in 0.1.5 + - Web push notifications (though not finalized) - Credentials details page - See more data without an ID - Change units of a give - ## [0.1.4] - 2023.11.20 - 7311d36726f3667ec4c68f241f91d404273ad4db -### Added + +### Added in 0.1.4 + - Offer on a project -### Changed -- Automatically set as visible when importing a contact +### Changed in 0.1.4 + +- Automatically set as visible when importing a contact ## [0.1.3] - 2023.11.08 - 910f57ec7d2e50803ae3d04f4b927e0f5219fbde -### Added + +### Added in 0.1.3 + - Contact name editing -### Changed + +### Changed in 0.1.3 + - Don't show actions on front page if not registered. -### Removed -- Home page Notiwind test buttons +### Removed in 0.1.3 + +- Home page Notiwind test buttons ## [0.1.2] - 2023.11.01 - 7f6c93802911a030a89fe3706e18b5c17151e5bb -### Added + +### Added in 0.1.2 + - Basics: create ID, record a give, declare a project, search, and get notifications. diff --git a/android/app/capacitor.build.gradle b/android/app/capacitor.build.gradle index fdb4970..151fee4 100644 --- a/android/app/capacitor.build.gradle +++ b/android/app/capacitor.build.gradle @@ -9,7 +9,7 @@ android { apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { - + implementation project(':capacitor-app') } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 4d7ca38..2607f04 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -22,6 +22,13 @@ + + + + + + + We're sorry but TimeSafari doesn't work properly without JavaScript enabled. Please enable it to continue.
- + diff --git a/ios/App/App/Info.plist b/ios/App/App/Info.plist index 2a84039..4ae63b7 100644 --- a/ios/App/App/Info.plist +++ b/ios/App/App/Info.plist @@ -45,5 +45,14 @@ UIViewControllerBasedStatusBarAppearance + CFBundleURLTypes + + + CFBundleURLSchemes + + timesafari + + + diff --git a/ios/App/Podfile b/ios/App/Podfile index c66ecd4..14cdb5b 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -11,7 +11,7 @@ install! 'cocoapods', :disable_input_output_paths => true def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' - + pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' end target 'App' do diff --git a/src/main.capacitor.ts b/src/main.capacitor.ts index 114583c..e89116b 100644 --- a/src/main.capacitor.ts +++ b/src/main.capacitor.ts @@ -1,16 +1,79 @@ import { initializeApp } from "./main.common"; import { App } from "@capacitor/app"; import router from "./router"; +import { handleApiError } from "./services/api"; +import { loadPlanWithRetry } from "./services/plan"; +import { Capacitor } from '@capacitor/core'; const app = initializeApp(); -// Handle deep links -App.addListener("appUrlOpen", (data: { url: string }) => { - console.log("Deep link opened:", data.url); - const slug = data.url.replace("timesafari://", ""); - if (slug) { - router.push("/" + slug); +// Store initial deep link if app is not ready +let pendingDeepLink: string | null = null; + +// Initialize API error handling +window.addEventListener('unhandledrejection', (event) => { + if (event.reason?.response) { + handleApiError(event.reason, event.reason.config?.url || 'unknown'); } }); +// Create reusable handler function +const handleDeepLink = async (data: { url: string }) => { + try { + if (Capacitor.isNativePlatform()) { + console.log("[Capacitor Deep Link] START Handler"); + console.log("[Capacitor Deep Link] Received URL:", data.url); + } + + // Wait for app to be mounted + if (!app._container) { + console.log("[Capacitor Deep Link] Waiting for app mount"); + await new Promise((resolve) => { + const interval = setInterval(() => { + if (app._container) { + clearInterval(interval); + resolve(); + } + }, 100); + }); + } + + const url = new URL(data.url); + const path = url.pathname.substring(1); + + if (Capacitor.isNativePlatform()) { + console.log("[Capacitor Deep Link] Parsed path:", path); + } + + // Map parameterized routes + const paramRoutes = { + 'claim': /^claim\/(.+)$/, + }; + + // Check if path matches any parameterized route + for (const [routeName, pattern] of Object.entries(paramRoutes)) { + const match = path.match(pattern); + if (match) { + if (Capacitor.isNativePlatform()) { + console.log(`[Capacitor Deep Link] Matched route: ${routeName}, param: ${match[1]}`); + } + await router.push({ + name: routeName, + params: { id: match[1] } + }); + return; + } + } + + await router.push('/' + path); + } catch (error) { + console.error("[Capacitor Deep Link] Error:", error); + handleApiError(error, 'deep-link'); + } +}; + +// Register listener +App.addListener("appUrlOpen", handleDeepLink); + +// Mount app app.mount("#app"); diff --git a/src/services/api.ts b/src/services/api.ts new file mode 100644 index 0000000..3d5cabe --- /dev/null +++ b/src/services/api.ts @@ -0,0 +1,13 @@ +export const handleApiError = (error: any, endpoint: string) => { + if (process.env.VITE_PLATFORM === 'capacitor') { + console.error(`[Capacitor API Error] ${endpoint}:`, error); + } + + // Specific handling for rate limits + if (error.response?.status === 400) { + console.warn(`[Rate Limit] ${endpoint}`); + return null; + } + + throw error; +}; \ No newline at end of file diff --git a/src/services/plan.ts b/src/services/plan.ts new file mode 100644 index 0000000..f0b18bb --- /dev/null +++ b/src/services/plan.ts @@ -0,0 +1,19 @@ +export const loadPlanWithRetry = async (handle: string, retries = 3) => { + for (let i = 0; i < retries; i++) { + try { + const plan = await loadPlan(handle); + if (plan) return plan; + } catch (err) { + console.warn(`[Plan Load] Attempt ${i + 1} failed for ${handle}`); + if (i === retries - 1) throw err; + await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1))); + } + } +}; + +const loadPlan = async (handle: string) => { + // Implement your plan loading logic here + // This is a placeholder - replace with actual implementation + const response = await fetch(`/api/plans/${handle}`); + return response.json(); +}; \ No newline at end of file