mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-18 00:39:34 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f7ac59c6f | ||
|
|
0e06e2de97 | ||
|
|
ed1d411bde | ||
|
|
8933e03c02 | ||
|
|
2c48155769 | ||
|
|
16e258bdbc | ||
|
|
c418ca1890 |
@@ -2,8 +2,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="org.thoughtcrime.securesms"
|
||||
android:versionCode="148"
|
||||
android:versionName="2.26.2">
|
||||
android:versionCode="151"
|
||||
android:versionName="2.26.5">
|
||||
|
||||
<uses-sdk tools:overrideLibrary="com.amulyakhare.textdrawable,com.astuetz.pagerslidingtabstrip,pl.tajchert.waitingdots,com.h6ah4i.android.multiselectlistpreferencecompat"/>
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
||||
public static final int PUSH_DECRYPT_SERIAL_ID_VERSION = 131;
|
||||
public static final int MIGRATE_SESSION_PLAINTEXT = 136;
|
||||
public static final int CONTACTS_ACCOUNT_VERSION = 136;
|
||||
public static final int MEDIA_DOWNLOAD_CONTROLS_VERSION = 146;
|
||||
public static final int MEDIA_DOWNLOAD_CONTROLS_VERSION = 151;
|
||||
|
||||
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
||||
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
||||
@@ -233,8 +233,8 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
||||
final Reader reader = mmsDb.readerFor(masterSecret, mmsDb.getMessage(part.getMmsId()));
|
||||
final MessageRecord record = reader.getNext();
|
||||
|
||||
if (part.getContentLocation() == null) {
|
||||
Log.w(TAG, "corrected a pending self-sent media part " + part.getPartId() + ".");
|
||||
if (part.getDataUri() != null) {
|
||||
Log.w(TAG, "corrected a pending media part " + part.getPartId() + "that already had data.");
|
||||
partDb.setTransferState(part.getMmsId(), part.getPartId(), PartDatabase.TRANSFER_PROGRESS_DONE);
|
||||
} else if (record != null && !record.isOutgoing() && record.isPush()) {
|
||||
Log.w(TAG, "queuing new attachment download job for incoming push part " + part.getPartId() + ".");
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SmsSendtoActivity extends Activity {
|
||||
destination = getDestinationForView(original);
|
||||
}
|
||||
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(this, destination.getDestination(), false);
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(this, destination.getDestination(), true);
|
||||
long threadId = DatabaseFactory.getThreadDatabase(this).getThreadIdIfExistsFor(recipients);
|
||||
|
||||
final Intent nextIntent;
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients.RecipientsModifiedListener;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -49,7 +50,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author Moxie Marlinspike
|
||||
*/
|
||||
public class PushRecipientsPanel extends RelativeLayout {
|
||||
public class PushRecipientsPanel extends RelativeLayout implements RecipientsModifiedListener {
|
||||
private final String TAG = PushRecipientsPanel.class.getSimpleName();
|
||||
private RecipientsPanelChangedListener panelChangeListener;
|
||||
|
||||
@@ -90,7 +91,7 @@ public class PushRecipientsPanel extends RelativeLayout {
|
||||
|
||||
public Recipients getRecipients() throws RecipientFormattingException {
|
||||
String rawText = recipientsText.getText().toString();
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, false);
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, true);
|
||||
|
||||
if (recipients.isEmpty())
|
||||
throw new RecipientFormattingException("Recipient List Is Empty!");
|
||||
@@ -129,6 +130,7 @@ public class PushRecipientsPanel extends RelativeLayout {
|
||||
} catch (RecipientFormattingException e) {
|
||||
recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList<Recipient>(), true);
|
||||
}
|
||||
recipients.addListener(this);
|
||||
|
||||
recipientsText.setAdapter(new RecipientsAdapter(this.getContext()));
|
||||
recipientsText.populate(recipients);
|
||||
@@ -149,6 +151,10 @@ public class PushRecipientsPanel extends RelativeLayout {
|
||||
});
|
||||
}
|
||||
|
||||
@Override public void onModified(Recipients recipients) {
|
||||
recipientsText.populate(recipients);
|
||||
}
|
||||
|
||||
private class FocusChangedListener implements View.OnFocusChangeListener {
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus && (panelChangeListener != null)) {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -33,6 +32,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFormattingException;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients.RecipientsModifiedListener;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
*
|
||||
* @author Moxie Marlinspike
|
||||
*/
|
||||
public class SingleRecipientPanel extends RelativeLayout {
|
||||
public class SingleRecipientPanel extends RelativeLayout implements RecipientsModifiedListener {
|
||||
private final String TAG = SingleRecipientPanel.class.getSimpleName();
|
||||
private RecipientsPanelChangedListener panelChangeListener;
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SingleRecipientPanel extends RelativeLayout {
|
||||
|
||||
public Recipients getRecipients() throws RecipientFormattingException {
|
||||
String rawText = recipientsText.getText().toString();
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, false);
|
||||
Recipients recipients = RecipientFactory.getRecipientsFromString(getContext(), rawText, true);
|
||||
|
||||
if (recipients.isEmpty())
|
||||
throw new RecipientFormattingException("Recipient List Is Empty!");
|
||||
@@ -132,6 +132,7 @@ public class SingleRecipientPanel extends RelativeLayout {
|
||||
} catch (RecipientFormattingException e) {
|
||||
recipients = RecipientFactory.getRecipientsFor(getContext(), new LinkedList<Recipient>(), true);
|
||||
}
|
||||
recipients.addListener(this);
|
||||
|
||||
recipientsText.setAdapter(new RecipientsAdapter(this.getContext()));
|
||||
recipientsText.populate(recipients);
|
||||
@@ -152,6 +153,10 @@ public class SingleRecipientPanel extends RelativeLayout {
|
||||
});
|
||||
}
|
||||
|
||||
@Override public void onModified(Recipients recipients) {
|
||||
recipientsText.populate(recipients);
|
||||
}
|
||||
|
||||
private class FocusChangedListener implements OnFocusChangeListener {
|
||||
public void onFocusChange(View v, boolean hasFocus) {
|
||||
if (!hasFocus && (panelChangeListener != null)) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.annotation.NonNull;
|
||||
@@ -79,6 +78,9 @@ public class ThumbnailView extends FrameLayout {
|
||||
progress = (ProgressWheel) findViewById(R.id.progress_wheel);
|
||||
downloadButton = (ImageButton) findViewById(R.id.download_button);
|
||||
|
||||
setOnClickListener(new ThumbnailClickDispatcher());
|
||||
downloadButton.setOnClickListener(new DownloadClickDispatcher());
|
||||
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ThumbnailView, 0, 0);
|
||||
backgroundColorHint = typedArray.getColor(0, Color.BLACK);
|
||||
@@ -184,12 +186,6 @@ public class ThumbnailView extends FrameLayout {
|
||||
|
||||
this.slide = slide;
|
||||
buildGlideRequest(slide, masterSecret).into(image);
|
||||
if (this.slide.getTransferProgress() == PartDatabase.TRANSFER_PROGRESS_DONE) {
|
||||
setOnClickListener(new ThumbnailClickDispatcher(thumbnailClickListener, slide));
|
||||
} else {
|
||||
setOnClickListener(null);
|
||||
}
|
||||
downloadButton.setOnClickListener(new ThumbnailClickDispatcher(downloadClickListener, slide));
|
||||
}
|
||||
|
||||
public void setThumbnailClickListener(ThumbnailClickListener listener) {
|
||||
@@ -230,7 +226,7 @@ public class ThumbnailView extends FrameLayout {
|
||||
builder = buildPlaceholderGlideRequest(slide);
|
||||
}
|
||||
|
||||
if (slide.isInProgress() && !hideControls) {
|
||||
if (slide.getTransferProgress() != PartDatabase.TRANSFER_PROGRESS_DONE && !hideControls) {
|
||||
return builder;
|
||||
} else {
|
||||
return builder.error(R.drawable.ic_missing_thumbnail_picture);
|
||||
@@ -332,20 +328,23 @@ public class ThumbnailView extends FrameLayout {
|
||||
void onClick(View v, Slide slide);
|
||||
}
|
||||
|
||||
private static class ThumbnailClickDispatcher implements View.OnClickListener {
|
||||
private ThumbnailClickListener listener;
|
||||
private Slide slide;
|
||||
|
||||
public ThumbnailClickDispatcher(ThumbnailClickListener listener, Slide slide) {
|
||||
this.listener = listener;
|
||||
this.slide = slide;
|
||||
}
|
||||
|
||||
private class ThumbnailClickDispatcher implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (listener != null)
|
||||
if (thumbnailClickListener != null &&
|
||||
slide != null &&
|
||||
slide.getPart().getDataUri() != null)
|
||||
{
|
||||
listener.onClick(view, slide);
|
||||
thumbnailClickListener.onClick(view, slide);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DownloadClickDispatcher implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (downloadClickListener != null && slide != null) {
|
||||
downloadClickListener.onClick(view, slide);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,6 +298,11 @@ public class PartDatabase extends Database {
|
||||
|
||||
if (!cursor.isNull(sizeColumn))
|
||||
part.setDataSize(cursor.getLong(cursor.getColumnIndexOrThrow(SIZE)));
|
||||
|
||||
int dataColumn = cursor.getColumnIndexOrThrow(DATA);
|
||||
|
||||
if (!cursor.isNull(dataColumn))
|
||||
part.setDataUri(PartAuthority.getPartUri(part.getPartId()));
|
||||
}
|
||||
|
||||
private ContentValues getContentValuesForPart(PduPart part) throws MmsException {
|
||||
@@ -440,8 +445,6 @@ public class PartDatabase extends Database {
|
||||
|
||||
getPartValues(part, cursor);
|
||||
|
||||
part.setDataUri(PartAuthority.getPartUri(part.getPartId()));
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,10 @@ public class AttachmentDownloadJob extends MasterSecretJob implements Injectable
|
||||
Log.w(TAG, "part no longer exists.");
|
||||
return;
|
||||
}
|
||||
if (part.getDataUri() != null) {
|
||||
Log.w(TAG, "part was already downloaded.");
|
||||
return;
|
||||
}
|
||||
|
||||
Log.w(TAG, "Downloading push part " + partId);
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType {
|
||||
database.markAsPush(messageId);
|
||||
database.markAsSecure(messageId);
|
||||
database.markAsSent(messageId, "push".getBytes(), 0);
|
||||
markPartsUploaded(messageId, message.getBody());
|
||||
} catch (InvalidNumberException | RecipientFormattingException | UndeliverableMessageException e) {
|
||||
Log.w(TAG, e);
|
||||
database.markAsSentFailed(messageId);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class ImageSlide extends Slide {
|
||||
|
||||
@Override
|
||||
public @DrawableRes int getPlaceholderRes(Theme theme) {
|
||||
return R.drawable.ic_missing_thumbnail_picture;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -174,7 +174,10 @@ public class MessageNotifier {
|
||||
}
|
||||
|
||||
updateBadge(context, notificationState.getMessageCount());
|
||||
scheduleReminder(context, reminderCount);
|
||||
|
||||
if (signal) {
|
||||
scheduleReminder(context, reminderCount);
|
||||
}
|
||||
} finally {
|
||||
if (telcoCursor != null) telcoCursor.close();
|
||||
if (pushCursor != null) pushCursor.close();
|
||||
|
||||
Reference in New Issue
Block a user