MobSms.DemoScreen (mob_sms v0.2.2)

Copy Markdown View Source

Ready-to-run sample screen exercising MobSms.compose/2 and MobSms.OneTimeCode.arm/2. Auto-listed by any host that enumerates Mob.Plugins.screens/0. Delete this file (and the manifest :screens entry) in a real app.

Two sections:

  • Composer — pre-fills the system SMS app with an invite body and hands off. Result flows to handle_info/2 as {:sms, atom}.

  • One-time code (OTP) — arms the platform's OTP autofill on mount with on_receive: :code (matches the text field's on_change={{self(), :code}}). Both platforms deliver the received code as {:change, :code, value} — same shape as any keystroke — so one handler covers iOS QuickType autofill AND Android's SMS Retriever. The optional {:sms_otp, :timeout} handler surfaces the sad path (5-min Android timeout, GMS start failure, evicted by re-arm).

Summary

Functions

dump_state(assigns)

Callback implementation for Mob.Screen.dump_state/1.

handle_event(event, params, socket)

Callback implementation for Mob.Screen.handle_event/3.

load_state(vsn, stored)

Callback implementation for Mob.Screen.load_state/2.

terminate(reason, socket)

Callback implementation for Mob.Screen.terminate/2.