Skip to content

nebs/NPCricket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPCricket

CI Status Version License Platform

About

Cricket is an iOS library for sending feedback directly from within the app. It grabs a screenshot, some feedback and sends the data to wherever you want (see overview below for details).

GitHub Logo

Example Usage

In your app delegate:

#import <NPCricket/NPCricket.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [NPCricket useEmailComposerWithToEmailAddress:@"[email protected]"];
  // ... your code here ...
  return YES;
}

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if (motion == UIEventSubtypeMotionShake) {
        [NPCricket show];
    }
}

Overview

Cricket does not show itself automatically. Instead, you must call [NPCricket show] yourself. One example would be to show it when the user shakes their phone (see the example above).

Cricket is designed to be extensible by relying on "handlers" to process the feedback. Any class can become a handler by conforming to the NPCricketHandler protocol. This way you could for example send the feedback directly to your server via a custom API.

For your convenience I've included a handler for using the built-in email composer (NPEmailComposerHandler)

Creating Handlers

If you want to create your own handler simply create a class that conforms to NPCricketHandler and implement the single method, like so:

#import "NPCricketHandlerProtocol.h"

@interface MyCustomHandler : NSObject <NPCricketHandler>
@end

@implementation MyCustomHandler

- (void)NPCricket_handleFeedback:(NPFeedback *)feedback {
  // Do something with the feedback ...
}

@end

Then you simply tell NPCricket to use it, like so:

MyCustomHandler *myCustomHandler = [[MyCustomHandler alloc] init];
[NPCricket useHandler:myCustomHandler];

Requirements

Cricket requires iOS 8.0 and above.

Installation

NPCricket is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "NPCricket"

Author

Nebojsa Petrovic, [email protected]

License

NPCricket is available under the MIT license. See the LICENSE file for more info.