Push some fixes
This commit is contained in:
parent
2850b2ed5a
commit
02b51f53da
|
@ -3,9 +3,11 @@ Added:
|
|||
- Push notifications for Friendica & GNU Social
|
||||
- Add follow/unfollow buttons for Pixelfed
|
||||
- View your own story (need to wait the endpoint)
|
||||
- Increase max bio chars to 500 for Pleroma
|
||||
|
||||
Fixed:
|
||||
- Proxy not applied with embedded videos
|
||||
- Fix no toots that remains displayed on Nitter timelines
|
||||
- Avoid to lose composed message when not sent
|
||||
- Notifications not pushed
|
||||
- Notifications not pushed
|
||||
- Fix some crashes
|
|
@ -63,6 +63,7 @@ import java.util.Map;
|
|||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.asynctasks.RetrieveAccountInfoAsyncTask;
|
||||
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
|
||||
import app.fedilab.android.asynctasks.UpdateCredentialAsyncTask;
|
||||
import app.fedilab.android.client.API;
|
||||
import app.fedilab.android.client.APIResponse;
|
||||
|
@ -248,8 +249,12 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
|
|||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (s.length() > 160) {
|
||||
String content = s.toString().substring(0, 160);
|
||||
int maxChar = 160;
|
||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA){
|
||||
maxChar = 500;
|
||||
}
|
||||
if (s.length() > maxChar) {
|
||||
String content = s.toString().substring(0, maxChar);
|
||||
set_profile_description.setText(content);
|
||||
set_profile_description.setSelection(set_profile_description.getText().length());
|
||||
Toasty.info(getApplicationContext(), getString(R.string.note_no_space), Toast.LENGTH_LONG).show();
|
||||
|
@ -348,14 +353,12 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
if (ContextCompat.checkSelfPermission(EditProfileActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(EditProfileActivity.this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE_PICTURE);
|
||||
return;
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(EditProfileActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(EditProfileActivity.this,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
|
||||
MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE_PICTURE);
|
||||
return;
|
||||
}
|
||||
|
||||
Intent getIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
|
@ -370,12 +373,14 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
|
|||
}
|
||||
});
|
||||
|
||||
Glide.with(set_profile_picture.getContext())
|
||||
.load(account.getAvatar())
|
||||
.into(set_profile_picture);
|
||||
Glide.with(set_header_picture.getContext())
|
||||
.load(account.getHeader())
|
||||
.into(set_header_picture);
|
||||
if( !EditProfileActivity.this.isFinishing()) {
|
||||
Glide.with(set_profile_picture.getContext())
|
||||
.load(account.getAvatar())
|
||||
.into(set_profile_picture);
|
||||
Glide.with(set_header_picture.getContext())
|
||||
.load(account.getHeader())
|
||||
.into(set_header_picture);
|
||||
}
|
||||
if (account.getHeader() == null || account.getHeader().contains("missing.png"))
|
||||
set_header_picture_overlay.setVisibility(View.VISIBLE);
|
||||
|
||||
|
|
|
@ -22,11 +22,15 @@ import android.util.Patterns;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import app.fedilab.android.client.HttpsConnection;
|
||||
import app.fedilab.android.helper.Helper;
|
||||
import app.fedilab.android.interfaces.OnRetrieveMetaDataInterface;
|
||||
|
@ -92,7 +96,12 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
Pattern imagePattern = Pattern.compile("meta[ a-zA-Z=\"'-]+property=[\"']og:image[\"']\\s+content=[\"']([^>]*)[\"']");
|
||||
try {
|
||||
if( !potentialUrl.startsWith("http")){
|
||||
potentialUrl = "http://" + potentialUrl;
|
||||
potentialUrl = "https://" + potentialUrl;
|
||||
}
|
||||
URLConnection conn = new URL(potentialUrl).openConnection();
|
||||
if (conn instanceof HttpsURLConnection) {
|
||||
error = true;
|
||||
return null;
|
||||
}
|
||||
String response = new HttpsConnection(this.contextWeakReference.get(), null).get(potentialUrl);
|
||||
Matcher matcherTitle = titlePattern.matcher(response);
|
||||
|
@ -113,18 +122,13 @@ public class RetrieveMetaDataAsyncTask extends AsyncTask<Void, Void, Void> {
|
|||
if (descriptionEncoded != null)
|
||||
description = Html.fromHtml(descriptionEncoded, Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
} else {
|
||||
//noinspection deprecation
|
||||
if (titleEncoded != null)
|
||||
title = Html.fromHtml(titleEncoded).toString();
|
||||
if (descriptionEncoded != null)
|
||||
description = Html.fromHtml(descriptionEncoded).toString();
|
||||
}
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException | HttpsConnection.HttpsConnectionException e) {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
} catch (IOException | IndexOutOfBoundsException e) {
|
||||
|
|
|
@ -2713,14 +2713,9 @@ public class API {
|
|||
} catch (HttpsConnection.HttpsConnectionException e) {
|
||||
setError(e.getStatusCode(), e);
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (KeyManagementException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
setDefaultError(e);
|
||||
}
|
||||
apiResponse.setStatuses(statuses);
|
||||
return apiResponse;
|
||||
|
|
|
@ -231,20 +231,22 @@ public class Notification implements Parcelable {
|
|||
for (int startPosition = -1; (startPosition = contentSpan.toString().indexOf(targetedEmoji, startPosition + 1)) != -1; startPosition++) {
|
||||
final int endPosition = startPosition + targetedEmoji.length();
|
||||
if (endPosition <= contentSpan.toString().length() && endPosition >= startPosition) {
|
||||
ImageSpan imageSpan;
|
||||
if (!disableAnimatedEmoji) {
|
||||
resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context));
|
||||
resource.setVisible(true, true);
|
||||
imageSpan = new ImageSpan(resource);
|
||||
} else {
|
||||
Bitmap bitmap = drawableToBitmap(resource);
|
||||
imageSpan = new ImageSpan(context,
|
||||
Bitmap.createScaledBitmap(bitmap, (int) Helper.convertDpToPixel(20, context),
|
||||
(int) Helper.convertDpToPixel(20, context), false));
|
||||
}
|
||||
contentSpan.setSpan(
|
||||
imageSpan, startPosition,
|
||||
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
try {
|
||||
ImageSpan imageSpan;
|
||||
if (!disableAnimatedEmoji) {
|
||||
resource.setBounds(0, 0, (int) Helper.convertDpToPixel(20, context), (int) Helper.convertDpToPixel(20, context));
|
||||
resource.setVisible(true, true);
|
||||
imageSpan = new ImageSpan(resource);
|
||||
} else {
|
||||
Bitmap bitmap = drawableToBitmap(resource);
|
||||
imageSpan = new ImageSpan(context,
|
||||
Bitmap.createScaledBitmap(bitmap, (int) Helper.convertDpToPixel(20, context),
|
||||
(int) Helper.convertDpToPixel(20, context), false));
|
||||
}
|
||||
contentSpan.setSpan(
|
||||
imageSpan, startPosition,
|
||||
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}catch (Exception ignored){}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,6 +275,7 @@ public class HttpsConnection {
|
|||
|
||||
|
||||
URL url = new URL(urlConnection);
|
||||
|
||||
if (proxy != null)
|
||||
httpsURLConnection = (HttpsURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue