librelist archives

« back to archive

Minimize chat app

Minimize chat app

From:
Simon Hill
Date:
2015-02-27 @ 05:21
I know you can programmatically minimize a chat window
<https://conversejs.org/docs/html/development.html#chats-grouping>, but how
would you minimize the app itself? I have a mobile web use case where I
want the app to load minimized.

Thanks for any help!
Si

Re: [conversejs] Minimize chat app

From:
Jc Brand
Date:
2015-02-27 @ 10:10
On Thu, Feb 26, 2015 at 09:21:48PM -0800, Simon Hill wrote:
>    I know you can [1]programmatically minimize a chat window, but how would
>    you minimize the app itself? I have a mobile web use case where I want the
>    app to load minimized.
>    Thanks for any help!
>    Si

You mean the control box, that contains the contacts roster etc.?

You can close it like this:

    converse.chats.get('controlbox').close()

BTW, in 0.8.6, converse.chats.get would open a chat box if it wasn't open yet.
I've instead changed this now so that "get" only returns a chat box if it's
already open.

To get the old behavior, one should call "converse.chats.open".


https://github.com/jcbrand/converse.js/commit/c70561b898f1272b8b7a5cee4c98e5b48243071d

It might be worth your while to cherry pick that commit for your own
installation.

Regards
JC

Re: [conversejs] Minimize chat app

From:
Simon Hill
Date:
2015-02-27 @ 13:15
Yes. Excellent thank you.






On Fri, Feb 27, 2015 at 2:10 AM -0800, "JC Brand" <lists@opkode.com> wrote:










On Thu, Feb 26, 2015 at 09:21:48PM -0800, Simon Hill wrote:
>    I know you can [1]programmatically minimize a chat window, but how would
>    you minimize the app itself? I have a mobile web use case where I want the
>    app to load minimized.
>    Thanks for any help!
>    Si

You mean the control box, that contains the contacts roster etc.?

You can close it like this:

    converse.chats.get('controlbox').close()

BTW, in 0.8.6, converse.chats.get would open a chat box if it wasn't open yet.
I've instead changed this now so that "get" only returns a chat box if it's
already open.

To get the old behavior, one should call "converse.chats.open".


https://github.com/jcbrand/converse.js/commit/c70561b898f1272b8b7a5cee4c98e5b48243071d

It might be worth your while to cherry pick that commit for your own
installation.

Regards
JC

Re: [conversejs] Minimize chat app

From:
Simon Hill
Date:
2015-02-27 @ 14:02
I spoke too soon :) Unfortunately I was not able to get that to work. In
case I misunderstood, here's a longer explanation of what I am doing. I am
using 0.8.6, and I want the minimized view of the controlbox by default so
that it does not dominate the screen on mobile web. I thought I could set
that with

show_controlbox_by_default: false,

but this has no effect. The full controlbox panel still shows by default
(tested in Chrome using Incognito window to clear cache).

After your advice I tried:

converse.listen.once('ready', function () {
    converse.chats.get('controlbox').close();

});

but this also had no effect.

Thank you for any help you can give me.



On Fri, Feb 27, 2015 at 2:10 AM, JC Brand <lists@opkode.com> wrote:

> On Thu, Feb 26, 2015 at 09:21:48PM -0800, Simon Hill wrote:
> >    I know you can [1]programmatically minimize a chat window, but how
> would
> >    you minimize the app itself? I have a mobile web use case where I
> want the
> >    app to load minimized.
> >    Thanks for any help!
> >    Si
>
> You mean the control box, that contains the contacts roster etc.?
>
> You can close it like this:
>
>     converse.chats.get('controlbox').close()
>
> BTW, in 0.8.6, converse.chats.get would open a chat box if it wasn't open
> yet.
> I've instead changed this now so that "get" only returns a chat box if it's
> already open.
>
> To get the old behavior, one should call "converse.chats.open".
>
>
> 
https://github.com/jcbrand/converse.js/commit/c70561b898f1272b8b7a5cee4c98e5b48243071d
>
> It might be worth your while to cherry pick that commit for your own
> installation.
>
> Regards
> JC
>

