Fix 103 response code for OG

This commit is contained in:
Thomas 2023-01-31 18:11:22 +01:00
parent 04c5f32c53
commit 833ea5d0c3
2 changed files with 11 additions and 4 deletions

View file

@ -793,6 +793,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
Request request = new Request.Builder() Request request = new Request.Builder()
.url(potentialUrl) .url(potentialUrl)
.build(); .build();
String finalPotentialUrl = potentialUrl;
client.newCall(request).enqueue(new Callback() { client.newCall(request).enqueue(new Callback() {
@Override @Override
public void onFailure(@NonNull Call call, @NonNull IOException e) { public void onFailure(@NonNull Call call, @NonNull IOException e) {
@ -869,6 +870,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} else if (response.code() == 103) {
activity.runOnUiThread(() -> {
Bundle b = new Bundle();
b.putString(Helper.ARG_SHARE_DESCRIPTION, finalPotentialUrl);
CrossActionHelper.doCrossShare(activity, b);
});
} else { } else {
activity.runOnUiThread(() -> Toasty.warning(activity, activity.getString(R.string.toast_error), Toast.LENGTH_LONG).show()); activity.runOnUiThread(() -> Toasty.warning(activity, activity.getString(R.string.toast_error), Toast.LENGTH_LONG).show());
} }

View file

@ -959,14 +959,14 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
} }
if (description != null && description.trim().length() > 0) { if (description != null && description.trim().length() > 0) {
if (url != null && !description.contains(url)) { if (url != null && !description.contains(url)) {
statusList.get(position).text += url + "\n"; statusList.get(position).text += url + "\n>";
} }
statusList.get(position).text += ">" + description + "\n\n"; statusList.get(position).text += description + "\n\n";
} else if (content != null && content.trim().length() > 0) { } else if (content != null && content.trim().length() > 0) {
if (!content.contains(url)) { if (!content.contains(url)) {
statusList.get(position).text += url + "\n"; statusList.get(position).text += url + "\n>";
} }
statusList.get(position).text += ">" + content + "\n\n"; statusList.get(position).text += content + "\n\n";
} else { } else {
statusList.get(position).text += url + "\n\n"; statusList.get(position).text += url + "\n\n";
} }