Skip to content

react-native-freedome migration

1.0 is a rewrite over @freedome/client (contract v1). FreeDomeProvider and useFreeDome() keep their names; everything behind them changed. 0.1’s own services (connection, auth, content, socket.io wiring) are gone — the client does that work, with a connection state machine, token refresh, realtime resume and an offline cache.

  • Licence MIT → NativeMindNONC (non-commercial use free; commercial use needs a licence from NativeMind sales).
  • Removed hard dependencies: @react-native-async-storage/async-storage, @react-native-community/netinfo, react-native-device-info, socket.io-client. New dependency: @freedome/client.
  • Native modules are optional peers wired explicitly: react-native-encrypted-storage (react-native-freedome/encrypted-storage) and react-native-zeroconf (react-native-freedome/zeroconf).
0.1 1.0
<FreeDomeProvider config={…}> + initialize(config) <FreeDomeProvider appId appName appVersion tokenStore discovery …> — no initialise step
reset() disconnect()
state.isInitialized / isInitializing not needed; useConnection().state (idle, negotiating, authenticating, online, …)
state.connectionStatus.isConnected / isConnecting useConnection().isOnline / isBusy
state.error (string) useConnection().error / errorCode (stable codes)
state.currentUser, hasRole, hasPermission client.session.role, client.session.scopes.has('playback:control')
state.discoveredSystems, connectToNearestDome() useDomeDiscovery().domes → connect(domes[0].endpoint)
connectToDome(dome) connect('host:port'), connect(endpoint) or pair('freedome://pair?…')
authenticateAsAdmin(user, password) connect(address, { credentials: Credentials.password(user, password) })
switchToGuestMode() connect(address) (guest is the default credential)
logout() logout() (ends the server session, forgets stored tokens)
addEventListener(type, fn) client.on('venues/+/players/main', fn) (contract topics)
getSystemStatus() client.server, client.engine.engines()
0.1 1.0
state.playbackState usePlayback().state / status
playContent(content) usePlayback().play(PlayTargets.show(id)) / PlayTargets.asset(id)
playAppContent(app, name, data) play(PlayTargets.app(app, { kind: name, data }))
ReactNativeFreeDome.quickPlay(app, name, d) deprecated useFreeDome().quickPlay(app, name, d) (same payload as above)
pausePlayback / resumePlayback / stopPlayback pause() / resume() / stop()
setVolume(v) setVolume(v) (player, 0..1) or client.playback.setVolume(v) (venue output)
setBrightness(b) client.playback.setBrightness(b)

The 0.1 quickPlay was a stub that always returned false; the 1.0 wrapper really publishes the payload and will be removed in 2.0.

ConnectionService, AuthService, ContentService, EventEmitter, Logger / LogLevel (pass a logger to the provider), the ReactNativeFreeDome class (getVersion() → VERSION, checkCompatibility() → the client negotiates on connect and reports incompatible), and the 0.1 content / dome type modules (use the contract types re-exported by @freedome/client).

useAudio (master gain / mute, zones, generator), usePairingLinks (freedome://pair deep links with the pairing code surfaced), EncryptedTokenStore, typed errors with codes, live control that fails fast while offline.