// Path: app/src/main/java/discovery/contentful/utils/CFPrefs.java
// public class CFPrefs {
//   private CFPrefs() {
//   }
// 
//   public static final String KEY_SPACE = "SPACE";
//   public static final String KEY_ACCESS_TOKEN = "TOKEN";
//   public static final String KEY_DID_LOGIN = "DID_LOGIN";
//   public static final String KEY_FIRST_LAUNCH = "FIRST_LAUNCH";
// 
//   public static SharedPreferences getInstance() {
//     return PreferenceManager.getDefaultSharedPreferences(CFApp.getInstance());
//   }
// 
//   public static Boolean didLogin() {
//     return getInstance().getBoolean(KEY_DID_LOGIN, false);
//   }
// 
//   public static Boolean firstLaunch() {
//     return getInstance().getBoolean(KEY_FIRST_LAUNCH, true);
//   }
// }


import android.content.SharedPreferences;
import discovery.contentful.utils.CFPrefs;
import com.contentful.java.cda.CDAClient;
import org.apache.commons.lang3.StringUtils;
package discovery.contentful.api;


public class CFClient {
  private static CDAClient sInstance;
  private static String locale;

  private CFClient() {
  }

  /**
   * Initialize this client.
   *
   * @param space String representing the Space key.
   * @param token String representing the access token required to log in to the Space.
   * @return {@link com.contentful.java.cda.CDAClient} instance.
   */
  public synchronized static CDAClient init(String space, String token) {
    SharedPreferences prefs = CFPrefs.getInstance();

    prefs.edit()
        .putString(CFPrefs.KEY_SPACE, space)
        .putString(CFPrefs.KEY_ACCESS_TOKEN, token)
        .apply();

    sInstance = CDAClient.builder().setSpace(space).setToken(token).build();

    locale = null;

// Path: app/src/main/java/discovery/contentful/utils/CFPrefs.java
// public class CFPrefs {
//   private CFPrefs() {
//   }
// 
//   public static final String KEY_SPACE = "SPACE";
//   public static final String KEY_ACCESS_TOKEN = "TOKEN";
//   public static final String KEY_DID_LOGIN = "DID_LOGIN";
//   public static final String KEY_FIRST_LAUNCH = "FIRST_LAUNCH";
// 
//   public static SharedPreferences getInstance() {
//     return PreferenceManager.getDefaultSharedPreferences(CFApp.getInstance());
//   }
// 
//   public static Boolean didLogin() {
//     return getInstance().getBoolean(KEY_DID_LOGIN, false);
//   }
// 
//   public static Boolean firstLaunch() {
//     return getInstance().getBoolean(KEY_FIRST_LAUNCH, true);
//   }
// }


// Path: app/src/main/java/discovery/contentful/api/CFClient.java
import android.content.SharedPreferences;
import discovery.contentful.utils.CFPrefs;
import com.contentful.java.cda.CDAClient;
import org.apache.commons.lang3.StringUtils;

package discovery.contentful.api;


public class CFClient {
  private static CDAClient sInstance;
  private static String locale;

  private CFClient() {
  }

  /**
   * Initialize this client.
   *
   * @param space String representing the Space key.
   * @param token String representing the access token required to log in to the Space.
   * @return {@link com.contentful.java.cda.CDAClient} instance.
   */
  public synchronized static CDAClient init(String space, String token) {
    SharedPreferences prefs = CFPrefs.getInstance();

    prefs.edit()
        .putString(CFPrefs.KEY_SPACE, space)
        .putString(CFPrefs.KEY_ACCESS_TOKEN, token)
        .apply();

    sInstance = CDAClient.builder().setSpace(space).setToken(token).build();

    locale = null;

    return sInstance;