Documentation
¶
Overview ¶
Package mobile is the gomobile-bind entry point used by the iOS Swift app and the Android app. It wraps internal/web.Server so the HTTP server runs in-process via a JNI .so — no subprocess, no exec from nativeLibraryDir, no PIE/page-size/SELinux pitfalls.
Index ¶
- func CheckPasscode(passcode, stored string) string
- func HashPasscode(passcode string) string
- type MessageNotifier
- type Server
- func NewAndroidPlayServer(dataDir string, preferredPort int) (*Server, error)
- func NewAndroidServer(dataDir string, preferredPort int) (*Server, error)
- func NewAndroidUniversalServer(dataDir string, preferredPort int) (*Server, error)
- func NewServer(dataDir string, preferredPort int) (*Server, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPasscode ¶ added in v0.42.0
CheckPasscode returns "" when passcode does not match stored, otherwise the value to keep stored (an older form comes back upgraded).
func HashPasscode ¶ added in v0.42.0
HashPasscode returns the stored form of the app-lock passcode ("" on failure).
Types ¶
type MessageNotifier ¶ added in v0.25.9
type MessageNotifier interface {
OnNewMessages(count int)
}
MessageNotifier is implemented on the native side (Kotlin/Swift). The Go background chat poll loop calls OnNewMessages when it discovers new messages, so the native app can post a system notification while it's backgrounded (the in-app, foreground case is handled by the web UI). The implementation must be cheap and non-blocking — it runs on a Go poll goroutine.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a running thefeed-client instance bound to 127.0.0.1.
func NewAndroidPlayServer ¶ added in v0.38.0
NewAndroidPlayServer is NewServer for the Google Play build: it disables the in-app updater end to end. Deliberately does NOT set THEFEED_ANDROID_APK — that flag is what points the updater at a GitHub APK asset.
func NewAndroidServer ¶ added in v0.20.0
NewAndroidServer is NewServer for per-ABI APK builds: the update prompt points at the matching ABI asset.
func NewAndroidUniversalServer ¶ added in v0.20.0
NewAndroidUniversalServer is NewServer for the universal APK build: the update prompt keeps the user on the universal asset.
func NewServer ¶
NewServer starts a server on 127.0.0.1. preferredPort=0 picks a kernel-assigned port; a positive value is tried first and falls back to kernel-assigned on bind failure. dataDir must be a writable app-private directory (e.g. NSDocumentDirectory on iOS).
func (*Server) Password ¶ added in v0.41.0
Password is the per-launch HTTP Basic secret every request to this server must carry. Any user name is accepted; only the password is checked.
The native side answers the server's auth challenge with it -- on Android from WebViewClient.onReceivedHttpAuthRequest, on iOS from the WKWebView navigation delegate's didReceive(challenge:). Those fire for sub-resources too, so one implementation covers the page, its scripts, its images, its XHRs and its event stream. Another app on the device sees 401.
Never write it anywhere another app can read -- app-private storage or an in-process value only. It changes every launch, so nothing should persist it beyond the process either.
func (*Server) SetMessageNotifier ¶ added in v0.25.9
func (s *Server) SetMessageNotifier(n MessageNotifier)
SetMessageNotifier registers (or, with nil, clears) the native new-message notifier. Safe to call after the server is running.