Stickerpipe is a stickers SDK for iOS
Get the API key on the Stickerpipe
use_frameworks!
pod "StickerPipe"
Add content of Framework folder to your project. You can also get sources from here for low-level customization and iOS 7 support
Import framework with:
swift:
@import Stickerpipe
objC:
#import <Stickerpipe/Stickerpipe.h>
Set API key in your AppDelegate.m
[STKStickersManager initWithApiKey:@"API_KEY"];
You can get your own API Key on http://stickerpipe.com to have customized packs set.
User id is required. After it specified, our SDK can provide user-specific packs customization. All changes to displayed packs settings are stored for thus unique keys.
After retrieving user id, set it to STKStickersManager with:
[STKStickersManager setUserKey:@"USER_ID"];
If you don't have logic for storing such unique id's, you can use UUID and store it to keychain, for saving between installations.
Init STKStickerController and add stickersView as inputView for your UITextView/UITextField. Storing stickerController instance is up to you
@property (strong, nonatomic) STKStickerController *stickerController;
self.stickerController.textInputView = self.inputTextView;
Use delegate method for recieving sticker messages from sticker view controller
- (void) stickerController:(STKStickerController *)stickerController
didSelectStickerWithMessage:(NSString *)message;
and display it with UIImageView:
- (void)stk_setStickerWithMessage: (NSString*)stickerMessage
completion: (STKCompletionBlock)completion;
or just retrieve an image for custom processing with imageManager property:
- (void)getImageForStickerMessage: (NSString*)stickerMessage
withProgress: (STKDownloadingProgressBlock)progressBlock
andCompletion: (STKCompletionBlock)completion;
Return your controller from delegate method for presenting modal controllers:
- (UIViewController*)stickerControllerViewControllerForPresentingModalView;
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
To add suggestions about stickers you should add UICollectionView to appropriate place on you screen, for example above UITextView. Then attach your collection view to STKStickerController
self.stickerController.suggestCollectionView = self.yourCollectionView;
Enable your suggests with showSuggests property
self.stickerController.showSuggests = YES;
To receive correct statistic about number of sent stickers and messages you should call pair of methods textMessageSendStatistic and stickerMessageSendStatistic.
Call textMessageSendStatistic after user send each text message
- (void)yourTextMessageDidSend {
[self.stickerController textMessageSendStatistic];
}
Call stickerMessageSendStatistic after user send each sticker in delegate method to STKStickerController
- (void)stickerController:(STKStickerController *)stickerController didSelectStickerWithMessage:(NSString *)message {
[self.stickerController stickerMessageSendStatistic];
}
You can change default placeholders color and shop content color:
Placeholder in stickers view
[self.stickerController setColorForStickersPlaceholder:[UIColor redColor]];
Placeholder in stickers view header
[self.stickerController setColorForStickersHeaderPlaceholderColor:[UIColor blueColor]];
Shop content color
[STKStickersManager setShopContentColor:[UIColor greenColor]];
Add custom Stickers to iMessage with Stickerpipe - http://stickerpipe.com/add-stickers-to-imessage
Stickerpipe is available under the Apache 2 license. See the LICENSE file for more information.