package com.bytedance.globalpayment.iap.google.service;

import X.C3554QXn;
import X.TMf;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.globalpayment.service.manager.iap.google.PayloadPreferencesService;

public class PayloadPreferencesServiceImpl implements PayloadPreferencesService {
    public static volatile PayloadPreferencesService instance;

    static {
        Covode.recordClassIndex(27106);
    }

    public static PayloadPreferencesService getInstance() {
        MethodCollector.i(2489);
        if (instance == null) {
            synchronized (PayloadPreferencesServiceImpl.class) {
                try {
                    if (instance == null) {
                        instance = new PayloadPreferencesServiceImpl();
                    }
                } catch (Throwable th) {
                    MethodCollector.o(2489);
                    throw th;
                }
            }
        }
        PayloadPreferencesService payloadPreferencesService = instance;
        MethodCollector.o(2489);
        return payloadPreferencesService;
    }

    public void removePayload(Context context, String str) {
        C3554QXn.LIZ(context, str);
    }

    public void removeQueryOrderParam(Context context, String str) {
        TMf.LIZ().LJ();
        C3554QXn.LIZ(context).edit().remove("key_query_order_".concat(String.valueOf(str))).apply();
    }

    public void addQueryOrderParam(Context context, String str, String str2, String str3, String str4, boolean z, String str5, boolean z2) {
        TMf.LIZ().LJ();
        SharedPreferences LIZ = C3554QXn.LIZ(context);
        String LIZ2 = C3554QXn.LIZ(str, str3, str4, z, str5, z2);
        if (!TextUtils.isEmpty(LIZ2)) {
            LIZ.edit().putString("key_query_order_".concat(String.valueOf(str2)), LIZ2).apply();
        }
    }
}
