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
This commit is contained in:
Matthew Raymer
2025-02-19 13:07:08 +00:00
parent 3135062c08
commit 1e22cdec82
13 changed files with 580 additions and 222 deletions

View File

@@ -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 <VERSION_TAG>
git push origin <VERSION_TAG>
```
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/<YOUR_KEY>" 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