Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Min kanboard version check modified. Kanboard v1.2.x version detected… #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions app/src/main/java/in/andres/kandroid/kanboard/KanboardProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;

import org.json.JSONArray;
import org.json.JSONObject;
Expand Down Expand Up @@ -75,6 +76,15 @@ public KanboardProject(@NonNull JSONObject project) throws MalformedURLException
this(project, null, null, null, null, null, null, null);
}

private URL readUrlFromJSON(JSONObject urls, String urlName ) throws MalformedURLException {
String url = urls.optString(urlName);
URL returnUrl = null;
if (!TextUtils.isEmpty(url)){
returnUrl = new URL(url);
}
return returnUrl;
}

public KanboardProject(@NonNull JSONObject project, @Nullable JSONArray columns, @Nullable JSONArray swimlanes,
@Nullable JSONArray categories, @Nullable JSONArray activetasks,
@Nullable JSONArray inactivetasks, @Nullable JSONArray overduetasks,
Expand Down Expand Up @@ -108,9 +118,10 @@ public KanboardProject(@NonNull JSONObject project, @Nullable JSONArray columns,
NumberActiveTasks = project.optInt("nb_active_tasks");
JSONObject urls = project.optJSONObject("url");
if (urls != null) {
ListURL = new URL(urls.optString("list"));
BoardURL = new URL(urls.optString("board"));
CalendarURL = new URL(urls.optString("calendar"));
ListURL = readUrlFromJSON(urls,"list");
BoardURL = readUrlFromJSON(urls,"board");
CalendarURL = readUrlFromJSON(urls,"calendar");

} else {
ListURL = null;
BoardURL = null;
Expand Down
9 changes: 5 additions & 4 deletions app/src/main/java/in/andres/kandroid/ui/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,11 @@ public void onDismiss(DialogInterface dialog) {
editor.putString("username", username);
editor.putString("password", password);
editor.apply();
} else if (version[0] >= Constants.minKanboardVersion[0] &&
version[1] >= Constants.minKanboardVersion[1] &&
version[2] >= Constants.minKanboardVersion[2]) {
} else if (version[0]*10000+version[1]*100+version[2] >=
Constants.minKanboardVersion[0]*10000
+Constants.minKanboardVersion[1]*100
+Constants.minKanboardVersion[2]
) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = preferences.edit();
editor.putString("serverurl", serverurl.trim());
Expand Down Expand Up @@ -305,4 +307,3 @@ public void onAnimationEnd(Animator animation) {
}
}
}