Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications #95

Draft
wants to merge 46 commits into
base: pre-beta
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0a35237
Draft /pro/notification
bonbud-macryg Jul 15, 2024
e6b0d3f
Draft /imp/notifications
bonbud-macryg Jul 15, 2024
6d3fad4
Draft imp/notification
bonbud-macryg Jul 16, 2024
dacf599
Draft notifications config and controller
bonbud-macryg Jul 18, 2024
eacd5e4
Draft notifications-config imp
bonbud-macryg Jul 18, 2024
ae2c95c
Get compiling
bonbud-macryg Jul 22, 2024
70adbfd
Error on unspecified stud
bonbud-macryg Jul 22, 2024
4704fdc
Check if config contains src pith
bonbud-macryg Jul 22, 2024
31909f5
Add packaged web-push library
bonbud-macryg Jul 23, 2024
09fa673
Add notification template
bonbud-macryg Jul 23, 2024
e280a34
Draft frontend code
bonbud-macryg Jul 23, 2024
574f63a
make txt, todos
bonbud-macryg Jul 23, 2024
dfc350e
Remove unnecessary ketcol
bonbud-macryg Jul 29, 2024
ccbb579
Fix notifications-config state
bonbud-macryg Jul 29, 2024
8cccfa7
Remove unnecessary tisfas
bonbud-macryg Jul 29, 2024
8ab95a6
Remove unnecessary com
bonbud-macryg Jul 29, 2024
e1e592d
Fix notifications-config init
bonbud-macryg Jul 29, 2024
ea63317
Parse and store json from push service
bonbud-macryg Jul 29, 2024
5b533ed
Clean up piths
bonbud-macryg Jul 29, 2024
a8f5b94
Add notifications to imp/home
bonbud-macryg Jul 29, 2024
58642e3
Dummy notifications from messenger
bonbud-macryg Jul 30, 2024
b826a58
Fix pith.not check, add ship.src.bowl check
bonbud-macryg Jul 30, 2024
5390897
Remove notif from message-sub
bonbud-macryg Jul 30, 2024
67d2676
Fill notifications with message text
bonbud-macryg Jul 30, 2024
1cf1e7f
Don't notify us about our own messages
bonbud-macryg Jul 30, 2024
13d7d6a
Add destination pith to pro/notification
bonbud-macryg Jul 31, 2024
c1a2235
Implement notification dst
bonbud-macryg Jul 31, 2024
068d06c
Add comment about json
bonbud-macryg Aug 1, 2024
e72d53b
Remove push notification stuff from sky-htmx
bonbud-macryg Aug 1, 2024
07e3676
Remove push JS files from backend
bonbud-macryg Aug 1, 2024
f561373
Remove push notifications stuff from Hoon
bonbud-macryg Aug 1, 2024
3dfcf3f
Remove notifications-config imp and pro
bonbud-macryg Aug 2, 2024
e24d7c1
New imp/notifications-config
bonbud-macryg Aug 2, 2024
6a2378a
Make notifications-config on init
bonbud-macryg Aug 2, 2024
6708f14
Add todo about checking piths
bonbud-macryg Aug 2, 2024
ef0b56d
Remove outdated import
bonbud-macryg Aug 2, 2024
09cae70
Draft frontend code
bonbud-macryg Jul 23, 2024
f3e4d29
Remove push notification stuff from sky-htmx
bonbud-macryg Aug 1, 2024
861dfad
Fix git conflicts
bonbud-macryg Aug 2, 2024
65a4413
Remove leftovers from git conflict
bonbud-macryg Aug 2, 2024
b65cc4c
Remove con/sky-htmx
bonbud-macryg Aug 9, 2024
bf5dbeb
Stub notification UI
bonbud-macryg Aug 14, 2024
362ece9
Comment out notifications in messenger
bonbud-macryg Aug 15, 2024
9717e8d
Build dependency on /notifications in sky
bonbud-macryg Aug 19, 2024
6968731
Remove %txt poke from notifications
bonbud-macryg Aug 19, 2024
d89a453
wip: rely on /notifications
bonbud-macryg Aug 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/arvo/app/neo.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,9 @@
=. run
(emit (do-card #/[p/our.bowl] %make %root ~ ~))
=. run
(emit (do-card #/[p/our.bowl]/sky %make %sky ~ ~))
(emit (do-card #/[p/our.bowl]/notifications %make %notifications ~ ~))
=. run
(emit (do-card #/[p/our.bowl]/sky %make %sky ~ (~(gas by *crew:neo) not/#/[p/our.bowl]/notifications ~)))
=. run
(emit (do-card #/[p/our.bowl]/srv/hawk %make %hawk-eyre ~ ~))
=. run
Expand Down
1 change: 1 addition & 0 deletions pkg/arvo/neo/cod/std/src/imp/home.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
[#/[p/our.bowl]/home/files %make %folder ~ ~]
[#/[p/our.bowl]/home/planner %make %planner ~ ~]
[#/[p/our.bowl]/home/messenger %make %messenger ~ ~]
[#/[p/our.bowl]/home/notifications %make %notifications ~ ~]
[#/[p/our.bowl]/home/landscape %make %iframe `iframe/!>('/apps/landscape') ~]
::
[#/[p/our.bowl]/home/docs %make %folder `folder/!>([%introduction %tutorials %guides ~]) ~]
Expand Down
78 changes: 73 additions & 5 deletions pkg/arvo/neo/cod/std/src/imp/mast-sky-ui.hoon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/@ ui-event
/@ txt
/@ order
/@ notification
/- serv=sky-server
^- kook:neo
=<
Expand Down Expand Up @@ -335,11 +336,78 @@
==
==
++ notifications
;div.fc.g2(slot "notifications")
;div.p3.br1.bd1: first
;div.p3.br1.bd1: second
;div.p3.br1.bd1: third
==
:: ;div.fc.g2(slot "notifications")
:: ;div.p3.br1.bd1: first
:: ;div.p3.br1.bd1: second
:: ;div.p3.br1.bd1: third
:: ==
(nots-to-manx nots)
::
++ flagged-not
:* flag=%.y
time=~2000.1.1
src=#/[p/~bud]/home/messages/dms/[p/~fun]
dst=#/[p/~bud]/home/messages/dms/[p/~fun]
cord='Unread notification.'
==
::
++ unflagged-not
:* flag=%.n
time=~1969.12.31
src=#/[p/~bud]/home/messages/dms/[p/~fun]
dst=#/[p/~bud]/home/messages/dms/[p/~fun]
cord='Read notification.'
==
::
++ nots
:~ flagged-not
flagged-not
unflagged-not
==
::
++ not-to-manx
|= not=notification
^- manx
;div.bd1.br2.p0.tl.ma.mt1
;div.fr.g1.p0.wf
;div.p0(style "width: 30%")
;img@"https://ewr1.vultrobjects.com/urbit/hastuc-dibtux/2024.4.30..2.37.9..bae1.47ae.147a.e147-IMG_5592.jpeg"(style "margin: 0px; object-fit: cover; border-radius: 6px;");
==
;div.p1(style "width: 70%")
;div.fr.jb
;div.s-1
=title "{<(format-src src.not)>}"
; ship/desk
==
;div.s-1
; {<time.not>}
==
==
; {(trip cord.not)}
==
==
==
::
++ nots-to-manx
|= nots=(list notification)
^- manx
;div(slot "notifications")
;*
%+ turn
nots
|= not=notification
^- manx
(not-to-manx not)
==
++ format-src
|= =pith
^- path
?. =(%p (head (head pith)))
(pout pith)
(pout (tail pith))
::
:: XX format time.not
::
++ lift
|= in=manx
^- manx
Expand Down
1 change: 1 addition & 0 deletions pkg/arvo/neo/cod/std/src/imp/message-sub.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
?> =(%rely stud)
:_ state
=+ !<([=term =leaf:neo] vax)
::
:: only get new kids
%+ murn ~(tap of:neo q:(~(got by deps.bowl) %pub))
|= [=pith:neo =idea:neo]
Expand Down
33 changes: 32 additions & 1 deletion pkg/arvo/neo/cod/std/src/imp/message.hoon
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
~
/@ message
^- kook:neo
|%
++ state [%pro %message]
++ poke (sy %sig ~)
++ kids *kids:neo
++ deps *deps:neo
++ form
^- form:neo
|_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase]
+* state !<(message state-vase)
++ init
|= old=(unit pail:neo)
^- (quip card:neo pail:neo)
?~ old
~| "No message contents for {<here.bowl>}"
!!
=/ new-message
!<(message q:(need old))
:_ [%message !>(new-message)]
~
:: ?: =(our.bowl from.new-message)
:: ~
:: :~ :- #/[p/our.bowl]/notifications
:: [%poke [%notification !>([%.y now.bowl here.bowl here.bowl contents.new-message])]]
:: ==
++ poke
|= [=stud:neo vaz=vase]
^- (quip card:neo pail:neo)
[~ [%message !>(state)]]
--
--
33 changes: 33 additions & 0 deletions pkg/arvo/neo/cod/std/src/imp/notification.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/@ flag
/@ notification
^- kook:neo
|%
++ state
^- curb:neo
[%pro %notification]
++ poke
^- (set stud:neo)
(sy %flag ~)
++ kids
*kids:neo
++ deps
*deps:neo
++ form
^- form:neo
|_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase]
+* state !<(notification state-vase)
++ init
|= old=(unit pail:neo)
^- (quip card:neo pail:neo)
?^ old
[~ u.old]
~| "notification: no notification provided"
!!
++ poke
|= [=stud:neo vaz=vase]
^- (quip card:neo pail:neo)
?> =(stud %flag)
?> =(our.bowl ship.src.bowl)
[~ [%notification !>([!<(flag vaz) time.state src.state dst.state cord.state])]]
--
--
31 changes: 31 additions & 0 deletions pkg/arvo/neo/cod/std/src/imp/notifications-config.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
^- kook:neo
|%
++ state [%pro %sig]
++ poke (sy %sig ~)
++ kids
^- kids:neo
%- some
:- %y
%- ~(gas by *lads:neo)
:~ :- [[%.y %buzz] [%.n %tas] %.y]
[[%pro %sig] ~]
:- [[%.y %mute] [%.n %tas] %.y]
[[%pro %sig] ~]
:- [[%.y %kill] [%.n %tas] %.y]
[[%pro %sig] ~]
==
++ deps
*deps:neo
++ form
^- form:neo
|_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase]
++ init
|= old=(unit pail:neo)
^- (quip card:neo pail:neo)
[~ [%sig !>(~)]]
++ poke
|= [=stud:neo vaz=vase]
^- (quip card:neo pail:neo)
[~ [%sig !>(~)]]
--
--
104 changes: 104 additions & 0 deletions pkg/arvo/neo/cod/std/src/imp/notifications.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/@ notification
/@ notifications-controller
^- kook:neo
=>
::
:: helper core
|%
++ has-pith-in
|= [piths=(set pith) query=pith]
^- ?
%- ~(any in piths)
|= =pith
^- ?
=(query (scag (lent query) pith))
--
::
:: main core
|%
++ state
^- curb:neo
[%pro %notifications-controller]
::
++ poke
^- (set stud:neo)
(sy %notification ~)
::
++ kids
^- kids:neo
%- some
:- %z
%- ~(gas by *lads:neo)
:~ :- [[%.y %notification] [%.n %da] %.n]
[[%pro %notification] ~]
:- [[%.y %config] [%.n %tas] %.n]
[[%pro %sig] ~]
==
::
++ deps
*deps:neo
::
++ form
^- form:neo
|_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase]
+* state !<(notifications-controller state-vase)
++ init
|= old=(unit pail:neo)
^- (quip card:neo pail:neo)
?^ old
[~ u.old]
:_ [%notifications-controller !>(|=(notification #/config/default))]
:~ :- (welp here.bowl ~[%config %default])
[%make %notifications-config `[%sig !>(~)] ~]
==
::
++ poke
|= [=stud:neo vaz=vase]
^- (quip card:neo pail:neo)
?> =(ship.src.bowl our.bowl)
?+ stud
!!
%notifications-controller
[~ [%notifications-controller vaz]]
::
%notification
=/ not !<(notification vaz)
?< =('' cord.not)
?< (gth time.not now.bowl)
:: XX should cut head off path more intelligently
:: "if head is our.bowl, remove head"
?> =(pith.src.bowl (tail src.not))
~& >> (state not)
~& >> ~(tar of:neo kids.bowl)
~& >> (~(get by ~(tar of:neo kids.bowl)) (state not))
~& >> (~(kids of:neo kids.bowl) #/config/default)
:: =/ config
:: !< notifications-config
:: q.pail:(need (~(get by ~(tar of:neo kids.bowl)) (state not)))
:: :_ [%notifications-controller !>(state)]
:: ?: (has-pith-in kill.config src.not)
:: ~
:: ?: (has-pith-in mute.config src.not)
:: =. flag.not %.y
:: :~ :- (welp here.bowl ~[[da/now.bowl]])
:: [%make %notification `[%notification !>(not)] ~]
:: ==
:: ?: (has-pith-in buzz.config src.not)
:: =. flag.not %.y
:: :~ :- (welp here.bowl ~[[da/now.bowl]])
:: [%make %notification `[%notification !>(not)] ~]
:: :: XX send push notifications to subscribers
:: ==
:_ [%notifications-controller !>(state)]
?. flag.not
=. flag.not %.y
:~ :- (welp here.bowl ~[[da/now.bowl]])
[%make %notification `[%notification !>(not)] ~]
==
:~ :- (welp here.bowl ~[[da/now.bowl]])
[%make %notification `[%notification !>(not)] ~]
:: XX send push notifications to subscribers
==
==
--
--
31 changes: 29 additions & 2 deletions pkg/arvo/neo/cod/std/src/imp/sky.hoon
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/@ flag
/@ notification
/@ notifications-controller
/- serv=sky-server
/* feather
/* s-k-y
Expand All @@ -6,11 +9,20 @@
=<
|%
++ state pro/%sig
++ poke (sy %gift %bind-static-assets ~)
++ poke (sy %gift %rely %bind-static-assets ~)
++ kids
:+ ~ %z
schema.serv
++ deps *deps:neo
++ deps
%- ~(gas by *deps:neo)
:~ :- %not
:+ req=| [pro/%notifications-controller (sy %notification %notifications-controller ~)]
:+ ~ %z
%- ~(gas by *lads:neo)
:~ :- [&/%notification |/%da |]
[pro/%notification (sy %flag ~)]
==
==
++ form
^- form:neo
|_ [=bowl:neo =aeon:neo =pail:neo]
Expand All @@ -20,6 +32,21 @@
?+ stud ~|(bad-stud/stud !!)
%gift
[~ sig/!>(~)]
::
%rely
:_ sig/!>(~)
%+ murn
~(tap by ~(tar of:neo q:(~(got by deps.bowl) %not)))
|= [=pith:neo =idea:neo]
^- (unit card:neo)
?. =(%notification p.pail.idea)
~
=/ not !<(notification q.pail.idea)
~& >> not
~
:: %- some
:: :- (welp here.bowl #/notification/[da/time.not])
:: [%make %notification `pail.idea ~]
::
%bind-static-assets
:_ sig/!>(~)
Expand Down
3 changes: 3 additions & 0 deletions pkg/arvo/neo/cod/std/src/lib/sky-server.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
:: /strategy/~zod/... = (list pith)
:- [&/%strategy &] [pro/%order (sy %order ~)]
::
:: /notification/~2024.8.19..14.47.48..9228 = notification
:- [&/%notification |/%da |] [pro/%notification (sy %flag ~)]
::
==
::
:: backend
Expand Down
1 change: 1 addition & 0 deletions pkg/arvo/neo/cod/std/src/pro/flag.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
,?
2 changes: 1 addition & 1 deletion pkg/arvo/neo/cod/std/src/pro/json.hoon
Original file line number Diff line number Diff line change
@@ -1 +1 @@
json
,json
1 change: 1 addition & 0 deletions pkg/arvo/neo/cod/std/src/pro/notification.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
,[=flag =time src=pith dst=pith =cord]
2 changes: 2 additions & 0 deletions pkg/arvo/neo/cod/std/src/pro/notifications-controller.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/@ notification
$-(notification pith)