Skip to content

Commit

Permalink
ImportExportHelper.getImportExportUrl: handle new URL
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin-st committed Aug 7, 2016
1 parent 62e0aae commit 511c83e
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static String sendExportRequest(Context context, String jsonString, Impo
String error = jsonResult.getString("error");
Crashlytics.logException(new ImportExportWebserviceException("Error is " + error));
}

return null;
} catch (JSONException e) {
e.printStackTrace();
Expand Down Expand Up @@ -278,11 +278,19 @@ private static void removeIdsFromGrids(List<String> currentGridNames, List<Grid>
}
}

/**
* Returns import-export server URL.
* If it matches one of the old URLs, return the new one
* @param context Context
* @return string
*/
public static String getImportExportServerUrl(Context context) {
String oldUrl = "http://www.munin-for-android.com/ws/importExport.php";
String oldUrl1 = "http://www.munin-for-android.com/ws/importExport.php";
String oldUrl2 = "http://ws.munin-for-android.com/importExport.php";

String url = Settings.getInstance(context).getString(Settings.PrefKeys.ImportExportServer, IMPORT_EXPORT_URI);

return url.equals(oldUrl) ? IMPORT_EXPORT_URI : url;
return url.equals(oldUrl1) || url.equals(oldUrl2) ? IMPORT_EXPORT_URI : url;
}

public static void showExportDialog(MuninFoo muninFoo, final Context context,
Expand Down

0 comments on commit 511c83e

Please sign in to comment.