Inline publish address validation error. Increase image upload request timeout.
This commit is contained in:
parent
94c3f67fe5
commit
8f39ad6d32
4 changed files with 39 additions and 2 deletions
|
@ -9,6 +9,7 @@ import org.json.JSONObject;
|
|||
import java.io.IOException;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.lbry.browser.exceptions.LbryResponseException;
|
||||
import io.lbry.browser.utils.Helper;
|
||||
|
@ -50,7 +51,10 @@ public class UploadImageTask extends AsyncTask<Void, Void, String> {
|
|||
addFormDataPart("file", fileName, RequestBody.create(file, MediaType.parse(fileType))).
|
||||
build();
|
||||
Request request = new Request.Builder().url("https://spee.ch/api/claim/publish").post(body).build();
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
OkHttpClient client = new OkHttpClient.Builder().
|
||||
writeTimeout(300, TimeUnit.SECONDS).
|
||||
readTimeout(300, TimeUnit.SECONDS).
|
||||
build();
|
||||
Response response = client.newCall(request).execute();
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
if (json.has("success") && Helper.getJSONBoolean("success", false, json)) {
|
||||
|
|
|
@ -152,6 +152,7 @@ public class PublishFormFragment extends BaseFragment implements
|
|||
private TextInputLayout layoutOtherLicenseDescription;
|
||||
private View inlineDepositBalanceContainer;
|
||||
private TextView inlineDepositBalanceValue;
|
||||
private TextView textInlineAddressInvalid;
|
||||
|
||||
private View linkPublishCancel;
|
||||
private MaterialButton buttonPublish;
|
||||
|
@ -198,6 +199,7 @@ public class PublishFormFragment extends BaseFragment implements
|
|||
noTagsView = root.findViewById(R.id.form_no_added_tags);
|
||||
noTagResultsView = root.findViewById(R.id.form_no_tag_results);
|
||||
|
||||
textInlineAddressInvalid = root.findViewById(R.id.publish_form_inline_address_invalid);
|
||||
inlineDepositBalanceContainer = root.findViewById(R.id.publish_form_inline_balance_container);
|
||||
inlineDepositBalanceValue = root.findViewById(R.id.publish_form_inline_balance_value);
|
||||
|
||||
|
@ -314,6 +316,25 @@ public class PublishFormFragment extends BaseFragment implements
|
|||
}
|
||||
});
|
||||
|
||||
inputAddress.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
String value = Helper.getValue(charSequence);
|
||||
boolean invalid = !Helper.isNullOrEmpty(value) && !LbryUri.isNameValid(value);
|
||||
Helper.setViewVisibility(textInlineAddressInvalid, invalid ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
inputDeposit.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(View view, boolean hasFocus) {
|
||||
|
|
|
@ -44,7 +44,7 @@ public class LbryUri {
|
|||
}
|
||||
|
||||
public static boolean isNameValid(String name) {
|
||||
return !name.matches(REGEX_INVALID_URI);
|
||||
return !Pattern.compile(REGEX_INVALID_URI).matcher(name).find();
|
||||
}
|
||||
|
||||
public static LbryUri tryParse(String url) {
|
||||
|
|
|
@ -377,6 +377,18 @@
|
|||
android:textSize="14sp" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/publish_form_inline_address_invalid"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:fontFamily="@font/inter"
|
||||
android:text="@string/address_invalid_characters"
|
||||
android:textColor="@color/red"
|
||||
android:textFontWeight="300"
|
||||
android:textSize="12sp"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue