UNPKG

@evan.network/ui-angular-core

Version:

The angular-core operates as an global and central library for the evan.network Angular 5 frontend development. Using this project you will be able to to the following things:

159 lines (158 loc) 5.69 kB
import { SingletonService } from '../singleton-service'; import { EvanCoreService } from './core'; import { EvanBCCService } from './bcc'; import { EvanQueue } from './queue'; import { QueueId } from './queue-utilities'; import { EvanTranslationService } from '../ui/translate'; import { EvanDescriptionService } from './description'; import { EvanUtilService } from '../utils'; /**************************************************************************************************/ /** * Blockchain-core wrapper service to handle users favorites. * * @class Injectable EvanBookmarkService */ export declare class EvanBookmarkService { private bcc; private core; private descriptionService; private queue; private singleton; private translate; private utils; /** * queue id for handling favorite saving */ queueId: QueueId; /** * make it standalone and load dependency services */ constructor(bcc: EvanBCCService, core: EvanCoreService, descriptionService: EvanDescriptionService, queue: EvanQueue, singleton: SingletonService, translate: EvanTranslationService, utils: EvanUtilService); /** * Queue a new bookmark add process. * * Usage: * const dapp = await this.bookmarkService.getBookmarkDefinition(ensAddress) * await this * .alertService.showSubmitAlert( * '_dappdapps.alert.validTitle', * { * key: '_dappdapps.alert.dappMessage', * translateOptions: dapp * }, * 'cancel', * 'submit' * ); * this.bookmarkService.queueAddBookmark(ensAddress, dapp)) * * @param {string} ensAddress ens address that should be added * @param {any} dapp dapp ens description */ queueAddBookmark(ensAddress: string, dapp: any): Promise<void>; /** * Queue a new bookmark removal process. * * Usage: * this.bookmarkService.queueRemoveBookmark('**.evan') * * @param {string} ensAddress ens address that should be remove */ queueRemoveBookmark(ensAddress: string): Promise<void>; /** * Add DApp bookmark to the current profile. * * Usage: Have a look at this.queueAddBookmark * * @param {string} ensAddress ens address that should be added * @param {any} dapp dapp ens definition * @return {Promise<void>} resolved when done */ addDAppBookmark(ensAddress: string, dapp: any): Promise<void>; /** * Remove bookmark from current account. * * @param {string} ensAddress ens address that should be removed * from the current account * @return {Promise<void>} resolved when done */ removeDappBookmark(ensAddress: string): Promise<void>; /** * Overwrite current bookmarks to the profile and write them to the * blockchain. * * @return {Promise<void>} resolved when done */ syncQueueBookmarks(): Promise<void>; /** * Reload profile data and return current bookmarked dapps. * * returns: * { * ... * "taskboard.evan": { * "name": "taskboard", * "description": "Create todos and manage updates.", * "i18n": { * "description": { * "de": "Erstelle Aufgaben und überwache Änderungen", * "en": "Create todos and manage updates" * }, * "name": { * "de": "Task Board", * "en": "Task Board" * } * }, * "imgSquare": "...", * "standalone": true, * "primaryColor": "#e87e23", * "secondaryColor": "#fffaf5", * "translated": { * "description": "Create todos and manage updates", * "name": "Task Board" * } * } * } * * @param {boolean} reload Force reload of current profile * and so reload the bookmarks. * @return {Promise<Array<any>>} bookmarks for the current user */ getDAppBookmarks(reload?: boolean): Promise<Array<any>>; /** * Clear bookmarks of current profile. * * @return {Promise<void>} resolved when done */ clearBookmarks(): Promise<void>; /** * Checks if the bookmark is already added the current profile bookmarks. * * @param {any} bookmark Bookmark ENS definition * @return {Promise<void>} resolved when done */ private setAlreadyAddedToBookmark; /** * Transform ENS definition to bookmark definition. * * @param {any} definition ENS definition to parse * @return {any} The bookmark from definition. */ getBookmarkFromDefinition(definition: any): any; /** * Loads an definition and checks the "already_added" state. * * result: have a look at getBookmarkFromDefinition * * @param {string} ensAddress ENS addres to load the definition from * @return {Promise<any>} The bookmark definition. */ getBookmarkDefinition(ensAddress: string): Promise<any>; /** * Loads multiple definitions and checks the "already_added" state. * * @param {string} ensAddresses ENS addresses to load the definition * from * @return {any} The bookmark definitions. */ getBookmarkDefinitions(ensAddresses: Array<string>): Promise<any>; }