Add actionable push notifications for iOS and Android
iOS: - Add notification categories with action buttons (complete, view, cancel, etc.) - Handle notification actions in AppDelegate with API calls - Add navigation to specific task from notification tap - Register UNNotificationCategory for each task state Android: - Add NotificationActionReceiver BroadcastReceiver for handling actions - Update MyFirebaseMessagingService to show action buttons - Add deep link handling in MainActivity for task navigation - Register receiver in AndroidManifest.xml Shared: - Add navigateToTaskId parameter to App for cross-platform navigation - Add notification observers in MainTabView/AllTasksView for refresh 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
81
iosApp/push_test_payloads/README.md
Normal file
81
iosApp/push_test_payloads/README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Push Notification Test Payloads
|
||||
|
||||
These `.apns` files can be dragged onto the iOS Simulator to test push notifications with action buttons.
|
||||
|
||||
## How to Use
|
||||
|
||||
1. Run the app on the iOS Simulator
|
||||
2. Drag and drop any `.apns` file onto the Simulator window
|
||||
3. The notification will appear with the appropriate action buttons
|
||||
|
||||
## Before Testing
|
||||
|
||||
Edit the `task_id` in each file to match a valid task ID from your database.
|
||||
|
||||
## Available Payloads
|
||||
|
||||
| File | Category | Actions | Description |
|
||||
|------|----------|---------|-------------|
|
||||
| `task_overdue.apns` | TASK_ACTIONABLE | edit, complete, cancel, mark_in_progress | Overdue task notification |
|
||||
| `task_due_soon.apns` | TASK_ACTIONABLE | edit, complete, cancel, mark_in_progress | Task due within threshold |
|
||||
| `task_in_progress.apns` | TASK_IN_PROGRESS | edit, complete, cancel | Task being worked on |
|
||||
| `task_cancelled.apns` | TASK_CANCELLED | uncancel, delete | Cancelled task |
|
||||
| `task_completed.apns` | TASK_COMPLETED | (none - read only) | Completed one-time task |
|
||||
| `task_assigned.apns` | TASK_ACTIONABLE | edit, complete, cancel, mark_in_progress | Task assigned to user |
|
||||
| `task_generic_free_user.apns` | TASK_NOTIFICATION_GENERIC | (none) | Free user sees generic message |
|
||||
|
||||
## iOS Notification Categories
|
||||
|
||||
The `category` field in `aps` maps to these iOS notification categories:
|
||||
|
||||
- `TASK_ACTIONABLE` - For overdue, due_soon, upcoming tasks (full action set)
|
||||
- `TASK_IN_PROGRESS` - For tasks currently being worked on
|
||||
- `TASK_CANCELLED` - For cancelled tasks (can uncancel or delete)
|
||||
- `TASK_COMPLETED` - For completed one-time tasks (read-only, no actions)
|
||||
- `TASK_NOTIFICATION_GENERIC` - For free users (no actions, generic message)
|
||||
|
||||
## Payload Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"Simulator Target Bundle": "com.tt.casera.CaseraDev",
|
||||
"aps": {
|
||||
"alert": {
|
||||
"title": "Notification Title",
|
||||
"subtitle": "Residence Name",
|
||||
"body": "Notification body text"
|
||||
},
|
||||
"sound": "default",
|
||||
"badge": 1,
|
||||
"category": "TASK_ACTIONABLE",
|
||||
"mutable-content": 1,
|
||||
"thread-id": "task-{id}"
|
||||
},
|
||||
"task_id": 123,
|
||||
"task_name": "Task Name",
|
||||
"residence_id": 1,
|
||||
"residence_name": "Residence Name",
|
||||
"notification_type": "task_overdue|task_due_soon|task_completed|task_assigned",
|
||||
"button_types": ["edit", "complete", "cancel", "mark_in_progress"],
|
||||
"is_premium": true
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Data Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `task_id` | int | The task ID to navigate to when tapped |
|
||||
| `task_name` | string | Display name of the task |
|
||||
| `residence_id` | int | The residence ID |
|
||||
| `residence_name` | string | Display name of the residence |
|
||||
| `notification_type` | string | Type of notification (for analytics/logging) |
|
||||
| `button_types` | array | Available actions for this task state |
|
||||
| `is_premium` | bool | Whether user is premium (affects display) |
|
||||
|
||||
## Notes
|
||||
|
||||
- The `Simulator Target Bundle` must match your app's bundle identifier
|
||||
- `mutable-content: 1` allows the Notification Service Extension to modify content
|
||||
- `thread-id` groups related notifications together
|
||||
- The app must register notification categories on launch for actions to work
|
||||
Reference in New Issue
Block a user