导航菜单

页面标题

页面副标题

Vi App v10.18.0 - UpswingSdkModule.java 源代码

正在查看: Vi App v10.18.0 应用的 UpswingSdkModule.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mventus.selfcare.activity.upswing;

import android.app.Activity;
import android.net.Uri;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import one.upswing.sdk.FailureCustomerInitiationResponse;
import one.upswing.sdk.SuccessCustomerInitiationResponse;
import one.upswing.sdk.UpswingSdk;
import one.upswing.sdk.UpswingSdkKt;
import one.upswing.sdk.partner.UpswingTheme;

public class UpswingSdkModule extends ReactContextBaseJavaModule {
    private static final String PARTNER_CODE = "VDFN";
    private static final String PARTNER_URL = "https://upswing.access.partner/";

    public UpswingSdkModule(ReactApplicationContext reactApplicationContext) {
        super(reactApplicationContext);
    }

    private UpswingSdk getUpswingSDK() {
        Activity currentActivity = getCurrentActivity();
        if (currentActivity != null) {
            return new UpswingSdk.Builder(currentActivity, PARTNER_CODE, new PartnerInitCustomerImpl(getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class))).setStatusBarColor(currentActivity.getResources().getColor(2131099737)).setUIMode(UpswingTheme.SYSTEM).build();
        }
        throw new IllegalStateException("Current activity is null");
    }

    public String getName() {
        return "UpswingSdkModule";
    }

    @ReactMethod
    public void initializeUpswingViaDeeplink(String str, String str2) {
        new UpswingSdk.Builder(getCurrentActivity(), PARTNER_CODE, new PartnerInitCustomerImpl(getReactApplicationContext().getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class))).build().initializeSdkViaDeepLink(Uri.parse(PARTNER_URL).buildUpon().appendQueryParameter("action", str).appendQueryParameter("redirect", str2).build());
    }

    @ReactMethod
    public void invokeUpswing(String str) {
        getUpswingSDK().initializeSdkViaDeepLink(Uri.parse("https://upswing.access.partner/VDFN?action=webview&redirect=" + str));
    }

    @ReactMethod
    public void invokeUpswingViaDeeplink(String str) {
        getUpswingSDK().initializeSdkViaDeepLink(Uri.parse(str));
    }

    @ReactMethod
    public void upswingFailure() {
        Holder.getInstance().getUpswingCallback().invoke(FailureCustomerInitiationResponse.INSTANCE);
    }

    @ReactMethod
    public void upswingLogout() {
        UpswingSdkKt.upswingSdkLogout(getCurrentActivity().getApplicationContext());
    }

    @ReactMethod
    public void upswingSuccess(String str, String str2) {
        Holder.getInstance().getUpswingCallback().invoke(new SuccessCustomerInitiationResponse(str, str2));
    }
}