use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method unfavoriteChat.
@UsedByApp
public JsPromise unfavoriteChat(final JsPeer peer) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
messenger.unfavoriteChat(peer.convert()).start(new CommandCallback<Void>() {
@Override
public void onResult(Void res) {
Log.d(TAG, "unfavouriteChat:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "unfavouriteChat:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method removeContact.
@UsedByApp
public JsPromise removeContact(final int uid) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
//noinspection ConstantConditions
messenger.removeContact(uid).start(new CommandCallback<Boolean>() {
@Override
public void onResult(Boolean res) {
Log.d(TAG, "removeContact:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "removeContact:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method revokeInviteLink.
@UsedByApp
public JsPromise revokeInviteLink(final int gid) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
//noinspection ConstantConditions
messenger.revokeInviteLink(gid).start(new CommandCallback<String>() {
@Override
public void onResult(String res) {
Log.d(TAG, "revokeInviteLink:result");
resolve(res);
}
@Override
public void onError(Exception e) {
Log.d(TAG, "revokeInviteLink:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method doGroupCall.
@UsedByApp
public JsPromise doGroupCall(final int gid) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
messenger.doGroupCall(gid).start(new CommandCallback<Long>() {
@Override
public void onResult(Long res) {
Log.d(TAG, "doGroupCall:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "doGroupCall:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method loadSessions.
@UsedByApp
public JsPromise loadSessions() {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
messenger.loadSessions().start(new CommandCallback<List<ApiAuthSession>>() {
@Override
public void onResult(List<ApiAuthSession> res) {
JsArray<JsAuthSession> jsSessions = JsArray.createArray().cast();
for (ApiAuthSession session : res) {
jsSessions.push(JsAuthSession.create(session));
}
resolve(jsSessions);
}
@Override
public void onError(Exception e) {
Log.e(TAG, e);
reject(e.getMessage());
}
});
}
});
}
Aggregations