Apple SDK
Add the https://gitlab.com/heypster/heypster-sdk.git repository in Xcode with Swift Package Manager. The SDK requires iOS 16, watchOS 9, visionOS 1, or macOS 11 or later. The HeypsterView picker is available on iOS and visionOS.
Initialize the client at launch, for example in your SwiftUI app initializer.
import HeypsterSDK
HeypsterClient.initialize(
configuration: .init(secret: "YOUR_APP_SECRET", id: "YOUR_APP_ID")
)
Present the picker in a SwiftUI sheet and receive the GIF in the callback.
import SwiftUI
import HeypsterSDK
struct GifPickerButton: View {
@State private var showsPicker = false
var body: some View {
Button("Choose a GIF") { showsPicker = true }
.sheet(isPresented: $showsPicker) {
HeypsterView { gif in
// Pass the selected GIF to your interface.
}
}
}
}
To test the integration, open HeypsterSDK.xcworkspace and run the Demo target. Display the selection in your interface with GIFView.
Android SDK
Android 7.0 (API 24) or later. Download the AAR module from the repository and place it in libs. Add these dependencies to your app module.
dependencies {
implementation("com.google.android.material:material:1.12.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation(files("libs/HeypsterSDK_1.0.0.aar"))
}
Initialize the client with your key, then open HeypsterView from a FragmentActivity. Declare a com.heypster.sdk.views.GifView view with the ID gifView in your layout.
HeypsterClient.initialize("YOUR_HEYPSTER_API_KEY")
val target = findViewById<GifView>(R.id.gifView)
findViewById<Button>(R.id.button).setOnClickListener {
HeypsterView { gif ->
target.loadGif(gif)
}.show(supportFragmentManager)
}
Web SDK
Install the package and import its entry point. The example uses gif_button as the ID of the button that opens the picker.
npm install heypster-gif
import HeypsterGifSDK from './node_modules/heypster-gif/index.js';
const picker = new HeypsterGifSDK(
'YOUR_HEYPSTER_API_KEY', true, 'fr', 'top', 'v1',
);
document.querySelector('#gif_button').addEventListener('click', () => {
picker.togglePopup();
});
window.addEventListener('heypsterGifClicked', ({ detail }) => {
const { gifMini, h264 } = detail;
// Utilisez l’URL GIF Mini ou l’URL vidéo H.264 dans votre interface.
});
| Option | Purpose |
|---|---|
apiKey | Your application’s heypster API key. Required. |
initialize | Use true to prepare the picker on page load. Defaults to false. |
language | Secondary interface language. Defaults to fr. Text and tag searches run in English. |
position | top by default, or bottom. |
interface | Use v1 for search and categories, v2 for emoji and tags as well, or v3 to include external results. |
external | MAX plan. Configures an external provider with provider and key. |
For lazy loading, call initialize() before the first togglePopup() call.
Flutter SDK
The SDK works on iOS, Android, Web, macOS, Windows, and Linux. Add the repository as a Git dependency in your Flutter project.
dependencies:
heypster_flutter_sdk:
git:
url: https://github.com/heypster/heypster-flutter-sdk.git
ref: v1.0.0
import 'package:heypster_flutter_sdk/heypster_flutter_sdk.dart';
// At startup, before runApp.
HeypsterFlutterSDK.configure(apiKey: 'YOUR_HEYPSTER_API_KEY');
In MaterialApp, add HeypsterLocalizations.delegate to your delegates and HeypsterLocalizations.supportedLocales to your supported locales. Connect selection to a HeypsterMediaSelectionListener, then open the picker with the widget context.
HeypsterDialog.instance.addListener(this);
HeypsterDialog.instance.show(context: context);
Display the selection with HeypsterMediaView, or embed a grid in your interface with HeypsterGridView.
Access and support
For application credentials or integration questions, email contact@heypster.com.