[IMP] doc: Improve mobile documentation (#20940)

* [IMP] Doc: improve the documentation

This makes the documentation more readable, makes cleaner sentences and removes the random capital letters within the sentences.

* [IMP] doc: make the info of switchAccount as clear as possible

* [IMP] doc: Make requested changes
This commit is contained in:
Yenthe V.G
2017-11-15 07:59:05 +01:00
committed by Adrian Torres
parent 79821458fa
commit dfa554ba7d
+27 -28
View File
@@ -10,15 +10,14 @@ Mobile JavaScript
Introduction
============
In Odoo 10.0 we released a mobile app, allows you to access all **Odoo apps**
In Odoo 10.0 we released a mobile app which allows you to access all **Odoo apps**
(even your customized modules).
The application is a combination of **Odoo Web** and **Native Mobile
components**, in other words it is a Odoo Web instance loaded inside native
WebView container of mobile.
components**. In other words it is a Odoo Web instance loaded inside a native, mobile, WebView container.
This page documents how you can access mobile native components like Camera,
Vibration, Notification, Toast through Odoo Web (via JavaScript). For this, you
Vibration, Notification and Toast through Odoo Web (via JavaScript). For this, you
do not need to be a mobile developer, if you know Odoo JavaScript API you can
access all available mobile features.
@@ -27,7 +26,7 @@ access all available mobile features.
How does it work?
=================
Internal working of Mobile application:
Internal workings of the mobile application:
.. image:: images/mobile_working.jpg
@@ -35,36 +34,36 @@ Of course, it is a web page that loads on a Mobile Native Web container. But it
is integrated in such a way that you can access native resources from your web
JavaScript.
WebPages (Odoo Web) is on the top of each layer, where second layer is a Bridge
between Odoo Web (JS) and Native component of mobile.
WebPages (Odoo Web) is on the top of each layer, where the second layer is a Bridge
between Odoo Web (JS) and the native mobile components.
When any call from JavaScript triggered it passes through Bridge and Bridge
pass it to native invoker to perform that action.
When any call from JavaScript is triggered it passes through Bridge and Bridge
passes it to the native invoker to perform that action.
When the native component has done their work, it again is passed to Bridge and
When the native component has done its work, it is passed to the Bridge again and
you get the output in JavaScript.
Process time taken by the Native component depends on what you are requesting
from Native resources. Like Camera or GPS Location.
from the Native resources. For example the Camera or GPS Location.
How to use it?
==============
As Odoo Web Framework, Mobile api can be used anywhere by getting object of
Just like the Odoo Web Framework, the Mobile API can be used anywhere by getting the object from
**web_mobile.rpc**
.. image:: images/odoo_mobile_api.png
Mobile rpc object provide list of methods available (Works only with Mobile
App).
The mobile RPC object provides a list of methods that are available (this only works with the mobile
app).
Just check for method availability and execute it.
Check if the method is available and then execute it.
Methods
-------
.. note:: Each of the methods returns JQuery Deffered object with returning
data JSON dictionary
.. note:: Each of the methods returns a JQuery Deffered object which returns
a data JSON dictionary
Show Toast in device
.....................
@@ -75,7 +74,7 @@ Show Toast in device
A toast provides simple feedback about an operation in a small popup. It only
fills the amount of space required for the message and the current activity
remains visible and interactive
remains visible and interactive.
.. code-block:: javascript
@@ -105,11 +104,11 @@ Show snackbar with action
.. js:function:: showSnackBar
:param object args: (*required*) **Message** to show in snackbar and action **button label** in Snackbar (optional)
:returns: ``True`` if User click on Action button, ``False`` if SnackBar auto dismissed after some time
:returns: ``True`` if the user clicks on the Action button, ``False`` if SnackBar auto dismissed after some time.
Snackbars provide lightweight feedback about an operation. They show a brief
message at the bottom of the screen on mobile and lower left on larger devices.
Snackbars appear above all other elements on screen and only one can be
message at the bottom of the screen on mobile or in the lower left corner on larger devices.
Snackbars appear above all the other elements on the screen and only one can be
displayed at a time.
.. code-block:: javascript
@@ -140,7 +139,7 @@ view at any time.
.. code-block:: javascript
mobile.showNotification({'title': 'Simple Notification', 'message': 'This is test of simple notification'})
mobile.showNotification({'title': 'Simple Notification', 'message': 'This is a test for a simple notification'})
.. image:: images/mobile_notification.png
@@ -152,7 +151,7 @@ Create contact in device
:param object args: Dictionary with contact details. Possible keys (name, mobile, phone, fax, email, website, street, street2, country_id, state_id, city, zip, parent_id, function and image)
Create device contact with given contact details.
Create a new device contact with the given contact details.
.. code-block:: javascript
@@ -183,11 +182,11 @@ Scanning barcodes
.. js:function:: scanBarcode
:returns: Scanned ``code`` from any barcodes
:returns: Scanned ``code`` from any barcode
The Barcode API detects barcodes in real-time, on device, in any orientation.
The barcode API detects barcodes in real-time, on the device, in any orientation.
It reads the following barcode formats:
The barcode API can read the following barcode formats:
* 1D barcodes: EAN-13, EAN-8, UPC-A, UPC-E, Code-39, Code-93, Code-128, ITF, Codabar
* 2D barcodes: QR Code, Data Matrix, PDF-417, AZTEC
@@ -196,7 +195,7 @@ It reads the following barcode formats:
mobile.methods.scanBarcode().then(function(code){
if(code){
// Perform operation with code scanned
// Perform operation with the scanned code
}
});
@@ -205,7 +204,7 @@ Switching account in device
.. js:function:: switchAccount
Use to switch device account.
Use switchAccount to switch from one account to another on the device.
.. code-block:: javascript