mirror of
https://github.com/block-core/blockcore-notes.git
synced 2024-09-29 22:40:44 +00:00
set metadata for loged in user
This commit is contained in:
parent
f19123c2cf
commit
ca31c46f00
@ -27,6 +27,7 @@ import { OptionsService } from './services/options';
|
||||
import { LabelService } from './services/label';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { BadgeService } from './services/badge';
|
||||
import { State } from './services/state';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -66,7 +67,8 @@ export class AppComponent {
|
||||
public ui: UIService,
|
||||
private bottomSheet: MatBottomSheet,
|
||||
public searchService: SearchService,
|
||||
public theme: ThemeService
|
||||
public theme: ThemeService,
|
||||
private state: State
|
||||
) {
|
||||
if (!this.visibilityHandler) {
|
||||
this.visibilityHandler = addEventListener('visibilitychange', (event) => {
|
||||
@ -96,7 +98,8 @@ export class AppComponent {
|
||||
}
|
||||
|
||||
this.authService.authInfo$.subscribe(async (auth) => {
|
||||
auth.publicKeyHex;
|
||||
this.state.pubkey = auth.publicKeyHex;
|
||||
|
||||
|
||||
this.authenticated = auth.authenticated();
|
||||
|
||||
|
@ -13,6 +13,9 @@ export class StateService {
|
||||
switch (event.kind) {
|
||||
case Kind.Metadata:
|
||||
this.addIfNewer(event, event.pubkey, this.state.events.metadata);
|
||||
if (this.state.pubkey == event.pubkey) {
|
||||
this.state.metadata = event;
|
||||
}
|
||||
break;
|
||||
case Kind.Text:
|
||||
this.addIfMissing(event, this.state.events.shortTextNote);
|
||||
@ -21,7 +24,8 @@ export class StateService {
|
||||
this.addIfNewer(event, event.pubkey, this.state.events.contacts);
|
||||
break;
|
||||
case Kind.Reaction:
|
||||
this.addIfNewer(event, event.content, this.state.events.reaction)
|
||||
this.addIfNewer(event, event.content, this.state.events.reaction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +60,10 @@ export class State {
|
||||
|
||||
circles: Circle[] = [];
|
||||
|
||||
metadata?: NostrEvent;
|
||||
|
||||
pubkey?: String;
|
||||
|
||||
events: EventsState = {
|
||||
metadata: new Map(),
|
||||
shortTextNote: new Map(),
|
||||
|
Loading…
Reference in New Issue
Block a user