Skip to content

コンテンツカードへのGIF の埋め込み

Braze SDK を使用してGIF をコンテンツカードに埋め込む方法について説明します。

About GIFs

Braze offers the ability to use a custom image library to display animated GIFs. Although the example below uses Glide , any image library that supports GIFs is compatible.

Integrating a custom image library

Step 1: Creating the image loader delegate

The Image Loader delegate must implement the following methods:

The integration example below is taken from the Glide integration sample app included with the Braze Android SDK.

Step 2: Setting the image loader delegate

The Braze SDK will use any custom image loader set with setBrazeImageLoader . We recommend setting the custom image loader in a custom application subclass:

Custom Image Loading with Jetpack Compose

To override image loading with Jetpack Compose, you can pass in a value to imageComposable . This function will take a Card and render the image and the modifiers needed. Alternatively, you can use customCardComposer of ContentCardsList to render the entire card.

In the following example, Glide’s Compose library is used for the cards listed in the imageComposable function:

前提条件

この機能を使用する前に、Swift Braze SDKを統合する必要があります。

カスタムイメージライブラリの統合

ステップ1:SDWebImageの統合

SDWebImageリポジトリ をXcodeプロジェクトに統合します。

ステップ2: 新しいSwift ファイルを作成する

Xcode プロジェクトで、SDWebImageGIFViewProvider.swift という名前の新しいファイルを作成し、以下をインポートします。

ステップ 3:GIFViewProvider を追加する

次に、サンプルSDWebImage GIFViewProvider を追加します。ファイルは次のようになります。

ステップ4:変更する AppDelegate.swift

プロジェクトのAppDelegate.swift で、BrazeUI コンポーネントにGIFViewProvider を使用してGIF サポートを追加します。ファイルは次のようになります。

現時点では、Web Braze SDK ではコンテンツカードGIF はサポートされていません。

「このページはどの程度役に立ちましたか?」
New Stuff!