Search in sources :

Example 26 with CommandCallback

use of im.actor.core.viewmodel.CommandCallback 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());
                }
            });
        }
    });
}
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 CommandCallback

use of im.actor.core.viewmodel.CommandCallback 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 28 with CommandCallback

use of im.actor.core.viewmodel.CommandCallback 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 29 with CommandCallback

use of im.actor.core.viewmodel.CommandCallback 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 30 with CommandCallback

use of im.actor.core.viewmodel.CommandCallback 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

CommandCallback (im.actor.core.viewmodel.CommandCallback)37 UsedByApp (im.actor.core.js.annotations.UsedByApp)28 RpcException (im.actor.core.network.RpcException)28 JsPromiseExecutor (im.actor.runtime.js.utils.JsPromiseExecutor)28 Void (im.actor.runtime.actors.messages.Void)13 UserVM (im.actor.core.viewmodel.UserVM)8 ArrayList (java.util.ArrayList)8 View (android.view.View)7 TextView (android.widget.TextView)7 List (java.util.List)7 AlertDialog (android.app.AlertDialog)5 Intent (android.content.Intent)4 GroupVM (im.actor.core.viewmodel.GroupVM)4 DialogInterface (android.content.DialogInterface)3 ViewGroup (android.view.ViewGroup)3 Toast (android.widget.Toast)3 MessageSearchEntity (im.actor.core.entity.MessageSearchEntity)3 ActorSDK (im.actor.sdk.ActorSDK)3 R (im.actor.sdk.R)3 ActorSDKMessenger.messenger (im.actor.sdk.util.ActorSDKMessenger.messenger)3