Search in sources :

Example 1 with TransportOptions

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);
}
Also used : MediaConstraints(org.thoughtcrime.securesms.mms.MediaConstraints) TransportOptions(org.thoughtcrime.securesms.TransportOptions)

Example 2 with TransportOptions

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);
    }
}
Also used : TransportOptions(org.thoughtcrime.securesms.TransportOptions) NonNull(androidx.annotation.NonNull)

Example 3 with TransportOptions

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);
}
Also used : MediaConstraints(org.thoughtcrime.securesms.mms.MediaConstraints) TransportOptions(org.thoughtcrime.securesms.TransportOptions)

Example 4 with TransportOptions

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);
    }
}
Also used : TransportOptions(org.thoughtcrime.securesms.TransportOptions) NonNull(androidx.annotation.NonNull)

Example 5 with TransportOptions

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;
}
Also used : TransportOptions(org.thoughtcrime.securesms.TransportOptions)

Aggregations

TransportOptions (org.thoughtcrime.securesms.TransportOptions)6 NonNull (androidx.annotation.NonNull)2 MediaConstraints (org.thoughtcrime.securesms.mms.MediaConstraints)2