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

nativescript-snapkit

v1.0.0

Published

SnapKit login

Downloads

2

Readme

NativeScript Snap Kit plugin

NPM version Twitter Follow

What!?

Glad you asked. This repo implements a NativeScript plugin for Snapchat's Snap Kit SDK. In its first iteration, this plugin only exposes the 'login' feature, called Login Kit. Feel free to open an issue requesting other features (other parts of the Snap Kit SDK are: Creative Kit, Bitmoji Kit, and Story Kit).

Installation

tns plugin add nativescript-snapkit

Configuration

Hop on over to the Snap Kit developer portal and create an app.

Android

Documentation for setting up iOS is available here, but a lot of it has already been handled by the plugin. You'll need to:

  • Open App_Resources/AndroidManifest.xml and add the com.snapchat.kit.sdk.clientId as shown here.
  • While you're there, also add com.snapchat.kit.sdk.redirectUrl as shown here.
  • And lastly, com.snapchat.kit.sdk.SnapKitActivity as shown here (make sure you adjust that android:scheme!).

iOS

Documentation for setting up iOS is available here, but a lot of it has already been handled by the plugin. You'll need to:

iOS startup wiring

When using Login Kit's features on iOS, you will need to require (not import) the plugin before the app is bootstrapped.

Failing to do so will mean Snapchat won't redirect back to your app after logging in.

Demo app

If you want to test logging in with your own Snapchat login, then the demo app is a good starting point. However, it only allows logging in with user eddyverbruggen so you'll need to update its configuration as mentioned above.

Follow these steps to install the demo app:

git clone https://github.com/EddyVerbruggen/nativescript-snapkit
cd nativescript-snapkit/src
npm i
# change the configuration, then:
npm run demo.ios # or demo.android

API (Login Kit)

login

The login function takes a boolean parameter (default false) indicating whether or not you want the plugin to retrieve user details.

import { LoginKit } from "nativescript-snapkit";

LoginKit.login(true)
    .then(result => console.log(`Login successful, details: ${JSON.stringify(result)}`))
    .catch(error => console.log(`Login failed. Details: ${error}`));

isLoggedIn

This function takes the same boolean parameter as login (default false). If false, this function will return a boolean. Otherwise it will return user details in case the user was indeed logged in, or false if he was not logged in.

import { LoginKit } from "nativescript-snapkit";

// use it either like this (no parameter, or 'false')
LoginKit.isLoggedIn()
    .then(loggedIn => console.log(`User was logged in? ${loggedIn}`));

// or use it like this, to get the details (in case the user was indeed logged in)
LoginKit.isLoggedIn(true)
    .then(result => {
      if (!result) {
        console.log(`User was not logged in.`);
      } else {
        console.log(`User was logged in. User details: ${JSON.stringify(result)}`)
      }
    });

logout

import { LoginKit } from "nativescript-snapkit";

LoginKit.logout()
    .then(() => console.log("Logged out"));