Re: [conversejs] Minimize chat app

From:
Jc Brand
Date:
2015-02-27 @ 20:25
On Fri, Feb 27, 2015 at 06:02:04AM -0800, Simon Hill wrote:
>    I spoke too soon :) Unfortunately I was not able to get that to work. In
>    case I misunderstood, here's a longer explanation of what I am doing. I am
>    using 0.8.6, and I want the minimized view of the controlbox by default so
>    that it does not dominate the screen on mobile web. I thought I could set
>    that with
> 
>  show_controlbox_by_default: false,
> 
>    but this has no effect. The full controlbox panel still shows by default
>    (tested in Chrome using Incognito window to clear cache).

What kind of setup are you using? Do you use prebind?

If the control box is open and you reload the page, then it will appear again,
even if show_controlbox_by_default is false.

However, otherwise it should remain closed. If not, then this might be a bug.

>    After your advice I tried:
> 
>  converse.listen.once('ready', function () {
>      converse.chats.get('controlbox').close();
>  });
> 
>  but this also had no effect.

Can you put a breakpoint with the debugger in that callback and see what
happens when you call that line?

Re: [conversejs] Minimize chat app

From:
Simon Hill
Date:
2015-02-27 @ 23:01
Yes, prebind.

I wrapped the action in a 10 second delay to step over that, and added
breakpoints, but still no dice.  Here's my full angular wrapper.

app.directive('converseJs', function (User, $q, $log, BOSH,
Connections,$timeout) {
    return {
        restrict: "A",
        scope: {},
        template: '',
        link: function (scope, element, attrs) {
            // watch when created, toggle hidden if user not logged in
            scope.$watch(function () {
                return User.data.user_uuid
            }, function (user_uuid) {
                if (user_uuid) {


                    $.getJSON('/api/v1/connections/BOSHprebind/',
function (data) {
                            require(['converse'], function (converse) {
                                console.log('chat prebinding
initialized', data);


                                converse.listen.once('ready', function () {
                                    $timeout(function() {

converse.chats.get('controlbox').close();
                                    },10000);
                                    $log.info('trying to initialize groups');

Connections.initializeGroups().then(function (groups) {
                                        $log.info('groups initialized', groups);
                                    })
                                });
                                converse.initialize({
                                    prebind: true,
                                    auto_list_rooms: true,
                                    auto_subscribe: true,
                                    bosh_service_url: BOSH,
                                    hide_muc_server: false,
                                    i18n: locales.en,
                                    show_controlbox_by_default: false,
                                    roster_groups: false,
                                    hide_offline_users: false,
                                    allow_contact_requests: true,
                                    jid: data.jid,
                                    sid: data.sid,
                                    rid: data.rid,
                                    message_carbons: true,
                                    fullname: User.data.username,
                                    debug: false,
                                    keepalive: true,
                                    allow_muc: true

                                });


                            })

                        }
                    );
                } else {
                    $('#conversejs').remove();

                }
            })

        }
    }
});




On Fri, Feb 27, 2015 at 12:25 PM, JC Brand <lists@opkode.com> wrote:

> On Fri, Feb 27, 2015 at 06:02:04AM -0800, Simon Hill wrote:
> >    I spoke too soon :) Unfortunately I was not able to get that to work.
> In
> >    case I misunderstood, here's a longer explanation of what I am doing.
> I am
> >    using 0.8.6, and I want the minimized view of the controlbox by
> default so
> >    that it does not dominate the screen on mobile web. I thought I could
> set
> >    that with
> >
> >  show_controlbox_by_default: false,
> >
> >    but this has no effect. The full controlbox panel still shows by
> default
> >    (tested in Chrome using Incognito window to clear cache).
>
> What kind of setup are you using? Do you use prebind?
>
> If the control box is open and you reload the page, then it will appear
> again,
> even if show_controlbox_by_default is false.
>
> However, otherwise it should remain closed. If not, then this might be a
> bug.
>
> >    After your advice I tried:
> >
> >  converse.listen.once('ready', function () {
> >      converse.chats.get('controlbox').close();
> >  });
> >
> >  but this also had no effect.
>
> Can you put a breakpoint with the debugger in that callback and see what
> happens when you call that line?
>
>
>

