Closed Bug 796582 Opened 12 years ago Closed 12 years ago

Don't use localStorage in the dialer

Categories

(Firefox OS Graveyard :: Gaia, defect)

defect
Not set
normal

Tracking

(blocking-basecamp:+)

RESOLVED FIXED
blocking-basecamp +

People

(Reporter: ghtobz, Unassigned)

Details

(Whiteboard: [label:dialer][label:perf][label:mentored], QARegressExclude)

[GitHub issue by fabricedesre on 2012-08-31T14:27:51Z, https://github.com/mozilla-b2g/gaia/issues/4222]
dialer/js/recents.js:374:        ((localStorage.getItem('latestCallLogVisit') < recent.date) ?
dialer/js/recents.js:574:    localStorage.setItem('latestCallLogVisit', Date.now());
[GitHub comment by SKatiyar on 2012-09-12T16:24:56Z]
Hi @fabricedesre,
I would like to take up this bug, but I would be needing some help regarding Gaia since I am new to it. I have b2g compiled and running on my system.
Thanks!
[GitHub comment by fabricedesre on 2012-09-12T16:40:50Z]
Welcome @SKatiyar ! I think @etiennesegonzac could mentor you here, since he "owns" the dialer.

thanks again for contributing!
[GitHub comment by SKatiyar on 2012-09-12T16:45:39Z]
Hi @etiennesegonzac,
Any help regarding the gaia-issues 4222 or even the hints on how to get started on working with coding gaia would be a great help.
Thanks!
[GitHub comment by etiennesegonzac on 2012-09-13T17:30:43Z]
@SKatiyar my pleasure :)

We want to replace the use of `localStorage` in the `recents.js` file like here :
https://github.com/mozilla-b2g/gaia/blob/master/apps/communications/dialer/js/recents.js#L591

By the asyncStorage library, you can find a example on how to use this library here:
https://github.com/mozilla-b2g/gaia/blob/master/apps/fm/js/fm.js#L397

Hope it's enough to start, you can always ask questions here!
[GitHub comment by SKatiyar on 2012-09-16T17:17:05Z]
Hi @etiennesegonzac,
Can I get more info on the asyncStorage library, basically using it.
Thanks!
[GitHub comment by vingtetun on 2012-09-17T10:19:02Z]
@SKatiyar There is a simple example about how to use it in apps/fm/js/fm.js

Basically there is 1 file to include (look at apps/fm/index.html) and 2 methods to use: 
asyncStorage.getItem('name_of_the_key', function callback(value) {
  ... do something with the value ...;
});

asyncStorage.setItem('name_of_the_key', value);

and that's it!
[GitHub comment by SKatiyar on 2012-09-17T17:52:12Z]
@vingtetun,
Thanks a lot and could you tell me how do I post the solution?
[GitHub comment by vingtetun on 2012-09-18T12:32:12Z]
@SKatiyar Are your changes in a branch in a fork?
[GitHub comment by SKatiyar on 2012-09-18T13:48:35Z]
@vingtetun, Does method given on mozilla dev website count as branch fork??? I downloaded the source on my linux machine using git clone command, modified and recompiled it, also ran the test-agent app in b2g after modifications. It showed no error for the dialer tests. So I am hoping the modifications are working correctly. How do I proceed from this point on??
[GitHub comment by vingtetun on 2012-09-18T14:26:12Z]
@SKatiyar From what you said it seems like you have a clone but you need to create a fork. There is some buttons on github to help you there. Once this is done you need to create a clone of your own fork and start the work from here.

Then you need to run |git checkout -b mybranch|. This will create a new branch called mybranch with your changes. 
But your changes are not permanent yet. Now you can do |git add filename.js| and do the action multiple times based on how many file you have changed. Once you have added all the file you have changed (|git diff| should be empty now) you can run |git commit -m "Convert localStorage to asyncStorage to the dialer app".

Now you should see your changes as a commit entry via |git log -1|.

If you see it that's good! You can now run |git push origin mybranch|. Once this is done you will be able to see your new branch on the github interface. From here you can create a 'pull request' to integrate your changes to the main repository!

It seems complicate but this is super simple once you are used to it (after a lot of iterations! ;))
[GitHub comment by SKatiyar on 2012-09-18T15:34:07Z]
@vingtetun, I am able to see my new branch on the github interface. Before creating any pull requests do i have to test the changes?
[GitHub comment by vingtetun on 2012-09-18T15:35:13Z]
@SKatiyar That would be lovely if you can try your changes before doing the pull request :) (congrats for the branch!)
[GitHub comment by SKatiyar on 2012-09-18T15:45:41Z]
@vingtetun, I used the test-agent app to test them but wasn't able to do the testing with other methods mentioned on gaia-hacking site. Is that a problem???
[GitHub comment by autonome on 2012-09-25T06:10:47Z]
@etiennesegonzac @vingtetun @fabricedesre can you please review and merge asap?
https://github.com/mozilla-b2g/gaia/pull/5572
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [label:dialer][label:perf][label:mentored] → [label:dialer][label:perf][label:mentored], QARegressExclude
You need to log in before you can comment on or make changes to this bug.