Java 类com.parse.ParseConfig 实例源码

项目:AnyWall    文件:ConfigHelper.java   
public void fetchConfigIfNeeded() {
  final long configRefreshInterval = 60 * 60; // 1 hour

  if (config == null ||
      System.currentTimeMillis() - configLastFetchedTime > configRefreshInterval) {
    // Set the config to current, just to load the cache
    config = ParseConfig.getCurrentConfig();

    // Set the current time, to flag that the operation started and prevent double fetch
    ParseConfig.getInBackground(new ConfigCallback() {
      @Override
      public void done(ParseConfig parseConfig, ParseException e) {
        if (e == null) {
          // Yay, retrieved successfully
          config = parseConfig;
          configLastFetchedTime = System.currentTimeMillis();
        } else {
          // Fetch failed, reset the time
          configLastFetchedTime = 0;
        }
      }
    });
  }
}
项目:readingtracker    文件:ParseConfigHelper.java   
public static void refreshConfig() {
    long currentTime = System.currentTimeMillis();
    if (currentTime - lastFetchedTime > configRefreshInterval) {
        lastFetchedTime = currentTime;
        ParseConfig.getInBackground(new ConfigCallback() {
            @Override
            public void done(ParseConfig config, ParseException e) {
                if (e == null) {
                    Log.d(TAG, "Fetched config from server.");
                } else {
                    Log.e(TAG, "Failed to fetch config from server. Using Cached Config.");
                }
                cachedConfig = ParseConfig.getCurrentConfig();
                Log.d(TAG,"Config is "+cachedConfig.toString());
           }
        });
    }
}
项目:Gazetti_Newspaper_Reader    文件:StarterApplication.java   
@Override
public void onCreate() {
    super.onCreate();

    Parse.enableLocalDatastore(this);
    Parse.initialize(this, Constants.getConstant(this, R.string.PARSE_APP_ID),
            Constants.getConstant(this, R.string.PARSE_CLIENT_KEY));

    Fabric.with(this, new Crashlytics());
    Crashlytics.getInstance().setDebugMode(false);

    Crashlytics.log(Log.INFO, StarterApplication.class.getName(), "Starting Application - " + System.currentTimeMillis());
    NewsCatFileUtil.getInstance(this);
    UserPrefUtil.getInstance(this);
    ParseConfig.getInBackground(new ConfigCallback() {
        @Override
        public void done(ParseConfig config, ParseException e) {
            ConfigService.getInstance();
            ConfigService.getInstance().setInstance(StarterApplication.this);
        }
    });
}
项目:NMSAlphabetAndroidApp    文件:App.java   
public static boolean forceUpdate(Context context){
    try {
        int updateVersion = ParseConfig.get().getInt("FORCE_UPDATE_VERSION", -1);
        return updateVersion > 0 && Util.getAppVersionCode(context) <= updateVersion;
    } catch (Exception e){
        return false;
    }
}
项目:Gazetti_Newspaper_Reader    文件:ConfigService.java   
private ConfigService() {
    if (isConfigAvailable()) {
        ParseConfig config = ParseConfig.getCurrentConfig();
        setConfigVersion(config.getNumber("version"));
        setTheHinduElementsFromConfig(config);
        setTOIElementsFromConfig(config);
        setIndianExpressElementsFromConfig(config);
        setFirstPostElementsFromConfig(config);
    } else {
        setTheHinduElementsFromConstants();
        setTOIElementsFromConstants();
        setIndianExpressElementsFromConstants();
        setFirstPostElementsFromConstants();
    }
}
项目:Gazetti_Newspaper_Reader    文件:ConfigService.java   
private void setIndianExpressElementsFromConfig(ParseConfig config) {
    setIndianExpressBody(config.getString("tie_body"));
    setIndianExpressHead(config.getString("tie_head"));
    setIndianExpressImage(config.getString("tie_image"));

    setIndianExpressBusinessBody(config.getString("tie_business_body"));
    setIndianExpressBusinessHead(config.getString("tie_business_head"));
    setIndianExpressBusinessImage(config.getString("tie_business_image"));
}
项目:RxParse    文件:ParseObservable.java   
@NonNull
@CheckReturnValue
public static Single<ParseConfig> getConfig() {
    return RxTask.single(() -> ParseConfig.getInBackground());
}
项目:Gazetti_Newspaper_Reader    文件:ConfigService.java   
private boolean isConfigAvailable() {
    return (ParseConfig.getCurrentConfig() != null);
}
项目:Gazetti_Newspaper_Reader    文件:ConfigService.java   
private void setTheHinduElementsFromConfig(ParseConfig config) {
    setTheHinduBody(config.getString("th_body"));
    setTheHinduHead(config.getString("th_head"));
    setTheHinduImageFirst(config.getString("th_image_1"));
    setTheHinduImageSecond(config.getString("th_image_2"));
}
项目:Gazetti_Newspaper_Reader    文件:ConfigService.java   
private void setTOIElementsFromConfig(ParseConfig config) {
    setTOIBody(config.getString("toi_body"));
    setTOIHead(config.getString("toi_head"));
    setTOIImageFirst(config.getString("toi_image_1"));
    setTOIImageSecond(config.getString("toi_image_2"));
}
项目:Gazetti_Newspaper_Reader    文件:ConfigService.java   
private void setFirstPostElementsFromConfig(ParseConfig config) {
    setFirstPostBody(config.getString("fp_body"));
    setFirstPostHead(config.getString("fp_head"));
    setFirstPostImage(config.getString("fp_image"));
}