Re: [conversejs] Minimize chat app

From:
Jc Brand
Date:
2015-02-28 @ 10:00
Looks like it might be a bug. Please create a ticket for it in Github.

On 28 Februarie 2015 12:01:22 vm. CET, Simon Hill <simonhill303@gmail.com> wrote:
>Yes, prebind.
>
>I wrapped the action in a 10 second delay to step over that, and added
>breakpoints, but still no dice.  Here's my full angular wrapper.
>
>app.directive('converseJs', function (User, $q, $log, BOSH,
>Connections,$timeout) {
>    return {
>        restrict: "A",
>        scope: {},
>        template: '',
>        link: function (scope, element, attrs) {
>            // watch when created, toggle hidden if user not logged in
>            scope.$watch(function () {
>                return User.data.user_uuid
>            }, function (user_uuid) {
>                if (user_uuid) {
>
>
>                    $.getJSON('/api/v1/connections/BOSHprebind/',
>function (data) {
>                            require(['converse'], function (converse) {
>                                console.log('chat prebinding
>initialized', data);
>
>
>                            converse.listen.once('ready', function () {
>                                    $timeout(function() {
>
>converse.chats.get('controlbox').close();
>                                    },10000);
>                              $log.info('trying to initialize groups');
>
>Connections.initializeGroups().then(function (groups) {
>                               $log.info('groups initialized', groups);
>                                    })
>                                });
>                                converse.initialize({
>                                    prebind: true,
>                                    auto_list_rooms: true,
>                                    auto_subscribe: true,
>                                    bosh_service_url: BOSH,
>                                    hide_muc_server: false,
>                                    i18n: locales.en,
>                                    show_controlbox_by_default: false,
>                                    roster_groups: false,
>                                    hide_offline_users: false,
>                                    allow_contact_requests: true,
>                                    jid: data.jid,
>                                    sid: data.sid,
>                                    rid: data.rid,
>                                    message_carbons: true,
>                                    fullname: User.data.username,
>                                    debug: false,
>                                    keepalive: true,
>                                    allow_muc: true
>
>                                });
>
>
>                            })
>
>                        }
>                    );
>                } else {
>                    $('#conversejs').remove();
>
>                }
>            })
>
>        }
>    }
>});
>
>
>
>
>On Fri, Feb 27, 2015 at 12:25 PM, JC Brand <lists@opkode.com> wrote:
>
>> On Fri, Feb 27, 2015 at 06:02:04AM -0800, Simon Hill wrote:
>> >    I spoke too soon :) Unfortunately I was not able to get that to
>work.
>> In
>> >    case I misunderstood, here's a longer explanation of what I am
>doing.
>> I am
>> >    using 0.8.6, and I want the minimized view of the controlbox by
>> default so
>> >    that it does not dominate the screen on mobile web. I thought I
>could
>> set
>> >    that with
>> >
>> >  show_controlbox_by_default: false,
>> >
>> >    but this has no effect. The full controlbox panel still shows by
>> default
>> >    (tested in Chrome using Incognito window to clear cache).
>>
>> What kind of setup are you using? Do you use prebind?
>>
>> If the control box is open and you reload the page, then it will
>appear
>> again,
>> even if show_controlbox_by_default is false.
>>
>> However, otherwise it should remain closed. If not, then this might
>be a
>> bug.
>>
>> >    After your advice I tried:
>> >
>> >  converse.listen.once('ready', function () {
>> >      converse.chats.get('controlbox').close();
>> >  });
>> >
>> >  but this also had no effect.
>>
>> Can you put a breakpoint with the debugger in that callback and see
>what
>> happens when you call that line?
>>
>>
>>

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.