Skip to content

Commit

Permalink
Merge pull request #1 from usabilla/release/v0.9.0
Browse files Browse the repository at this point in the history
v0.9.0
  • Loading branch information
andlie authored Nov 30, 2021
2 parents c2ab50c + ac0998f commit b81aeaf
Showing 1 changed file with 128 additions and 2 deletions.
130 changes: 128 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,128 @@
# usabilla-u4a-unity
Unity wrapper for Mobile SDK
# GetFeedback Mobile SDK Unity Wrapper

## Overview

Congratulations! You have build an application for Android or iOS using Unity, and You're ready to collect feedback from your users.

GetFeedbacks Unity Wrapper gives You the ability to collect feedback natively on Android or iOS. No extra code is needed to get the forms you've created displayed. GetFeedback handles all configuration and displaying across the different devices.

Drop the wrapper-code into your `assets` folder, add a few lines of code in your application, and start collecting.

## Key Topics
The following topics will be covered in this readme

* Installation
* Initialisation
* Show Feedback form
* Show Campaign / Send Event
* Callback from SDK
* Customize Campaign Banner

## Installation

Get the [latest code]([email protected]:usabilla/usabilla-u4a-unity.git) from our github repository. Unpack the zip file into your Unity project `Assets/Plugins` folder. Take care not to overwrite any other files

If Your application targets iOS, open the `Usabilla.framework.meta` file (auto-generated by Unity), and change the `AddToEmbeddedBinaries: false` to `AddToEmbeddedBinaries: true`. This ensures that the framework will be added correct in the iOS application.

## Initialisation
To proper set up the GetFeedback SDK, call `GetFeedback.Bridge.initialize("<YOUR APP ID>>")`. This MUST be done before any campaign can be displayed.
Your App ID is created when You create Your Campaign on the GetFeedback website

## Show Feedback form
To show a FeedBack form, call `GetFeedback.Bridge.showFeedback("<FORM ID>")`. This will display the form, covering the current UI.
NOTE: The SDK doesn't pause any threads or code. If it is needed to halt the current application execution, make sure to do so before calling the SDK

## Show Campaign / Send Event
To show a FeedBack campaign, call `GetFeedback.Bridge.sendEvent("<The Event>>")`. This will depending on the parameters for the campaign, display a banner with the first page of the campaign. Once a campaign has been displayed on a device, it can not be displayed again on the device.

NOTE: The SDK doesn't pause any threads or code. If it is needed to halt the current application execution, make sure to do so before calling the SDK

## Callback from SDK
The SDK can report back to the Unity Application when certain events occur, e.g. the Feedback form has been removed. Call `GetFeedbackBridge.setDelegate()` to enable callback. The SDK needs to know where to deliver the callback.
Configure this with `GetFeedback.Events.sdkEvent.AddListener(<function to call>)`. The sdkEvent is a `UnityEvent<string>` so the function should accept a string eg `public void sdkCallBackMethod(string data)`. To learn about the data, check the

## Configure Theme
The SDK allowas for some font and images customization.
The Theme class, holds 4 properties. Configure the Theme object, and then use the

Bridge.setTheme()
method the apply the theme. Note that the theme must be set before any call to showFeedBack or sendEvent. The setTheme only needs to occur once, unless there is a need for different themes throughout the application.

#### headerColor
(iOS only) - must be a #rgb string (eg #97D3BC)
#### fonts
regular - specify the name of the font NOT the filename
textSize - size in px
bold - specify the name of the font NOT the filename
titleSize - size in px
miniSize - size in px. The minimum size of the fonts

The font-files must be placed in the `StreamingAssets` Directory. The SDK will search the library for any .ttf files and install them in the application, no further setup is need in the native app

#### images
enabledEmoticons - an array of strings of up to 5 images, used instead of the default emoticons
disabledEmoticons - an array of strings of up to 5 images, used instead of the default disabled emoticons

All Image for the Theme must also be placed in the `StreamingAssets`. The Native SDK will read the files from this directory.
#### banner (see Customize Campaign Banner)
If the banner is left empty, the default SDK banner implementation will be applied.
To configure a different banner layout add a Banner Object

## Customize Campaign Banner
The Banner object holds 4 properties

### enableClickThrough
a bool. Used to allow click-through in the view outside the card of the banner
#### contourBgAssetName
The name of the image used as background. The image will be scaled to fill the screen
#### logo
A BannerLogo object, with one property
assetName - the name of the logo
The logo is constraint to 150x115 (HxW) in size
#### navigation
A BannerNaviagtion Object with 4 properteis
continueButtonBgAssetName - the name of the image used as background for the button (Optional)
continueButtonTextColor - the text color as a #RGB string for the button (Optional)
cancelButtonBgAssetName - the name of the image used as background for the button (Optional)
cancelButtonTextColor - the text color as a #RGB string for the button (Optional)


<div style="page-break-after: always"></div>

### Appendix 1: Theme example

Fonts font = new Fonts();
font.regular = "DancingScript-Bold";
font.textSize = 15;
font.bold = "TBFvoice-Bold";
font.titleSize = 15;
font.miniSize = 12;

Images images = new Images();
images.enabledEmoticons = new string[] { "pouting.png", "weary.png", "neutral.png", "face.png", "smiling.png" };
images.disabledEmoticons = new string[] { "pouting.png", "weary.png", "neutral.png", "face.png", "smiling.png" };

BannerLogo logo = new BannerLogo();
logo.assetName = "logo.png";

BannerNavigation navigation = new BannerNavigation();
navigation.continueButtonBgAssetName = "buttonContinue.png";
navigation.continueButtonTextColor = "#FFFFFF";
navigation.cancelButtonBgAssetName = "buttonCancel.png";
navigation.cancelButtonTextColor = "#97D3BC";

Banner banner = new Banner();
banner.enableClickThrough = false;
banner.contourBgAssetName = "background.png";
banner.logo = logo;
banner.navigation = navigation;

Theme theme = new Theme();
theme.fonts = font;
theme.images = images;
theme.banner = banner;
theme.headerColor = "#345423";




0 comments on commit b81aeaf

Please sign in to comment.