當前位置: 首頁>>代碼示例>>Java>>正文


Java NotInDirectoryException類代碼示例

本文整理匯總了Java中org.thoughtcrime.securesms.database.NotInDirectoryException的典型用法代碼示例。如果您正苦於以下問題:Java NotInDirectoryException類的具體用法?Java NotInDirectoryException怎麽用?Java NotInDirectoryException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NotInDirectoryException類屬於org.thoughtcrime.securesms.database包,在下文中一共展示了NotInDirectoryException類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isPushDestination

import org.thoughtcrime.securesms.database.NotInDirectoryException; //導入依賴的package包/類
private static boolean isPushDestination(Context context, String destination) {
  TextSecureDirectory directory = TextSecureDirectory.getInstance(context);

  try {
    return directory.isSecureTextSupported(destination);
  } catch (NotInDirectoryException e) {
    try {
      SignalServiceAccountManager   accountManager = AccountManagerFactory.createManager(context);
      Optional<ContactTokenDetails> registeredUser = accountManager.getContact(destination);

      if (!registeredUser.isPresent()) {
        registeredUser = Optional.of(new ContactTokenDetails());
        registeredUser.get().setNumber(destination);
        directory.setNumber(registeredUser.get(), false);
        return false;
      } else {
        registeredUser.get().setNumber(destination);
        directory.setNumber(registeredUser.get(), true);
        return true;
      }
    } catch (IOException e1) {
      Log.w(TAG, e1);
      return false;
    }
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:27,代碼來源:MessageSender.java

示例2: isActiveInDirectory

import org.thoughtcrime.securesms.database.NotInDirectoryException; //導入依賴的package包/類
private static boolean isActiveInDirectory(Context context, Recipient recipient) {
  try {
    return TextSecureDirectory.getInstance(context)
                              .isSecureTextSupported(Util.canonicalizeNumber(context, recipient.getNumber()));
  } catch (NotInDirectoryException | InvalidNumberException e) {
    return false;
  }
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:9,代碼來源:GroupCreateActivity.java

示例3: isPushDestination

import org.thoughtcrime.securesms.database.NotInDirectoryException; //導入依賴的package包/類
private static boolean isPushDestination(Context context, String destination) {
  TextSecureDirectory directory = TextSecureDirectory.getInstance(context);

  try {
    return directory.isActiveNumber(destination);
  } catch (NotInDirectoryException e) {
    try {
      TextSecureAccountManager      accountManager = TextSecureCommunicationFactory.createManager(context);
      String                        contactToken   = DirectoryUtil.getDirectoryServerToken(destination);
      Optional<ContactTokenDetails> registeredUser = accountManager.getContact(contactToken);

      if (!registeredUser.isPresent()) {
        registeredUser = Optional.of(new ContactTokenDetails());
        registeredUser.get().setNumber(destination);
        directory.setNumber(registeredUser.get(), false);
        return false;
      } else {
        registeredUser.get().setNumber(destination);
        directory.setNumber(registeredUser.get(), true);
        return true;
      }
    } catch (IOException e1) {
      Log.w(TAG, e1);
      return false;
    }
  }
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:28,代碼來源:MessageSender.java


注:本文中的org.thoughtcrime.securesms.database.NotInDirectoryException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。