Fix 'Suggested Title' bug (#1120)

- Fixed issue where a post's suggested titles would fail to generate

Co-authored-by: Kurian Vithayathil <no.reply@github.com>
This commit is contained in:
Kurian Vithayathil 2022-09-21 01:56:26 -04:00 committed by GitHub
parent 1108d41eed
commit 0a18220998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ import android.os.Handler;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.webkit.URLUtil;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
@ -351,10 +352,10 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
suggestTitleButton.setOnClickListener(view -> {
Toast.makeText(this, R.string.please_wait, Toast.LENGTH_SHORT).show();
String url = linkEditText.getText().toString().trim();
if (!url.startsWith("https://") || !url.startsWith("http://")) {
if (!URLUtil.isHttpsUrl(url) && !URLUtil.isHttpUrl(url)) {
url = "https://" + url;
}
new Retrofit.Builder()
mRetrofit.newBuilder()
.baseUrl("http://localhost/")
.addConverterFactory(ScalarsConverterFactory.create())
.build().create(TitleSuggestion.class).getHtml(url).enqueue(new Callback<String>() {