Git Product home page Git Product logo

stkios's Introduction

About

Version Platform License

Stickerpipe is a stickers SDK for iOS

ios

Installation

Get the API key on the Stickerpipe

CocoaPods:

use_frameworks!
pod "StickerPipe", "~> 0.3.10"

Usage

For import framework to project use:

@import Stickerpipe

API key

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.

Users

[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

In-app purchase product identifiers

   [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.

Internal currency

   [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];

Subscription

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;
}

Push notifications

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

Text message send

    [self.stickerController textMessageSent:message];

Layout sticker fames

- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
[self.stickerController updateFrames];
}

Сustomizations

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]];

Credits

Stickerpipe

Contact

[email protected]

License

Stickerpipe is available under the Apache 2 license. See the LICENSE file for more information.

stkios's People

Contributors

akoryakin avatar dehimb avatar olyaluts avatar

Watchers

Sergey Vinogradov 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.