Search in sources :

Example 26 with JsPromiseExecutor

use of im.actor.runtime.js.utils.JsPromiseExecutor 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());
                }
            });
        }
    });
}
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 27 with JsPromiseExecutor

use of im.actor.runtime.js.utils.JsPromiseExecutor 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());
                }
            });
        }
    });
}
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 28 with JsPromiseExecutor

use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.

the class JsFacade method clearChat.

@UsedByApp
public JsPromise clearChat(final JsPeer peer) {
    return JsPromise.create(new JsPromiseExecutor() {

        @Override
        public void execute() {
            messenger.clearChat(peer.convert()).start(new CommandCallback<Void>() {

                @Override
                public void onResult(Void res) {
                    Log.d(TAG, "clearChat:result");
                    resolve();
                }

                @Override
                public void onError(Exception e) {
                    Log.d(TAG, "clearChat: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 29 with JsPromiseExecutor

use of im.actor.runtime.js.utils.JsPromiseExecutor in project actor-platform by actorapp.

the class JsFacade method editMyNick.

@UsedByApp
public JsPromise editMyNick(final String newNick) {
    return JsPromise.create(new JsPromiseExecutor() {

        @Override
        public void execute() {
            //noinspection ConstantConditions
            messenger.editMyNick(newNick).start(new CommandCallback<Boolean>() {

                @Override
                public void onResult(Boolean res) {
                    Log.d(TAG, "editMyNick:result");
                    resolve();
                }

                @Override
                public void onError(Exception e) {
                    Log.d(TAG, "editMyNick: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)29 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 ApiAuthSession (im.actor.core.api.ApiAuthSession)1 ApiDialog (im.actor.core.api.ApiDialog)1 ResponseLoadArchived (im.actor.core.api.rpc.ResponseLoadArchived)1 RpcCallback (im.actor.core.network.RpcCallback)1 UserVM (im.actor.core.viewmodel.UserVM)1