EvanAlertService

Source alert

Ionic AlertController wrapper for easier usage.


showAlert

alertService.showAlert(title, message, buttons, inputs);

Ionic AlertController.create wrapper to handle translations of the form.

Parameters

  1. title - string|any: Title ‘title’ || { key: ‘title’, translateOptions: { } }
  2. message - string|any: Message ‘message’ || { key: ‘message’, translateOptions: { } }
  3. buttons - Array<any: Buttons that should be display
  4. inputs - Array<any>: Inputs that should be displayed

Returns

Alert: this.alertCtrl.create result

Example

For a bigger example view showSubmitAlert

await this
  .alertService.showAlert(
    '_dappdapps.alert.validTitle',
    {
      key: '_dappdapps.alert.dappMessage',
      translateOptions: dapp
    }
  );

showSubmitAlert

alertService.showSubmitAlert(arguments);

Function description

Parameters

  1. title - string|any: ‘title’ || { title: ‘’, translateOptions: { } }
  2. message - string|any: ‘message’ || { title: ‘’, translateOptions: { } }
  3. cancelText - string: ‘cancelText’ || { title: ‘’, translateOptions: { } }
  4. submitText - string: ‘submitText’ || { title: ‘’, translateOptions: { } }
  5. inputs - Array<any>: Inputs that should be displayed

Returns

Promise returns any: promise that is deployed on button reject / resolve

Example

await this
  .alertService.showSubmitAlert(
    '_dappdapps.alert.validTitle',
    {
      key: '_dappdapps.alert.dappMessage',
      translateOptions: dapp
    },
    'cancel',
    'submit'
  );

addDAppAlertStyle

alertService.addDAppAlertStyle(arguments);

Adds an temporary style to show a better looking alert using the definition colors and img.

Parameters

  1. DApp bookmark definition - any: DApp bookmark definition

Example

Reference Implementation: Favorites DApp

this.alertService.addDAppAlertStyle(this.dapps[dappKey]);

removeDAppAlertStyle

alertService.removeDAppAlertStyle(definition);

Remove an temporary style that was used for the DApp definition style.

Parameters

  1. definition - any: DApp bookmark definition

Example

Reference Implementation: Favorites DApp

alertService.removeDAppAlertStyle(definition);