Latest 0.1.0
Homepage https://github.com/nishimao/FeedbackKit
License MIT
Platforms ios 8.0
Authors

feedback tool for iOS app

Feature

  • [x]Send feedback by mail
  • [x]Send feedback by custom action
  • [ ]Mask privacy info before getting screen capture

You can also send feedback to a platform, such as Slack by using custom action.

Requirements

  • iOS8.0+
  • Xcode 7.3+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 0.39.0+ is required to build FeedbackKit.

To integrate FeedbackKit into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!

pod 'FeedbackKit'

Then, run the following command:

$ pod install

Carthage

Comming soon (Welcome Pull Request)

Usage

Show feedback-view for sending feedback to one user by Email

import FeedbackKit

let emailConifg = Feedback.EmailConfig(to: "[email protected]")
Feedback.Email(emailConfig: emailConifg).show {
    print("dismissed")
}

Show feedback-view for sending feedback to multiple users by Email, and setting custom mail subject

let emailConfig = Feedback.EmailConfig(toList:
                    ["[email protected]",
                     "[email protected]"])
emailConfig.ccList = ["[email protected]",
                      "[email protected]"]
emailConfig.bccList = ["[email protected]",
                       "[email protected]"]
emailConfig.mailSubject = "custom mail subject"
Feedback.Email(emailConfig: emailConfig).show {
    print("## dismissed")
}

Show feedback-view by 2 finger long press

Please use ‘addDoubleLongPressGestureRecognizer’ method, do not use ‘show’ method.

let emailConifg = Feedback.EmailConfig(to: "[email protected]")
Feedback.Email(emailConfig: emailConifg).addDoubleLongPressGestureRecognizer {
    print("dismissed")
}

Show feedback-view for sending feedback to Slack by using custom action

Please use ‘Custom’ enum.
At first, please let me explain a basic rule of custom action.
If you use ‘Custom’ enum, you must call ‘success’ method when custom action was finished successfully.
If you do not call ‘success’ method, feedback-view will not be disappeared.

Feedback.Custom { (feedbackViewController, sendInformation, success) in
    print("custom action")
    success() // important method
}.show {
    print("dismissed")
}

Next, let’s implement a logic for sending to Slack.
I think that using SlackKit is a shortcut of goal.

If you use cocoapods, please add SlackKit as follows.

pod 'SlackKit'

and you need to get slack’s web api token.

useful link for creating slack’s web api token as follows.
https://api.slack.com/docs/oauth-test-tokens

import SlackKit

Feedback.Custom { (feedbackViewController, sendInformation, success) in

    let token = "please put your slack's web api token"
    let bot = SlackKit(withAPIToken: token)
    guard let client: Client = bot.clients[token] else {
        return
    }
    guard let imageData = sendInformation.captureImageData else {
        return
    }

    let selectedTitle = sendInformation.selectedTitle ?? ""
    let comment = sendInformation.comment ?? ""
    let reporterName = sendInformation.reporterName ?? ""
    let className = sendInformation.className ?? ""

    client.webAPI.uploadFile(imageData, filename: "feedback", channels: ["#image_upload_your_channel"], success: { (file) in

            guard let imageUrl = file.urlPrivate else {
                return
            }

            let attachment = Attachment(fallback: "You got new feedback", title: selectedTitle,   text: "(className) : (comment) by (reporterName)", imageURL: imageUrl)

            // text and image
            client.webAPI.sendMessage("#feedback_your_channel", text: "You got new feedback", username: "feedback",
                attachments: [attachment],
                success: { (complete:(ts: String?, channel: String?)) in
                    print("## message success ")
                    success() // important method. need to call this method for dismiss feedback view
                }, failure: { (error) in
                    print("## message fail (error)")
            })
        }) { (error) in
            print("## upload failure")
    }
}.show {
    print("dismissed")
}

Latest podspec

{
    "name": "FeedbackKit",
    "version": "0.1.0",
    "summary": "This is useful tool to send feedback.",
    "description": "This is tool to send feedback of developing app for iOS app. This is very useful to do doog fooding.",
    "homepage": "https://github.com/nishimao/FeedbackKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Mao Nishi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/nishimao/FeedbackKit.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "FeedbackKit/Classes/**/*.swift",
    "resource_bundles": {
        "FeedbackKit": [
            "FeedbackKit/Classes/*.storyboard"
        ]
    }
}

Pin It on Pinterest

Share This