Stickerpipe is a stickers SDK for iOS
Get the API key on the Stickerpipe
CocoaPods:
use_frameworks!
pod "StickerPipe", "~> 0.3.10"
For import framework to project use:
@import Stickerpipe
Add API key in your AppDelegate.m
[STKStickersManager initWithApiKey:@"API_KEY"];
[STKStickersManager setStartTimeInterval];
You can get your own API Key on http://stickerpipe.com to have customized packs set.
[STKStickersManager setUserKey:@"USER_ID"];
You have an ability to sell content via your internal currency, inApp purchases or provide via subscription model. We use price points for selling our content. Currently we have A, B and C price points. We use A to mark FREE content and B/C for the paid content. Basically B is equal to 0.99$ and C equal to 1.99$ but the actual price can be vary depend on the countries and others circumstances.
To sell content via inApp purchases, you have to create products for B and C content at your iTunes Connect developer console and then set ids to sdk
[STKStickersManager setPriceBProductId:@"com.priceB.example" andPriceCProductId:@"com.priceC.example"];
To sell content via internal currency, you have to set your prices to sdk. This price labels will be showed at stickers shop, values you will received at callback from shop.
[STKStickersManager setPriceBWithLabel:@"0.99 USD" andValue:0.99f];
[STKStickersManager setPriceCwithLabel:@"1.99 USD" andValue:1.99f];
When your purchase was failed you have to call failed method:
[[STKStickersPurchaseService sharedInstance] purchaseFailedError:error];
If you want to use subscription model, you need to set subscription flag to sdk, when user became or ceased to be subscriber(or premium user). After this, content with B price point be available for free for subscribers(premium users)
[STKStickersManager setUserIsSubscriber:NO];
You hava to subscribe on purchase notification
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(purchasePack:) name:STKPurchasePackNotification object:nil];
- (void)purchasePack:(NSNotification *)notification {
packName = notification.userInfo[@"packName"];
packPrice = notification.userInfo[@"packPrice"];
}
When your purchase was succeeded you have to call success method:
[[STKStickersPurchaseService sharedInstance] purchasInternalPackName:packName andPackPrice:packPrice];
Init STKStickerController and add stickersView like inputView for your UITextView/UITextField
@property (strong, nonatomic) STKStickerController *stickerController;
self.stickerController.textInputView = self.inputTextView;
Use delegate method for reciving sticker messages from sticker view controller
- (void)stickerController:(STKStickerController *)stickerController didSelectStickerWithMessage:(NSString *)message {
//Send sticker message
}
Use delegate method to set base controller for presenting modal controllers
- (UIViewController *)stickerControllerViewControllerForPresentingModalView {
return self;
}
Register to push notifications in AppDelegate.
Add
[STKStickersManager sendDeviceToken:deviceToken failure:nil];
method call to delegate method:
- (void)application:(UIApplication )application didRegisterForRemoteNotificationsWithDeviceToken:(NSData )deviceToken
Add
STKStickerController *stickerController = ...
[STKStickersManager getUserInfo:userInfo stickerController:stickerController];
method call to delegate method:
- (void) application:(UIApplication )application didReceiveRemoteNotification:(NSDictionary )userInfo
[self.stickerController textMessageSent:message];
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
[self.stickerController updateFrames];
}
You can change default placeholders color:
Placeholder in stickers view
[self.stickerController setColorForStickersPlaceholder:[UIColor redColor]];
Placeholder in stickers view header
[self.stickerController setColorForStickersHeaderPlaceholderColor:[UIColor blueColor]];
Stickerpipe
Stickerpipe is available under the Apache 2 license. See the LICENSE file for more information.