package com.epson.iprint.storage.dropbox;

import com.dropbox.core.DbxRequestConfig;
import com.dropbox.core.http.OkHttp3Requestor;
import com.dropbox.core.p005v2.DbxClientV2;

public class DropboxClientFactory {
    private static final String CLIENT_IDENTIFIER = "Epson-iPrint/6.3";
    private static DbxClientV2 sDbxClient;

    public static void init(String str) {
        if (sDbxClient == null) {
            sDbxClient = new DbxClientV2(DbxRequestConfig.newBuilder(CLIENT_IDENTIFIER).withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient())).build(), str);
        }
    }

    public static DbxClientV2 getClient() {
        DbxClientV2 dbxClientV2 = sDbxClient;
        if (dbxClientV2 == null) {
            return null;
        }
        return dbxClientV2;
    }

    public static void deleteClient() {
        sDbxClient = null;
    }
}
