use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method revokeIntegrationToken.
@UsedByApp
public JsPromise revokeIntegrationToken(final int gid) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
//noinspection ConstantConditions
messenger.revokeIntegrationToken(gid).start(new CommandCallback<String>() {
@Override
public void onResult(String res) {
Log.d(TAG, "revokeIntegrationToken:result");
resolve(res);
}
@Override
public void onError(Exception e) {
Log.d(TAG, "revokeIntegrationToken:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method editMyAbout.
@UsedByApp
public JsPromise editMyAbout(final String newAbout) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
//noinspection ConstantConditions
messenger.editMyAbout(newAbout).start(new CommandCallback<Boolean>() {
@Override
public void onResult(Boolean res) {
Log.d(TAG, "editMyAbout:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "editMyAbout:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method editName.
@UsedByApp
public JsPromise editName(final int uid, final String newName) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
//noinspection ConstantConditions
messenger.editName(uid, newName).start(new CommandCallback<Boolean>() {
@Override
public void onResult(Boolean res) {
Log.d(TAG, "editName:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "editName:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method inviteMember.
@UsedByApp
public JsPromise inviteMember(final int gid, final int uid) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
//noinspection ConstantConditions
messenger.inviteMember(gid, uid).start(new CommandCallback<Void>() {
@Override
public void onResult(Void res) {
Log.d(TAG, "inviteMember:result");
resolve();
}
@Override
public void onError(Exception e) {
Log.d(TAG, "inviteMember:error");
reject(e.getMessage());
}
});
}
});
}
use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.
the class JsFacade method loadArchivedDialogs.
@UsedByApp
private JsPromise loadArchivedDialogs(final boolean init) {
return JsPromise.create(new JsPromiseExecutor() {
@Override
public void execute() {
messenger.loadArchivedDialogs(init, new RpcCallback<ResponseLoadArchived>() {
@Override
public void onResult(ResponseLoadArchived response) {
JsArray<JsDialogShort> res = JsArray.createArray().cast();
for (ApiDialog d : response.getDialogs()) {
res.push(JsDialogShort.create(messenger.buildPeerInfo(EntityConverter.convert(d.getPeer())), d.getUnreadCount()));
}
Log.d(TAG, "loadArchivedDialogs:result");
resolve(res);
}
@Override
public void onError(RpcException e) {
Log.d(TAG, "loadArchivedDialogs:error");
reject(e.getMessage());
}
});
}
});
}
Aggregations