- Merge VK login/link/check and Review test buttons from dev_rustore - Unify Rustore/GooglePlay SKU format via ChannelHelpers.normalizeSkuList() - Fix ChannelConfig runtime sync: Java InitSDK sets channel from ChannelHelpers.CHANNEL - Fix AndroidMinSdkVersion 25→26 for tuyoosdk compatibility - Fix Flexion AndroidManifest tools:replace missing fullBackupContent value - Add [CHANNEL-VERIFY] debug logs for channel verification Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
package com.unity3d.player;
|
|
|
|
import android.util.Log;
|
|
|
|
import org.json.JSONArray;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
public class ChannelHelpers {
|
|
public static final String CHANNEL = "Rustore";
|
|
|
|
static void register() {
|
|
// Rustore uses default behavior, no additional SDKHelper
|
|
}
|
|
|
|
public static String normalizeSkuList(String msg) {
|
|
if (msg == null || msg.isEmpty()) return msg;
|
|
try {
|
|
JSONArray products = new JSONArray(msg);
|
|
for (int i = 0; i < products.length(); i++) {
|
|
JSONObject p = products.getJSONObject(i);
|
|
|
|
// price is in kopecks, convert to micros: kopecks * 10000
|
|
String price = p.optString("price", "0");
|
|
long micros = Long.parseLong(price) * 10000;
|
|
p.put("price_amount_micros", String.valueOf(micros));
|
|
|
|
// Map currency → price_currency_code
|
|
String currency = p.optString("currency", "");
|
|
if (!currency.isEmpty()) {
|
|
p.put("price_currency_code", currency);
|
|
}
|
|
|
|
// Convert display price: "199" → "₽1.99"
|
|
float rubles = Float.parseFloat(price) / 100;
|
|
p.put("price", String.format("₽%s", rubles));
|
|
}
|
|
return products.toString();
|
|
} catch (JSONException e) {
|
|
Log.e("ChannelHelpers", "normalizeSkuList error: " + e.getMessage());
|
|
return msg;
|
|
}
|
|
}
|
|
}
|