Commit Graph

39 Commits

Author SHA1 Message Date
Chad Curtis 53eb0f37e9 Add kind 1111 to Android native notification service
- Add kind 1111 to the Nostr REQ filter in NotificationRelayService
- Add case 1111 to kindToAction() in NostrPoller with the same context-aware
  label logic: 'replied to your comment' when k=1111, 'commented on your post' otherwise
2026-03-07 02:01:59 -06:00
Chad Curtis ac09b0670a Losslessly compress public and Android image assets
Reduced PNG file sizes using sharp (compressionLevel 9, effort 10) with
no quality loss. Saved ~132K from public/ and ~960K from Android res/.
2026-03-04 03:21:37 -06:00
Chad Curtis fb9064cb0e Add pull-to-refresh to notifications; simplify Android notifications to use 'Someone' instead of fetching kind 0 metadata 2026-02-26 18:06:53 -06:00
Chad Curtis cbecefad84 Fix Android launcher icons: generate ic_launcher.png and ic_launcher_round.png with logo
The icon generation script was only producing ic_launcher_foreground.png
(adaptive icon layer) and leaving ic_launcher.png/ic_launcher_round.png as
solid purple squares with no logo. This caused the app icon to appear as a
big purple circle on device. The script now generates all three icon types
at all density buckets.
2026-02-26 15:32:02 -06:00
Chad Curtis 8c6747e46f Regenerate Android adaptive icon foreground PNGs 2026-02-26 14:56:50 -06:00
Chad Curtis a2f0397c0c Scale down adaptive icon foreground to 70% for proper safe-zone fit 2026-02-25 21:28:01 -06:00
Chad Curtis b138b04afb Restore all Android icons and generate-icons.sh to known good state (4abe629)
Reverts broken changes from intermediate commits that:
- Changed ic_launcher_foreground.xml viewport from 100x100 to 90x80 with scale
- Changed mipmap-anydpi-v26 to reference @drawable instead of @mipmap foreground
- Changed ic_stat_ditto.xml viewport from 100x100 to 90x80
- Rewrote generate-icons.sh to generate legacy icons with broken viewBox hack
- Produced tiny broken foreground PNGs (318-340 bytes)

All icon resources and the script are now identical to 4abe629, with freshly
regenerated foreground PNGs at the correct 66% content size.
2026-02-25 17:52:16 -06:00
Chad Curtis fd8fc1c3d6 Fix Android icon regressions: regenerate launcher PNGs and fix notification icon viewport
- Regenerate all ic_launcher*.png and ic_launcher_foreground.png which had regressed
  to tiny broken files (318-343 bytes) that rendered as white squares on purple
- Fix ic_stat_ditto.xml: change viewportWidth/Height from 100x100 to 90x80 to match
  the effective logo bounds, correcting the off-center logo in the notification tray
2026-02-25 17:52:16 -06:00
Chad Curtis f4cbb71e38 Fix Android icon centering by correcting SVG viewBox
The logo was still off-center because the SVG viewBox '-5 -10 100 100'
is asymmetric and doesn't properly frame the logo content.

Changes:
- Update generate-icons.sh: Change viewBox from '-5 -10 100 100' to '0 0 90 80'
- Update vector foreground: Change viewportWidth/Height from 100x100 to 90x80
- Adjust pivot point to match new viewport dimensions
- Regenerate all launcher PNGs and adaptive foreground PNGs with corrected viewBox

The logo should now be properly centered without the left gap.
2026-02-25 01:03:49 +00:00
Chad Curtis 407b4f1e4d Fix Android icon centering to remove left gap
The logo was off-center with a gap on the left due to the SVG's asymmetric
viewBox (-5, -10, 100, 100). Fixed by adjusting rendering and positioning.

Changes:
- Update generate-icons.sh: Render at 600px and crop to 512px for better centering
- Update vector foreground: Shift translateX from 5 to 7 to compensate for viewBox offset
- Regenerate all launcher PNGs and adaptive foreground PNGs

