- fix some bugs (see discord)

Closes https://codeberg.org/gitnex/GitNex/issues/1153

Co-authored-by: qwerty287 <ndev@web.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1154
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
This commit is contained in:
qwerty287 2022-06-16 00:11:56 +02:00 committed by 6543
parent 8975d5c7ca
commit f75fad2bea
3 changed files with 22 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package org.mian.gitnex.actions;
import android.app.Activity;
import android.content.Context;
import androidx.annotation.NonNull;
import org.gitnex.tea4j.v2.models.Comment;
@ -112,7 +113,10 @@ public class IssueActions {
IssueDetailActivity.singleIssueUpdate = true;
((IssueDetailActivity) ctx).onResume();
RepoDetailActivity.updateRepo = true;
if(((Activity) ctx).getIntent().getStringExtra("openedFromLink") == null ||
!((Activity) ctx).getIntent().getStringExtra("openedFromLink").equals("true")) {
RepoDetailActivity.updateRepo = true;
}
}
}
else if(response.code() == 401) {

View File

@ -146,8 +146,11 @@ public class CommitDetailFragment extends Fragment {
// we need a ClickListener here to prevent that the ItemClickListener of the diffFiles ListView handles clicks for the header
});
CommitDetailFragment.this.binding.diffFiles.addHeaderView(binding.getRoot());
assert response.body() != null;
Commit commitsModel = response.body();
if(commitsModel == null) {
onFailure(call, new Throwable());
return;
}
String[] commitMessageParts = commitsModel.getCommit().getMessage().split("(\r\n|\n)", 2);
if(commitMessageParts.length > 1 && !commitMessageParts[1].trim().isEmpty()) {

View File

@ -263,13 +263,19 @@ public class RepoInfoFragment extends Fragment {
switch(response.code()) {
case 200:
try {
assert response.body() != null;
Markdown.render(ctx, response.body().string(), binding.repoFileContents, repository);
}
catch(IOException e) {
e.printStackTrace();
}
assert response.body() != null;
new Thread(() -> {
try {
Markdown.render(ctx, response.body().string(), binding.repoFileContents, repository);
}
catch(IOException e) {
requireActivity().runOnUiThread(() -> {
Toasty.error(ctx, ctx.getString(R.string.genericError));
binding.fileContentsFrameHeader.setVisibility(View.GONE);
binding.fileContentsFrame.setVisibility(View.GONE);
});
}
}).start();
break;
case 401: