Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bug 853798 - [Buri][Dialer]The screen display abnormal after using USSD #9062

Merged
merged 0 commits into from about 1 year ago

3 participants

Anthony Ricaud Etienne Segonzac Dominic Kuo
Anthony Ricaud
Owner
Rik commented April 09, 2013
  • Refactored the USSD UI to not use a new window but only a regular DOM element
Etienne Segonzac

General comments:

  • it looks good (the code)
  • it works very well
  • I think keeping the postMesage was the right choice, it makes the change very clear

Now less fun, we have a unique opportunity to fix bug 799435 [1] and I think we should take it (and also rename the files).
So my inline comments will be based on the fact that we're mmi-ying all the things [2].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=799435
[2] insert a meme here

apps/communications/dialer/index.html
... ...
@@ -198,6 +202,40 @@ <h1 id="header-edit-mode-text" data-l10n-id="edit">Edit</h1>
198 202
         <button>Action 2</button>
199 203
       </menu>
200 204
     </form>
  205
+
  206
+    <article id="message-screen" role="region" hidden>
  207
+      <section role="region">
  208
+        <header>
  209
+          <button id="message-close"><span class="icon icon-close"> close </span></button>
  210
+          <menu type="toolbar">
  211
+            <button id="send" disabled> send </button>
  212
+          </menu>
  213
+          <h1 id="header-title">USSD</h1>
  214
+        </header>
  215
+      </section>
  216
+      <section id="message-container" role="region">
  217
+        <div id="message">Wesh
1

