mobile

package
v0.45.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasscode added in v0.42.0

func CheckPasscode(passcode, stored string) string

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

func HashPasscode(passcode string) string

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

func NewAndroidPlayServer(dataDir string, preferredPort int) (*Server, error)

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

func NewAndroidServer(dataDir string, preferredPort int) (*Server, error)

NewAndroidServer is NewServer for per-ABI APK builds: the update prompt points at the matching ABI asset.

func NewAndroidUniversalServer added in v0.20.0

func NewAndroidUniversalServer(dataDir string, preferredPort int) (*Server, error)

NewAndroidUniversalServer is NewServer for the universal APK build: the update prompt keeps the user on the universal asset.

func NewServer

func NewServer(dataDir string, preferredPort int) (*Server, error)

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

func (s *Server) Password() string

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) Port

func (s *Server) Port() int

Port returns the listening port (0 after Stop).

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.

func (*Server) Stop

func (s *Server) Stop()

Stop closes the listener and waits for serve to return.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL