Slide 1

Slide 1 text

Gaiaにプルリクを投げた話

Slide 2

Slide 2 text

Gaiaとは https://developer.mozilla.org/en/docs/Mozilla/Firefox_OS/Platform/Architecture Gaia is the core web apps of the device, and user interface layer, all written in HTML5, CSS and JavaScript, with a number of exposed APIs to allow the UI code to interact with the phone hardware and Gecko functionality. だそうです。

Slide 3

Slide 3 text

Gaiaとは ● これら、みんなGaia (HTML/CSS/JS) ● ロック画面、ステータスバーな んかも全部!

Slide 4

Slide 4 text

gaia開発の流れ

Slide 5

Slide 5 text

Bugzilla

Slide 6

Slide 6 text

Bugzilla

Slide 7

Slide 7 text

Bugzilla ● Firefox OS 以外でも、mozilla製品全般のissue管理に利用 ● 各スレッドはバグ番号で管理される ● 不具合、新機能の提案などが書き込まれる ここから、Gaia関連のバグを読み漁り直せそうなものを探した

Slide 8

Slide 8 text

mozilla-b2g/gaia (GitHub)

Slide 9

Slide 9 text

mozilla-b2g/gaia (GitHub) ● gaia部分の独立したレポジトリがGitHubにある ● Pull Request送れる ○ “Bub [バグ番号] - [説明]”の形式のタイトルをつける (テストケース実行などは枚数の都合上、割愛)

Slide 10

Slide 10 text

gaiaを実行する

Slide 11

Slide 11 text

Firefox OS Simulator

Slide 12

Slide 12 text

FirefoxOS Sumulator

Slide 13

Slide 13 text

FirefoxOS Sumulatorで動かす ● DEBUG=1 DESKTOP=0 make ● profileを変更して、ビルド先の ディレクトリを指定

Slide 14

Slide 14 text

けど... ● 自分の環境では起動直後にすぐ落ちてしまう... ○ Gecko以下もnightlyのイメージを使わないとダメ? ● 起動している間も、デバッガとは接続できない ○ 設定の問題かも? シミュレータでの開発を諦める...orz

Slide 15

Slide 15 text

実機

Slide 16

Slide 16 text

実機にgaiaをインストール ● なんといっても、実機が一番 ● gaia部分だけを指定して、焼くことができる ○ システムアプリを個別に焼くことも可能 gaia一括更新 “make reset-gaia” or “make install-gaia” アプリ個別更新 APP=calendar make install-gaia https://developer.mozilla.org/en- US/Firefox_OS/Developing_Gaia/Different_ways_to_run_Gaia#Using_Gaia_in_Simulator_via_WebIDE

Slide 17

Slide 17 text

いざ、開発スタート

Slide 18

Slide 18 text

Bug 1217825 - [calendar]support for 0 minutes events

Slide 19

Slide 19 text

Bug 1217825 - [calendar]support for 0 minutes events ● 文字通り、開始時間〜終了時間が0分の予定が表示されない ● Googleカレンダーから読み込んだ際に発生したと書いてある ○ (端末で0分の予定を作ろうとすると、開始日が勝手にずれて作れない ) ● 2015/10/23に報告されて、割と放置されてる これを直してみる!!

Slide 20

Slide 20 text

Calendar App ● 使えるアカウント ○ Google ○ Yahoo ○ CalDav 今回はGoogleを使用

Slide 21

Slide 21 text

0分の予定を作成し...

Slide 22

Slide 22 text

比較用に30分の予定も一緒に作成

Slide 23

Slide 23 text

端末で同期してみる... 確かに、0分の予定は表示されない

Slide 24

Slide 24 text

コードを読む

Slide 25

Slide 25 text

gaia/apps/calendar とりあえずGitHubで読んでみ る

Slide 26

Slide 26 text

すると...

Slide 27

Slide 27 text

ん!?!?

Slide 28

Slide 28 text

Bug 1181061 - Support for events with zero duration

Slide 29

Slide 29 text

Bug 1181061 - You can't create an event starting and ending..

Slide 30

Slide 30 text

Bug 1181061 - You can't create an event starting and ending.. ● 端末で0分の予定が作れないというバグ ● GitHubをみるまで、気がつかなかった ● バグの重複を確認しなかった... ○ ちなみに、PRは見つけた日の2日前にマージされてた ● ステータスは“RESOLVED FIXED” もしかして、もう全部直ってる!?!?

Slide 31

Slide 31 text

端末上で0分の予定が作れた

Slide 32

Slide 32 text

けど... Google Calendarで作った0分の予定は表 示されない... あくまで、端末での予定作成と表示の修正 のみ

Slide 33

Slide 33 text

残ってるバグを直す!!

Slide 34

Slide 34 text

adb logcat ● Androidで使えるものと同じ ● logcatの内容が全部見れる

Slide 35

Slide 35 text

