From fffdedc0c6032c1172a6965829ad0e6ac8ce9bdb Mon Sep 17 00:00:00 2001 From: Patrick Bergeron Date: Wed, 12 Jul 2023 15:49:07 -0500 Subject: [PATCH 1/3] fixes how trove and lexicon are added to the app catalog. also adds a poke add-catalog-entry gives devs a poke to add a 'native-app' to the catalog --- desks/realm/app/bazaar.hoon | 28 +++++++++++++++++++++++++++- desks/realm/lib/bazaar.hoon | 28 ++++++++++++++++++++++++++++ desks/realm/sur/bazaar/store.hoon | 1 + 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/desks/realm/app/bazaar.hoon b/desks/realm/app/bazaar.hoon index cef4560fc0..98ec32fea4 100644 --- a/desks/realm/app/bazaar.hoon +++ b/desks/realm/app/bazaar.hoon @@ -54,7 +54,21 @@ =/ old=(unit state-0) (mole |.(!<(state-0 vase))) ?^ old - `this(state u.old) + =| lexicon-app=native-app:store + =. title.lexicon-app 'Lexicon' + =. color.lexicon-app '#EEDFC9' + =. icon.lexicon-app 'AppIconLexicon' + =. config.lexicon-app [size=[3 7] titlebar-border=%.n show-titlebar=%.y] + =| trove-app=native-app:store + =. title.trove-app 'Trove' + =. color.trove-app '#DCDCDC' + =. icon.trove-app 'AppIconTrove' + =. config.trove-app [size=[7 8] titlebar-border=%.n show-titlebar=%.y] + :_ this(state u.old) + :: add two new app entries for Realm's new "native" apps: %trove and %lexicon + :~ [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-lexicon lexicon-app]])] + [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-trove trove-app]])] + == %- (slog leaf+"nuking old %bazaar state" ~) :: temporarily doing this for making development easier =^ cards this on-init :_ this @@ -428,6 +442,7 @@ %set-host (set-host +.action) :: testing helper. remove an app from the ship catalog w/o producing any effects %delete-catalog-entry (delete-catalog-entry +.action) + %add-catalog-entry (add-catalog-entry +.action) == :: +pre: prefix for scries to hood :: ++ pre /(scot %p our.bowl)/hood/(scot %da now.bowl) @@ -734,6 +749,17 @@ ^- (quip card _state) =. catalog.state (~(del by catalog.state) app-id) [~ state] + :: + :: + :: $add-catalog-entry + :: add a new native-app to the catalog. does not currently support %urbit or %web apps. + ++ add-catalog-entry + |= [=app-id:store =native-app:store] + ^- (quip card _state) + :: %- (slog leaf+"{}: [add-catalog-entry] {}" ~) + =. catalog.state (~(put by catalog.state) app-id [%native native-app]) + =. grid-index.state (set-grid-index:helpers:bazaar:core app-id grid-index.state) + `state -- ++ reaction |= [rct=reaction:store] diff --git a/desks/realm/lib/bazaar.hoon b/desks/realm/lib/bazaar.hoon index a998179e63..399a685025 100644 --- a/desks/realm/lib/bazaar.hoon +++ b/desks/realm/lib/bazaar.hoon @@ -31,6 +31,7 @@ [%clear-stall clear-stall] [%set-host set-host] [%delete-catalog-entry del-cat-entry] + [%add-catalog-entry add-cat-entry] == :: ++ install-app @@ -120,6 +121,33 @@ %- ot :~ [%app-id so] == + :: + ++ add-cat-entry + %- ot + :~ [%app-id so] + [%native-app native-app] + == + :: %- of + :: :~ [%native native-app] + :: [%web ~] :: currently not supported + :: [%urbit ~] :: currently not supported + :: == + :: + ++ native-app + %- ot + :~ [%title so] + [%info so] + [%color so] + [%icon so] + [%config cfg] + == + :: + ++ cfg + %- ot + :~ [%size (at ~[ni ni])] + [%titlebar-border bo] + [%show-titlebar bo] + == -- -- :: diff --git a/desks/realm/sur/bazaar/store.hoon b/desks/realm/sur/bazaar/store.hoon index 9231429c9c..f74a2f186a 100644 --- a/desks/realm/sur/bazaar/store.hoon +++ b/desks/realm/sur/bazaar/store.hoon @@ -74,6 +74,7 @@ [%clear-stall path=space-path:spaces args=(map cord cord)] [%set-host app-id=desk host=ship] [%delete-catalog-entry =app-id] + [%add-catalog-entry =app-id =native-app] == :: +$ interaction From 800733d5a417d128c02db0875eb92b7731e86c71 Mon Sep 17 00:00:00 2001 From: Patrick Bergeron Date: Thu, 13 Jul 2023 08:31:56 -0500 Subject: [PATCH 2/3] remove adding of trove and lexicon on on-load --- desks/realm/app/bazaar.hoon | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/desks/realm/app/bazaar.hoon b/desks/realm/app/bazaar.hoon index 98ec32fea4..ed75368b13 100644 --- a/desks/realm/app/bazaar.hoon +++ b/desks/realm/app/bazaar.hoon @@ -53,22 +53,22 @@ ^- (quip card:agent:gall agent:gall) =/ old=(unit state-0) (mole |.(!<(state-0 vase))) - ?^ old - =| lexicon-app=native-app:store - =. title.lexicon-app 'Lexicon' - =. color.lexicon-app '#EEDFC9' - =. icon.lexicon-app 'AppIconLexicon' - =. config.lexicon-app [size=[3 7] titlebar-border=%.n show-titlebar=%.y] - =| trove-app=native-app:store - =. title.trove-app 'Trove' - =. color.trove-app '#DCDCDC' - =. icon.trove-app 'AppIconTrove' - =. config.trove-app [size=[7 8] titlebar-border=%.n show-titlebar=%.y] - :_ this(state u.old) - :: add two new app entries for Realm's new "native" apps: %trove and %lexicon - :~ [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-lexicon lexicon-app]])] - [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-trove trove-app]])] - == + ?^ old `this(state u.old) + :: =| lexicon-app=native-app:store + :: =. title.lexicon-app 'Lexicon' + :: =. color.lexicon-app '#EEDFC9' + :: =. icon.lexicon-app 'AppIconLexicon' + :: =. config.lexicon-app [size=[3 7] titlebar-border=%.n show-titlebar=%.y] + :: =| trove-app=native-app:store + :: =. title.trove-app 'Trove' + :: =. color.trove-app '#DCDCDC' + :: =. icon.trove-app 'AppIconTrove' + :: =. config.trove-app [size=[7 8] titlebar-border=%.n show-titlebar=%.y] + :: :_ this(state u.old) + :: :: add two new app entries for Realm's new "native" apps: %trove and %lexicon + :: :~ [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-lexicon lexicon-app]])] + :: [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-trove trove-app]])] + :: == %- (slog leaf+"nuking old %bazaar state" ~) :: temporarily doing this for making development easier =^ cards this on-init :_ this From 604d761216d4782bd6b4e5e830e4f050ef711b69 Mon Sep 17 00:00:00 2001 From: Patrick Bergeron Date: Thu, 13 Jul 2023 18:29:10 -0500 Subject: [PATCH 3/3] remove %trove and %lexicon in on-load and add %os-trove and %os-lexicon --- desks/realm/app/bazaar.hoon | 42 +++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/desks/realm/app/bazaar.hoon b/desks/realm/app/bazaar.hoon index ed75368b13..aeb5653af8 100644 --- a/desks/realm/app/bazaar.hoon +++ b/desks/realm/app/bazaar.hoon @@ -53,22 +53,26 @@ ^- (quip card:agent:gall agent:gall) =/ old=(unit state-0) (mole |.(!<(state-0 vase))) - ?^ old `this(state u.old) - :: =| lexicon-app=native-app:store - :: =. title.lexicon-app 'Lexicon' - :: =. color.lexicon-app '#EEDFC9' - :: =. icon.lexicon-app 'AppIconLexicon' - :: =. config.lexicon-app [size=[3 7] titlebar-border=%.n show-titlebar=%.y] - :: =| trove-app=native-app:store - :: =. title.trove-app 'Trove' - :: =. color.trove-app '#DCDCDC' - :: =. icon.trove-app 'AppIconTrove' - :: =. config.trove-app [size=[7 8] titlebar-border=%.n show-titlebar=%.y] - :: :_ this(state u.old) - :: :: add two new app entries for Realm's new "native" apps: %trove and %lexicon - :: :~ [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-lexicon lexicon-app]])] - :: [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-trove trove-app]])] - :: == + ?^ old :: `this(state u.old) + =| lexicon-app=native-app:store + =. title.lexicon-app 'Lexicon' + =. color.lexicon-app '#EEDFC9' + =. icon.lexicon-app 'AppIconLexicon' + =. config.lexicon-app [size=[3 7] titlebar-border=%.n show-titlebar=%.y] + =| trove-app=native-app:store + =. title.trove-app 'Trove' + =. color.trove-app '#DCDCDC' + =. icon.trove-app 'AppIconTrove' + =. config.trove-app [size=[7 8] titlebar-border=%.n show-titlebar=%.y] + =. catalog.u.old (~(del by catalog.u.old) %lexicon) + =. catalog.u.old (~(del by catalog.u.old) %trove) + :_ this(state u.old) + :: add two new app entries for Realm's new "native" apps: %trove and %lexicon + :~ ::[%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%delete-catalog-entry [%lexicon]]])] + [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-lexicon lexicon-app]])] + ::[%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%delete-catalog-entry [%trove]]])] + [%pass / %agent [our.bowl %bazaar] %poke bazaar-action+!>([%add-catalog-entry [%os-trove trove-app]])] + == %- (slog leaf+"nuking old %bazaar state" ~) :: temporarily doing this for making development easier =^ cards this on-init :_ this @@ -747,8 +751,10 @@ ++ delete-catalog-entry |= [=app-id:store] ^- (quip card _state) - =. catalog.state (~(del by catalog.state) app-id) - [~ state] + ?: (~(has by catalog.state) app-id) + =. catalog.state (~(del by catalog.state) app-id) + `state + `state :: :: :: $add-catalog-entry