1.0.1 • Published 11 months ago

nixa-feedback-module v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

nixa-feedback-module

The dependencies used by the latest version are the same as needed for Ionic 7.0.5. For older versions use:

nixa-feedback-moduleIonicAngular
1.0.0>= 7.0.5^16.0.0

The module is thought as an easy to integrate solution for sending feedback. Typically, the user shakes her device, a popup opens, the user can enter what went wrong, and finally the report is sent, including some additional information like screenshot, logs, app and device info.

The report is sent to a web service, which can do anything with the data, e.g. forward by mail to the developer, store it in a database, ...

Usage

npm package

npm install nixa-feedback-module --save

Cordova plugins

Additionally, you will need some Cordova plugins:

import module

In your app.module.ts, you have to import the module:

import { FeedbackModule } from "nixa-feedback-module";

@NgModule({
  ...
  imports: [
    FeedbackModule,
    ...
  ],

registering for Shake events

In your app.component.ts, you have to inject 2 components into your constructor:

  • FeedbackService: processes the shake
  • FeedbackViewerModalService: shows a modal in case of a shake event
import { FeedbackService, FeedbackViewerModalService } from "nixa-feedback-module";

constructor(
  platform: Platform,
  feedbackService: FeedbackService,
  private feedbackViewerModalService: FeedbackViewerModalService) {

  platform.ready().then(() => {
    feedbackService.shaken.subscribe(() => {
      this.feedbackViewerModalService.openModal();
    });
    feedbackService.startWatchForShake();
  });
}

Configuration

It is recommended to place the configuration in environment.ts:

export const environment = {
  feedback: {
    ...
  }
}

Just call `configure' before registering for shake events:

feedbackService.configure(environment.feedback);

Its structure is defined in the interface FeedbackConfiguration:

  • isEnabled: the shaken event is fired only if this is set to true
  • appKey: app key used for authorization with the backend (see below)
  • appSecret: app secret used for authorization with the backend (see below)
  • url: url of the backend (see below)
  • language: language used for the modal; see "multi language support"
  • translation: custom language used for the modal; see "multi language support"
  • categories: array of categories shown in the modal; could be something like error, improvement, smile, frown, ...
  • attachScreenshot: specifies, if a screenshot should be attached; valid values are Yes, No and Ask (ask the user if she wants to include it) this requires the Screenshot plugin
  • attachDeviceInfo: specifies, if device info should be attached; valid values are Yes, No and Ask (ask the user if she wants to include it) this requires the Device plugin
  • attachAppInfo: specifies, if app info should be attached; valid values are Yes, No and Ask (ask the user if she wants to include it) this requires the AppVersion plugin
  • attachLogMessages: specifies, if log messages should be attached; valid values are Yes, No and Ask (ask the user if she wants to include it)

Backend

For the backend, you need a service which can process the message with all provided infos.

multi language support

With language parameter in the configuration, you can use to select the language. Currently en and de are supported.

If you need another language, either open an issue, or just use the translation configuration. This parameter you can use to pass your completely own texts. Just fill the FeedbackViewerTranslation object.

1.0.1

11 months ago

1.0.0

12 months ago