The logo now appears properly centered in the icon.
2026-02-25 00:54:01 +00:00
Chad Curtis cde98744d6 Reduce Android icon logo size to 40% for more breathing room
Zoomed out the logo further from 50% to 40% for better visual balance
and more padding around the logo.

Changes:
- Update generate-icons.sh: Change content_size from 50% to 40%
- Update vector foreground: Scale from 0.75 to 0.6 to match PNG sizing
- Regenerate all launcher PNGs and adaptive foreground PNGs

The logo now has generous padding and looks more refined in the app launcher.
2026-02-25 00:45:32 +00:00
Chad Curtis c82e9722d9 Reduce Android icon logo size from 66% to 50% for better appearance
The logo was zoomed in too far, making it difficult to see the full design.
Reduced the logo size to 50% of the icon canvas for proper padding.

Changes:
- Update generate-icons.sh: Change content_size from 66% to 50%
- Update vector foreground: Add 0.75 scale transformation to match PNG sizing
- Regenerate all launcher PNGs with the smaller, better-proportioned logo
- Regenerate all adaptive foreground PNGs

The logo now has proper breathing room and looks much better in the app launcher.
2026-02-25 00:38:06 +00:00
Chad Curtis 7f8f492acd Fix Android launcher icons to show Ditto logo on purple background
The APK was showing just a purple circle because the legacy launcher PNG files
(ic_launcher.png and ic_launcher_round.png) were solid purple with no logo.

Changes:
- Update generate-icons.sh to generate legacy launcher PNGs (for Android < 8.0)
- Add ImageMagick as fallback SVG renderer when inkscape/rsvg unavailable
- Replace 'bc' calculations with bash arithmetic for better compatibility
- Generate both square and round launcher icons with white logo on purple bg
- Regenerate all launcher icons (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi)