カレンダーを起動してみると... I/Calendar( 4905): Content JS LOG: views/settings [calendar] "Will add calendar to settings view" {"remote":{"id":" /caldav/v2/****************%40virtual/events/","url":"/caldav/v2/****************/events/","name":"誕生日","color":"#bad600"," description":"Google の連絡先や Google+ の「あなたのサークル」内のユーザーの誕生日を表示します。また、Google の連絡先 に登録されている記念日や予定があれば、それも表示されます。","syncToken":"****************","privilegeSet":["read","read- free-busy","read-current-user-privilege-set","write-properties"]},"accountId":1,"localDisplayed":true,"lastEventSyncDate":" 2015-12-16T15:17:38.634Z","lastEventSyncToken":"****************","firstEventSyncDate":"2015-12-16T15:00:00.000Z"," _id":2} I/Calendar( 4905): at module.exports/< (app://calendar.gaiamobile.org/js/bundle.js:3543:5) I/Calendar( 4905): Content JS LOG: views/settings [calendar] "Will add calendar to settings view" {"remote":{"id":" /caldav/v2/****************/events/","url":"/caldav/v2/****************/events/","name":"日本の祝日","color":"#df4784"," description":"日本の祝日と行事","syncToken":"****************","privilegeSet":["read","read-free-busy","read-current-user- privilege-set","write-properties"]},"accountId":1,"localDisplayed":true,"lastEventSyncDate":"2015-12-16T15:17:38.637Z"," lastEventSyncToken":"****************","firstEventSyncDate":"2015-12-16T15:00:00.000Z","_id":3}

Slide 36

Slide 36 text

adb logcat ● 既ににそれっぽい内容がログに出てる ● console.logとかでデバッグできそう

Slide 37

Slide 37 text

出力できた!!

Slide 38

Slide 38 text

テストコードを手がかりに探す ● fixturesにicalのダミーデータがあった ● ダミーを使ってる箇所から辿っていく

Slide 39

Slide 39 text

test/service/caldav_test.js

Slide 40

Slide 40 text

test/service/caldav_test.js

Slide 41

Slide 41 text

js/service/caldav.js

Slide 42

Slide 42 text

js/service/caldav.js

Slide 43

Slide 43 text

ざっと、こんな感じ ● 長くなるので割愛 ● きちんと記録をとっていないので、どう読んだか覚えてない...orz ● 基本的にデータの流れを追っただけ

Slide 44

Slide 44 text

dtendが無い!! I/Calendar( 3905): Content JS LOG: worker/manager [calendar] {"name":"worker","message":" service/caldav, [calendar] , {\"component\":[\"vevent\",[[\"dtstart\",{\"tzid\":\"Asia/Tokyo\"},\"date-time\",\" 2015-12-16T03:00:00\"],[\"dtstamp\",{},\"date-time\",\"2015-12-15T16:49:25Z\"],[\"uid\",{},\"text\",\" lbflmq7d0tdtisbenmd4pj45tk@google.com\"],[\"created\",{},\"date-time\",\"2015-12-15T16:49:25Z\"],[\" description\",{},\"text\"],[\"last-modified\",{},\"date-time\",\"2015-12-15T16:49:25Z\"],[\"location\",{},\"text\"],[\" sequence\",{},\"integer\",0],[\"status\",{},\"text\",\"CONFIRMED\"],[\"summary\",{},\"text\",\"test\"],[\"transp\", {},\"text\",\"OPAQUE\"]],[[\"valarm\",[[\"action\",{},\"text\",\"DISPLAY\"],[\"description\",{},\"text\",\"This is an event reminder\"],[\"trigger\",{},\"duration\",\"-P0DT0H30M0S\"]],[]]]],\"_rangeExceptionCache\":{},\" exceptions\":{},\"rangeExceptions\":[]}"}

Slide 45

Slide 45 text

dtendが無い!! ● いろいろ調べると0分の予定の場合、終了時刻を示す dtendプロパティが渡されて いないことがわかった ● そのため、その後の計算で落ちてた http://search.cpan.org/~rfrankel/iCal-Parser-1.16/lib/iCal/Parser.pm

Slide 46

Slide 46 text

無理やり補う (けど、これでいいのか???)

Slide 47

Slide 47 text

同期できた!!

Slide 48

Slide 48 text

けど... ● Yahooカレンダーで、終日予定の繰り返しの場合は開始時刻 = 終了時刻 となる仕 様がある ● それ用の修正と競合して、終日予定扱いされてしまう...

Slide 49

Slide 49 text

とりあえずPR打つ

Slide 50

Slide 50 text

テストも勝手に回ります

Slide 51

Slide 51 text

おわり ● まだレスポンスは来てない ● 変更内容的に、テストの修正も必要になるかも ● 終日予定になる問題は、どちらかというとYahooのデータがおかしいので、直すとし たらそっちを切り分ける感じ

Slide 52

Slide 52 text

参考 https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Developing_Gaia https://developer.mozilla.org/en- US/Firefox_OS/Developing_Gaia/Different_ways_to_run_Gaia#Using_Gaia_in_Firefox_Mulet https://developer.mozilla.org/en- US/Firefox_OS/Developing_Gaia/Submitting_a_Gaia_patch#Easy_patch_submission_with_Autolander https://developer.mozilla.org/en/docs/Introduction https://developer.mozilla.org/en-US/Firefox_OS/Phone_guide/Flame/Updating_your_Flame

Slide 53

Slide 53 text

参考 https://developer.mozilla.org/en- US/docs/Mozilla/Firefox_OS/Developing_Gaia/Running_custom_builds_in_WebIDE https://developer.mozilla.org/en- US/Firefox_OS/Developing_Gaia/Different_ways_to_run_Gaia#Using_Gaia_in_Simulator_via_WebIDE https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Developing_Gaia/Build_System_Primer https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Developing_Gaia/make_options_reference http://search.cpan.org/~rfrankel/iCal-Parser-1.16/lib/iCal/Parser.pm