Skip to content

Commit

Permalink
Merge pull request #29 from usabilla/develop
Browse files Browse the repository at this point in the history
Release v3.3.0
  • Loading branch information
gPinato authored Feb 13, 2017
2 parents 88c5785 + 1db3bd5 commit b8e6313
Show file tree
Hide file tree
Showing 24 changed files with 542 additions and 18 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 3.3.0

#### Added
- **UsabillaFeedbackForm.dismissAutomatically** Bool attribute to handle automatic or manual form dismiss
- **formDidClose** delegate method of **UsabillaFeedbackFormDelegate** protocol, take a look at the [documentation](Readme.MD/#submission-callback)

#### Fixed

- Screenshot image picker orientation always in portrait: now showing in the same orientation as previous view controller
- Unexpected scrolling when typing in textfield

## 3.2.1
#### Fixed

Expand All @@ -18,6 +29,12 @@
#### Fixed
- Issue with the rating control (star and mood) where it was not reset correctly after reuse

#### Updated

- The methods from `UsabillaFeedbackFormDelegate` protocol are now executed in the same thread of the one where the `UsabillaFeedbackForm.loadFeedbackForm` method is executed.

*Be sure to execute the `present(form....)` on the Main thread if you are calling `UsabillaFeedbackForm.loadFeedbackForm` in a background thread and want the form to correctly show.*

## 3.1.0
#### Added
- Possibility to configure font size in the SDK. See the wiki for more info.
Expand Down
91 changes: 75 additions & 16 deletions Readme.MD
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@ Usabilla for Apps allows you to collect feedback from your user with great ease

Take a look at our [Wiki](https://github.com/usabilla/usabilla-u4a-ios-sdk/wiki) for a complete and in depth guide on how to install and customize the SDK.

## Latest changes in v3.2.1
#### Added
- Carthage compatibility
- Caching for feedback: when there is no internet connection feedbacks are now saved and sent when a connection is back.

Follow [these steps](#initialization) in order to enable the caching feature.
## Latest changes in v3.3.0

#### Removed
- Alamofire dependency
- PromiseKit dependency
#### Added
- **UsabillaFeedbackForm.dismissAutomatically** Bool attribute to handle automatic or manual form dismiss
- **formDidClose** delegate method of **UsabillaFeedbackFormDelegate** protocol, take a look at the [documentation](Readme.MD/#formDidClose)

#### Fixed
- Issue with the rating control (star and mood) where it was not reset correctly after reuse
- Synchronization (thread) issue that could freeze the user interface
- Textfield position when the keyboard is showing up
- Screenshot image picker orientation always in portrait: now showing in the same orientation as previous view controller
- Unexpected scrolling when typing in textfield

## Requirements

Expand Down Expand Up @@ -45,7 +39,7 @@ platform :ios, '9.0'
use_frameworks!

target 'MyApp' do
pod 'UsabillaFeedbackForm', '~> 3.0'
pod 'UsabillaFeedbackForm', '~> 3.3.0'
end
```

Expand All @@ -65,7 +59,7 @@ to add carthage to your project.
And add this line to your `Cartfile`:

```yaml
github "usabilla/usabilla-u4a-ios-swift-sdk" "v3.2.1"
github "usabilla/usabilla-u4a-ios-swift-sdk" "v3.3.0"
```

### Manual
Expand Down Expand Up @@ -93,7 +87,7 @@ Add the following line to the **didFinishLaunchingWithOptions**:
```swift
UsabillaFeedbackForm.load()
```
The **load** method is here in order to init the caching feature : submit the previously submitted feedbacks.
The **load** method is here in order to init the caching feature : submit the previously submitted feedback.

#### Using forms

Expand Down Expand Up @@ -178,8 +172,73 @@ This invitation will only be showed if:

You have to specify the app id omitting the initial "id", leaving only the numerical part.

### Submission callback

Since **v3.3.0** it is possible to get information about the feedback the user has left by implementing UsabillaFeedbackFormDelegate.**formDidClose** method.

You will also be notified if the user has left the form without submitting it.

This method provides you with an array of **FeedbackResult**:

```swift
struct FeedbackResult {
let rating: Int?
let abandonedPageIndex: Int?
var sent: Bool
}
```

This is because the user may submit the form multiple times and this method will be called only once for all feedback sent.

The **rating** value is set as soon as the user interacts with it and will be reported even if the form is not submitted.

The **abandonedPageIndex** is only set if the user cancels the form before submission.

Here is a sample implementation :

```swift
func formDidClose(formID: String, with feedbackResults: [FeedbackResult]) {
guard let feedback = feedbackResults.first else {
return
}

if feedback.sent == false {
let abandonedPageIndex = feedback.abandonedPageIndex
print("Hey why did you left the form here \(abandonedPageIndex)")
return
}

if let rating = feedback.rating {
if rating >= 4 {
// thanks the user with a nice Emoji 🙏
// or give the user a coupon code
}
}
}
```

### Handle manual dismiss

Since **v3.3.0** it is possible to customize the way the form is dismissed

Set the automatic UsabillaFeedbackForm dismissal attribute to false:

```swift
UsabillaFeedbackForm.dismissAutomatically = false
```

and implement the **formDidClose** delegate method:

```swift
func formDidClose(formID: String, with feedbackResults: [FeedbackResult]) {
// handle your custom dismiss e.g: dismiss(animated: true, completion: nil)
}
```

**Warning**: by doing this the form will not dismiss by itself and you will be the only one responsible for its correct behaviour.


## Integration with Obj-C application
## Integration with Obj-C applications

To integrate the SDK in your Obj-C application, follow apple official guidelines on how to [use Swift and Objective-C in the Same Project](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html)

Expand Down
Binary file modified UsabillaFeedbackForm.framework/Assets.car
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ open class UsabillaFeedbackForm {
open static var appStoreId: String? = nil
open static var hideGiveMoreFeedback: Bool = true
open static var showCancelButton: Bool = false
open static var dismissAutomatically: Bool = true

static var defaultLocalisationFile = true
open static var localizedStringFile: String = "usa_localizable" {
didSet {
defaultLocalisationFile = false
}
}

/**
Initialize the **Usabilla SDK**

Expand All @@ -49,9 +51,34 @@ open class UsabillaFeedbackForm {

}

public struct FeedbackResult {
let rating: Int?
let abandonedPageIndex: Int?
var sent: Bool {
return abandonedPageIndex == nil
}
}

public protocol UsabillaFeedbackFormDelegate: class {

func formLoadedCorrectly(_ form: UINavigationController, active: Bool)
func formFailedLoading(_ backupForm: UINavigationController)

/**
This method is called once the form is closed

- Parameter feedbackResults: Array of FeedbackResult

If UsabillaFeedbackForm.**hideGiveMoreFeedback** is set to **false**, the **feedbackResults** array will always contains only one value.
Otherwise the feedbackResults can contains between 1 and n FeedbackResult

This method should be used to dismiss the form if the UsabillaFeedbackForm.**dismissAutomatically** attribute is set to **false**
*/
func formDidClose(formID: String, with feedbackResults: [FeedbackResult])

}

public extension UsabillaFeedbackFormDelegate {
func formDidClose(formID: String, with feedbackResults: [FeedbackResult]) {
}
}
Binary file modified UsabillaFeedbackForm.framework/Info.plist
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified UsabillaFeedbackForm.framework/UsabillaFeedbackForm
Binary file not shown.
Loading

0 comments on commit b8e6313

Please sign in to comment.