The icons now properly display:
- Purple background (#7c52e0)
- White Ditto logo (66% safe zone sizing)
- Round variant with circular mask

This fixes the issue for both:
- Modern devices (Android 8.0+): Uses adaptive icon system with vector foreground
- Legacy devices (Android < 8.0): Uses pre-rendered PNG launcher icons
2026-02-25 00:06:35 +00:00
Chad Curtis 04349db2b1 Fix Android app icon to show Ditto logo instead of purple circle
- Delete conflicting ic_launcher_background.xml drawable with teal grid pattern
- Update adaptive icon XMLs to use vector drawable instead of PNG mipmap
- Change from @mipmap/ic_launcher_foreground to @drawable/ic_launcher_foreground
- Vector drawable (drawable-v24/ic_launcher_foreground.xml) contains proper white Ditto logo
- Background color (#7c52e0 purple) is correctly defined in values/ic_launcher_background.xml

The APK was showing only a purple circle because the vector foreground logo wasn't being used. Now the adaptive icon system will properly composite the white Ditto logo on the purple background.
2026-02-25 00:04:16 +00:00
Chad Curtis 015a3a7e3f Fix Android app name capitalization to Ditto
- Update strings.xml to use 'Ditto' instead of 'ditto'
- Update capacitor.config.ts appName to 'Ditto'
- Update GitLab CI/CD artifact naming to use 'Ditto-' prefix
- Ensures consistency with web version branding
2026-02-25 00:01:41 +00:00
Chad Curtis 7132c43afa Add foreground PNGs for adaptive icon, restore foreground reference 2026-02-24 10:25:58 -06:00
Chad Curtis e2f94de1a2 Fix adaptive icon: use committed launcher PNG instead of broken foreground vector 2026-02-24 10:10:55 -06:00
Chad Curtis 4abe62962d Commit launcher PNGs directly, remove from CI generation 2026-02-24 06:11:54 -06:00
Chad Curtis 4f31b57d12 Fix icon branding: white SVG recolor, new logo notification icon, splash uses vector 2026-02-24 04:11:45 -06:00
Chad Curtis c8e92644d8 Fix spurious JSONException catch in EOSE handler 2026-02-24 01:49:26 -06:00
Chad Curtis 49d6166b99 Rewrite notification service: connect-fetch-disconnect per cycle, limit 5 events, adaptive interval 2026-02-24 01:18:11 -06:00
Chad Curtis b02b2a9e56 Rebrand Android app icons to Ditto logo with purple background 2026-02-24 01:03:53 -06:00
Alex Gleason 1f035f4a6e Rename Mew to Ditto across entire codebase
- Update all branding: titles, meta tags, OG tags, manifest
- Rename MewLogo component to DittoLogo
- Update Capacitor config: appId to pub.ditto.app, hostname to ditto.pub
- Migrate Android Java package from com.mew.app to pub.ditto.app
- Rename MewNotificationPlugin to DittoNotificationPlugin
- Update all localStorage keys from mew: to ditto: prefix
- Update Nostr encrypted settings d-tag from mew-metadata to ditto-metadata
- Update all page titles, zap comments, and UI strings
- Rename ic_stat_mew.xml drawable to ic_stat_ditto.xml
- Update build script references (mew.apk -> ditto.apk)
- Update all domain references (mew.shakespeare.wtf -> ditto.pub)
2026-02-23 11:50:00 -06:00
Chad Curtis 24c577e152 Show zap amount in native notifications, navigate to /notifications on tap
- Extract zap amount from kind 9735 events in NostrPoller.java (checks
  amount tag then falls back to description tag's zap request)
- Format amounts compactly (e.g. 1.5K sats, 2M sats)
- Set data URI on notification PendingIntent so tapping opens /notifications
- Handle deep link intent in MainActivity (both onCreate and onNewIntent)
- Remove dead localNotificationActionPerformed listener from TypeScript
  (only fired for Capacitor-API notifications, not natively posted ones)
2026-02-22 17:40:33 -06:00
Chad Curtis e00802d027 Build v2026.02.22: Update mew.apk (6.4M) 2026-02-22 03:40:46 -06:00
Chad Curtis 07123403cd Fix excessive battery drain: replace permanent WakeLock with AlarmManager keepalive
The notification service was holding a PARTIAL_WAKE_LOCK indefinitely,
preventing the CPU from ever sleeping. Combined with OkHttp's 30-second
ping interval, this caused continuous CPU wake-ups — worse than the
previous polling approach.

Changes:
- Remove permanent WakeLock that kept CPU running 24/7
- Disable OkHttp's 30s ping interval (useless without WakeLock in Doze)
- Add AlarmManager keepalive using setAndAllowWhileIdle() every ~8 min
- Acquire brief WakeLock (15s timeout) only during keepalive checks
- Track connection liveness via relay message timestamps
- Reconnect automatically when Doze kills the TCP connection
- Missed events are recovered via the existing 'since' timestamp

Expected improvement: ~3 brief wake-ups/hour vs continuous CPU usage.
Notifications may be delayed up to ~8 min in deep sleep.
2026-02-22 03:37:41 -06:00
Chad Curtis c565050779 Build v2026.02.21: Update mew.apk (6.3M) 2026-02-21 05:34:24 -06:00
Chad Curtis 34a2cda6fd Add ACCESS_NETWORK_STATE permission for ConnectivityManager 2026-02-20 17:49:57 -06:00
Chad Curtis 8ba7c16958 Fix startup crash: call startForeground() immediately in onCreate
Android 12+ crashes the app if startForeground() isn't called within 5
seconds of startForegroundService(). Moved it from onStartCommand() to
the top of onCreate() to ensure the foreground notification is posted
before any other initialization.
2026-02-20 17:48:04 -06:00
Chad Curtis 6066b5ec49 Replace polling notification system with persistent WebSocket subscription
Replaces the AlarmManager-based polling (wake every 60s, open/close WebSocket
connections) with a persistent WebSocket subscription to a Nostr relay. Events
are delivered in real-time via the open connection. A partial WakeLock keeps
the connection alive through Doze mode (same approach as Signal without FCM).

- Add NotificationRelayService: foreground service with persistent WebSocket,
  exponential backoff reconnection, network-aware reconnect, relay rotation
  on failure, and SharedPreferences config listener
- Refactor NostrPoller into notification dispatcher with metadata caching
  (SharedPreferences-based, avoids redundant WebSocket connections for
  repeat authors)
- Remove NotificationService (AlarmManager scheduler) and PollAlarmReceiver
  (WakeLock-based polling)
- Remove SCHEDULE_EXACT_ALARM permission (no longer needed)
- Disable web-layer background refetch on native (persistent connection
  handles it)
2026-02-20 17:43:26 -06:00
Chad Curtis 0ff2ea4198 Untrack generated mipmap PNGs and ignore android/downloads/ 2026-02-20 17:09:22 -06:00
Chad Curtis 1881e3cde9 Build v2026.02.20: Update mew.apk (6.2M) 2026-02-20 15:30:11 -06:00
Chad Curtis e9331a4a6c Move notification polling to native Java with AlarmManager
Replace JS WebView-based polling with pure native implementation:
- NostrPoller: Java WebSocket client that queries Nostr relays directly via OkHttp
- PollAlarmReceiver: AlarmManager fires every 60s, acquires WakeLock, runs native poll
- NotificationService: foreground service keeps process alive, schedules alarms
- MewNotificationPlugin: Capacitor plugin passes pubkey/relays from JS to SharedPreferences
- Remove notificationService.ts (all polling logic now in Java)
- Simplify useNativeNotifications to only configure native service + handle permissions
2026-02-19 12:10:13 -06:00
Chad Curtis 64726d2cf7 Add local WebSocket notification polling and Mew splash/notification icons
- Implement Signal-like local-only notifications via direct WebSocket relay polling
- Poll every 60s foreground, 15min background, no external push server
- Resolve NIP-05 display names for notification body (e.g. 'alice@nostr.com reacted to your post')
- Add Capacitor LocalNotifications plugin with POST_NOTIFICATIONS permission
- Replace default Capacitor splash with Mew logo PNG on dark background using Android 12 Theme.SplashScreen
- Add ic_stat_mew vector drawable for notification small icon
- Regenerate splash PNGs with #14161f background
2026-02-19 10:40:38 -06:00
Chad Curtis 780271f3c1 Fix sticky headers to use top-mobile-bar pattern
- Change STICKY_HEADER_CLASS to use 'top-mobile-bar sidebar:top-0'
- Matches the pattern used in Feed and NotificationsPage
- On mobile: sticky tabs position below the MobileTopBar (accounting for safe area)
- On desktop: sticky tabs position at top-0 (no top bar on desktop)
- Fixes issue where safe-area-top created unwanted space above tabs
2026-02-19 08:03:08 -06:00
Chad Curtis 40b1c1c182 Add safe-area-top to sticky headers
- Update STICKY_HEADER_CLASS constant to include safe-area-top
- Fixes sticky tabs in Search and Settings pages on mobile
- Ensures sticky headers respect device notches and status bars
- Feed and NotificationsPage already use top-mobile-bar which includes safe area
2026-02-19 07:58:45 -06:00
Chad Curtis db7bbb0095 Update app icon background to dark theme color
- Change icon background from white (#ffffff) to dark theme (#14161f)
- Update capacitor.config.ts backgroundColor to match
- Update generate-icons.sh to use dark theme color
- Regenerate all Android icons with new background
- Prevents white-on-white icon appearance
2026-02-19 06:27:00 -06:00
Chad Curtis d47f12b38d Build v2026.02.19: Update mew.apk (5.1M) 2026-02-19 06:21:41 -06:00
Chad Curtis 2f02e65ab6 Add Android Capacitor build system
- Install Capacitor dependencies (@capacitor/cli, @capacitor/core, @capacitor/android, @capacitor/app, @capacitor/status-bar, sharp)
- Create capacitor.config.ts with app configuration
- Update .gitignore to exclude Android build outputs and keystore files
- Generate icon-512.png from logo.svg
- Add scripts for icon generation, APK building, and keystore creation
- Initialize Capacitor Android platform
- Configure build.gradle with signing support
- Generate Android app icons in all required densities
- Add npm scripts: 'icons' and 'build:apk'
2026-02-19 06:18:02 -06:00