Exemplo n.º 1
0
  public AbsCallActor(ModuleContext context) {
    super(context);

    this.callManager = context.getCallsModule().getCallManager();
    this.callViewModels = context().getCallsModule().getCallViewModels();
    this.selfSettings = new PeerSettings();
    this.selfSettings.setIsPreConnectionEnabled(WebRTC.isSupportsPreConnections());
  }
Exemplo n.º 2
0
  /**
   * INTERNAL API Create User View Model
   *
   * @param user Initial User value
   * @param modules im.actor.android.modules reference
   */
  public UserVM(@NotNull User user, @NotNull ModuleContext modules) {
    super(user);

    id = user.getUid();
    sex = user.getSex();
    isBot = user.isBot();
    name = new StringValueModel("user." + id + ".name", user.getName());
    localName = new StringValueModel("user." + id + ".local_name", user.getLocalName());
    serverName = new StringValueModel("user." + id + ".server_name", user.getServerName());
    nick = new StringValueModel("user." + id + ".nick", user.getNick());
    about = new StringValueModel("user." + id + ".about", user.getAbout());
    avatar = new AvatarValueModel("user." + id + ".avatar", user.getAvatar());
    isContact =
        new BooleanValueModel(
            "user." + id + ".contact", modules.getContactsModule().isUserContact(id));
    isInPhoneBook =
        new BooleanValueModel(
            "user." + id + ".in_pb", modules.getContactsModule().isUserInPhoneBook(id));
    isBlocked = new BooleanValueModel("user." + id + ".blocked", user.isBlocked());
    isVerified = new BooleanValueModel("user." + id + ".is_verified", user.isVerified());
    timeZone = new StringValueModel("user." + id + ".time_zone", user.getTimeZone());
    presence =
        new ValueModelUserPresence(
            "user." + id + ".presence", new UserPresence(UserPresence.State.UNKNOWN));
    phones = new ValueModelUserPhone("user." + id + ".phones", buildPhones(user.getRecords()));
    emails = new ValueModelUserEmail("user." + id + ".emails", buildEmails(user.getRecords()));
    links = new ValueModelUserLink("user." + id + ".links", buildLinks(user.getRecords()));
    contacts =
        new ValueModelContactRecord(
            "user." + id + ".contacts", new ArrayListContactRecord(user.getRecords()));
    botCommands =
        new ValueModelBotCommands(
            "user." + id + ".bot_commands", new ArrayListBotCommands(user.getCommands()));
    // Notify about presence change every minute as text representation can change
    presenceTimer =
        new CommonTimer(
            new Runnable() {
              @Override
              public void run() {
                presence.forceNotify();
                presenceTimer.schedule(PRESENCE_UPDATE_DELAY);
              }
            });
    presenceTimer.schedule(PRESENCE_UPDATE_DELAY);
  }
Exemplo n.º 3
0
 public UploadTask(
     long rid, String descriptor, String fileName, ActorRef manager, ModuleContext context) {
   super(context);
   this.LOG = context.getConfiguration().isEnableFilesLogging();
   this.rid = rid;
   this.fileName = fileName;
   this.descriptor = descriptor;
   this.manager = manager;
   this.TAG = "UploadTask{" + rid + "}";
 }
Exemplo n.º 4
0
  public SettingsModule(ModuleContext context) {
    super(context);

    String platformType;
    switch (context.getConfiguration().getPlatformType()) {
      case ANDROID:
        platformType = "android";
        break;
      case IOS:
        platformType = "ios";
        break;
      case WEB:
        platformType = "web";
        break;
      default:
      case GENERIC:
        platformType = "generic";
        break;
    }

    String deviceType;
    switch (context.getConfiguration().getDeviceCategory()) {
      case TABLET:
        deviceType = "tablet";
        break;
      case DESKTOP:
        deviceType = "desktop";
        break;
      case MOBILE:
        deviceType = "mobile";
        break;
      default:
        deviceType = "generic";
        break;
    }

    // Platform+Device specific settings
    KEY_SOUND_EFFECTS = "app." + platformType + "" + deviceType + ".tones_enabled";
    KEY_CHAT_SEND_BY_ENTER = "app." + platformType + "" + deviceType + ".send_by_enter";
    KEY_MARKDOWN_ENABLED = "app." + platformType + "" + deviceType + ".use_markdown";
    KEY_CHAT_TEXT_SIZE = "app." + platformType + "." + deviceType + ".text_size";

    // Device-type notification settings
    KEY_NOTIFICATION_ENABLED = "category." + deviceType + ".notification.enabled";
    KEY_NOTIFICATION_SOUND_ENABLED = "category." + deviceType + ".notification.sound.enabled";
    KEY_NOTIFICATION_VIBRATION = "category." + deviceType + ".notification.vibration.enabled";
    KEY_NOTIFICATION_TEXT = "category." + deviceType + ".notification.show_text";
    KEY_NOTIFICATION_CHAT_PREFIX = "category." + deviceType + ".notification.chat.";

    KEY_NOTIFICATION_IN_APP_ENABLED = "category." + deviceType + ".in_app.enabled";
    KEY_NOTIFICATION_IN_APP_SOUND = "category." + deviceType + ".in_app.sound.enabled";
    KEY_NOTIFICATION_IN_APP_VIBRATION = "category." + deviceType + ".in_app.vibration.enabled";

    // Account-wide notification settings
    KEY_NOTIFICATION_SOUND = "account.notification.sound";
    KEY_NOTIFICATION_GROUP_ENABLED = "account.notifications.group.enabled";
    KEY_NOTIFICATION_GROUP_ONLY_MENTIONS = "account.notifications.group.mentions";

    // Hints
    KEY_RENAME_HINT_SHOWN = "hint.contact.rename";

    KEY_WALLPAPPER = "wallpaper.uri";
    KEY_PRIVACY = "privacy.last_seen";
  }