Implement intent filter; hide password for now

This commit is contained in:
2020-11-22 17:00:37 -06:00
parent 23f2978a64
commit 0859cec853
10 changed files with 155 additions and 42 deletions

View File

@@ -329,6 +329,11 @@ public class Preferences
return storage.getBoolean("pref_sync_enabled", false);
}
public void setSyncEnabled(boolean enabled)
{
storage.putBoolean("pref_sync_enabled", enabled);
}
/**
* @return An integer representing the first day of the week. Sunday

View File

@@ -25,7 +25,9 @@ import org.isoron.uhabits.core.commands.*;
import org.isoron.uhabits.core.models.*;
import org.isoron.uhabits.core.preferences.*;
import org.isoron.uhabits.core.tasks.*;
import org.isoron.uhabits.core.ui.callbacks.*;
import org.isoron.uhabits.core.utils.*;
import org.jetbrains.annotations.*;
import java.io.*;
import java.util.*;
@@ -156,10 +158,19 @@ public class ListHabitsBehavior
habit.getId());
}
public void onSyncKeyOffer(@NotNull String key)
{
screen.showConfirmInstallSyncKey(() -> {
prefs.setSyncKey(key);
prefs.setSyncEnabled(true);
screen.showMessage(Message.SYNC_ENABLED);
});
}
public enum Message
{
COULD_NOT_EXPORT, IMPORT_SUCCESSFUL, IMPORT_FAILED, DATABASE_REPAIRED,
COULD_NOT_GENERATE_BUG_REPORT, FILE_NOT_RECOGNIZED
COULD_NOT_GENERATE_BUG_REPORT, FILE_NOT_RECOGNIZED, SYNC_ENABLED
}
public interface BugReporter
@@ -196,5 +207,7 @@ public class ListHabitsBehavior
void showSendBugReportToDeveloperScreen(String log);
void showSendFileScreen(@NonNull String filename);
void showConfirmInstallSyncKey(@NonNull OnConfirmedCallback callback);
}
}