Giter Site home page Giter Site logo

lerist / feedbackkit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nishimao/feedbackkit

0.0 3.0 0.0 730 KB

This is useful tool to send feedback in ios app development.

License: MIT License

Swift 72.07% Ruby 4.52% Objective-C 1.51% Shell 21.90%

feedbackkit's Introduction

FeedbackKit

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")
}

feedbackkit's People

Contributors

nishimao avatar

Watchers

James Cloos avatar Lerist avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.