ブランドフォロー機能の設定

    ブランドフォロー機能の設定


    記事の要約

    この機能を使って、クライアントがShoplive Playerに登録したブランドをいいね(フォロー)することができます。この機能を有効にすると、Shoplive Player内にブランドイメージとともに「いいね!」(フォロー)するボタンが表示されます。ボタンのステータスは、顧客が設定した顧客のデータにリンクされます。

    この機能を連携させるには、ShopLiveに相談する必要があり、詳しくはShopLiveの担当者にお問い合わせください。

    ブランドいいね(フォロー) 表示

    val user = ShopLiveUser().apply {
        userId = "harry"
        userName = "potter"
        addCustomParameter("brand", "{\"identifier\":\"brand-identifier\",\"favorite\":true}")
    }
    ShopLive.setUser(user)

    PlainText


    いいね(フォロー) クリック時のコールバック

    override fun onReceivedCommand(context: Context, command: String, data: JSONObject) {
        when (command) {
            "ON_CLICK_BRAND_FAVORITE_BUTTON" -> {
                val identifier = data.getString("identifier")
                val isFavorite = data.getBoolean("favorite")
                Log.d("shoplive", "identifier=$identifier, isFavorite=$isFavorite")
            }
            "ON_CHANGED_BRAND_FAVORITE" -> {
                val identifier = data.getString("identifier")
                Log.d("shoplive", "identifier=$identifier")
            }
        }
    }

    PlainText


    いいね(フォロー) 設定のステータスをShoplive Playerに転送する

    ユーザーのブランドの「いいね!」のステータス(フォロー)をShoplive Playerに転送することで、ブランドの「いいね!」のステータス(フォロー)を連携できます。

    val result = "{\"identifier\":\"brand-identifier\",\"favorite\":false}"
    ShopLive.sendCommandMessage("SET_BRAND_FAVORITE", result)

    PlainText