use of im.actor.runtime.annotations.Verified in project actor-platform by actorapp.
the class OwnTypingActor method onTyping.
@Verified
private void onTyping(Peer peer) {
if (ActorTime.currentTime() - lastTypingTime < TYPING_DELAY) {
return;
}
lastTypingTime = ActorTime.currentTime();
ApiOutPeer outPeer = buidOutPeer(peer);
if (outPeer == null) {
return;
}
cancelPrevRequest();
prevRid = request(new RequestTyping(outPeer, ApiTypingType.TEXT));
if (typingCancellable != null) {
typingCancellable.cancel();
typingCancellable = null;
}
typingCancellable = schedule(new AbortTyping(peer), TYPING_CANCEL_DELAY);
}
use of im.actor.runtime.annotations.Verified in project actor-platform by actorapp.
the class UserRouter method checkIsInPhoneBook.
@Verified
protected Promise<Void> checkIsInPhoneBook(User user) {
if (!config().isEnableOnClientPrivacy()) {
return Promise.success(null);
}
Log.d("ON_CLIENT_PRIVACY", "checking " + user.getName() + " is in phone book");
return getPhoneBook().flatMap(new Function<List<PhoneBookContact>, Promise<Void>>() {
@Override
public Promise<Void> apply(List<PhoneBookContact> phoneBookContacts) {
return new Promise<Void>(resolver -> {
List<ContactRecord> userRecords = user.getRecords();
Log.d("ON_CLIENT_PRIVACY", "phonebook have " + phoneBookContacts.size() + " records");
Log.d("ON_CLIENT_PRIVACY", "user have " + userRecords.size() + " records");
outer: for (ContactRecord record : userRecords) {
for (PhoneBookContact phoneBookContact : phoneBookContacts) {
for (PhoneBookPhone phone1 : phoneBookContact.getPhones()) {
if (record.getRecordType() == ContactRecordType.PHONE) {
if (record.getRecordData().equals(phone1.getNumber() + "")) {
context().getContactsModule().markInPhoneBook(user.getUid());
getUserVM(user.getUid()).isInPhoneBook().change(true);
Log.d("ON_CLIENT_PRIVACY", "in record book!");
break outer;
}
}
}
for (PhoneBookEmail email : phoneBookContact.getEmails()) {
if (record.getRecordType() == ContactRecordType.EMAIL) {
if (record.getRecordData().equals(email.getEmail())) {
context().getContactsModule().markInPhoneBook(user.getUid());
getUserVM(user.getUid()).isInPhoneBook().change(true);
Log.d("ON_CLIENT_PRIVACY", "in record book!");
break outer;
}
}
}
}
}
Log.d("ON_CLIENT_PRIVACY", "finish check");
resolver.result(null);
});
}
});
}
use of im.actor.runtime.annotations.Verified in project actor-platform by actorapp.
the class DialogsActor method onMessageContentChanged.
@Verified
private Promise<Void> onMessageContentChanged(Peer peer, long rid, AbsContent content) {
Dialog dialog = dialogs.getValue(peer.getUnuqueId());
// If message is on top
if (dialog != null && dialog.getRid() == rid) {
ContentDescription description = ContentDescription.fromContent(content);
addOrUpdateItem(new DialogBuilder(dialog).setText(description.getText()).setRelatedUid(description.getRelatedUser()).setMessageType(description.getContentType()).createDialog());
}
return Promise.success(null);
}
use of im.actor.runtime.annotations.Verified in project actor-platform by actorapp.
the class DialogsActor method onGroupChanged.
@Verified
private Promise<Void> onGroupChanged(Group group) {
Dialog dialog = dialogs.getValue(group.peer().getUnuqueId());
if (dialog != null) {
// Ignore if nothing changed
if (dialog.getDialogTitle().equals(group.getTitle()) && equalsE(dialog.getDialogAvatar(), group.getAvatar())) {
return Promise.success(null);
}
// Update dialog peer info
Dialog updated = dialog.editPeerInfo(group.getTitle(), group.getAvatar());
addOrUpdateItem(updated);
updateSearch(updated);
}
return Promise.success(null);
}
use of im.actor.runtime.annotations.Verified in project actor-platform by actorapp.
the class PresenceActor method onGroupOnline.
@Verified
private void onGroupOnline(int gid, int count, long updateDate) {
// Log.d(TAG, "onGroupOnline #" + gid + " " + count + " at " + updateDate);
if (lastGidState.containsKey(gid) && lastGidState.get(gid) >= updateDate) {
// Log.d(TAG, "onGroupOnline:ignored - too old");
return;
}
lastGidState.put(gid, updateDate);
// Log.d(TAG, "onGroupOnline:updated");
GroupVM vm = getGroupVM(gid);
if (vm != null) {
vm.getPresence().change(count);
}
}
Aggregations