Пример #1
0
  private void setChatterFacebookIds() {
    if (chatterFacebookIds == null) {
      chatterFacebookIds = new ArrayList<String>();
    }

    for (Chatter chatter : chatters) {
      // Send the notif to everyone except yourself
      if (!chatter.getFacebookId().equals(HushApp.getCurrentUser().getFacebookId())) {
        chatterFacebookIds.add(chatter.getFacebookId());
      }
    }
  }
Пример #2
0
  @Override
  protected void onResume() {
    super.onResume();

    chat = HushApp.getCurrentUser().getCurrentChat();
    chat.fetchChattersFromParse(this);
    chat.fetchMessagesFromParse(maxMessages, this);

    tvChatTopic.setText(chat.getTopic());

    // Register as broadcast receiver
    LocalBroadcastManager.getInstance(this)
        .registerReceiver(
            pushNotifReceiver, new IntentFilter(Constants.broadcastLocalMessageAction));

    updateMessagesAdapterFromDisk();
  }
Пример #3
0
  public void onSendClicked(View v) {
    String content = etChatWindowMessage.getText().toString();

    Message message = new Message(content, HushApp.getCurrentUser().getFacebookId());
    message.saveToParse();

    chat.addMessage(message);
    chat.saveToParse();

    // Save to parse and send a push notification
    chat.saveToParseWithPush(
        this,
        HushPushNotifReceiver.PushType.NEW_MESSAGE.toString(),
        chat.getTopic() + "|" + message.getContent(),
        getChatterFacebookIds());

    adapterMessages.add(message);

    etChatWindowMessage.setText("");
  }