taskbridgeapp.reminders.controller.ReminderController

class taskbridgeapp.reminders.controller.ReminderController

Bases: object

Contains various static methods for the stages of reminder synchronisation.

Methods

associate_containers

Associate local reminder lists with remote task calendars.

connect_caldav

Connect to the remote CalDav server.

count_completed

Count the number of local completed reminders.

delete_completed

Delete completed reminders.

fetch_local_reminders

Fetch local reminder lists

fetch_remote_reminders

Fetch remote reminders.

sync_deleted_containers

Synchronise deleted local reminder lists / remote task calendars.

sync_deleted_reminders

Synchronise deleted reminders.

sync_reminders

Synchronise reminders.

sync_reminders_to_db

Save list of reminders to SQLite database.

Attributes

CALDAV_HEADERS

Headers to send to the remote calendar server (currently unused)

CALDAV_PASSWORD

Password of the remote calendar server (this is stored in KeyChain)

CALDAV_URL

URL of the remote calendar server

CALDAV_USERNAME

Username of the remote calendar server

LOCAL_LISTS

Local reminder lists

REMOTE_CALENDARS

Remote note calendars

TO_SYNC

List of reminder lists to be synchronised

CALDAV_HEADERS = {}

Headers to send to the remote calendar server (currently unused)

CALDAV_PASSWORD = ''

Password of the remote calendar server (this is stored in KeyChain)

CALDAV_URL = ''

URL of the remote calendar server

CALDAV_USERNAME = ''

Username of the remote calendar server

LOCAL_LISTS = []

Local reminder lists

REMOTE_CALENDARS = []

Remote note calendars

TO_SYNC = []

List of reminder lists to be synchronised

__init__()
static associate_containers()

Associate local reminder lists with remote task calendars.

Return type:

tuple[bool, str] | tuple[bool, List[ReminderContainer]]

Returns:

-success (bool) - true if associations are successfully created.

-data (str | List[ReminderContainer]) - error message on failure, or list of reminder containers.

static connect_caldav()

Connect to the remote CalDav server.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if a connection is successfully made.

-data (str) - success message.

static count_completed()

Count the number of local completed reminders.

Return type:

tuple[bool, str] | tuple[bool, int]

Returns:

-success (bool) - true if completed reminders are counted successfully.

-data (str | int) - error message on failure, or number of completed reminders.

static delete_completed()

Delete completed reminders.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if completed reminders are deleted successfully.

-data (str) - error message on failure, or success message.

static fetch_local_reminders()

Fetch local reminder lists

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if local reminder lists are fetched successfully.

-data (str) - error message on failure, or success message.

static fetch_remote_reminders()

Fetch remote reminders.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if remote reminders are fetched successfully.

-data (str) - error message on failure, or success message.

static sync_deleted_containers()

Synchronise deleted local reminder lists / remote task calendars.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if reminder containers are synchronised successfully.

-data (str) - error message on failure, or success message.

static sync_deleted_reminders()

Synchronise deleted reminders.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if deleted reminders are synchronised successfully.

-data (str) - error message on failure, or success message.

static sync_reminders()

Synchronise reminders. Returns a dictionary with the following keys:

  • remote_added - name of reminders added to the remote calendar as List[str].

  • remote_updated - name of reminders updated in the remote calendar as List[str].

  • local_added - name of reminders added to the local list as List[str].

  • local_updated - name of reminders updated in the local list as List[str].

Any of the above may be empty if no such changes were made.

Return type:

tuple[bool, str] | tuple[bool, dict]

Returns:

-success (bool) - true if notes are successfully synchronised.

-data (str | dict) - error message on failure, or dict with results as above.

static sync_reminders_to_db()

Save list of reminders to SQLite database.

Return type:

tuple[bool, str]

Returns:

-success (bool) - true if reminders are saved successfully.

-data (str) - error message on failure, or success message.