database is dropped when viewing settings screen if using SD Card sync

Bug #657178 reported by Olivier Bilodeau on 2010-10-09
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Olivier Bilodeau

Bug Description

Because when the preference activity loads, setServer is run for initialization and within setServer:

if (!service.needsAuth()){

SD Card service doesn't need auth so the database is nuked.

This is all new code to me so I'll see what I can do..

Olivier Bilodeau (plaxx) on 2010-10-09
Changed in tomdroid:
assignee: nobody → Olivier Bilodeau (plaxx)
importance: Undecided → High
milestone: none → 0.4
status: New → Confirmed
Olivier Bilodeau (plaxx) wrote :

I simply removed the lines. For SD Card it's ok and as far as I can tell it won't do any problems to Web sync... correct?

I'll make my mind on this tomorrow. It's in lp:tomdroid rev 197 for now.

I have an apk signed with debug keys if anyone's willing to test.

Rodja (trappe) wrote :

I've wrote these lines to gain a clean state when switching from Web sync to SD Card. Otherwise your Web notes will still be in the local database.

Unfortunately I overlooked that setServer(...) is not only called when the pref changes but also every time the Activity get's created:

// Enable or disable the server field depending on the selected sync service

  syncService.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

   public boolean onPreferenceChange(Preference preference, Object newValue) {

    return true;

Rodja (trappe) wrote :

I think there are two simple solutions:

1. move the lines

if (!service.needsAuth()){

into the onPreferenceChangeListener

2. find an other way to enable or disable the server field depending on the selected sync service, without calling setServer() in OnCreate.

Olivier Bilodeau (plaxx) wrote :

Implemented solution 1. onPreferenceChangeListener calls a new syncServiceChanged if service changed then in here I setServer and drop database if !service.needsAuth.

Changed in tomdroid:
status: Confirmed → Fix Committed
Olivier Bilodeau (plaxx) wrote :

fix released in 0.4.0

Changed in tomdroid:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers