Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Commit

Permalink
Similar changes for android.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikDemyankov committed Feb 29, 2016
1 parent 7d4dbdf commit 687719f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.nordnetab.chcp.main.model.PluginFilesStructure;
import com.nordnetab.chcp.main.utils.Paths;

import java.io.BufferedReader;
import java.io.InputStreamReader;
Expand All @@ -22,8 +24,6 @@ public class ApplicationConfig {

private static final String MARKET_URL_FORMAT = "market://details?id=%s";

private static final String APPLICATION_CONFIG_IN_ASSETS = "www/chcp.json";

private static class JsonKeys {
public static final String STORE_PACKAGE_IDENTIFIER = "android_identifier";
}
Expand Down Expand Up @@ -71,12 +71,13 @@ public static ApplicationConfig fromJson(String jsonString) {
* @param context application context
* @return application config from assets
*/
public static ApplicationConfig configFromAssets(final Context context) {
public static ApplicationConfig configFromAssets(final Context context, final String configFileName) {
final AssetManager assetManager = context.getResources().getAssets();
final StringBuilder returnString = new StringBuilder();
final String configFilePath = "www/" + configFileName;
BufferedReader reader = null;
try {
InputStreamReader isr = new InputStreamReader(assetManager.open(APPLICATION_CONFIG_IN_ASSETS));
InputStreamReader isr = new InputStreamReader(assetManager.open(configFilePath));
reader = new BufferedReader(isr);
String line;
while ((line = reader.readLine()) != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.nordnetab.chcp.main.model.PluginFilesStructure;
import com.nordnetab.chcp.main.utils.VersionHelper;

import java.io.IOException;
Expand Down Expand Up @@ -94,7 +95,7 @@ public static PluginInternalPreferences createDefault(final Context context) {
pluginPrefs.setCurrentReleaseVersionName("");

// read app config from assets to get current release version
final ApplicationConfig appConfig = ApplicationConfig.configFromAssets(context);
final ApplicationConfig appConfig = ApplicationConfig.configFromAssets(context, PluginFilesStructure.CONFIG_FILE_NAME);
if (appConfig != null) {
pluginPrefs.setCurrentReleaseVersionName(appConfig.getContentConfig().getReleaseVersion());
}
Expand Down

0 comments on commit 687719f

Please sign in to comment.