B2G

From TAMI
Jump to navigationJump to search

This page is about Firefox OS, nick named Boot to Gecko, or B2G for short.


Hebrew

Hebrew Keyboard Layout

export GAIA_KEYBOARD_LAYOUTS=en,he
./build.sh

You can also just put this in your .userconfig file.

Right to Left Display

In the HEAD version there is a bug with backspace on Hebrew input. I've reported here: https://bugzilla.mozilla.org/show_bug.cgi?id=1057552

To solve the backspace problem in a generic way, in gecko/modules/libpref/init/all.js change:

pref("bidi.edit.delete_immediately", true);

I still don't understand this completely, but the logic that decides whether to perform the deletion or not is here: gecko/editor/libeditor/nsTextEditRulesBidi.cpp

It's something about the caret position blah blah. Still dir="auto" provides a better solution since the text also moves nicely in RTL. But I wonder if it needs to be applied to every every html field specifically or not.

The work around for the bug, which also fixes RTL display is adding dir="auto" to input fields. For example in the sms app I edited the message input in index.html (https://github.com/mozilla-b2g/gaia/blob/master/apps/sms/index.html) :

<div id="messages-input" contentEditable="true" name="message" x-inputmode="-moz-sms" class="js-l10n-placeholder" dir="auto"> </div>


This bug tracks RTL issues in B2G: https://bugzilla.mozilla.org/show_bug.cgi?id=906270

UPDATE: We have made a difference! This seems to be fixed to the default behavior. https://bugzilla.mozilla.org/show_bug.cgi?id=1034337 Hooray


Debugging/Development

Gecko

For printing logs in gecko that will show up on `adb logcat`, one must use the printf_stderr function


Javascript console

A cool thing I did today though was get a javascript console working directly on my phone. According to here https://developer.mozilla.org/en-US/Firefox_OS/Debugging/Debugging_and_security_testing The steps I did:

avnerus@localhost ~/Flame $ virtualenv venv
avnerus@localhost ~/Flame $ source venv/bin/activate
(venv)avnerus@localhost ~/Flame $ pip install marionette_client
(venv)avnerus@localhost ~/Flame $ adb forward tcp:2828 tcp:2828
(venv)avnerus@localhost ~/Flame $ python fxos-repl.py list

then I could see a list of my applications. I did:

(venv)avnerus@localhost ~/Flame $ python fxos-repl.py connect app://browser.gaiamobile.org/index.html

I tried > alert('hi');

and it displayed it on my phone :D

I also did

> console.log('Avner')

and I could see it in "adb logcat" (When console logging is enabled on the phone's developer menu).


cool stuff!

Messaging

Applications

  • WhatsApp - OpenWappp doesn't work on HEAD, but I did manage to connect to WhatsApp with ConnectA2 and Loqui IM.
  • Telegram - Telegram web client is published as an app.


Push Notifications

ConnectA2 seems to support SimplePush on WhatsApp. I'm not sure how they do it. Maybe they register WhatsApp for you and forward you the notifications? I think Telegram may be the close to implementing it. I'm tracking this issue:

https://github.com/zhukov/webogram/issues/363

It seems the client already sends the Firefox OS endpoint to the server, but I don't think the server supports it as of now.