From ec62e3cebfc690f7435fb76e73dcf843c304c0f9 Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Tue, 14 Jan 2020 12:52:34 +0000 Subject: [PATCH] Make DueDate optional on MilestoneCreaton (#252) Merge branch 'master' into milestone-DueDate-optional_240 add check again if gitea is older than 1.10.0 ... Crowdin [2020-01-04] + add Latvian (#253) update Translators add Latvian update Crowdin Co-authored-by: 6543 <6543@obermui.de> make DueDate optional on MilestoneCreaton Co-authored-by: 6543 <6543@obermui.de> --- .../mian/gitnex/activities/NewMilestoneActivity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java b/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java index c2293adb..61d68c58 100644 --- a/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/NewMilestoneActivity.java @@ -18,6 +18,7 @@ import org.mian.gitnex.R; import org.mian.gitnex.clients.RetrofitClient; import org.mian.gitnex.helpers.AlertDialogs; import org.mian.gitnex.helpers.Authorization; +import org.mian.gitnex.helpers.VersionCheck; import org.mian.gitnex.helpers.Toasty; import org.mian.gitnex.models.Milestones; import org.mian.gitnex.util.AppUtil; @@ -117,15 +118,16 @@ public class NewMilestoneActivity extends AppCompatActivity implements View.OnCl } } - if(newMilestoneDueDate.equals("")) { - + String finalMilestoneDueDate = null; + if(!newMilestoneDueDate.isEmpty()) { + finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate))); + } else if (VersionCheck.compareVersion("1.10.0", tinyDb.getString("giteaVersion")) > 1) { + // if Gitea version is less than 1.10.0 DueDate is required Toasty.info(getApplicationContext(), getString(R.string.milestoneDateEmpty)); return; - } disableProcessButton(); - String finalMilestoneDueDate = (AppUtil.customDateCombine(AppUtil.customDateFormat(newMilestoneDueDate))); createNewMilestone(instanceUrl, Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, newMilestoneTitle, newMilestoneDescription, finalMilestoneDueDate); }