šŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →
Socket
Book a DemoInstallSign in
Socket

instabug-cordova

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

instabug-cordova

The purpose of this plugin is to simplify the process of integrating the Instabug SDK in a hybrid application, as well as to provide an interface to interfacing with the SDK through JavaScript.

1.0.0
Source
npm
Version published
Weekly downloads
56
-16.42%
Maintainers
1
Weekly downloads
Ā 
Created
Source

Cordova Instabug Plugin

The purpose of this plugin is to simplify the process of integrating the Instabug SDK in a hybrid application, as well as to provide an interface to interfacing with the SDK through JavaScript.

Supported Platforms

  • iOS (SDK >= ?)
  • Android (SDK >= 10)

Installation

Currently, this plugin can only be installed via the Command-Line Interface.

cordova plugin add https://github.com/Instabug/instabug-cordova

Usage

To initialize Instabug in your app, you only need to make one call to the plugin: activate. This method requires your app's token and your desired invocation event, and can take a wide range of optional parameters for configuration.

Your app's token (available on your Instabug dashboard online) can be specified as a string or an object containing properties according to platform:

var token = 'YOUR_TOKEN_HERE';

or

var tokens = {
  android: 'YOUR_ANDROID_TOKEN_HERE',
  ios: 'YOUR_IOS_TOKEN_HERE'
};

The invocation event can be specified as one of the following values:

valuenative equivalentdescriptioniOS only?
'shake'InstabugInvocationEvent.SHAKEShaking the device while in any screen to show the feedback form.
'button'InstabugInvocationEvent.FLOATING_BUTTONShows a floating button on top of all views, when pressed it takes a screenshot.
'screenshot'InstabugInvocationEvent.SCREENSHOT_GESTURETaking a screenshot using the Home+Lock buttons while in any screen to show the feedback form, substituted with IBGInvocationEventShake on iOS 6.1.3 and earlier.√
'swipe'InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFTSwiping two fingers left while in any screen to show the feedback form.√
'none'InstabugInvocationEvent.NONENo event will be registered to show the feedback form, you'll need to code your own and call the method invoke.
Like the token, the value itself can be provided, or you can give an object with values according to platforms using the same syntax as above.

The final parameter to the activate method (besides success and error callback functions) is an optional object containing properties to set a variety of configurations. None of these configurations are required. See the table below for their specifications.

propertydescriptionpossible valuesdefault valueAndroid?iOS?
emailRequiredSets whether email field is required or not when submitting bug/feedbacktrue, falsetrue√√
commentRequiredSets whether comment field is required or not when submitting bug/feedbacktrue, falsefalse√√
defaultInvocationModeSets which invocation mode should the SDK use by default when the invocation event occurs'bug','feedback', 'na''na'√√
shakingThresholdAndroidSets the threshold value of the shake gesture on the deviceString representation of int'11'√
shakingThresholdIPhoneSets the threshold value of the shake gesture on the deviceString representation of double'2.5'√
shakingThresholdIPadSets the threshold value of the shake gesture on the deviceString representation of double'0.6'√
floatingButtonEdgeSets the default edge at which the floating button will be shown'right', 'left''right'√√
floatingButtonOffsetSets the default offset of the floating button from the top of the screenString representation of integer'-1'√√
enableDebugEnable/Disable debug logs from Instabug SDKtrue, falsefalse√
enableConsoleLogsEnable/disable console log to be added to reportstrue, falsetrue√
enableInstabugLogsEnable/disable Instabug log to be added to reportstrue, falsetrue√
enableTrackingUserSteps*Enable/disable automatic user steps trackingtrue, falsetrue√√
enableCrashReporting*Enable/disable crash reportingtrue, falsetrue√√
enableInAppMessagingEnable/Disable in-app messagingtrue, falsetrue√
enableConversationSoundsSet whether new messages received will trigger a small sound notification or nottrue, falsefalse√
enablePushNotificationsEnable/disable push notifications featuretrue, falsetrue√√
enableIntroDialogEnable/disable intro dialog shown the first time app is openedtrue, falsetrue√√
enableUserDataEnable/disable user data to be added to reportstrue, falsetrue√
colorThemeSet which color theme to use for the SDK's UI'light', 'dark''light'√√
*Pro feature

