导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - b.java 源代码

正在查看: Hopscotch v9.7.2 应用的 b.java JAVA 源代码文件

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


package com.gokwik.sdk.common.di;

import android.content.Context;
import com.gokwik.sdk.api.AnalyticsApiService;
import com.gokwik.sdk.api.ApiService;
import com.gokwik.sdk.api.UserAgentInterceptor;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public final class b {
    private static b compositionRoot;
    private boolean isProduction;
    private Retrofit mAnalyticsRetrofit;
    private Retrofit mRetrofit;

    private b() {
    }

    public static b c() {
        if (compositionRoot == null) {
            compositionRoot = new b();
        }
        return compositionRoot;
    }

    public final AnalyticsApiService a(Context context, boolean z) {
        if (this.mAnalyticsRetrofit == null || this.isProduction != z) {
            this.isProduction = z;
            this.mAnalyticsRetrofit = new Retrofit.Builder().baseUrl(z ? "https://hits.gokwik.co/" : "https://sandbox-hits.gokwik.co/").addCallAdapterFactory(RxJava2CallAdapterFactory.create()).addConverterFactory(GsonConverterFactory.create()).client(new OkHttpClient.Builder().addInterceptor(new UserAgentInterceptor(context)).build()).build();
        }
        return (AnalyticsApiService) this.mAnalyticsRetrofit.create(AnalyticsApiService.class);
    }

    public final ApiService b(boolean z) {
        if (this.mRetrofit == null || this.isProduction != z) {
            this.isProduction = z;
            this.mRetrofit = new Retrofit.Builder().baseUrl(z ? "https://api.gokwik.co/" : "https://sandbox.gokwik.co/").addCallAdapterFactory(RxJava2CallAdapterFactory.create()).addConverterFactory(GsonConverterFactory.create()).build();
        }
        return (ApiService) this.mRetrofit.create(ApiService.class);
    }
}