当前位置: 首页>>代码示例>>Java>>正文


Java VerifiedMessage.VerifiedState方法代码示例

本文整理汇总了Java中org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage.VerifiedState方法的典型用法代码示例。如果您正苦于以下问题:Java VerifiedMessage.VerifiedState方法的具体用法?Java VerifiedMessage.VerifiedState怎么用?Java VerifiedMessage.VerifiedState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage的用法示例。


在下文中一共展示了VerifiedMessage.VerifiedState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRun

import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage; //导入方法依赖的package包/类
@Override
public void onRun() throws IOException, UntrustedIdentityException {
  try {
    if (!TextSecurePreferences.isMultiDevice(context)) {
      Log.w(TAG, "Not multi device...");
      return;
    }

    if (destination == null) {
      Log.w(TAG, "No destination...");
      return;
    }

    String                        canonicalDestination = Util.canonicalizeNumber(context, destination);
    VerifiedMessage.VerifiedState verifiedState        = getVerifiedState(verifiedStatus);
    SignalServiceMessageSender    messageSender        = messageSenderFactory.create();
    VerifiedMessage               verifiedMessage      = new VerifiedMessage(canonicalDestination, new IdentityKey(identityKey, 0), verifiedState, timestamp);

    messageSender.sendMessage(SignalServiceSyncMessage.forVerified(verifiedMessage));
  } catch (InvalidNumberException | InvalidKeyException e) {
    throw new IOException(e);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:MultiDeviceVerifiedUpdateJob.java

示例2: getVerifiedMessage

import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage; //导入方法依赖的package包/类
private Optional<VerifiedMessage> getVerifiedMessage(Recipient recipient, Optional<IdentityDatabase.IdentityRecord> identity) throws InvalidNumberException {
  if (!identity.isPresent()) return Optional.absent();

  String      destination = Util.canonicalizeNumber(context, recipient.getNumber());
  IdentityKey identityKey = identity.get().getIdentityKey();

  VerifiedMessage.VerifiedState state;

  switch (identity.get().getVerifiedStatus()) {
    case VERIFIED:   state = VerifiedMessage.VerifiedState.VERIFIED;   break;
    case UNVERIFIED: state = VerifiedMessage.VerifiedState.UNVERIFIED; break;
    case DEFAULT:    state = VerifiedMessage.VerifiedState.DEFAULT;    break;
    default: throw new AssertionError("Unknown state: " + identity.get().getVerifiedStatus());
  }

  return Optional.of(new VerifiedMessage(destination, identityKey, state, System.currentTimeMillis()));
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:18,代码来源:MultiDeviceContactUpdateJob.java

示例3: getVerifiedState

import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage; //导入方法依赖的package包/类
private VerifiedMessage.VerifiedState getVerifiedState(VerifiedStatus status) {
  VerifiedMessage.VerifiedState verifiedState;

  switch (status) {
    case DEFAULT:    verifiedState = VerifiedMessage.VerifiedState.DEFAULT;    break;
    case VERIFIED:   verifiedState = VerifiedMessage.VerifiedState.VERIFIED;   break;
    case UNVERIFIED: verifiedState = VerifiedMessage.VerifiedState.UNVERIFIED; break;
    default: throw new AssertionError("Unknown status: " + verifiedStatus);
  }

  return verifiedState;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:13,代码来源:MultiDeviceVerifiedUpdateJob.java


注:本文中的org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage.VerifiedState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。