Commit 0c1d6965186af66fe78a5371c5cdca1f4c06caca

Authored by OpenWapp Developer
1 parent bf7d1956d1

Adapting the inbox for the new conversation-fetching procedure.

Showing 7 changed files with 37 additions and 3 deletions

app/scripts/collections/history.js View file @ 0c1d696
... ... @@ -275,6 +275,7 @@
275 275 var index = offset;
276 276 if (index === groupsLength) {
277 277 _this.saveConversationList();
  278 + _this.finishedSyncing = true;
278 279 _this.trigger('history:synced');
279 280 }
280 281 else {
app/scripts/localisations/translation.js View file @ 0c1d696
... ... @@ -52,6 +52,7 @@
52 52 'foto de contacto:',
53 53 openWapp: 'OpenWapp',
54 54 loading: 'Cargando…',
  55 + loadingConversations: 'Cargando conversaciones…',
55 56 registerOpenWapp: 'Registro en OpenWapp',
56 57 welcomeMessage1: 'Bienvenido a OpenWapp.',
57 58 welcomeMessage2: 'Registrarse es muy fácil y rápido.',
... ... @@ -222,6 +223,7 @@
222 223 'contact picture:',
223 224 openWapp: 'OpenWapp',
224 225 loading: 'Loading…',
  226 + loadingConversations: 'Loading conversations…',
225 227 registerOpenWapp: 'OpenWapp Sign-up',
226 228 welcomeMessage1: 'Welcome to OpenWapp.',
227 229 welcomeMessage2: 'Registering is very quick and easy.',
... ... @@ -394,6 +396,7 @@
394 396 'e imagem de contato:',
395 397 openWapp: 'OpenWapp',
396 398 loading: 'Carregando…',
  399 + loadingConversations: 'Carregando conversas…',
397 400 registerOpenWapp: 'Cadastro no OpenWapp',
398 401 welcomeMessage1: 'Bem vindo ao OpenWapp.',
399 402 welcomeMessage2: 'Se cadastrar é muito fácil e rápido.',
... ... @@ -565,6 +568,7 @@
565 568 'e imagem de contato:',
566 569 openWapp: 'OpenWapp',
567 570 loading: 'Carregando…',
  571 + loadingConversations: 'Carregando conversas…',
568 572 registerOpenWapp: 'Cadastro no OpenWapp',
569 573 welcomeMessage1: 'Bem vindo ao OpenWapp.',
570 574 welcomeMessage2: 'Se cadastrar é muito fácil e rápido.',
app/scripts/models/rtc.js View file @ 0c1d696
... ... @@ -120,6 +120,10 @@
120 120 _this.set('status', 'offline');
121 121 });
122 122  
  123 + this.listenTo(this.client, 'connecting', function () {
  124 + _this.set('status', 'connecting');
  125 + });
  126 +
123 127 // TODO: Remember, this is a generic message, it was triggered when
124 128 // receiving any kind of message. We should distinguish by cases
125 129 // or make client to always trigger a message providing from, type and
app/scripts/templates/inbox.hbs View file @ 0c1d696
... ... @@ -18,7 +18,7 @@
18 18 </aside>
19 19  
20 20 {{! TODO: Pending design for this message }}
21   - <div id="no-conversations" class="empty-info">
  21 + <div id="no-conversations" class="empty-info" hidden>
22 22 <p>{{translate 'noConversation'}}</p>
23 23 <p>{{translate 'selectContacts'}}</p>
24 24 </div><!-- no conversations -->
... ... @@ -27,7 +27,8 @@
27 27 <ul>
28 28 </ul>
29 29 <div id='contacts-centinel'>
30   - <p>Centinela</p>
  30 + <p>{{translate 'loadingConversations'}}</p>
  31 + <progress></progress>
31 32 </div>
32 33 </section>
33 34  
app/scripts/vendor/coseme-client/client.js View file @ 0c1d696
... ... @@ -147,6 +147,7 @@
147 147 _authErrorCallback(reason);
148 148 }
149 149 _authErrorCallback = null;
  150 + fire('disconnected');
150 151 }
151 152  
152 153 // Contact status
... ... @@ -577,6 +578,7 @@
577 578 }
578 579  
579 580 authenticating = true;
  581 + fire('connecting');
580 582 _authSuccessCallback = onSuccess;
581 583 _authErrorCallback = onError;
582 584 methods.call('auth_login', [userId, password]);
app/scripts/views/inbox.js View file @ 0c1d696
... ... @@ -98,7 +98,6 @@
98 98 var section = this.$el.find('#conversations').first();
99 99 var list = section.find('ul').first();
100 100 if (conversations.length !== 0) {
101   - this.$el.find('#no-conversations').hide();
102 101 section.show();
103 102 }
104 103  
... ... @@ -195,6 +194,18 @@
195 194 this.listenTo(this.model, 'add', this._addConversation);
196 195 });
197 196 this.model.loadConversations();
  197 + }
  198 +
  199 + if (this.model.finishedSyncing) {
  200 + this.$el.find('#contacts-centinel').hide();
  201 + }
  202 + else {
  203 + this.listenToOnce(this.model, 'history:synced', function () {
  204 + this.$el.find('#contacts-centinel').hide();
  205 + if (this.model.models.length === 0) {
  206 + this.$el.find('#no-conversations').show();
  207 + }
  208 + });
198 209 }
199 210 },
200 211  
app/styles/_inbox.sass View file @ 0c1d696
... ... @@ -91,4 +91,14 @@
91 91 &:first-child
92 92 margin-top: 0
93 93 font-weight: bold
  94 +
  95 +#contacts-centinel
  96 + text-align: center
  97 + padding: 1rem
  98 + padding-bottom: 2rem
  99 + background: linear-gradient(to bottom, #dadada, #fff)
  100 + p
  101 + margin-bottom: 1rem
  102 + font-size: small
  103 + color: #3d3d3d