Search in sources :

Example 21 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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());
                }
            });
        }
    });
}
Also used : JsPromiseExecutor(im.actor.runtime.js.utils.JsPromiseExecutor) CommandCallback(im.actor.core.viewmodel.CommandCallback) RpcException(im.actor.core.network.RpcException) UsedByApp(im.actor.core.js.annotations.UsedByApp)

Example 22 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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());
                }
            });
        }
    });
}
Also used : JsPromiseExecutor(im.actor.runtime.js.utils.JsPromiseExecutor) CommandCallback(im.actor.core.viewmodel.CommandCallback) Void(im.actor.runtime.actors.messages.Void) RpcException(im.actor.core.network.RpcException) UsedByApp(im.actor.core.js.annotations.UsedByApp)

Example 23 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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());
                }
            });
        }
    });
}
Also used : JsPromiseExecutor(im.actor.runtime.js.utils.JsPromiseExecutor) ApiDialog(im.actor.core.api.ApiDialog) RpcException(im.actor.core.network.RpcException) RpcCallback(im.actor.core.network.RpcCallback) ResponseLoadArchived(im.actor.core.api.rpc.ResponseLoadArchived) UsedByApp(im.actor.core.js.annotations.UsedByApp)

Example 24 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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());
                }
            });
        }
    });
}
Also used : JsPromiseExecutor(im.actor.runtime.js.utils.JsPromiseExecutor) CommandCallback(im.actor.core.viewmodel.CommandCallback) Void(im.actor.runtime.actors.messages.Void) RpcException(im.actor.core.network.RpcException) UsedByApp(im.actor.core.js.annotations.UsedByApp)

Example 25 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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());
                }
            });
        }
    });
}
Also used : JsPromiseExecutor(im.actor.runtime.js.utils.JsPromiseExecutor) CommandCallback(im.actor.core.viewmodel.CommandCallback) RpcException(im.actor.core.network.RpcException) UsedByApp(im.actor.core.js.annotations.UsedByApp)

Aggregations

UsedByApp (im.actor.core.js.annotations.UsedByApp)32 RpcException (im.actor.core.network.RpcException)29 JsPromiseExecutor (im.actor.runtime.js.utils.JsPromiseExecutor)29 CommandCallback (im.actor.core.viewmodel.CommandCallback)28 Void (im.actor.runtime.actors.messages.Void)9 ArrayList (java.util.ArrayList)5 List (java.util.List)5 MessageSearchEntity (im.actor.core.entity.MessageSearchEntity)4 Element (com.google.gwt.dom.client.Element)1 ApiAuthSession (im.actor.core.api.ApiAuthSession)1 ApiDialog (im.actor.core.api.ApiDialog)1 ResponseLoadArchived (im.actor.core.api.rpc.ResponseLoadArchived)1 MentionFilterResult (im.actor.core.entity.MentionFilterResult)1 JsCallsProvider (im.actor.core.js.providers.JsCallsProvider)1 JsNotificationsProvider (im.actor.core.js.providers.JsNotificationsProvider)1 JsPhoneBookProvider (im.actor.core.js.providers.JsPhoneBookProvider)1 RpcCallback (im.actor.core.network.RpcCallback)1 UserVM (im.actor.core.viewmodel.UserVM)1 JsLogProvider (im.actor.runtime.js.JsLogProvider)1 Date (java.util.Date)1