Sample

The sample demonstrates how to initiate Instabug.

cordova.plugins.instabug.activate(
    {
        android: 'MY_ANDROID_TOKEN',
        ios: 'MY_IOS_TOKEN'
    },
    'shake',
    {
        commentRequired: true,
        colorTheme: 'dark',
        shakingThresholdIPhone: '1.5',
        shakingThresholdIPad: '0.6',
        enableIntroDialog: false
    },
    function () {
        console.log('Instabug initialized.');
    },
    function (error) {
        console.log('Instabug could not be initialized - ' + error);
    }
);

Other actions

After you've initialized Instabug, you can call a variety of other methods on the plugin object. Each of these methods takes success and error callback function parameters, specified after any parameters detailed in the table below. If a parameter is listed as optional and you do not wish to supply it, pass null instead, otherwise your callback functions won't run.

methoddescriptionparametersAndroid?iOS?
invokeShow the Instabug dialog so user can choose to report a bug, or submit feedbackoptional: 'bug', 'feedback', or 'na'√√
showIntro*Display the discovery dialog explaining the shake gesture or the two finger swipe gesturenone√√
setPrimaryColorSet the primary color that the SDK will use to tint certain UI elements in the SDKinteger representation of a color .√√
setUserEmail*If your app already acquires the user's email address and you provide it to this method, Instabug will pre-fill the user email in reportsemail address√√
setUserName*Sets the user name that is used in the dashboard's contactname√√
setUserData*Adds specific user data that you need to be added to the reportsany string√√
addFile*Uploads file along upcoming reportsPath to desired file on device - can't use path of file relative to your application files. Can be specified as a string or an object with properties by platform.√√
addLog*Appends a log message to Instabug internal log. These logs are then sent along the next uploaded report. All log messages are timestamped. Logs aren't cleared per single application run. If you wish to reset the logs, use clearLog(). Note: logs passed to this method are NOT printed to Logcat.any string√√
clearLogClears Instabug internal lognone√
changeInvocationEventChanges the event used to invoke Instabug SDK'shake', 'button', 'screenshot', 'swipe', or 'none' (see first table on page)√√
disableDisables all Instabug functionalitynone√
enableEnables all Instabug functionalitynone√
isEnabledReturns true if Instabug is enabled, false if it's disablednone√
isDebugEnabledReturns if Instabug SDK debug logs will be added to LogCat logs or notnone√
setLocaleSet the locale used to display the strings in the correct language'arabic', 'chineseSimplified', 'chineseTraditional', 'english', 'french', 'german', 'italian', 'japanese', 'korean', 'polish', 'portugueseBrazil', 'russian', 'spanish', 'swedish', or 'turkish'√
*Pro feature

Tips & tricks

  • You should initialize Instabug as soon as you can in your app. For Ionic users, the best place is in the run method of your module.
  • For Android, if you use other plugins that open dialogs (like InAppBrowser) that you will want included in your screenshots, you'll need to modify the plugin code itself to call Instabug.setDialog(Dialog dialog) when it is opened. See Instabug official documentation for more info on usage (or, you can always check out my InAppBrowser fork, which includes this functionality as well as other useful things like hiding an open browser).
  • The Instabug SDK also offers a reportException method that is not accessible through JavaScript but may be useful for adding these exceptions to your reports if you modify plugins to call it.

Contributing (please do!)

  • Fork this repo.
  • Create your own branch. (git checkout -b my-feature)
  • Commit your changes. (git commit -am 'Add my awesome feature')
  • Push to your branch. (git push origin my-feature)
  • Create new pull request.

License

This software is released under the Apache 2.0 License.

Ā© 2016 Instabug. All rights reserved.

FAQs

Package last updated on 09 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts