mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-21 08:21:30 +00:00
Add link preview, GIF & open group metadata warnings
This commit is contained in:
parent
e6cd0322c2
commit
0b2986a8a9
@ -40,7 +40,19 @@
|
|||||||
android:id="@+id/joinPublicChatButton"
|
android:id="@+id/joinPublicChatButton"
|
||||||
android:layout_width="196dp"
|
android:layout_width="196dp"
|
||||||
android:layout_height="@dimen/medium_button_height"
|
android:layout_height="@dimen/medium_button_height"
|
||||||
android:layout_marginBottom="@dimen/medium_spacing"
|
|
||||||
android:text="Next" />
|
android:text="Next" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
|
android:layout_marginBottom="@dimen/medium_spacing"
|
||||||
|
android:textSize="@dimen/very_small_font_size"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:text="Open groups can be joined by anyone and do not provide full metadata protection" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -22,7 +22,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="@dimen/small_spacing"
|
||||||
android:layout_marginRight="@dimen/large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:textSize="@dimen/small_font_size"
|
android:textSize="@dimen/small_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
@ -40,7 +40,19 @@
|
|||||||
android:id="@+id/joinPublicChatButton"
|
android:id="@+id/joinPublicChatButton"
|
||||||
android:layout_width="196dp"
|
android:layout_width="196dp"
|
||||||
android:layout_height="@dimen/medium_button_height"
|
android:layout_height="@dimen/medium_button_height"
|
||||||
android:layout_marginBottom="@dimen/medium_spacing"
|
|
||||||
android:text="Next" />
|
android:text="Next" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
|
android:layout_marginTop="@dimen/small_spacing"
|
||||||
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
|
android:layout_marginBottom="@dimen/small_spacing"
|
||||||
|
android:textSize="@dimen/very_small_font_size"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:text="Open groups can be joined by anyone and do not provide full metadata protection" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -157,16 +157,16 @@ import org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository;
|
|||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreviewUtil;
|
import org.thoughtcrime.securesms.linkpreview.LinkPreviewUtil;
|
||||||
import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel;
|
import org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel;
|
||||||
import org.thoughtcrime.securesms.logging.Log;
|
import org.thoughtcrime.securesms.logging.Log;
|
||||||
import org.thoughtcrime.securesms.loki.redesign.messaging.LokiAPIUtilities;
|
|
||||||
import org.thoughtcrime.securesms.loki.LokiMessageDatabase;
|
import org.thoughtcrime.securesms.loki.LokiMessageDatabase;
|
||||||
import org.thoughtcrime.securesms.loki.LokiThreadDatabase;
|
import org.thoughtcrime.securesms.loki.LokiThreadDatabase;
|
||||||
import org.thoughtcrime.securesms.loki.LokiThreadDatabaseDelegate;
|
import org.thoughtcrime.securesms.loki.LokiThreadDatabaseDelegate;
|
||||||
import org.thoughtcrime.securesms.loki.redesign.messaging.LokiUserDatabase;
|
|
||||||
import org.thoughtcrime.securesms.loki.MultiDeviceUtilities;
|
import org.thoughtcrime.securesms.loki.MultiDeviceUtilities;
|
||||||
import org.thoughtcrime.securesms.loki.redesign.views.SessionRestoreBannerView;
|
|
||||||
import org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity;
|
import org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity;
|
||||||
|
import org.thoughtcrime.securesms.loki.redesign.messaging.LokiAPIUtilities;
|
||||||
|
import org.thoughtcrime.securesms.loki.redesign.messaging.LokiUserDatabase;
|
||||||
import org.thoughtcrime.securesms.loki.redesign.views.FriendRequestViewDelegate;
|
import org.thoughtcrime.securesms.loki.redesign.views.FriendRequestViewDelegate;
|
||||||
import org.thoughtcrime.securesms.loki.redesign.views.MentionCandidateSelectionView;
|
import org.thoughtcrime.securesms.loki.redesign.views.MentionCandidateSelectionView;
|
||||||
|
import org.thoughtcrime.securesms.loki.redesign.views.SessionRestoreBannerView;
|
||||||
import org.thoughtcrime.securesms.mediasend.Media;
|
import org.thoughtcrime.securesms.mediasend.Media;
|
||||||
import org.thoughtcrime.securesms.mediasend.MediaSendActivity;
|
import org.thoughtcrime.securesms.mediasend.MediaSendActivity;
|
||||||
import org.thoughtcrime.securesms.mms.AttachmentManager;
|
import org.thoughtcrime.securesms.mms.AttachmentManager;
|
||||||
@ -658,9 +658,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
break;
|
break;
|
||||||
case PICK_GIF:
|
case PICK_GIF:
|
||||||
setMedia(data.getData(),
|
setMedia(data.getData(),
|
||||||
MediaType.GIF,
|
MediaType.GIF,
|
||||||
data.getIntExtra(GiphyActivity.EXTRA_WIDTH, 0),
|
data.getIntExtra(GiphyActivity.EXTRA_WIDTH, 0),
|
||||||
data.getIntExtra(GiphyActivity.EXTRA_HEIGHT, 0));
|
data.getIntExtra(GiphyActivity.EXTRA_HEIGHT, 0));
|
||||||
break;
|
break;
|
||||||
case SMS_DEFAULT:
|
case SMS_DEFAULT:
|
||||||
initializeSecurity(isSecureText, isDefaultSms);
|
initializeSecurity(isSecureText, isDefaultSms);
|
||||||
@ -1931,7 +1931,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
case AttachmentTypeSelector.TAKE_PHOTO:
|
case AttachmentTypeSelector.TAKE_PHOTO:
|
||||||
attachmentManager.capturePhoto(this, TAKE_PHOTO); break;
|
attachmentManager.capturePhoto(this, TAKE_PHOTO); break;
|
||||||
case AttachmentTypeSelector.ADD_GIF:
|
case AttachmentTypeSelector.ADD_GIF:
|
||||||
AttachmentManager.selectGif(this, PICK_GIF, !isSecureText); break;
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle("Search GIFs?");
|
||||||
|
builder.setMessage("You will not have full metadata protection when sending GIFs.");
|
||||||
|
builder.setPositiveButton("OK", (dialog, which) -> {
|
||||||
|
AttachmentManager.selectGif(this, PICK_GIF, !isSecureText);
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss() );
|
||||||
|
builder.create().show();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +216,25 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
|||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
boolean enabled = (boolean)newValue;
|
boolean enabled = (boolean)newValue;
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
|
||||||
|
builder.setTitle("Enable Link Previews?");
|
||||||
|
builder.setMessage("You will not have full metadata protection when sending or receiving link previews.");
|
||||||
|
builder.setPositiveButton("OK", (dialog, which) -> dialog.dismiss());
|
||||||
|
builder.setNegativeButton("Cancel", (dialog, which) -> {
|
||||||
|
TextSecurePreferences.setLinkPreviewsEnabled(requireContext(), false);
|
||||||
|
((SwitchPreferenceCompat)AppProtectionPreferenceFragment.this.findPreference(TextSecurePreferences.LINK_PREVIEWS)).setChecked(false);
|
||||||
|
ApplicationContext.getInstance(requireContext())
|
||||||
|
.getJobManager()
|
||||||
|
.add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(requireContext()),
|
||||||
|
TextSecurePreferences.isTypingIndicatorsEnabled(requireContext()),
|
||||||
|
TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(requireContext()),
|
||||||
|
false));
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationContext.getInstance(requireContext())
|
ApplicationContext.getInstance(requireContext())
|
||||||
.getJobManager()
|
.getJobManager()
|
||||||
.add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(requireContext()),
|
.add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(requireContext()),
|
||||||
|
@ -370,6 +370,10 @@ public class TextSecurePreferences {
|
|||||||
return getBooleanPreference(context, LINK_PREVIEWS, false);
|
return getBooleanPreference(context, LINK_PREVIEWS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setLinkPreviewsEnabled(Context context, boolean enabled) {
|
||||||
|
setBooleanPreference(context, LINK_PREVIEWS, enabled);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isGifSearchInGridLayout(Context context) {
|
public static boolean isGifSearchInGridLayout(Context context) {
|
||||||
return getBooleanPreference(context, GIF_GRID_LAYOUT, false);
|
return getBooleanPreference(context, GIF_GRID_LAYOUT, false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user