use of org.thoughtcrime.securesms.TransportOptions in project Signal-Android by WhisperSystems.
the class ShareRepository method isMmsSupported.
private boolean isMmsSupported(@NonNull Context context, @NonNull Attachment attachment) {
boolean canReadPhoneState = ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED;
if (!Util.isDefaultSmsProvider(context) || !canReadPhoneState || !Util.isMmsCapable(context)) {
return false;
}
TransportOptions options = new TransportOptions(context, true);
options.setDefaultTransport(TransportOption.Type.SMS);
MediaConstraints mmsConstraints = MediaConstraints.getMmsMediaConstraints(options.getSelectedTransport().getSimSubscriptionId().or(-1));
return mmsConstraints.isSatisfied(context, attachment) || mmsConstraints.canResize(attachment);
}
use of org.thoughtcrime.securesms.TransportOptions in project Signal-Android by signalapp.
the class MultiShareSender method resolveTransportOption.
@NonNull
public static TransportOption resolveTransportOption(@NonNull Context context, boolean forceSms) {
if (forceSms) {
TransportOptions options = new TransportOptions(context, false);
options.setDefaultTransport(TransportOption.Type.SMS);
return options.getSelectedTransport();
} else {
return TransportOptions.getPushTransportOption(context);
}
}
use of org.thoughtcrime.securesms.TransportOptions in project Signal-Android by signalapp.
the class ShareRepository method isMmsSupported.
private boolean isMmsSupported(@NonNull Context context, @NonNull Attachment attachment) {
boolean canReadPhoneState = ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED;
if (!Util.isDefaultSmsProvider(context) || !canReadPhoneState || !Util.isMmsCapable(context)) {
return false;
}
TransportOptions options = new TransportOptions(context, true);
options.setDefaultTransport(TransportOption.Type.SMS);
MediaConstraints mmsConstraints = MediaConstraints.getMmsMediaConstraints(options.getSelectedTransport().getSimSubscriptionId().or(-1));
return mmsConstraints.isSatisfied(context, attachment) || mmsConstraints.canResize(attachment);
}
use of org.thoughtcrime.securesms.TransportOptions in project Signal-Android by WhisperSystems.
the class MultiShareSender method resolveTransportOption.
@NonNull
public static TransportOption resolveTransportOption(@NonNull Context context, boolean forceSms) {
if (forceSms) {
TransportOptions options = new TransportOptions(context, false);
options.setDefaultTransport(TransportOption.Type.SMS);
return options.getSelectedTransport();
} else {
return TransportOptions.getPushTransportOption(context);
}
}
use of org.thoughtcrime.securesms.TransportOptions in project Signal-Android by WhisperSystems.
the class SendButton method initializeTransportOptions.
private TransportOptions initializeTransportOptions(boolean media) {
if (isInEditMode())
return null;
TransportOptions transportOptions = new TransportOptions(getContext(), media);
transportOptions.addOnTransportChangedListener(this);
setOnLongClickListener(this);
return transportOptions;
}
Aggregations