Add account object interface.
Add new vcard parser.
This commit is contained in:
@@ -5,7 +5,7 @@ import {environment} from '@src/environments/environment';
|
||||
import {first} from 'rxjs/operators';
|
||||
import {AccountIndex, MutableKeyStore, MutablePgpKeyStore, PGPSigner, Signer} from '@app/_helpers';
|
||||
import {ArgPair, Envelope, Syncable, User} from 'cic-client-meta';
|
||||
import {parse} from '@src/assets/js/parse-vcard';
|
||||
const vCard = require('vcard-parser');
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -16,6 +16,7 @@ export class UserService {
|
||||
signer: Signer = new PGPSigner(this.keystore);
|
||||
accountIndexQuery = new AccountIndex(environment.contractAddress);
|
||||
|
||||
accountsMeta = [];
|
||||
accounts: any = [];
|
||||
private accountsList = new BehaviorSubject<any>(this.accounts);
|
||||
accountsSubject = this.accountsList.asObservable();
|
||||
@@ -155,8 +156,10 @@ export class UserService {
|
||||
const accountAddresses = await this.accountIndexQuery.last(await this.accountIndexQuery.totalAccounts());
|
||||
for (const accountAddress of accountAddresses.slice(offset, offset + limit)) {
|
||||
this.getAccountDetailsFromMeta(await User.toKey(accountAddress)).pipe(first()).subscribe(res => {
|
||||
const accountInfo = Envelope.fromJSON(JSON.stringify(res)).unwrap().m.data;
|
||||
accountInfo.vcard = parse(atob(accountInfo.vcard));
|
||||
const account = Envelope.fromJSON(JSON.stringify(res)).unwrap();
|
||||
this.accountsMeta.push(account);
|
||||
const accountInfo = account.m.data;
|
||||
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
|
||||
this.accounts.push(accountInfo);
|
||||
this.accountsList.next(this.accounts);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user