mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 11:33:41 +03:00
Merge branch 'master' into lf/profile-overlay
This commit is contained in:
commit
f5d8a36df2
@ -19,7 +19,7 @@
|
|||||||
+$ state-zero [%0 state-base]
|
+$ state-zero [%0 state-base]
|
||||||
+$ state-one [%1 state-base]
|
+$ state-one [%1 state-base]
|
||||||
+$ state-base
|
+$ state-base
|
||||||
$: synced=(map path ship)
|
$: =synced
|
||||||
invite-created=_|
|
invite-created=_|
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
@ -77,6 +77,7 @@
|
|||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
?+ path (on-watch:def path)
|
?+ path (on-watch:def path)
|
||||||
[%contacts *] [(watch-contacts:cc t.path) this]
|
[%contacts *] [(watch-contacts:cc t.path) this]
|
||||||
|
[%synced *] [(watch-synced:cc t.path) this]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ on-agent
|
++ on-agent
|
||||||
@ -124,30 +125,29 @@
|
|||||||
++ poke-contact-action
|
++ poke-contact-action
|
||||||
|= act=contact-action
|
|= act=contact-action
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
|^
|
|
||||||
:_ state
|
:_ state
|
||||||
?+ -.act !!
|
?+ -.act !!
|
||||||
%edit (handle-contact-action path.act ship.act act)
|
%edit (handle-contact-action path.act ship.act act)
|
||||||
%add (handle-contact-action path.act ship.act act)
|
%add (handle-contact-action path.act ship.act act)
|
||||||
%remove (handle-contact-action path.act ship.act act)
|
%remove (handle-contact-action path.act ship.act act)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ handle-contact-action
|
++ handle-contact-action
|
||||||
|= [=path =ship act=contact-action]
|
|= [=path =ship act=contact-action]
|
||||||
^- (list card)
|
^- (list card)
|
||||||
:: local
|
:: local
|
||||||
?: (team:title our.bol src.bol)
|
?: (team:title our.bol src.bol)
|
||||||
=/ shp ?:(=(path /~/default) our.bol (~(got by synced) path))
|
?. (~(has by synced) path) ~
|
||||||
=/ appl ?:(=(shp our.bol) %contact-store %contact-hook)
|
=/ shp ?:(=(path /~/default) our.bol (~(got by synced) path))
|
||||||
[%pass / %agent [shp appl] %poke %contact-action !>(act)]~
|
=/ appl ?:(=(shp our.bol) %contact-store %contact-hook)
|
||||||
:: foreign
|
[%pass / %agent [shp appl] %poke %contact-action !>(act)]~
|
||||||
=/ shp (~(got by synced) path)
|
:: foreign
|
||||||
?. |(=(shp our.bol) =(src.bol ship)) ~
|
=/ shp (~(got by synced) path)
|
||||||
:: scry group to check if ship is a member
|
?. |(=(shp our.bol) =(src.bol ship)) ~
|
||||||
=/ =group (need (group-scry path))
|
:: scry group to check if ship is a member
|
||||||
?. (~(has in group) shp) ~
|
=/ =group (need (group-scry path))
|
||||||
[%pass / %agent [our.bol %contact-store] %poke %contact-action !>(act)]~
|
?. (~(has in group) shp) ~
|
||||||
--
|
[%pass / %agent [our.bol %contact-store] %poke %contact-action !>(act)]~
|
||||||
::
|
::
|
||||||
++ poke-hook-action
|
++ poke-hook-action
|
||||||
|= act=contact-hook-action
|
|= act=contact-hook-action
|
||||||
@ -160,7 +160,9 @@
|
|||||||
[~ state]
|
[~ state]
|
||||||
=. synced (~(put by synced) path.act our.bol)
|
=. synced (~(put by synced) path.act our.bol)
|
||||||
:_ state
|
:_ state
|
||||||
[%pass contact-path %agent [our.bol %contact-store] %watch contact-path]~
|
:~ [%pass contact-path %agent [our.bol %contact-store] %watch contact-path]
|
||||||
|
[%give %fact [/synced]~ %contact-hook-update !>([%initial synced])]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
%add-synced
|
%add-synced
|
||||||
?> (team:title our.bol src.bol)
|
?> (team:title our.bol src.bol)
|
||||||
@ -168,7 +170,9 @@
|
|||||||
=. synced (~(put by synced) path.act ship.act)
|
=. synced (~(put by synced) path.act ship.act)
|
||||||
=/ contact-path [%contacts path.act]
|
=/ contact-path [%contacts path.act]
|
||||||
:_ state
|
:_ state
|
||||||
[%pass contact-path %agent [ship.act %contact-hook] %watch contact-path]~
|
:~ [%pass contact-path %agent [ship.act %contact-hook] %watch contact-path]
|
||||||
|
[%give %fact [/synced]~ %contact-hook-update !>([%initial synced])]
|
||||||
|
==
|
||||||
::
|
::
|
||||||
%remove
|
%remove
|
||||||
=/ ship (~(get by synced) path.act)
|
=/ ship (~(get by synced) path.act)
|
||||||
@ -179,13 +183,20 @@
|
|||||||
%- zing
|
%- zing
|
||||||
:~ (pull-wire [%contacts path.act])
|
:~ (pull-wire [%contacts path.act])
|
||||||
[%give %kick ~[[%contacts path.act]] ~]~
|
[%give %kick ~[[%contacts path.act]] ~]~
|
||||||
|
[%give %fact [/synced]~ %contact-hook-update !>([%initial synced])]~
|
||||||
==
|
==
|
||||||
?. |(=(u.ship src.bol) (team:title our.bol src.bol))
|
?. |(=(u.ship src.bol) (team:title our.bol src.bol))
|
||||||
:: if neither ship = source or source = us, do nothing
|
:: if neither ship = source or source = us, do nothing
|
||||||
[~ state]
|
[~ state]
|
||||||
:: delete a foreign ship's path
|
:: delete a foreign ship's path
|
||||||
:- (pull-wire [%contacts path.act])
|
=/ cards
|
||||||
state(synced (~(del by synced) path.act))
|
(handle-contact-action path.act our.bol [%remove path.act our.bol])
|
||||||
|
:_ state(synced (~(del by synced) path.act))
|
||||||
|
%- zing
|
||||||
|
:~ (pull-wire [%contacts path.act])
|
||||||
|
[%give %fact [/synced]~ %contact-hook-update !>([%initial synced])]~
|
||||||
|
cards
|
||||||
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ watch-contacts
|
++ watch-contacts
|
||||||
@ -197,10 +208,13 @@
|
|||||||
=/ =group (need (group-scry pax))
|
=/ =group (need (group-scry pax))
|
||||||
?> (~(has in group) src.bol)
|
?> (~(has in group) src.bol)
|
||||||
=/ contacts (need (contacts-scry pax))
|
=/ contacts (need (contacts-scry pax))
|
||||||
:~ :*
|
[%give %fact ~ %contact-update !>([%contacts pax contacts])]~
|
||||||
%give %fact ~ %contact-update
|
::
|
||||||
!>([%contacts pax contacts])
|
++ watch-synced
|
||||||
== ==
|
|= pax=path
|
||||||
|
^- (list card)
|
||||||
|
?> (team:title our.bol src.bol)
|
||||||
|
[%give %fact ~ %contact-hook-update !>([%initial synced])]~
|
||||||
::
|
::
|
||||||
++ watch-ack
|
++ watch-ack
|
||||||
|= [wir=wire saw=(unit tang)]
|
|= [wir=wire saw=(unit tang)]
|
||||||
@ -308,13 +322,15 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
%add
|
%add
|
||||||
=/ owner (~(got by synced) path.fact)
|
=/ owner (~(get by synced) path.fact)
|
||||||
?> |(=(owner src.bol) =(src.bol ship.fact))
|
?~ owner ~
|
||||||
|
?> |(=(u.owner src.bol) =(src.bol ship.fact))
|
||||||
~[(contact-poke [%add path.fact ship.fact contact.fact])]
|
~[(contact-poke [%add path.fact ship.fact contact.fact])]
|
||||||
::
|
::
|
||||||
%remove
|
%remove
|
||||||
=/ owner (~(got by synced) path.fact)
|
=/ owner (~(get by synced) path.fact)
|
||||||
?> |(=(owner src.bol) =(src.bol ship.fact))
|
?~ owner ~
|
||||||
|
?> |(=(u.owner src.bol) =(src.bol ship.fact))
|
||||||
%+ welp
|
%+ welp
|
||||||
:~ (group-poke [%remove [ship.fact ~ ~] path.fact])
|
:~ (group-poke [%remove [ship.fact ~ ~] path.fact])
|
||||||
(contact-poke [%remove path.fact ship.fact])
|
(contact-poke [%remove path.fact ship.fact])
|
||||||
@ -353,7 +369,8 @@
|
|||||||
|= =path
|
|= =path
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
?. (~(has by synced) path)
|
?. (~(has by synced) path)
|
||||||
[~ state]
|
:_ state
|
||||||
|
[(contact-poke [%delete path])]~
|
||||||
:_ state(synced (~(del by synced) path))
|
:_ state(synced (~(del by synced) path))
|
||||||
:~ [%pass [%contacts path] %agent [our.bol %contact-store] %leave ~]
|
:~ [%pass [%contacts path] %agent [our.bol %contact-store] %leave ~]
|
||||||
[(contact-poke [%delete path])]
|
[(contact-poke [%delete path])]
|
||||||
|
@ -142,7 +142,7 @@
|
|||||||
|= [=path =ship]
|
|= [=path =ship]
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
=/ contacts (~(got by rolodex) path)
|
=/ contacts (~(got by rolodex) path)
|
||||||
?> (~(has by contacts) ship)
|
?. (~(has by contacts) ship) [~ state]
|
||||||
=. contacts (~(del by contacts) ship)
|
=. contacts (~(del by contacts) ship)
|
||||||
:- (send-diff path [%remove path ship])
|
:- (send-diff path [%remove path ship])
|
||||||
state(rolodex (~(put by rolodex) path contacts))
|
state(rolodex (~(put by rolodex) path contacts))
|
||||||
|
@ -147,9 +147,9 @@
|
|||||||
::
|
::
|
||||||
%delete
|
%delete
|
||||||
%+ weld
|
%+ weld
|
||||||
:~ (group-poke [%unbundle path.act])
|
:~ (contact-hook-poke [%remove path.act])
|
||||||
|
(group-poke [%unbundle path.act])
|
||||||
(contact-poke [%delete path.act])
|
(contact-poke [%delete path.act])
|
||||||
(contact-hook-poke [%remove path.act])
|
|
||||||
==
|
==
|
||||||
(delete-metadata path.act)
|
(delete-metadata path.act)
|
||||||
::
|
::
|
||||||
|
@ -38,18 +38,12 @@
|
|||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
=/ old !<(state-zero vase)
|
=/ old !<(state-zero vase)
|
||||||
:_ this(state old)
|
:_ this(state old)
|
||||||
%+ murn
|
%+ murn ~(tap by synced.old)
|
||||||
~(tap by synced.old)
|
|
||||||
|= [=path =ship]
|
|= [=path =ship]
|
||||||
^- (unit card)
|
^- (unit card)
|
||||||
=/ =wire
|
=/ =wire [(scot %p ship) %group path]
|
||||||
[(scot %p ship) %group path]
|
=/ =term ?:(=(our.bowl ship) %group-store %group-hook)
|
||||||
=/ =term
|
?: (~(has by wex.bowl) [wire ship term]) ~
|
||||||
?: =(our.bowl ship)
|
|
||||||
%group-store
|
|
||||||
%group-hook
|
|
||||||
?: (~(has by wex.bowl) [wire ship term])
|
|
||||||
~
|
|
||||||
`[%pass wire %agent [ship term] %watch [%group path]]
|
`[%pass wire %agent [ship term] %watch [%group path]]
|
||||||
::
|
::
|
||||||
++ on-leave on-leave:def
|
++ on-leave on-leave:def
|
||||||
@ -173,10 +167,9 @@
|
|||||||
%remove [(update-subscribers [%group pax.diff] diff) state]
|
%remove [(update-subscribers [%group pax.diff] diff) state]
|
||||||
::
|
::
|
||||||
%unbundle
|
%unbundle
|
||||||
:_ state(synced (~(del by synced.state) pax.diff))
|
=/ ship (~(get by synced.state) pax.diff)
|
||||||
%+ snoc
|
?~ ship [~ state]
|
||||||
(update-subscribers [%group pax.diff] diff)
|
(poke-group-hook-action [%remove pax.diff])
|
||||||
[%give %kick [%group pax.diff]~ ~]
|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ handle-foreign
|
++ handle-foreign
|
||||||
@ -185,7 +178,6 @@
|
|||||||
?- -.diff
|
?- -.diff
|
||||||
%keys [~ state]
|
%keys [~ state]
|
||||||
%bundle [~ state]
|
%bundle [~ state]
|
||||||
::
|
|
||||||
%path
|
%path
|
||||||
:_ state
|
:_ state
|
||||||
?~ pax.diff ~
|
?~ pax.diff ~
|
||||||
@ -219,23 +211,24 @@
|
|||||||
[(group-poke pax.diff diff)]~
|
[(group-poke pax.diff diff)]~
|
||||||
::
|
::
|
||||||
%remove
|
%remove
|
||||||
:_ state
|
?~ pax.diff [~ state]
|
||||||
?~ pax.diff ~
|
|
||||||
=/ ship (~(get by synced.state) pax.diff)
|
=/ ship (~(get by synced.state) pax.diff)
|
||||||
?~ ship ~
|
?~ ship [~ state]
|
||||||
?. =(src.bol u.ship) ~
|
?. =(src.bol u.ship) [~ state]
|
||||||
[(group-poke pax.diff diff)]~
|
?. (~(has in members.diff) our.bol) [~ state]
|
||||||
|
=/ changes (poke-group-hook-action [%remove pax.diff])
|
||||||
|
:_ +.changes
|
||||||
|
%+ welp -.changes
|
||||||
|
:~ (group-poke pax.diff diff)
|
||||||
|
(group-poke pax.diff [%unbundle pax.diff])
|
||||||
|
==
|
||||||
::
|
::
|
||||||
%unbundle
|
%unbundle
|
||||||
?~ pax.diff
|
?~ pax.diff [~ state]
|
||||||
[~ state]
|
|
||||||
=/ ship (~(get by synced.state) pax.diff)
|
=/ ship (~(get by synced.state) pax.diff)
|
||||||
?~ ship
|
?~ ship [~ state]
|
||||||
[~ state]
|
?. =(src.bol u.ship) [~ state]
|
||||||
?. =(src.bol u.ship)
|
(poke-group-hook-action [%remove pax.diff])
|
||||||
[~ state]
|
|
||||||
:_ state(synced (~(del by synced.state) pax.diff))
|
|
||||||
[(group-poke pax.diff diff)]~
|
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ group-poke
|
++ group-poke
|
||||||
@ -262,5 +255,4 @@
|
|||||||
?: =(u.shp our.bol)
|
?: =(u.shp our.bol)
|
||||||
[%pass wir %agent [our.bol %group-store] %leave ~]~
|
[%pass wir %agent [our.bol %group-store] %leave ~]~
|
||||||
[%pass wir %agent [u.shp %group-hook] %leave ~]~
|
[%pass wir %agent [u.shp %group-hook] %leave ~]~
|
||||||
::
|
|
||||||
--
|
--
|
||||||
|
@ -1,10 +1,21 @@
|
|||||||
/- *contact-view
|
/- *contact-view, *contact-hook
|
||||||
|%
|
|%
|
||||||
++ nu :: parse number as hex
|
++ nu :: parse number as hex
|
||||||
|= jon/json
|
|= jon/json
|
||||||
?> ?=({$s *} jon)
|
?> ?=({$s *} jon)
|
||||||
(rash p.jon hex)
|
(rash p.jon hex)
|
||||||
::
|
::
|
||||||
|
++ hook-update-to-json
|
||||||
|
|= upd=contact-hook-update
|
||||||
|
=, enjs:format
|
||||||
|
^- json
|
||||||
|
%+ frond %contact-hook-update
|
||||||
|
%- pairs
|
||||||
|
%+ turn ~(tap by synced.upd)
|
||||||
|
|= [pax=^path shp=^ship]
|
||||||
|
^- [cord json]
|
||||||
|
[(spat pax) s+(scot %p shp)]
|
||||||
|
::
|
||||||
++ rolodex-to-json
|
++ rolodex-to-json
|
||||||
|= rolo=rolodex
|
|= rolo=rolodex
|
||||||
=, enjs:format
|
=, enjs:format
|
||||||
|
13
pkg/arvo/mar/contact/hook-update.hoon
Normal file
13
pkg/arvo/mar/contact/hook-update.hoon
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/+ *contact-json
|
||||||
|
|_ upd=contact-hook-update
|
||||||
|
++ grow
|
||||||
|
|%
|
||||||
|
++ json (hook-update-to-json upd)
|
||||||
|
--
|
||||||
|
::
|
||||||
|
++ grab
|
||||||
|
|%
|
||||||
|
++ noun contact-hook-update
|
||||||
|
--
|
||||||
|
::
|
||||||
|
--
|
@ -12,4 +12,7 @@
|
|||||||
::
|
::
|
||||||
[%remove =path]
|
[%remove =path]
|
||||||
==
|
==
|
||||||
|
::
|
||||||
|
+$ synced (map path ship)
|
||||||
|
+$ contact-hook-update [%initial =synced]
|
||||||
--
|
--
|
||||||
|
@ -31,6 +31,7 @@ const MARKDOWN_CONFIG = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export class ChatInput extends Component {
|
export class ChatInput extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@ -116,6 +117,7 @@ export class ChatInput extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({ patpSearch: match[1].toLowerCase() });
|
this.setState({ patpSearch: match[1].toLowerCase() });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSearch() {
|
clearSearch() {
|
||||||
@ -314,7 +316,6 @@ export class ChatInput extends Component {
|
|||||||
searchTerm={this.state.patpSearch}
|
searchTerm={this.state.patpSearch}
|
||||||
cm={this.editor}
|
cm={this.editor}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className="fl"
|
className="fl"
|
||||||
style={{
|
style={{
|
||||||
|
@ -11,8 +11,7 @@ class UrbitApi {
|
|||||||
this.bindPaths = [];
|
this.bindPaths = [];
|
||||||
|
|
||||||
this.contactHook = {
|
this.contactHook = {
|
||||||
edit: this.contactEdit.bind(this),
|
edit: this.contactEdit.bind(this)
|
||||||
remove: this.contactRemove.bind(this)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.contactView = {
|
this.contactView = {
|
||||||
@ -108,14 +107,6 @@ class UrbitApi {
|
|||||||
return this.action("contact-hook", "contact-action", data);
|
return this.action("contact-hook", "contact-action", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
contactRemove(path, ship) {
|
|
||||||
return this.contactHookAction({
|
|
||||||
remove: {
|
|
||||||
path, ship
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
contactEdit(path, ship, editField) {
|
contactEdit(path, ship, editField) {
|
||||||
/* editField can be...
|
/* editField can be...
|
||||||
{nickname: ''}
|
{nickname: ''}
|
||||||
|
@ -317,7 +317,7 @@ export class ContactCard extends Component {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.setState({awaiting: true, type: "Removing from group"}, (() => {
|
this.setState({awaiting: true, type: "Removing from group"}, (() => {
|
||||||
api.contactHook.remove(props.path, `~${props.ship}`).then(() => {
|
api.contactView.delete(props.path).then(() => {
|
||||||
let destination = (props.ship === window.ship)
|
let destination = (props.ship === window.ship)
|
||||||
? "" : props.path;
|
? "" : props.path;
|
||||||
this.setState({awaiting: false});
|
this.setState({awaiting: false});
|
||||||
|
@ -9,14 +9,7 @@ import { LocalReducer } from '/reducers/local.js';
|
|||||||
|
|
||||||
class Store {
|
class Store {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.state = {
|
this.state = this.initialState();
|
||||||
contacts: {},
|
|
||||||
groups: {},
|
|
||||||
associations: {},
|
|
||||||
permissions: {},
|
|
||||||
invites: {},
|
|
||||||
selectedGroups: []
|
|
||||||
};
|
|
||||||
|
|
||||||
this.initialReducer = new InitialReducer();
|
this.initialReducer = new InitialReducer();
|
||||||
this.groupUpdateReducer = new GroupUpdateReducer();
|
this.groupUpdateReducer = new GroupUpdateReducer();
|
||||||
@ -28,6 +21,17 @@ class Store {
|
|||||||
this.setState = () => {};
|
this.setState = () => {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initialState() {
|
||||||
|
return {
|
||||||
|
contacts: {},
|
||||||
|
groups: {},
|
||||||
|
associations: {},
|
||||||
|
permissions: {},
|
||||||
|
invites: {},
|
||||||
|
selectedGroups: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
setStateHandler(setState) {
|
setStateHandler(setState) {
|
||||||
this.setState = setState;
|
this.setState = setState;
|
||||||
}
|
}
|
||||||
@ -35,6 +39,11 @@ class Store {
|
|||||||
handleEvent(data) {
|
handleEvent(data) {
|
||||||
let json = data.data;
|
let json = data.data;
|
||||||
|
|
||||||
|
if ('clear' in json && json.clear) {
|
||||||
|
this.setState(this.initialState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.log(json);
|
console.log(json);
|
||||||
this.initialReducer.reduce(json, this.state);
|
this.initialReducer.reduce(json, this.state);
|
||||||
this.groupUpdateReducer.reduce(json, this.state);
|
this.groupUpdateReducer.reduce(json, this.state);
|
||||||
|
@ -5,48 +5,63 @@ import urbitOb from 'urbit-ob';
|
|||||||
|
|
||||||
|
|
||||||
export class Subscription {
|
export class Subscription {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.firstRoundSubscriptionComplete = false;
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if (api.authTokens) {
|
if (api.authTokens) {
|
||||||
this.initializeContacts();
|
this.firstRoundSubscription();
|
||||||
|
window.urb.setOnChannelError(this.onChannelError.bind(this));
|
||||||
} else {
|
} else {
|
||||||
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
|
console.error("~~~ ERROR: Must set api.authTokens before operation ~~~");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeContacts() {
|
onChannelError(err) {
|
||||||
api.bind('/primary', 'PUT', api.authTokens.ship, 'contact-view',
|
console.error('event source error: ', err);
|
||||||
|
console.log('initiating new channel');
|
||||||
|
this.firstRoundSubscriptionComplete = false;
|
||||||
|
setTimeout(2000, () => {
|
||||||
|
store.handleEvent({
|
||||||
|
data: { clear : true}
|
||||||
|
});
|
||||||
|
this.start();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe(path, app) {
|
||||||
|
api.bind(path, 'PUT', api.authTokens.ship, app,
|
||||||
this.handleEvent.bind(this),
|
this.handleEvent.bind(this),
|
||||||
this.handleError.bind(this),
|
(err) => {
|
||||||
this.handleQuitAndResubscribe.bind(this));
|
console.log(err);
|
||||||
api.bind('/primary', 'PUT', api.authTokens.ship, 'invite-view',
|
this.subscribe(path, app);
|
||||||
this.handleEvent.bind(this),
|
},
|
||||||
this.handleError.bind(this),
|
() => {
|
||||||
this.handleQuitAndResubscribe.bind(this));
|
this.subscribe(path, app);
|
||||||
api.bind('/all', 'PUT', api.authTokens.ship, 'group-store',
|
});
|
||||||
this.handleEvent.bind(this),
|
}
|
||||||
this.handleError.bind(this),
|
|
||||||
this.handleQuitAndResubscribe.bind(this));
|
firstRoundSubscription() {
|
||||||
api.bind('/all', 'PUT', api.authTokens.ship, 'metadata-store',
|
this.subscribe('/primary', 'contact-view');
|
||||||
this.handleEvent.bind(this),
|
}
|
||||||
this.handleError.bind(this),
|
|
||||||
this.handleQuitAndResubscribe.bind(this));
|
secondRoundSubscriptions() {
|
||||||
|
this.subscribe('/synced', 'contact-hook');
|
||||||
|
this.subscribe('/primary', 'invite-view');
|
||||||
|
this.subscribe('/all', 'group-store');
|
||||||
|
this.subscribe('/all', 'metadata-store');
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEvent(diff) {
|
handleEvent(diff) {
|
||||||
|
if (!this.firstRoundSubscriptionComplete) {
|
||||||
|
this.firstRoundSubscriptionComplete = true;
|
||||||
|
this.secondRoundSubscriptions();
|
||||||
|
}
|
||||||
store.handleEvent(diff);
|
store.handleEvent(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleQuitSilently(quit) {
|
|
||||||
// no-op
|
|
||||||
}
|
|
||||||
|
|
||||||
handleQuitAndResubscribe(quit) {
|
|
||||||
// TODO: resubscribe
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export let subscription = new Subscription();
|
export let subscription = new Subscription();
|
||||||
|
@ -242,7 +242,7 @@ a {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.md h1, .md h2, .md h3, .md h4, .md h5, .md p, .md a, .md ul, .md blockquote,.md code,.md pre {
|
.md h1, .md h2, .md h3, .md h4, .md h5, .md p, .md a, .md ul, .md ol, .md blockquote,.md code,.md pre {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ a {
|
|||||||
.md code, .md pre {
|
.md code, .md pre {
|
||||||
font-family: "Source Code Pro", mono;
|
font-family: "Source Code Pro", mono;
|
||||||
}
|
}
|
||||||
.md ul>li {
|
.md ul>li, .md ol>li {
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
.md a {
|
.md a {
|
||||||
|
Loading…
Reference in New Issue
Block a user