Search in sources :

Example 26 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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());
                }
            });
        }
    });
}
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 27 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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());
                }
            });
        }
    });
}
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 28 with UsedByApp

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

Example 29 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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 30 with UsedByApp

use of im.actor.core.js.annotations.UsedByApp 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)

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