wesh gros, bien ou bien ? on cleanup un peu le markup avant de lander ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/dialer.js
... ...
@@ -341,7 +341,12 @@ var CallHandler = (function callHandler() {
341 341
   /* === USSD === */
342 342
   function init() {
1

nit: we should rename the function for initMMI since it's just doing mmi stuffs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/ussd.js
... ...
@@ -25,6 +22,12 @@ var UssdManager = {
25 22
     if (this._conn.voice) {
26 23
       this._conn.addEventListener('voicechange', this);
27 24
       this._operator = MobileOperator.userFacingInfo(this._conn).operator;
  25
+      var message = {
  26
+        type: 'voicechangeUI',
1

how about a mmi-* prefix for the messages? since the whole dialer app frame is getting the message I'd like to be more specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/ussd.js
... ...
@@ -138,106 +139,25 @@ var UssdManager = {
138 139
       type: 'error',
1

mmi-error ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/ussd.js
((36 lines not shown))
171  
-      // even before the new USSD window has been opened and/or
172  
-      // initialized.
173  
-      this._popup.addEventListener('ready', this.uiReady.bind(this));
174  
-
175  
-      if (!ussd) {
176  
-        return;
177  
-      }
178  
-      // The message containing the received USSD won't be delivered until
179  
-      // the UI notifies about its successfull load.
180  
-      var message = {
181  
-        type: 'ussdreceived',
182  
-        message: ussd.message,
183  
-        sessionEnded: ussd.sessionEnded
184  
-      };
185  
-      this.postMessage(message, this.COMMS_APP_ORIGIN);
  152
+      window.postMessage({type: 'loading'}, this.COMMS_APP_ORIGIN);
1

mmi-loading ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/ussd.js
... ...
@@ -249,7 +169,7 @@ var UssdManager = {
249 169
         // Do not notify the UI if no message to show.
250 170
         if (evt.message != null || evt.sessionEnded)
251 171
           message = {
252  
-            type: 'ussdreceived',
  172
+            type: 'ussdreceivedUI',
2

mmi-received

Anthony Ricaud Owner
Rik added a note April 10, 2013

I prefer mmi-received-ui to not be confused with ussdreceived that might get renamed to 'mmireceived' one day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/ussd.js
... ...
@@ -257,7 +177,7 @@ var UssdManager = {
257 177
       case 'voicechange':
258 178
         this._operator = MobileOperator.userFacingInfo(this._conn).operator;
259 179
         message = {
260  
-          type: 'voicechange',
  180
+          type: 'voicechangeUI',
1

tricky one, I'd say mmi-networkchange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/ussd_ui.js
((12 lines not shown))
81 74
   },
82 75
 
83  
-  cancel: function uui_cancel() {
84  
-    window.opener.postMessage({
  76
+  closeWindow: function uui_closeWindow() {
  77
+    window.postMessage({
85 78
       type: 'cancel'
1

mmi-cancel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/js/ussd_ui.js
... ...
@@ -137,7 +133,7 @@ var UssdUI = {
137 133
   reply: function uui_reply() {
138 134
     this.showLoading();
139 135
     var response = this.responseTextNode.value;
140  
-    window.opener.postMessage({
  136
+    window.postMessage({
141 137
       type: 'reply',
1

mmi-reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/test/unit/mock_ussd_ui.js
... ...
@@ -7,18 +7,22 @@ var MockUssdUI = {
7 7
   _messageReceived: null,
8 8
   _sessionEnded: null,
9 9
 
10  
-  postMessage: function muui_postMessage(message, origin) {
11  
-    switch (message.type) {
12  
-      case 'ussdreceived':
13  
-        this._messageReceived = message.message;
14  
-        this._sessionEnded = message.sessionEnded;
  10
+  postMessage: function muui_postMessage(evt) {
  11
+    if (!evt.data) {
  12
+      return;
  13
+    }
  14
+
  15
+    switch (evt.data.type) {
  16
+      case 'ussdreceivedUI':
1

yep, definitely, it will look much better after the event names rename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/index.html
... ...
@@ -198,6 +202,40 @@ <h1 id="header-edit-mode-text" data-l10n-id="edit">Edit</h1>
198 202
         <button>Action 2</button>
199 203
       </menu>
200 204
     </form>
  205
+
  206
+    <article id="message-screen" role="region" hidden>
  207
+      <section role="region">
  208
+        <header>
  209
+          <button id="message-close"><span class="icon icon-close"> close </span></button>
  210
+          <menu type="toolbar">
  211
+            <button id="send" disabled> send </button>
2

mmi-send ?

Anthony Ricaud Owner
Rik added a note April 10, 2013

We can't change the ID because of L10N strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/index.html
... ...
@@ -198,6 +202,40 @@ <h1 id="header-edit-mode-text" data-l10n-id="edit">Edit</h1>
198 202
         <button>Action 2</button>
199 203
       </menu>
200 204
     </form>
  205
+
  206
+    <article id="message-screen" role="region" hidden>
1

let's mmify the markup too, message could lead to confusion in a (sick) Communications app.

-> mmi-screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/index.html
... ...
@@ -198,6 +202,40 @@ <h1 id="header-edit-mode-text" data-l10n-id="edit">Edit</h1>
198 202
         <button>Action 2</button>
199 203
       </menu>
200 204
     </form>
  205
+
  206
+    <article id="message-screen" role="region" hidden>
  207
+      <section role="region">
  208
+        <header>
  209
+          <button id="message-close"><span class="icon icon-close"> close </span></button>
1

mmi-close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/index.html
... ...
@@ -198,6 +202,40 @@ <h1 id="header-edit-mode-text" data-l10n-id="edit">Edit</h1>
198 202
         <button>Action 2</button>
199 203
       </menu>
200 204
     </form>
  205
+
  206
+    <article id="message-screen" role="region" hidden>
  207
+      <section role="region">
  208
+        <header>
  209
+          <button id="message-close"><span class="icon icon-close"> close </span></button>
  210
+          <menu type="toolbar">
  211
+            <button id="send" disabled> send </button>
  212
+          </menu>
  213
+          <h1 id="header-title">USSD</h1>
  214
+        </header>
  215
+      </section>
  216
+      <section id="message-container" role="region">
1

mmi-container

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/communications/dialer/index.html
... ...
@@ -49,6 +52,7 @@
49 52
     <script defer src="/dialer/js/telephony_helper.js"></script>
50 53
     <script defer src="/dialer/js/ussd.js"></script>
51 54
     <script defer src="/dialer/js/newsletter_manager.js"></script>
  55
+    <script defer src="/dialer/js/ussd_ui.js"></script>
1

nit: let's group the ussd.js line and the ussd_ui.js lines.

Wait.

I meant mmi.js and mmi_ui.js :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Anthony Ricaud
Owner
Rik commented April 10, 2013

all-the-things-meme-generator-mmi-all-the-things-aa7a72

Anthony Ricaud
Owner
Rik commented April 10, 2013

I also removed listening to the 'close' message type in mmi_ui.js because we don't send that kind of messages anymore.

apps/communications/dialer/js/mmi.js
... ...
@@ -19,12 +16,18 @@ var UssdManager = {
19 16
   // session.
20 17
   _pendingRequest: null,
2

Correct me if I'm wrong, but we're not using the _pendingRequest anywhere right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Dominic Kuo dominickuo merged commit 2abd232 into from April 15, 2013
Dominic Kuo dominickuo closed this April 15, 2013
Anthony Ricaud Rik deleted the branch April 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Sorry, commit information is not available for this pull request.

This page is out of date. Refresh to see the latest.

Showing 0 changed files with 0 additions and 0 deletions. Show diff stats Hide diff stats

Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.