nandi/frqpublic Fork 0
0bc64b5f1c03f116c85730830fe0d35b0570e3d3
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Share the connect screen, and the cells under it 80eb088 · on 0bc64b5f1c03f116c85730830fe0d35b0570e3d3 · nandi · 8d ago
actions.cljc · 27 lines · 1.0 KBText Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(ns frq.actions
  "What a screen can ask the app to do, named once so both can answer.

  The same shape as `frq.io`, one layer up: the cells in `frq.cells` are state
  a shared screen can read directly, and these are the things it cannot do for
  itself. `connect!` on the desktop is `frq.state/connect!` — IRC over jolt's
  TLS, SASL, the reader thread — and on the phone it is the dart:io one. The
  screen calls the same name either way and knows neither."
  (:refer-clojure :exclude [name]))

(defonce ^:private impl (atom {}))

(defn install!
  "Register what this platform does. Anything left out is a no-op, so a screen
  can be rendered before the action behind a button exists — which is how the
  phone got the connect screen on it before SASL was ported."
  [m]
  (swap! impl merge m)
  nil)

(defn- call [k args]
  (when-let [f (get @impl k)] (apply f args)))

(defn connect! [] (call :connect! []))
(defn disconnect! [] (call :disconnect! []))
(defn forget-session! [] (call :forget-session! []))
(defn open-url! [url] (call :open-url! [url]))