use of im.actor.core.viewmodel.CommandCallback 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.core.viewmodel.CommandCallback 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.core.viewmodel.CommandCallback 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());
}
});
}
});
}
use of im.actor.core.viewmodel.CommandCallback in project actor-platform by actorapp.
the class JsFacade method kickMember.
@UsedByApp
public JsPromise kickMember(final int gid, final int uid) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
//noinspection ConstantConditions
messenger.kickMember(gid, uid).start(new CommandCallback<Void>() {
@Override
public void onResult(Void res) {
Log.d(TAG, "kickMember:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "kickMember:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.core.viewmodel.CommandCallback in project actor-platform by actorapp.
the class JsFacade method favoriteChat.
@UsedByApp
public JsPromise favoriteChat(final JsPeer peer) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
messenger.favouriteChat(peer.convert()).start(new CommandCallback<Void>() {
@Override
public void onResult(Void res) {
Log.d(TAG, "favouriteChat:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "favouriteChat:error");
reject(e.getMessage());
}
});
}
});
}
Aggregations