Update critical bug fix - 0.4.2

This commit is contained in:
David 2013-08-04 17:56:24 +02:00
parent 0a2db6be10
commit 520e23d438
4 changed files with 22 additions and 8 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.luhmer.owncloudnewsreader"
android:versionCode="24"
android:versionName="0.4.1" >
android:versionCode="25"
android:versionName="0.4.2" >
<uses-sdk
android:minSdkVersion="7"

Binary file not shown.

View file

@ -25,18 +25,20 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import de.luhmer.owncloudnewsreader.SettingsActivity;
import de.luhmer.owncloudnewsreader.helper.CustomTrustManager;
import de.luhmer.owncloudnewsreader.reader.owncloud.API;
import de.luhmer.owncloudnewsreader.util.Base64;
public class HttpJsonRequest {
//private static final String TAG = "HttpJsonRequest";
//@TargetApi(Build.VERSION_CODES.GINGERBREAD)
@SuppressLint("DefaultLocale")
public static InputStream PerformJsonRequest(String urlString, List<NameValuePair> nameValuePairs, final String username, final String password, Context context) throws AuthenticationException, Exception
{
if(nameValuePairs != null)
urlString += "&" + URLEncodedUtils.format(nameValuePairs, "utf-8");
URL url = new URL(urlString);
URL url = new URL(API.validateURL(urlString));
HttpURLConnection urlConnection = getUrlConnection(url, context, username, password);
//HttpsURLConnection urlConnection = null;
@ -69,6 +71,12 @@ public class HttpJsonRequest {
urlConnection.setReadTimeout(120000);//2min
urlConnection.setRequestProperty("Content-Type","application/json");
//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
// CookieHandler.setDefault(new CookieManager());
//urlConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 (.NET CLR 3.5.30729)");
//urlConnection.setRequestProperty("Host", "de.luhmer.ownCloudNewsReader");
urlConnection.connect();
@ -117,7 +125,7 @@ public class HttpJsonRequest {
@SuppressLint("DefaultLocale")
public static int performTagChangeRequest(String urlString, String username, String password, Context context, String content) throws Exception
{
URL url = new URL(urlString);
URL url = new URL(API.validateURL(urlString));
HttpURLConnection urlConnection = getUrlConnection(url, context, username, password);
urlConnection.setDoOutput(true);
urlConnection.setRequestMethod("PUT");

View file

@ -15,7 +15,7 @@ import de.luhmer.owncloudnewsreader.reader.owncloud.apiv2.APIv2;
public abstract class API {
protected SharedPreferences mPrefs;
Pattern RemoveAllDoubleSlashes = Pattern.compile("[^:](\\/\\/)");
static final Pattern RemoveAllDoubleSlashes = Pattern.compile("[^:](\\/\\/)");
public API(Context cont) {
mPrefs = PreferenceManager.getDefaultSharedPreferences(cont);
@ -46,14 +46,16 @@ public abstract class API {
/**
*
* @return http(s)://url_to_server/
* @return http(s)://url_to_server
*/
protected String getOcRootPath() {
String oc_root_path = mPrefs.getString(SettingsActivity.EDT_OWNCLOUDROOTPATH_STRING, "");
oc_root_path = RemoveAllDoubleSlashes.matcher(oc_root_path).replaceAll("/");
if(!oc_root_path.endsWith("/"))
oc_root_path += "/";
//if(!oc_root_path.endsWith("/"))
// oc_root_path += "/";
//while(oc_root_path.endsWith("/"))
// oc_root_path += oc_root_path.substring(0, oc_root_path.length() - 2);
return oc_root_path;
}
@ -83,5 +85,9 @@ public abstract class API {
return OwnCloudReaderMethods.GetUpdatedItems(tag, cont, lastSync, api);
}
public static String validateURL(String url) {
return RemoveAllDoubleSlashes.matcher(url).replaceAll("/");
}
public abstract boolean PerformTagExecution(List<String> itemIds, FeedItemTags.TAGS tag, Context context, API api);
}