npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

imokhles-react-native-snapchat-kit

v1.0.7

Published

Bridge to use Snapchat Frameworks in react native

Downloads

17

Readme

React-Native SnapchatKit

1. Change Log

  • v1.0.0 :
    • Brand new React Native Snaps

2. SDK Instalation

From your project folder:

yarn

$ yarn add git+https://github.com/QuentinbTahi/react-snap-kit.git -- save

npm

$ npm install git+https://github.com/QuentinbTahi/react-snap-kit.git -- save

3. Project configuration

3.2 iOS configuration

3.2.1 Change min iOS version :

Edit your Podfile min version to 10 : platform :ios, '10.0'

3.2.2 Run $ pod install from iOS folder :

$ cd ios && pod install

or

$ react-native link react-native-snapchat-kit`

3.2.3 Edit info.plist file :

Add to Info.plist

<key>SCSDKClientId</key>
<string>YOUR CLIENT ID</string>

<key>SCSDKRedirectUrl</key>
<string>YOUR REDIRECT URL</string>

<key>SCSDKScopes</key>
<array>
     <string>https://auth.snapchat.com/oauth2/api/user.display_name</string>
    <string>https://auth.snapchat.com/oauth2/api/user.bitmoji.avatar</string>
</array>

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>snapchat</string>
    <string>bitmoji-sdk</string>
    <string>itms-apps</string>
</array>

REMEMBER Add the app url to your URL Types on Xcode config.

3.2.4 Update the AppDelegate.m (Login only) :

#import <SCSDKLoginKit/SCSDKLoginKit.h>

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
  if ([SCSDKLoginClient application:application openURL:url options:options]) {
    return YES;
  }
  
  return NO;
}

3.3 Android configuration

3.3.1 Update build.gradle :

Update android/build.gradle with the min SDK Version :

minSdkVersion = 19

and add to your repositories list :

maven {
    url "https://storage.googleapis.com/snap-kit-build/maven"
}

3.3.2 Update AndroidManifest.xml :

Add the INTERNET permission

<uses-permission android:name="android.permission.INTERNET" />

Add this to your application

<meta-data android:name="com.snapchat.kit.sdk.clientId" android:value="YOUR CLIENT ID" />
<meta-data android:name="com.snapchat.kit.sdk.redirectUrl" android:value="YOUR REDIRECT URL" />
<meta-data android:name="com.snapchat.kit.sdk.scopes" android:resource="@array/snap_connect_scopes" />

<activity android:name="com.snapchat.kit.sdk.SnapKitActivity" android:launchMode="singleTask">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!--
            Enter the parts of your redirect url below
            e.g., if your redirect url is myapp://snap-kit/oauth2
                android:scheme="myapp"
                android:host="snap-kit"
                android:path="/oauth2"
        !-->
        <data
            android:scheme="the scheme of your redirect url"
            android:host="the host of your redirect url"
            android:path="the path of your redirect url"
        />
    </intent-filter>
</activity>

3.3.3 Create a new file values/arrays.xml :

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="snap_connect_scopes">
        <item>https://auth.snapchat.com/oauth2/api/user.display_name</item>
        <item>https://auth.snapchat.com/oauth2/api/user.bitmoji.avatar</item>
    </string-array>
</resources>

3.3.4 Set up your FileProvider to share media files to Snapchat (creative kit only):

To share any media or sticker content to Snapchat, follow the protocol specified by FileProvider API. Once you have set this up, your AndroidManifest.xml will contain the following under <application>:

<provider
    android:authorities="${applicationId}.fileprovider"
    android:name="android.support.v4.content.FileProvider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/file_paths"
        />
</provider>

Note: The authority used by the SDK is explicitly <your-package-name>.fileprovider. Please ensure you follow this convention when setting the value. If you have different package names for debug and production builds, the ${applicationId} should resolve to it appropriately.

4. Usage

4.1 Login

import SnapchatKit from 'react-native-snapchat-kit';

SnapchatKit.login() 
SnapchatKit.isLogged()
SnapchatKit.logout()
SnapchatKit.getUserInfo()

4.1 Creative

import SnapchatKit from 'react-native-snapchat-kit';

SnapchatKit.sharePhoto(photoImageSourceOrUrl, stickerImageSourceOrUrl, stickerPosX, stickerPosY, attachmentUrl, caption);
SnapchatKit.shareVideoAtUrl(videoUrl, stickerImageSourceOrUrl, stickerPosX, stickerPosY, attachmentUrl, caption);

4.1.1 Notes on creative kit :

  • Media Size and Length Restrictions

    • Shared media must be 100 MB or smaller.
    • Videos must be 60 seconds or shorter.
  • Suggested Media Parameters:

    • Aspect ratio - 9:16
    • Preferred file types:
    • Image - .jpg or .png
    • Video - .mp4
    • Dimensions - 1080px x 1920px
    • Video Bitrate - 1080p at 8mbps or 720p at 5mbps