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:

224 lines (223 loc) 6.99 kB
import { EvanBCCService } from './bcc'; import { EvanCoreService } from './core'; import { EvanDescriptionService } from './description'; import { EvanModalService } from '../ui/modal'; import { EvanQueue } from './queue'; import { EvanRoutingService } from '../ui/routing'; import { EvanToastService } from '../ui/toast'; import { EvanTranslationService } from '../ui/translate'; import { QueueId } from './queue-utilities'; import { SingletonService } from '../singleton-service'; /**************************************************************************************************/ /** * Blockchain-core mailbox wrapper * * @class Injectable EvanMailboxService */ export declare class EvanMailboxService { private bcc; private core; private singleton; private definitionService; private queueService; private toastService; private translateService; private routingService; /** * indicator that mails are loading */ isLoadingMails: any; /** * last count of mail notifications */ lastNotificationMailCount: number; /** * maximum mails to get for received mails */ receivedMailLoadCount: number; /** * amount of received mails, that could not be decrypted */ invalidReceivedMailCount: number; /** * maximum mails to get for sent mails */ sentMailLoadCount: number; /** * amount of sent mails, that could not be decrypted */ invalidSentMailCount: number; /** * profile queue id, for saving sharing keys, .. */ updateProfileQueueId: QueueId; /** * all mail cache */ mails: object[]; /** * newly received mail count */ newMailCount: number; /** * all mails that were already viewed (cached into local storage) */ readMails: Array<string>; /** * received mail cache */ receivedMails: object[]; /** * queue id to handle mail sending */ sendMailQueueId: QueueId; /** * queue id to handle mail sending */ answerMailQueueId: QueueId; /** * send mail cache */ sentMails: object[]; /** * total received mail count */ totalReceivedMailCount: number; /** * total sent mail count */ totalSentMailCount: number; /** * make it standalone and load dependency services and load mails */ constructor(bcc: EvanBCCService, core: EvanCoreService, singleton: SingletonService, definitionService: EvanDescriptionService, queueService: EvanQueue, toastService: EvanToastService, translateService: EvanTranslationService, routingService: EvanRoutingService); /** * Check for new mails and set the newMails property to false / true when new mails incoming * * @return {Promise<void>} resolved when done */ checkNewMails(): Promise<void>; /** * Check read mails within localStorage cache and return them. * * returns: [ '0x00...', '0x100...' ] * * @return {Array<string>} readed mails from localStorage */ getReadMails(): Array<string>; /** * Get read mail count * * @return {number} count of read mails */ getReadMailsCount(): number; /** * Add a mail id to the mail read array within the localStorage * * @param {string} mailId mail id */ addReadMails(mailId: string): void; /** * Check for new mails and update the last read mail count */ syncLastReadCount(): Promise<void>; /** * Show a mail modal, to provide the user the possility to change the email * text before sending. * Usage: * await this.mailboxService * .showMailModal( * this.modalService, * '_dappcontacts.invitation-message', * '_dappcontacts.invitation-message-long', * '_dappcontacts.invitation-text.title', * '_dappcontacts.invitation-text.body', * ); * * @param {string} modalService modal service (must to be inclued, to * prevent recursive services) * @param {string} alertTitle title of the modal * @param {string} alertText sub text of the modal * @param {string} title title text of the mail * @param {string} body body text of the mail * @return {Promise<any>} adjusted mail result */ showMailModal(modalService: EvanModalService, alertTitle: string, alertText: string, title: string, body: string): Promise<any>; /** * Increase the mail count for a specific type * * @param {number} raise number to raise the mail count with * @param {string} type sent / received */ raiseMailLoadCount(raise: number, type: string): void; /** * Reset the current bunch of mails and starts at the beginning * * @return {Promise<void>} Resolved when done. */ resetMails(): Promise<{ receivedMails: object[]; sentMails: object[]; }>; /** * Load the mails for the current account. * * result: * { * receivedMails: [ this.getMail() ], * sentMails: [ ... ] * } * * @return {any} The mails. */ getMails(): Promise<{ receivedMails: object[]; sentMails: object[]; }>; /** * Get a mail with a mail id. * * usage: * { * "id": "0x00000000000000000000000000000000000000fa", * "content": { * "from": "0xe70dfbc43369DE771d357fA4a6559be2eF16772f", * "fromAlias": "Another user", * "title": "contact request", * "body": "hello,\n\ni want to add you as a contact.\n\nWith kind regards,\n\nAnother user", * "attachments": [ * { * "type": "commKey", * "key": "9430..." * } * ], * "sent": 1526626132635, * "to": "0xCCC..." * }, * "cryptoInfo": { * "originator": "0xd926...", * "keyLength": 256, * "algorithm": "aes-256-cbc" * } * * @param {string} mailId The mail identifier * @return {Promise<any>} return the mail */ getMail(mailId: string): Promise<any>; /** * Send an mail, using the queue. * * @param {string} mail mail object * @param {string} from account id from * @param {string} to to account id */ sendMail(mail: any, from: string, to: string): Promise<void>; /** * Send an mail answer, using the queue. * * @param {string} mail mail object * @param {string} from account id from * @param {string} to to account id */ sendAnswer(mail: any, from: string, to: string): Promise<void>; }