Browse Source

Docs and such

Philipp Heckel 2 years ago
parent
commit
3513209ae8
4 changed files with 121 additions and 0 deletions
  1. 23 0
      README.md
  2. 23 0
      docs/FEATURE_PARITY.md
  3. 48 0
      docs/GETTING_STARTED.md
  4. 27 0
      docs/TECHNICAL_LIMITATIONS.md

+ 23 - 0
README.md

@@ -0,0 +1,23 @@
+#  ntfy iOS App
+This is the iOS app for [ntfy](https://github.com/binwiederhier/ntfy) ([ntfy.sh](https://ntfy.sh)).
+
+**Project status: The app is under HEAVY DEVELOPMENT.**
+
+## Relevant Links
+
+- [Android App - Feature Parity](docs/FEATURE_PARITY.md)
+- [Getting Started - Development](docs/GETTING_STARTED.md)
+- [Technical Limitations](docs/TECHNICAL_LIMITATIONS.md)
+
+## Contact me
+You can directly contact me **[on Discord](https://discord.gg/cT7ECsZj9w)** or [on Matrix](https://matrix.to/#/#ntfy:matrix.org) 
+(bridged from Discord), or via the [GitHub issues](https://github.com/binwiederhier/ntfy/issues), or find more contact information
+[on my website](https://heckel.io/about).
+
+## License
+Originally developed by [@Copephobia](https://github.com/Copephobia). He did the bulk of the work, and deserves most
+of the credit. Thank you @Copephobia!
+
+The app is now maintained with ❤️ by [Philipp C. Heckel](https://heckel.io).   
+The project is dual licensed under the [Apache License 2.0](LICENSE) and the [GPLv2 License](LICENSE.GPLv2).
+

+ 23 - 0
docs/FEATURE_PARITY.md

@@ -0,0 +1,23 @@
+#  ntfy.sh iOS - Android Feature Parity
+
+This document is to keep track of the feature parity between the iOS and Android ntfy.sh apps.
+
+**Last Updated: 2021-02-26**
+
+| Feature | iOS | Android | Notes |
+| --- | --- | --- | --- |
+| Subscribe to default server topic | :white_check_mark: | :white_check_mark: |
+| Subscribe to self-hosted server topic | :x: | :white_check_mark: | Not yet implemented |
+| Instant delivery | :x: | :white_check_mark: | Foreground services not possible in iOS |
+| Pause notifications | :x: | :white_check_mark: | Will likely require [Filtering](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_usernotifications_filtering) to prevent displaying notifications while still receiving them |
+| Send test notification | :white_check_mark: | :white_check_mark: | Not fully implemented |
+| Unsubscribe from topic | :white_check_mark: | :white_check_mark: |
+| Delete notifications | :white_check_mark: | :white_check_mark: |
+| Notification priority | :warning: | :white_check_mark: | Displays an exclamation mark in notification row for high.max priority, no changes to the actual push notification (sounds, vibrations), no  prioirty filtering |
+| Tags and emojis | :white_check_mark: | :white_check_mark: |
+| Click action | :x: | :white_check_mark: | Not yet implemented |
+| Attachments | :warning: | :white_check_mark: | Not fully implemented |
+| User Authentication | :warning: | :white_check_mark: | Not fully implemented |
+| Dark mode | :white_check_mark: | :white_check_mark: | Dependent on iOS dark mode, may add override in |
+| Logging | :x: | :white_check_mark: | Not yet implemented |
+| Share to topic | :x: | :white_check_mark: | Not yet implemented |

+ 48 - 0
docs/GETTING_STARTED.md

@@ -0,0 +1,48 @@
+# ntfy.sh iOS - Getting Started with Development
+
+## Requirements
+Note: these requirements are strictly based off of my development on this app. There may be other versions of macOS / XCode that work. Feel free to test on other versions!
+
+1. macOS Monterey or later
+1. XCode 13.2+
+1. A physical iOS device (for push notifications, I could not get them to work in the XCode simulator)
+1. The [macOS development branch for ntfy](https://github.com/Copephobia/ntfy/tree/macos-development) (for APNS configuration)
+1. Firebase account
+1. Apple Developer license? (I forget if its possible to do testing without purchasing the license)
+
+## Setup - Apple Developer
+
+1. [Create a new key in Apple Developer Member Center](https://developer.apple.com/account/resources/authkeys/add)
+  1. Select "Apple Push Notifications service (APNs)"
+1. Download the newly created key (should have a file name similar to `AuthKey_ZZZZZZ.p8`, where `ZZZZZZ` is the **Key ID**)
+1. Record your **Team ID** - it can be seen in the top-right corner of the page, or on your Account > Membership page
+
+## Setup - Firebase
+
+1. If you haven't already, create a Google / Firebase account
+1. Visit the [Firebase console](https://console.firebase.google.com)
+1. Create a new Firebase project:
+  1. Enter a project name
+  1. Disable Google Analytics (currently iOS app does not support analytics)
+1. On the "Project settings" page, add an iOS app
+  1. Apple bundle ID - "com.copephobia.ntfy-ios" (this can be changed to match XCode's ntfy.sh target > "Bundle Identifier" value)
+  1. Register the app
+  1. Download the config file - GoogleInfo.plist (this will need to be included in the ntfy-ios repository / XCode)
+1. Generate a new service account private key for the ntfy server
+  1. Go to "Project settings" > "Service accounts"
+  1. Click "Generate new private key" to generate and download a private key to use for sending messages via the ntfy server
+
+## Setup - ntfy server
+
+1. Checkout the [macOS development branch for ntfy](https://github.com/Copephobia/ntfy/tree/macos-development)
+1. If not already made, make the `/etc/ntfy/` directory and move the service account private key to that folder
+1. Copy the `server/server.yml` file from the ntfy repository to `/etc/ntfy/`
+1. Modify the `/etc/ntfy/server.yml` file `firebase-key-file` value to the path of the private key
+1. Install go: `brew install go`
+1. In the ntfy repository, run `make build-simple`
+
+## Setup - XCode
+
+1. Follow step 4 of [https://firebase.google.com/docs/ios/setup](Add Firebase to your Apple project) to install the firebase-ios-sdk in XCode, if it's not already present - you can select any packages in addition to Firebase Core / Firebase Messaging
+1. Similarly, install the SQLite.swift package dependency in XCode
+1. When running the debug build, ensure XCode is pointed to the connected iOS device - registering for push notifications does not work in the iOS simulators

+ 27 - 0
docs/TECHNICAL_LIMITATIONS.md

@@ -0,0 +1,27 @@
+#  ntfy.sh iOS - Technical Limitations
+
+### No Foreground Services
+
+Android can utilize foreground services to maintain a connection to the ntfy.sh / self-hosted server.
+ 
+iOS doe not have any such feature, so the app can currently only rely on Firebase and background tasks.
+
+### Background Tasks
+
+iOS "intelligently" decides when to run background tasks, NOT when you schedule / request them.
+
+Taken from [Background execution demystified](https://developer.apple.com/videos/play/wwdc2020/10063/), you would expect a "periodic" background task to be executed every 2 hours. In reality, iOS may decide to execute the background task at an irregular interval, sometimes not executing for hours at a time.
+
+In my limited testing, I created a background app refresh task to gather new notifications periodically (every 15 minutes) poll the topics for new notifications. The end result was that my background task was executed only once in the day that I let it run.
+
+This made me realize that background tasks are very unreliable in the context of ntfy.sh, where it would be best to periodically poll the topics for notifications. If the background task were to not execute for a longer period than notifications are cached, then it's possible that notifications would never make it to the app.
+
+### Self-hosted Servers
+
+Self-hosted servers are a tricky problem to solve.
+
+Because the iOS app heavily almost exclusively on Firebase (unless you want to manually refresh every topic on your own to get the latest notifications), the self-hosted server would need to be running Firebase.
+
+In addition to running firebase, the iOS users would need to build their own iOS app with their firebase credentials packaged in.
+
+If we want to stick with the default (official) iOS app, and allow self-hosted servers to be used / subscribed to, the self-hosted server would need to relay any notifications to ntfy.sh, so that it may use the Firebase credentials/configuration there to properly send the notification to the iOS device.