Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,41 @@
* Fixed an issue where a user not sharing their Bitmoji would cause an exception
* Fixed Videos not working on Android Clients
* Fixed an issue where some Videos wouldn't work despite meeting Snapchat's Video requirements
* Bug fixes & Code improvements
* Bug fixes & Code improvements

## 3.0.0

* **BREAKING CHANGE:** Upgraded Snap Kit on Android to 2.1.0.
When updating this plugin, please perform the following changes to your app:
* in `android/build.gradle`, remove the following:

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

* in `android/app/build.gradle`, remove the following:

```groovy
implementation([
'com.snapchat.kit.sdk:creative:1.10.0',
'com.snapchat.kit.sdk:login:1.10.0',
'com.snapchat.kit.sdk:bitmoji:1.10.0',
'com.snapchat.kit.sdk:core:1.10.0'
])
```

* in `android/app/src/main/AndroidManifest.xml`:
* change `com.snapchat.kit.sdk.clientId` to `com.snap.kit.clientId`
* change `com.snapchat.kit.sdk.redirectUrl` to `com.snap.kit.redirectUrl`
* change `com.snapchat.kit.sdk.scopes` to `com.snap.kit.scopes"`
* remove the following:

```xml
<queries>
<package android:name="com.snapchat.android" />
</queries>
```

* Widened `http` support to >=0.13.3 <2.0.0
65 changes: 38 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Snapkit

[![Pub Package](https://img.shields.io/pub/v/snapkit.svg)](https://pub.dev/packages/snapkit)
[![Code Analysis](https://github.com/TimmyRB/snapkit/actions/workflows/code-analysis.yml/badge.svg)](https://github.com/TimmyRB/snapkit/actions/workflows/code-analysis.yml)
[![Android Builds](https://github.com/TimmyRB/snapkit/actions/workflows/build-android.yml/badge.svg)](https://github.com/TimmyRB/snapkit/actions/workflows/build-android.yml)
[![iOS Builds](https://github.com/TimmyRB/snapkit/actions/workflows/build-ios.yml/badge.svg)](https://github.com/TimmyRB/snapkit/actions/workflows/build-ios.yml)
[![Code Analysis](https://github.com/TimmyRB/snapkit/actions/workflows/code-analysis.yml/badge.svg)](https://github.com/TimmyRB/snapkit/actions/workflows/code-analysis.yml)
[![Android Builds](https://github.com/TimmyRB/snapkit/actions/workflows/build-android.yml/badge.svg)](https://github.com/TimmyRB/snapkit/actions/workflows/build-android.yml)
[![iOS Builds](https://github.com/TimmyRB/snapkit/actions/workflows/build-ios.yml/badge.svg)](https://github.com/TimmyRB/snapkit/actions/workflows/build-ios.yml)

A plugin that allows developers like you to integrate with Snapchat (using [SnapKit](https://kit.snapchat.com)) into your Flutter applications!

Expand All @@ -14,22 +14,28 @@ Follow the [Wiki](https://github.com/TimmyRB/snapkit/wiki) for steps on how to g
## Usage

### Create new Instance

```dart
Snapkit snapkit = new Snapkit();
final snapkit = Snapkit();
```

### AuthState Stream

```dart
snapkit.onAuthStateChanged.listen((SnapchatUser? user) {
// Do something with the returned SnapchatUser or null here
});
```

### AuthState Class

```dart
class MyAppState extends State<MyApp> implements SnapchatAuthStateListener {

snapkit.addAuthStateListener(this);
@override
void initState() {
super.initState();
_snapkit.addAuthStateListener(this);
}

@override
void onLogin(SnapchatUser user) {
Expand All @@ -40,72 +46,77 @@ class MyAppState extends State<MyApp> implements SnapchatAuthStateListener {
void onLogout() {
// Do something on logout
}

}
```

### Login

```dart
await snapkit.login();

// or

snapkit.login().then(user => {});
```

### Logout

```dart
await snapkit.logout();

// or

snapkit.logout().then(() => {});
```

### Verify a Phone Number

Returns a `bool` if Snapchat has verified the phone number, throws
an error if there was a problem. Always returns `false` on Android
an error if there was a problem. Always returns `false` on Android.

```dart
snapkit.verifyPhoneNumber('US', '1231234567')
.then(isVerified {})
.catchError((error, StackTrace stacktrace) {})
try {
final isVerified = await snapkit.verifyPhoneNumber('US', '1231234567');
} catch (error, stackTrace) {
// Handle error
}
```

## Share to Snapchat

### Share to LIVE

```dart
snapkit.share(SnapchatMediaType.NONE,
snapkit.share(
SnapchatMediaType.NONE,
sticker: SnapchatSticker?,
caption: String?,
attachmentUrl: String?
);
```

### Share with Background Photo

```dart
snapkit.share(SnapchatMediaType.PHOTO,
snapkit.share(
SnapchatMediaType.PHOTO,
image: ImageProvider,
sticker: SnapchatSticker?,
caption: String?,
attachmentUrl: String?
attachmentUrl: String?,
);
```

### Share with Background Video
Currently unavailable on Android

Currently unavailable on Android.

```dart
snapkit.share(SnapchatMediaType.VIDEO,
snapkit.share(
SnapchatMediaType.VIDEO,
videoUrl: String,
sticker: SnapchatSticker?,
caption: String?,
attachmentUrl: String?
attachmentUrl: String?,
);
```

### SnapchatSticker

```dart
new SnapchatSticker(
image: ImageProvider
SnapchatSticker(
image: ImageProvider,
);
```
26 changes: 15 additions & 11 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,34 @@ version '1.0'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.3.1'
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
maven {
url "https://storage.googleapis.com/snap-kit-build/maven"
}
mavenCentral()
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 30
if (project.android.hasProperty("namespace")) {
namespace 'com.jacobbrasil.snapkit'
}

compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 19
Expand All @@ -34,9 +40,7 @@ android {

dependencies {
implementation([
'com.snapchat.kit.sdk:creative:1.10.0',
'com.snapchat.kit.sdk:login:1.10.0',
'com.snapchat.kit.sdk:bitmoji:1.10.0',
'com.snapchat.kit.sdk:core:1.10.0'
'com.snap.creativekit:creativekit:2.1.0',
'com.snap.loginkit:loginkit:2.1.0',
])
}
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
3 changes: 3 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jacobbrasil.snapkit">
<queries>
<package android:name="com.snapchat.android" />
</queries>
</manifest>
Loading