# Consuming App Migration: org.timesafari → org.timesafari

Use this document in your **consuming app** repo (e.g. with Cursor or as a checklist) to migrate from `org.timesafari.dailynotification` to `org.timesafari.dailynotification` after the daily-notification-plugin has been updated.

## Summary of plugin changes

The plugin’s package/namespace and public identifiers were renamed:

- **Package/namespace**: `org.timesafari.dailynotification` → `org.timesafari.dailynotification`
- **Intent action (Android)**: `org.timesafari.daily.NOTIFICATION` → `org.timesafari.daily.NOTIFICATION`
- **Dismiss action (Android)**: `org.timesafari.daily.DISMISS` → `org.timesafari.daily.DISMISS`
- **iOS BGTask identifiers**: `org.timesafari.dailynotification.fetch` / `.notify` / `.prefetch` → `org.timesafari.dailynotification.*`
- **Capacitor plugin class**: `org.timesafari.dailynotification.DailyNotificationPlugin` → `org.timesafari.dailynotification.DailyNotificationPlugin`

Your app must align with these so the plugin loads and receivers/intents work.

---

## 1. Update plugin dependency

- Ensure the consuming app depends on a **version of the plugin that already uses `org.timesafari`** (e.g. after the plugin repo’s com→org migration is merged/released).
- Reinstall/sync: `npm install` (or equivalent) so the updated plugin is used.

---

## 2. Capacitor plugin registration (Android & iOS)

The plugin is registered by **class name**. Update every place that references the plugin class.

**Typical locations:**

- `android/app/src/main/assets/capacitor.plugins.json` (or `public/plugins` if you use that)
- Any script or config that writes the plugin class string

**Change:**

- From: `"class": "org.timesafari.dailynotification.DailyNotificationPlugin"` or `"classpath": "org.timesafari.dailynotification.DailyNotificationPlugin"`
- To: `"class": "org.timesafari.dailynotification.DailyNotificationPlugin"` or `"classpath": "org.timesafari.dailynotification.DailyNotificationPlugin"`

If you use a script (e.g. `fix-capacitor-plugins.js`) that injects this class name, update the script to use `org.timesafari.dailynotification.DailyNotificationPlugin`.

---

## 3. Android: `AndroidManifest.xml`

**Receiver class names** (must match the plugin’s new package):

- `org.timesafari.dailynotification.DailyNotificationReceiver` → `org.timesafari.dailynotification.DailyNotificationReceiver`
- `org.timesafari.dailynotification.NotifyReceiver` → `org.timesafari.dailynotification.NotifyReceiver`
- `org.timesafari.dailynotification.BootReceiver` → `org.timesafari.dailynotification.BootReceiver`
- Any other `org.timesafari.dailynotification.*` receiver → `org.timesafari.dailynotification.*`

**Intent action** (must match plugin’s `DailyNotificationConstants.ACTION_NOTIFICATION`):

- `<action android:name="org.timesafari.daily.NOTIFICATION" />` → `<action android:name="org.timesafari.daily.NOTIFICATION" />`

Search the manifest for `org.timesafari` and replace with `org.timesafari` for these plugin-related entries.

---

## 4. Android: ProGuard / R8 (if you keep plugin classes)

If you have custom keep rules that reference the plugin package:

- `org.timesafari.dailynotification` → `org.timesafari.dailynotification`

(e.g. `-keep class org.timesafari.dailynotification.**` → `-keep class org.timesafari.dailynotification.**`).

---

## 5. iOS: `Info.plist` (BGTask identifiers)

The plugin uses these background task identifiers. Your app’s `Info.plist` must list the **same** identifiers.

**In `BGTaskSchedulerPermittedIdentifiers` (or equivalent):**

- `org.timesafari.dailynotification.fetch` → `org.timesafari.dailynotification.fetch`
- `org.timesafari.dailynotification.notify` → `org.timesafari.dailynotification.notify`

If you use the prefetch identifier:

- `org.timesafari.dailynotification.prefetch` → `org.timesafari.dailynotification.prefetch`

Update any other `org.timesafari.dailynotification.*` task IDs to `org.timesafari.dailynotification.*`.

---

## 6. App ID / Bundle ID (optional; breaking for installs)

- **Plugin package/namespace** change does **not** require you to change your app’s **applicationId** (Android) or **Bundle ID** (iOS).
- If you **do** change your app’s id from `org.timesafari.*` to `org.timesafari.*`, the store and OS will treat it as a **new app** (new install, no in-place update). Only change this if you intend that.

---

## 7. Custom intent actions / deep links

If your app or backend uses custom actions that included the old prefix (e.g. `org.timesafari.dailynotification.REFRESH_DATA` or `OPEN_SETTINGS`), update them to `org.timesafari.dailynotification.*` so they still match what the plugin or your code expects.

---

## 8. Scripts and docs in the consuming app

- Any script that uses the **plugin package** or **intent action** (e.g. `adb shell am start`, `dumpsys package`, or broadcast actions) should use `org.timesafari.dailynotification` and `org.timesafari.daily.NOTIFICATION` where applicable.
- Update internal docs or runbooks that reference the old package or action strings.

---

## 9. Verification

- **Android**: Build the app, install, and confirm notifications still schedule and fire. Check `adb shell dumpsys package <your.package>` for receivers and that alarms use `org.timesafari.daily.NOTIFICATION` if you inspect with `dumpsys alarm`.
- **iOS**: Build and run; confirm BGTask registration and notification behavior. Ensure `Info.plist` identifiers match the plugin’s Swift constants.
- **Capacitor**: Confirm the plugin is loaded (e.g. no “class not found” or missing plugin in the bridge).

---

## Quick find-and-replace (consuming app only)

Use with care; prefer updating specific files as above. Suggested patterns:

- **Plugin class**: `org.timesafari.dailynotification.DailyNotificationPlugin` → `org.timesafari.dailynotification.DailyNotificationPlugin`
- **Receiver/package references**: `org.timesafari.dailynotification.` → `org.timesafari.dailynotification.`
- **Notification intent action**: `org.timesafari.daily.NOTIFICATION` → `org.timesafari.daily.NOTIFICATION`
- **BGTask identifiers**: `org.timesafari.dailynotification.fetch` / `.notify` / `.prefetch` → `org.timesafari.dailynotification.fetch` / `.notify` / `.prefetch`

Do **not** blindly replace `org.timesafari` in your **app’s own** applicationId/Bundle ID unless you intend to ship as a new app.

---

**Reference:** This migration is aligned with the changes in the `daily-notification-plugin` repo (package rename com → org). For plugin-side details, see that repo’s history and docs.
