diff --git a/android/app/.gitignore b/android/app/.gitignore new file mode 100644 index 0000000..0e60033 --- /dev/null +++ b/android/app/.gitignore @@ -0,0 +1 @@ +.cxx diff --git a/assets/i18n/en.json b/assets/i18n/en.json index d45a746..61bb802 100644 --- a/assets/i18n/en.json +++ b/assets/i18n/en.json @@ -50,7 +50,6 @@ "edit_account_page": { "titlebar": "Edit Account", "header": "Account Profile", - "update": "Update", "instructions": "This information will be shared with the people you invite to connect with you on VeilidChat.", "error": "Account modification error", "name": "Name", @@ -64,9 +63,9 @@ "destroy_account_description": "Destroy account, removing it completely from all devices everywhere", "destroy_account_confirm_message": "This action is PERMANENT, and your VeilidChat account will no longer be recoverable with the recovery key. Restoring from backups will not recover your account!", "destroy_account_confirm_message_details": "You will lose access to:\n • Your entire message history\n • Your contacts\n • This will not remove your messages you have sent from other people's devices\n", - "confirm_are_you_sure": "Are you sure you want to do this?", - "failed_to_remove": "Failed to remove account.\n\nTry again when you have a more stable network connection.", - "failed_to_destroy": "Failed to destroy account.\n\nTry again when you have a more stable network connection.", + "failed_to_remove_title": "Failed to remove account", + "try_again_network": "Try again when you have a more stable network connection", + "failed_to_destroy_title": "Failed to destroy account", "account_removed": "Account removed successfully", "account_destroyed": "Account destroyed successfully" }, @@ -83,6 +82,12 @@ "view": "View", "share": "Share" }, + "confirmation": { + "confirm": "Confirm", + "discard_changes": "Discard changes?", + "are_you_sure_discard": "Are you sure you want to discard your changes?", + "are_you_sure": "Are you sure you want to do this?" + }, "button": { "ok": "Ok", "cancel": "Cancel", @@ -94,10 +99,11 @@ "close": "Close", "yes": "Yes", "no": "No", - "waiting_for_network": "Waiting For Network" + "update": "Update", + "waiting_for_network": "Waiting For Network", + "chat": "Chat" }, "toast": { - "confirm": "Confirm", "error": "Error", "info": "Info" }, @@ -122,7 +128,7 @@ "contacts": "Contacts", "edit_contact": "Edit Contact", "invitations": "Invitations", - "no_contact_selected": "Double-click a contact to edit it", + "no_contact_selected": "Select a contact to view or edit", "new_chat": "Open Chat", "close_contact": "Close Contact" }, @@ -141,9 +147,7 @@ "form_nickname": "Nickname", "form_notes": "Notes", "form_fingerprint": "Fingerprint", - "form_show_availability": "Show availability", - "save": "Save", - "save_disabled": "Save" + "form_show_availability": "Show availability" }, "availability": { "unspecified": "Unspecified", @@ -171,18 +175,21 @@ "create_invitation_dialog": { "title": "Create Contact Invitation", "me": "me", - "fingerprint": "Fingerprint:", + "recipient_name": "Contact Name", + "recipient_hint": "Enter the recipient's name", + "recipient_helper": "Name of the person you are inviting to chat", + "message_hint": "Enter message for contact (optional)", + "message_label": "Message", + "message_helper": "Message to send with invitation", + "fingerprint": "Fingerprint", "connect_with_me": "Connect with {name} on VeilidChat!", - "enter_message_hint": "Enter message for contact (optional)", - "message_to_contact": "Message to send with invitation (not encrypted)", "generate": "Generate Invitation", - "message": "Message", "unlocked": "Unlocked", "pin": "PIN", "password": "Password", "protect_this_invitation": "Protect this invitation:", "note": "Note:", - "note_text": "Contact invitations can be used by anyone. Make sure you send the invitation to your contact over a secure medium, and preferably use a password or pin to ensure that they are the only ones who can unlock the invitation and accept it.", + "note_text": "Do not post contact invitations publicly.\n\nContact invitations can be used by anyone. Make sure you send the invitation to your contact over a secure medium, and preferably use a password or pin to ensure that they are the only ones who can unlock the invitation and accept it.", "pin_description": "Choose a PIN to protect the contact invite.\n\nThis level of security is appropriate only for casual connections in public environments for 'shoulder surfing' protection.", "password_description": "Choose a strong password to protect the contact invite.\n\nThis level of security is appropriate when you must be sure the contact invitation is only accepted by its intended recipient. Share this password over a different medium than the invite itself.", "pin_does_not_match": "PIN does not match", @@ -192,6 +199,7 @@ "invitation_copied": "Invitation Copied" }, "invitation_dialog": { + "to": "To", "message_from_contact": "Message from contact", "validating": "Validating...", "failed_to_accept": "Failed to accept contact invitation", @@ -278,6 +286,7 @@ "delivery": "Delivery", "enable_badge": "Enable icon 'badge' bubble", "enable_notifications": "Enable notifications", + "enable_wallpaper": "Enable wallpaper", "message_notification_content": "Message notification content", "invitation_accepted": "On invitation accept/reject", "message_received": "On message received", diff --git a/assets/images/grid.svg b/assets/images/grid.svg new file mode 100644 index 0000000..f30d577 --- /dev/null +++ b/assets/images/grid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/wallpaper/arctic.svg b/assets/images/wallpaper/arctic.svg new file mode 100644 index 0000000..ebcaee4 --- /dev/null +++ b/assets/images/wallpaper/arctic.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/babydoll.svg b/assets/images/wallpaper/babydoll.svg new file mode 100644 index 0000000..55f28a3 --- /dev/null +++ b/assets/images/wallpaper/babydoll.svg @@ -0,0 +1,663 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/eggplant.svg b/assets/images/wallpaper/eggplant.svg new file mode 100644 index 0000000..48e6ad3 --- /dev/null +++ b/assets/images/wallpaper/eggplant.svg @@ -0,0 +1,495 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/elite.svg b/assets/images/wallpaper/elite.svg new file mode 100644 index 0000000..606d21f --- /dev/null +++ b/assets/images/wallpaper/elite.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/wallpaper/forest.svg b/assets/images/wallpaper/forest.svg new file mode 100644 index 0000000..fb61069 --- /dev/null +++ b/assets/images/wallpaper/forest.svg @@ -0,0 +1,6888 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/garden.svg b/assets/images/wallpaper/garden.svg new file mode 100644 index 0000000..f4e6372 --- /dev/null +++ b/assets/images/wallpaper/garden.svg @@ -0,0 +1,8182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/gold.svg b/assets/images/wallpaper/gold.svg new file mode 100644 index 0000000..16e5ab5 --- /dev/null +++ b/assets/images/wallpaper/gold.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/grim.svg b/assets/images/wallpaper/grim.svg new file mode 100644 index 0000000..7c3968f --- /dev/null +++ b/assets/images/wallpaper/grim.svg @@ -0,0 +1,928 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/lapis.svg b/assets/images/wallpaper/lapis.svg new file mode 100644 index 0000000..c78fa58 --- /dev/null +++ b/assets/images/wallpaper/lapis.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/lime.svg b/assets/images/wallpaper/lime.svg new file mode 100644 index 0000000..d65222e --- /dev/null +++ b/assets/images/wallpaper/lime.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/scarlet.svg b/assets/images/wallpaper/scarlet.svg new file mode 100644 index 0000000..7047ca7 --- /dev/null +++ b/assets/images/wallpaper/scarlet.svg @@ -0,0 +1,349 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/wallpaper/vapor.svg b/assets/images/wallpaper/vapor.svg new file mode 100644 index 0000000..34bfe59 --- /dev/null +++ b/assets/images/wallpaper/vapor.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.yaml b/build.yaml index 950fe95..77b9050 100644 --- a/build.yaml +++ b/build.yaml @@ -1,6 +1,9 @@ targets: $default: builders: + freezed: + options: + generic_argument_factories: true json_serializable: options: explicit_to_json: true diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 8b3e7d0..3e31b44 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -48,6 +48,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> diff --git a/lib/account_manager/cubits/account_record_cubit.dart b/lib/account_manager/cubits/account_record_cubit.dart index 9a73246..16ab2e0 100644 --- a/lib/account_manager/cubits/account_record_cubit.dart +++ b/lib/account_manager/cubits/account_record_cubit.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:async_tools/async_tools.dart'; -import 'package:protobuf/protobuf.dart'; import 'package:veilid_support/veilid_support.dart'; import '../../proto/proto.dart' as proto; @@ -47,53 +46,30 @@ class AccountRecordCubit extends DefaultDHTRecordCubit { // Public Interface void updateAccount( - AccountSpec accountSpec, Future Function() onSuccess) { - _sspUpdate.updateState((accountSpec, onSuccess), (state) async { + AccountSpec accountSpec, Future Function() onChanged) { + _sspUpdate.updateState((accountSpec, onChanged), (state) async { await _updateAccountAsync(state.$1, state.$2); }); } Future _updateAccountAsync( - AccountSpec accountSpec, Future Function() onSuccess) async { - var changed = false; - + AccountSpec accountSpec, Future Function() onChanged) async { + var changed = true; await record?.eventualUpdateProtobuf(proto.Account.fromBuffer, (old) async { - changed = false; if (old == null) { return null; } - final newAccount = old.deepCopy() - ..profile.name = accountSpec.name - ..profile.pronouns = accountSpec.pronouns - ..profile.about = accountSpec.about - ..profile.availability = accountSpec.availability - ..profile.status = accountSpec.status - //..profile.avatar = - ..profile.timestamp = Veilid.instance.now().toInt64() - ..invisible = accountSpec.invisible - ..autodetectAway = accountSpec.autoAway - ..autoAwayTimeoutMin = accountSpec.autoAwayTimeout - ..freeMessage = accountSpec.freeMessage - ..awayMessage = accountSpec.awayMessage - ..busyMessage = accountSpec.busyMessage; + final oldAccountSpec = AccountSpec.fromProto(old); + changed = oldAccountSpec != accountSpec; + if (!changed) { + return null; + } - if (newAccount.profile != old.profile || - newAccount.invisible != old.invisible || - newAccount.autodetectAway != old.autodetectAway || - newAccount.autoAwayTimeoutMin != old.autoAwayTimeoutMin || - newAccount.freeMessage != old.freeMessage || - newAccount.busyMessage != old.busyMessage || - newAccount.awayMessage != old.awayMessage) { - changed = true; - } - if (changed) { - return newAccount; - } - return null; + return accountSpec.updateProto(old); }); if (changed) { - await onSuccess(); + await onChanged(); } } diff --git a/lib/account_manager/models/account_spec.dart b/lib/account_manager/models/account_spec.dart index 539b8d0..918e192 100644 --- a/lib/account_manager/models/account_spec.dart +++ b/lib/account_manager/models/account_spec.dart @@ -1,12 +1,16 @@ -import 'package:flutter/widgets.dart'; +import 'package:equatable/equatable.dart'; +import 'package:meta/meta.dart'; +import 'package:protobuf/protobuf.dart'; +import 'package:veilid_support/veilid_support.dart'; import '../../proto/proto.dart' as proto; /// Profile and Account configurable fields /// Some are publicly visible via the proto.Profile /// Some are privately held as proto.Account configurations -class AccountSpec { - AccountSpec( +@immutable +class AccountSpec extends Equatable { + const AccountSpec( {required this.name, required this.pronouns, required this.about, @@ -19,37 +23,99 @@ class AccountSpec { required this.autoAway, required this.autoAwayTimeout}); + const AccountSpec.empty() + : name = '', + pronouns = '', + about = '', + availability = proto.Availability.AVAILABILITY_FREE, + invisible = false, + freeMessage = '', + awayMessage = '', + busyMessage = '', + avatar = null, + autoAway = false, + autoAwayTimeout = 15; + + AccountSpec.fromProto(proto.Account p) + : name = p.profile.name, + pronouns = p.profile.pronouns, + about = p.profile.about, + availability = p.profile.availability, + invisible = p.invisible, + freeMessage = p.freeMessage, + awayMessage = p.awayMessage, + busyMessage = p.busyMessage, + avatar = p.profile.hasAvatar() ? p.profile.avatar : null, + autoAway = p.autodetectAway, + autoAwayTimeout = p.autoAwayTimeoutMin; + String get status { late final String status; switch (availability) { case proto.Availability.AVAILABILITY_AWAY: status = awayMessage; - break; case proto.Availability.AVAILABILITY_BUSY: status = busyMessage; - break; case proto.Availability.AVAILABILITY_FREE: status = freeMessage; - break; case proto.Availability.AVAILABILITY_UNSPECIFIED: case proto.Availability.AVAILABILITY_OFFLINE: status = ''; - break; } return status; } + Future updateProto(proto.Account old) async { + final newProto = old.deepCopy() + ..profile.name = name + ..profile.pronouns = pronouns + ..profile.about = about + ..profile.availability = availability + ..profile.status = status + ..profile.timestamp = Veilid.instance.now().toInt64() + ..invisible = invisible + ..autodetectAway = autoAway + ..autoAwayTimeoutMin = autoAwayTimeout + ..freeMessage = freeMessage + ..awayMessage = awayMessage + ..busyMessage = busyMessage; + + final newAvatar = avatar; + if (newAvatar != null) { + newProto.profile.avatar = newAvatar; + } else { + newProto.profile.clearAvatar(); + } + + return newProto; + } + //////////////////////////////////////////////////////////////////////////// - String name; - String pronouns; - String about; - proto.Availability availability; - bool invisible; - String freeMessage; - String awayMessage; - String busyMessage; - ImageProvider? avatar; - bool autoAway; - int autoAwayTimeout; + final String name; + final String pronouns; + final String about; + final proto.Availability availability; + final bool invisible; + final String freeMessage; + final String awayMessage; + final String busyMessage; + final proto.DataReference? avatar; + final bool autoAway; + final int autoAwayTimeout; + + @override + List get props => [ + name, + pronouns, + about, + availability, + invisible, + freeMessage, + awayMessage, + busyMessage, + avatar, + autoAway, + autoAwayTimeout + ]; } diff --git a/lib/account_manager/models/local_account/local_account.freezed.dart b/lib/account_manager/models/local_account/local_account.freezed.dart index 92e376f..effc69a 100644 --- a/lib/account_manager/models/local_account/local_account.freezed.dart +++ b/lib/account_manager/models/local_account/local_account.freezed.dart @@ -37,8 +37,12 @@ mixin _$LocalAccount { throw _privateConstructorUsedError; // Display name for account until it is unlocked String get name => throw _privateConstructorUsedError; + /// Serializes this LocalAccount to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of LocalAccount + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $LocalAccountCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -70,6 +74,8 @@ class _$LocalAccountCopyWithImpl<$Res, $Val extends LocalAccount> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of LocalAccount + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -108,6 +114,8 @@ class _$LocalAccountCopyWithImpl<$Res, $Val extends LocalAccount> ) as $Val); } + /// Create a copy of LocalAccount + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $SuperIdentityCopyWith<$Res> get superIdentity { @@ -145,6 +153,8 @@ class __$$LocalAccountImplCopyWithImpl<$Res> _$LocalAccountImpl _value, $Res Function(_$LocalAccountImpl) _then) : super(_value, _then); + /// Create a copy of LocalAccount + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -244,7 +254,7 @@ class _$LocalAccountImpl implements _LocalAccount { (identical(other.name, name) || other.name == name)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -255,7 +265,9 @@ class _$LocalAccountImpl implements _LocalAccount { hiddenAccount, name); - @JsonKey(ignore: true) + /// Create a copy of LocalAccount + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$LocalAccountImplCopyWith<_$LocalAccountImpl> get copyWith => @@ -281,24 +293,32 @@ abstract class _LocalAccount implements LocalAccount { factory _LocalAccount.fromJson(Map json) = _$LocalAccountImpl.fromJson; - @override // The super identity key record for the account, +// The super identity key record for the account, // containing the publicKey in the currentIdentity - SuperIdentity get superIdentity; - @override // The encrypted currentIdentity secret that goes with -// the identityPublicKey with appended salt - @Uint8ListJsonConverter() - Uint8List get identitySecretBytes; - @override // The kind of encryption input used on the account - EncryptionKeyType get encryptionKeyType; - @override // If account is not hidden, password can be retrieved via - bool get biometricsEnabled; - @override // Keep account hidden unless account password is entered -// (tries all hidden accounts with auth method (no biometrics)) - bool get hiddenAccount; - @override // Display name for account until it is unlocked - String get name; @override - @JsonKey(ignore: true) + SuperIdentity + get superIdentity; // The encrypted currentIdentity secret that goes with +// the identityPublicKey with appended salt + @override + @Uint8ListJsonConverter() + Uint8List + get identitySecretBytes; // The kind of encryption input used on the account + @override + EncryptionKeyType + get encryptionKeyType; // If account is not hidden, password can be retrieved via + @override + bool + get biometricsEnabled; // Keep account hidden unless account password is entered +// (tries all hidden accounts with auth method (no biometrics)) + @override + bool get hiddenAccount; // Display name for account until it is unlocked + @override + String get name; + + /// Create a copy of LocalAccount + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$LocalAccountImplCopyWith<_$LocalAccountImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/account_manager/models/per_account_collection_state/per_account_collection_state.freezed.dart b/lib/account_manager/models/per_account_collection_state/per_account_collection_state.freezed.dart index 8dcc549..1aa0c7e 100644 --- a/lib/account_manager/models/per_account_collection_state/per_account_collection_state.freezed.dart +++ b/lib/account_manager/models/per_account_collection_state/per_account_collection_state.freezed.dart @@ -35,7 +35,9 @@ mixin _$PerAccountCollectionState { get activeSingleContactChatBlocMapCubit => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of PerAccountCollectionState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PerAccountCollectionStateCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -74,6 +76,8 @@ class _$PerAccountCollectionStateCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of PerAccountCollectionState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -139,6 +143,8 @@ class _$PerAccountCollectionStateCopyWithImpl<$Res, ) as $Val); } + /// Create a copy of PerAccountCollectionState + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AsyncValueCopyWith? get avAccountRecordState { @@ -190,6 +196,8 @@ class __$$PerAccountCollectionStateImplCopyWithImpl<$Res> $Res Function(_$PerAccountCollectionStateImpl) _then) : super(_value, _then); + /// Create a copy of PerAccountCollectionState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -353,7 +361,9 @@ class _$PerAccountCollectionStateImpl implements _PerAccountCollectionState { activeConversationsBlocMapCubit, activeSingleContactChatBlocMapCubit); - @JsonKey(ignore: true) + /// Create a copy of PerAccountCollectionState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PerAccountCollectionStateImplCopyWith<_$PerAccountCollectionStateImpl> @@ -401,8 +411,11 @@ abstract class _PerAccountCollectionState implements PerAccountCollectionState { ActiveConversationsBlocMapCubit? get activeConversationsBlocMapCubit; @override ActiveSingleContactChatBlocMapCubit? get activeSingleContactChatBlocMapCubit; + + /// Create a copy of PerAccountCollectionState + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PerAccountCollectionStateImplCopyWith<_$PerAccountCollectionStateImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/account_manager/models/user_login/user_login.freezed.dart b/lib/account_manager/models/user_login/user_login.freezed.dart index c93ee7b..2804a77 100644 --- a/lib/account_manager/models/user_login/user_login.freezed.dart +++ b/lib/account_manager/models/user_login/user_login.freezed.dart @@ -30,8 +30,12 @@ mixin _$UserLogin { throw _privateConstructorUsedError; // The time this login was most recently used Timestamp get lastActive => throw _privateConstructorUsedError; + /// Serializes this UserLogin to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of UserLogin + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $UserLoginCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -60,6 +64,8 @@ class _$UserLoginCopyWithImpl<$Res, $Val extends UserLogin> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of UserLogin + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -88,6 +94,8 @@ class _$UserLoginCopyWithImpl<$Res, $Val extends UserLogin> ) as $Val); } + /// Create a copy of UserLogin + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AccountRecordInfoCopyWith<$Res> get accountRecordInfo { @@ -123,6 +131,8 @@ class __$$UserLoginImplCopyWithImpl<$Res> _$UserLoginImpl _value, $Res Function(_$UserLoginImpl) _then) : super(_value, _then); + /// Create a copy of UserLogin + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -198,12 +208,14 @@ class _$UserLoginImpl implements _UserLogin { other.lastActive == lastActive)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, superIdentityRecordKey, identitySecret, accountRecordInfo, lastActive); - @JsonKey(ignore: true) + /// Create a copy of UserLogin + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$UserLoginImplCopyWith<_$UserLoginImpl> get copyWith => @@ -227,17 +239,24 @@ abstract class _UserLogin implements UserLogin { factory _UserLogin.fromJson(Map json) = _$UserLoginImpl.fromJson; - @override // SuperIdentity record key for the user +// SuperIdentity record key for the user // used to index the local accounts table - Typed get superIdentityRecordKey; - @override // The identity secret as unlocked from the local accounts table - Typed get identitySecret; - @override // The account record key, owner key and secret pulled from the identity - AccountRecordInfo get accountRecordInfo; - @override // The time this login was most recently used - Timestamp get lastActive; @override - @JsonKey(ignore: true) + Typed + get superIdentityRecordKey; // The identity secret as unlocked from the local accounts table + @override + Typed + get identitySecret; // The account record key, owner key and secret pulled from the identity + @override + AccountRecordInfo + get accountRecordInfo; // The time this login was most recently used + @override + Timestamp get lastActive; + + /// Create a copy of UserLogin + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$UserLoginImplCopyWith<_$UserLoginImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/account_manager/views/edit_account_page.dart b/lib/account_manager/views/edit_account_page.dart index 3ba0f65..81b67eb 100644 --- a/lib/account_manager/views/edit_account_page.dart +++ b/lib/account_manager/views/edit_account_page.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:async_tools/async_tools.dart'; import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -10,17 +11,18 @@ import 'package:veilid_support/veilid_support.dart'; import '../../layout/default_app_bar.dart'; import '../../notifications/notifications.dart'; -import '../../proto/proto.dart' as proto; import '../../theme/theme.dart'; import '../../tools/tools.dart'; import '../../veilid_processor/veilid_processor.dart'; import '../account_manager.dart'; import 'edit_profile_form.dart'; +const _kDoBackArrow = 'doBackArrow'; + class EditAccountPage extends StatefulWidget { const EditAccountPage( {required this.superIdentityRecordKey, - required this.existingAccount, + required this.initialValue, required this.accountRecord, super.key}); @@ -28,7 +30,7 @@ class EditAccountPage extends StatefulWidget { State createState() => _EditAccountPageState(); final TypedKey superIdentityRecordKey; - final proto.Account existingAccount; + final AccountSpec initialValue; final OwnedDHTRecordPointer accountRecord; @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { @@ -36,8 +38,7 @@ class EditAccountPage extends StatefulWidget { properties ..add(DiagnosticsProperty( 'superIdentityRecordKey', superIdentityRecordKey)) - ..add(DiagnosticsProperty( - 'existingAccount', existingAccount)) + ..add(DiagnosticsProperty('initialValue', initialValue)) ..add(DiagnosticsProperty( 'accountRecord', accountRecord)); } @@ -49,36 +50,14 @@ class _EditAccountPageState extends WindowSetupState { titleBarStyle: TitleBarStyle.normal, orientationCapability: OrientationCapability.portraitOnly); - Widget _editAccountForm(BuildContext context, - {required Future Function(AccountSpec) onUpdate}) => - EditProfileForm( + EditProfileForm _editAccountForm(BuildContext context) => EditProfileForm( header: translate('edit_account_page.header'), instructions: translate('edit_account_page.instructions'), - submitText: translate('edit_account_page.update'), + submitText: translate('button.update'), submitDisabledText: translate('button.waiting_for_network'), - onUpdate: onUpdate, - initialValueCallback: (key) => switch (key) { - EditProfileForm.formFieldName => widget.existingAccount.profile.name, - EditProfileForm.formFieldPronouns => - widget.existingAccount.profile.pronouns, - EditProfileForm.formFieldAbout => - widget.existingAccount.profile.about, - EditProfileForm.formFieldAvailability => - widget.existingAccount.profile.availability, - EditProfileForm.formFieldFreeMessage => - widget.existingAccount.freeMessage, - EditProfileForm.formFieldAwayMessage => - widget.existingAccount.awayMessage, - EditProfileForm.formFieldBusyMessage => - widget.existingAccount.busyMessage, - EditProfileForm.formFieldAvatar => - widget.existingAccount.profile.avatar, - EditProfileForm.formFieldAutoAway => - widget.existingAccount.autodetectAway, - EditProfileForm.formFieldAutoAwayTimeout => - widget.existingAccount.autoAwayTimeoutMin.toString(), - String() => throw UnimplementedError(), - }, + onSubmit: _onSubmit, + onModifiedState: _onModifiedState, + initialValue: widget.initialValue, ); Future _onRemoveAccount() async { @@ -88,8 +67,7 @@ class _EditAccountPageState extends WindowSetupState { child: Column(mainAxisSize: MainAxisSize.min, children: [ Text(translate('edit_account_page.remove_account_confirm_message')) .paddingLTRB(24, 24, 24, 0), - Text(translate('edit_account_page.confirm_are_you_sure')) - .paddingAll(8), + Text(translate('confirmation.are_you_sure')).paddingAll(8), Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { @@ -127,9 +105,9 @@ class _EditAccountPageState extends WindowSetupState { .info(text: translate('edit_account_page.account_removed')); GoRouterHelper(context).pop(); } else { - context - .read() - .error(text: translate('edit_account_page.failed_to_remove')); + context.read().error( + title: translate('edit_account_page.failed_to_remove_title'), + text: translate('edit_account_page.try_again_network')); } } } finally { @@ -156,8 +134,7 @@ class _EditAccountPageState extends WindowSetupState { Text(translate( 'edit_account_page.destroy_account_confirm_message_details')) .paddingLTRB(24, 24, 24, 0), - Text(translate('edit_account_page.confirm_are_you_sure')) - .paddingAll(8), + Text(translate('confirmation.are_you_sure')).paddingAll(8), Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { @@ -196,7 +173,8 @@ class _EditAccountPageState extends WindowSetupState { GoRouterHelper(context).pop(); } else { context.read().error( - text: translate('edit_account_page.failed_to_destroy')); + title: translate('edit_account_page.failed_to_destroy_title'), + text: translate('edit_account_page.try_again_network')); } } } finally { @@ -213,26 +191,51 @@ class _EditAccountPageState extends WindowSetupState { } } - Future _onUpdate(AccountSpec accountSpec) async { - // Look up account cubit for this specific account - final perAccountCollectionBlocMapCubit = - context.read(); - final accountRecordCubit = await perAccountCollectionBlocMapCubit.operate( - widget.superIdentityRecordKey, - closure: (c) async => c.accountRecordCubit); - if (accountRecordCubit == null) { - return; - } - - // Update account profile DHT record - // This triggers ConversationCubits to update - accountRecordCubit.updateAccount(accountSpec, () async { - // Update local account profile - await AccountRepository.instance - .updateLocalAccount(widget.superIdentityRecordKey, accountSpec); + void _onModifiedState(bool isModified) { + setState(() { + _isModified = isModified; }); } + Future _onSubmit(AccountSpec accountSpec) async { + try { + setState(() { + _isInAsyncCall = true; + }); + try { + // Look up account cubit for this specific account + final perAccountCollectionBlocMapCubit = + context.read(); + final accountRecordCubit = await perAccountCollectionBlocMapCubit + .operate(widget.superIdentityRecordKey, + closure: (c) async => c.accountRecordCubit); + if (accountRecordCubit == null) { + return false; + } + + // Update account profile DHT record + // This triggers ConversationCubits to update + accountRecordCubit.updateAccount(accountSpec, () async { + // Update local account profile + await AccountRepository.instance + .updateLocalAccount(widget.superIdentityRecordKey, accountSpec); + }); + + return true; + } finally { + setState(() { + _isInAsyncCall = false; + }); + } + } on Exception catch (e, st) { + if (mounted) { + await showErrorStacktraceModal( + context: context, error: e, stackTrace: st); + } + } + return false; + } + @override Widget build(BuildContext context) { final displayModalHUD = _isInAsyncCall; @@ -245,9 +248,23 @@ class _EditAccountPageState extends WindowSetupState { ? IconButton( icon: const Icon(Icons.arrow_back), onPressed: () { - Navigator.pop(context); - }, - ) + singleFuture((this, _kDoBackArrow), () async { + if (_isModified) { + final ok = await showConfirmModal( + context: context, + title: + translate('confirmation.discard_changes'), + text: translate( + 'confirmation.are_you_sure_discard')); + if (!ok) { + return; + } + } + if (context.mounted) { + Navigator.pop(context); + } + }); + }) : null, actions: [ const SignalStrengthMeterWidget(), @@ -260,10 +277,7 @@ class _EditAccountPageState extends WindowSetupState { ]), body: SingleChildScrollView( child: Column(children: [ - _editAccountForm( - context, - onUpdate: _onUpdate, - ).paddingLTRB(0, 0, 0, 32), + _editAccountForm(context).paddingLTRB(0, 0, 0, 32), OptionBox( instructions: translate('edit_account_page.remove_account_description'), @@ -285,4 +299,5 @@ class _EditAccountPageState extends WindowSetupState { //////////////////////////////////////////////////////////////////////////// bool _isInAsyncCall = false; + bool _isModified = false; } diff --git a/lib/account_manager/views/edit_profile_form.dart b/lib/account_manager/views/edit_profile_form.dart index 1774bff..d6bb504 100644 --- a/lib/account_manager/views/edit_profile_form.dart +++ b/lib/account_manager/views/edit_profile_form.dart @@ -13,7 +13,7 @@ import '../../theme/theme.dart'; import '../../veilid_processor/veilid_processor.dart'; import '../models/models.dart'; -const _kDoUpdateSubmit = 'doUpdateSubmit'; +const _kDoSubmitEditProfile = 'doSubmitEditProfile'; class EditProfileForm extends StatefulWidget { const EditProfileForm({ @@ -21,9 +21,9 @@ class EditProfileForm extends StatefulWidget { required this.instructions, required this.submitText, required this.submitDisabledText, - required this.initialValueCallback, - this.onUpdate, - this.onSubmit, + required this.initialValue, + required this.onSubmit, + this.onModifiedState, super.key, }); @@ -32,11 +32,11 @@ class EditProfileForm extends StatefulWidget { final String header; final String instructions; - final Future Function(AccountSpec)? onUpdate; - final Future Function(AccountSpec)? onSubmit; + final Future Function(AccountSpec) onSubmit; + final void Function(bool)? onModifiedState; final String submitText; final String submitDisabledText; - final Object Function(String key) initialValueCallback; + final AccountSpec initialValue; @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { @@ -44,14 +44,13 @@ class EditProfileForm extends StatefulWidget { properties ..add(StringProperty('header', header)) ..add(StringProperty('instructions', instructions)) - ..add(ObjectFlagProperty Function(AccountSpec)?>.has( - 'onUpdate', onUpdate)) ..add(StringProperty('submitText', submitText)) ..add(StringProperty('submitDisabledText', submitDisabledText)) - ..add(ObjectFlagProperty.has( - 'initialValueCallback', initialValueCallback)) - ..add(ObjectFlagProperty Function(AccountSpec)?>.has( - 'onSubmit', onSubmit)); + ..add(ObjectFlagProperty Function(AccountSpec)>.has( + 'onSubmit', onSubmit)) + ..add(ObjectFlagProperty.has( + 'onModifiedState', onModifiedState)) + ..add(DiagnosticsProperty('initialValue', initialValue)); } static const String formFieldName = 'name'; @@ -71,8 +70,9 @@ class _EditProfileFormState extends State { @override void initState() { - _autoAwayEnabled = - widget.initialValueCallback(EditProfileForm.formFieldAutoAway) as bool; + _savedValue = widget.initialValue; + _currentValueName = widget.initialValue.name; + _currentValueAutoAway = widget.initialValue.autoAway; super.initState(); } @@ -82,13 +82,10 @@ class _EditProfileFormState extends State { final theme = Theme.of(context); final scale = theme.extension()!; - final initialValueX = - widget.initialValueCallback(EditProfileForm.formFieldAvailability) - as proto.Availability; final initialValue = - initialValueX == proto.Availability.AVAILABILITY_UNSPECIFIED + _savedValue.availability == proto.Availability.AVAILABILITY_UNSPECIFIED ? proto.Availability.AVAILABILITY_FREE - : initialValueX; + : _savedValue.availability; final availabilities = [ proto.Availability.AVAILABILITY_FREE, @@ -109,7 +106,7 @@ class _EditProfileFormState extends State { value: x, child: Row(mainAxisSize: MainAxisSize.min, children: [ AvailabilityWidget.availabilityIcon( - x, scale.primaryScale.primaryText), + x, scale.primaryScale.appText), Text(x == proto.Availability.AVAILABILITY_OFFLINE ? translate('availability.always_show_offline') : AvailabilityWidget.availabilityName(x)) @@ -138,6 +135,12 @@ class _EditProfileFormState extends State { .fields[EditProfileForm.formFieldAwayMessage]!.value as String; final busyMessage = _formKey.currentState! .fields[EditProfileForm.formFieldBusyMessage]!.value as String; + + const proto.DataReference? avatar = null; + // final avatar = _formKey.currentState! + // .fields[EditProfileForm.formFieldAvatar]!.value + //as proto.DataReference?; + final autoAway = _formKey .currentState!.fields[EditProfileForm.formFieldAutoAway]!.value as bool; final autoAwayTimeoutString = _formKey.currentState! @@ -153,11 +156,21 @@ class _EditProfileFormState extends State { freeMessage: freeMessage, awayMessage: awayMessage, busyMessage: busyMessage, - avatar: null, + avatar: avatar, autoAway: autoAway, autoAwayTimeout: autoAwayTimeout); } + // Check if everything is the same and update state + void _onChanged() { + final currentValue = _makeAccountSpec(); + _isModified = currentValue != _savedValue; + final onModifiedState = widget.onModifiedState; + if (onModifiedState != null) { + onModifiedState(_isModified); + } + } + Widget _editProfileForm( BuildContext context, ) { @@ -176,24 +189,32 @@ class _EditProfileFormState extends State { return FormBuilder( key: _formKey, autovalidateMode: AutovalidateMode.onUserInteraction, + onChanged: _onChanged, child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - AvatarWidget( - name: _formKey.currentState?.value[EditProfileForm.formFieldName] - as String? ?? - '?', - size: 128, - borderColor: border, - foregroundColor: scale.primaryScale.primaryText, - backgroundColor: scale.primaryScale.primary, - scaleConfig: scaleConfig, - textStyle: theme.textTheme.titleLarge!.copyWith(fontSize: 64), - ).paddingLTRB(0, 0, 0, 16), + Row(children: [ + const Spacer(), + AvatarWidget( + name: _currentValueName, + size: 128, + borderColor: border, + foregroundColor: scale.primaryScale.primaryText, + backgroundColor: scale.primaryScale.primary, + scaleConfig: scaleConfig, + textStyle: theme.textTheme.titleLarge!.copyWith(fontSize: 64), + ).paddingLTRB(0, 0, 0, 16), + const Spacer() + ]), FormBuilderTextField( autofocus: true, name: EditProfileForm.formFieldName, - initialValue: widget - .initialValueCallback(EditProfileForm.formFieldName) as String, + initialValue: _savedValue.name, + onChanged: (x) { + setState(() { + _currentValueName = x ?? ''; + }); + }, decoration: InputDecoration( floatingLabelBehavior: FloatingLabelBehavior.always, labelText: translate('account.form_name'), @@ -204,23 +225,20 @@ class _EditProfileFormState extends State { FormBuilderValidators.required(), ]), textInputAction: TextInputAction.next, - ).onFocusChange(_onFocusChange), + ), FormBuilderTextField( name: EditProfileForm.formFieldPronouns, - initialValue: - widget.initialValueCallback(EditProfileForm.formFieldPronouns) - as String, + initialValue: _savedValue.pronouns, maxLength: 64, decoration: InputDecoration( floatingLabelBehavior: FloatingLabelBehavior.always, labelText: translate('account.form_pronouns'), hintText: translate('account.empty_pronouns')), textInputAction: TextInputAction.next, - ).onFocusChange(_onFocusChange), + ), FormBuilderTextField( name: EditProfileForm.formFieldAbout, - initialValue: widget - .initialValueCallback(EditProfileForm.formFieldAbout) as String, + initialValue: _savedValue.about, maxLength: 1024, maxLines: 8, minLines: 1, @@ -229,74 +247,69 @@ class _EditProfileFormState extends State { labelText: translate('account.form_about'), hintText: translate('account.empty_about')), textInputAction: TextInputAction.newline, - ).onFocusChange(_onFocusChange), - _availabilityDropDown(context) - .paddingLTRB(0, 0, 0, 16) - .onFocusChange(_onFocusChange), + ), + _availabilityDropDown(context).paddingLTRB(0, 0, 0, 16), FormBuilderTextField( name: EditProfileForm.formFieldFreeMessage, - initialValue: widget.initialValueCallback( - EditProfileForm.formFieldFreeMessage) as String, + initialValue: _savedValue.freeMessage, maxLength: 128, decoration: InputDecoration( floatingLabelBehavior: FloatingLabelBehavior.always, labelText: translate('account.form_free_message'), hintText: translate('account.empty_free_message')), textInputAction: TextInputAction.next, - ).onFocusChange(_onFocusChange), + ), FormBuilderTextField( name: EditProfileForm.formFieldAwayMessage, - initialValue: widget.initialValueCallback( - EditProfileForm.formFieldAwayMessage) as String, + initialValue: _savedValue.awayMessage, maxLength: 128, decoration: InputDecoration( floatingLabelBehavior: FloatingLabelBehavior.always, labelText: translate('account.form_away_message'), hintText: translate('account.empty_away_message')), textInputAction: TextInputAction.next, - ).onFocusChange(_onFocusChange), + ), FormBuilderTextField( name: EditProfileForm.formFieldBusyMessage, - initialValue: widget.initialValueCallback( - EditProfileForm.formFieldBusyMessage) as String, + initialValue: _savedValue.busyMessage, maxLength: 128, decoration: InputDecoration( floatingLabelBehavior: FloatingLabelBehavior.always, labelText: translate('account.form_busy_message'), hintText: translate('account.empty_busy_message')), textInputAction: TextInputAction.next, - ).onFocusChange(_onFocusChange), + ), FormBuilderCheckbox( name: EditProfileForm.formFieldAutoAway, - initialValue: - widget.initialValueCallback(EditProfileForm.formFieldAutoAway) - as bool, + initialValue: _savedValue.autoAway, side: BorderSide(color: scale.primaryScale.border, width: 2), + checkColor: scale.primaryScale.borderText, + activeColor: scale.primaryScale.border, title: Text(translate('account.form_auto_away'), style: textTheme.labelMedium), onChanged: (v) { setState(() { - _autoAwayEnabled = v ?? false; + _currentValueAutoAway = v ?? false; }); }, - ).onFocusChange(_onFocusChange), + ), FormBuilderTextField( name: EditProfileForm.formFieldAutoAwayTimeout, - enabled: _autoAwayEnabled, - initialValue: widget.initialValueCallback( - EditProfileForm.formFieldAutoAwayTimeout) as String, + enabled: _currentValueAutoAway, + initialValue: _savedValue.autoAwayTimeout.toString(), decoration: InputDecoration( labelText: translate('account.form_auto_away_timeout'), ), validator: FormBuilderValidators.positiveNumber(), textInputAction: TextInputAction.next, - ).onFocusChange(_onFocusChange), + ), Row(children: [ const Spacer(), Text(widget.instructions).toCenter().flexible(flex: 6), const Spacer(), - ]).paddingSymmetric(vertical: 4), - if (widget.onSubmit != null) + ]).paddingSymmetric(vertical: 16), + Row(children: [ + const Spacer(), Builder(builder: (context) { final networkReady = context .watch() @@ -307,7 +320,7 @@ class _EditProfileFormState extends State { false; return ElevatedButton( - onPressed: networkReady ? _doSubmit : null, + onPressed: (networkReady && _isModified) ? _doSubmit : null, child: Row(mainAxisSize: MainAxisSize.min, children: [ const Icon(Icons.check, size: 16).paddingLTRB(0, 0, 4, 0), Text(networkReady @@ -317,36 +330,24 @@ class _EditProfileFormState extends State { ]), ); }), + const Spacer() + ]) ], ), ); } - void _onFocusChange(bool focused) { - if (!focused) { - _doUpdate(); - } - } - - void _doUpdate() { - final onUpdate = widget.onUpdate; - if (onUpdate != null) { - singleFuture((this, _kDoUpdateSubmit), () async { - if (_formKey.currentState?.saveAndValidate() ?? false) { - final aus = _makeAccountSpec(); - await onUpdate(aus); - } - }); - } - } - void _doSubmit() { final onSubmit = widget.onSubmit; - if (onSubmit != null) { - singleFuture((this, _kDoUpdateSubmit), () async { - if (_formKey.currentState?.saveAndValidate() ?? false) { - final aus = _makeAccountSpec(); - await onSubmit(aus); + if (_formKey.currentState?.saveAndValidate() ?? false) { + singleFuture((this, _kDoSubmitEditProfile), () async { + final updatedAccountSpec = _makeAccountSpec(); + final saved = await onSubmit(updatedAccountSpec); + if (saved) { + setState(() { + _savedValue = updatedAccountSpec; + }); + _onChanged(); } }); } @@ -358,5 +359,8 @@ class _EditProfileFormState extends State { ); /////////////////////////////////////////////////////////////////////////// - late bool _autoAwayEnabled; + late AccountSpec _savedValue; + late bool _currentValueAutoAway; + late String _currentValueName; + bool _isModified = false; } diff --git a/lib/account_manager/views/new_account_page.dart b/lib/account_manager/views/new_account_page.dart index 69c75ae..a739094 100644 --- a/lib/account_manager/views/new_account_page.dart +++ b/lib/account_manager/views/new_account_page.dart @@ -8,7 +8,6 @@ import 'package:go_router/go_router.dart'; import '../../layout/default_app_bar.dart'; import '../../notifications/cubits/notifications_cubit.dart'; -import '../../proto/proto.dart' as proto; import '../../theme/theme.dart'; import '../../tools/tools.dart'; import '../../veilid_processor/veilid_processor.dart'; @@ -28,33 +27,6 @@ class _NewAccountPageState extends WindowSetupState { titleBarStyle: TitleBarStyle.normal, orientationCapability: OrientationCapability.portraitOnly); - Object _defaultAccountValues(String key) { - switch (key) { - case EditProfileForm.formFieldName: - return ''; - case EditProfileForm.formFieldPronouns: - return ''; - case EditProfileForm.formFieldAbout: - return ''; - case EditProfileForm.formFieldAvailability: - return proto.Availability.AVAILABILITY_FREE; - case EditProfileForm.formFieldFreeMessage: - return ''; - case EditProfileForm.formFieldAwayMessage: - return ''; - case EditProfileForm.formFieldBusyMessage: - return ''; - // case EditProfileForm.formFieldAvatar: - // return null; - case EditProfileForm.formFieldAutoAway: - return false; - case EditProfileForm.formFieldAutoAwayTimeout: - return '15'; - default: - throw StateError('missing form element'); - } - } - Widget _newAccountForm( BuildContext context, ) => @@ -63,10 +35,10 @@ class _NewAccountPageState extends WindowSetupState { instructions: translate('new_account_page.instructions'), submitText: translate('new_account_page.create'), submitDisabledText: translate('button.waiting_for_network'), - initialValueCallback: _defaultAccountValues, + initialValue: const AccountSpec.empty(), onSubmit: _onSubmit); - Future _onSubmit(AccountSpec accountSpec) async { + Future _onSubmit(AccountSpec accountSpec) async { // dismiss the keyboard by unfocusing the textfield FocusScope.of(context).unfocus(); @@ -88,13 +60,15 @@ class _NewAccountPageState extends WindowSetupState { context.read().error( text: translate('new_account_page.network_is_offline'), title: translate('new_account_page.error')); - return; + return false; } final writableSuperIdentity = await AccountRepository.instance .createWithNewSuperIdentity(accountSpec); GoRouterHelper(context).pushReplacement('/new_account/recovery_key', extra: [writableSuperIdentity, accountSpec.name]); + + return true; } finally { if (mounted) { setState(() { @@ -108,6 +82,7 @@ class _NewAccountPageState extends WindowSetupState { context: context, error: e, stackTrace: st); } } + return false; } @override @@ -135,9 +110,10 @@ class _NewAccountPageState extends WindowSetupState { }) ]), body: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16), child: _newAccountForm( - context, - )).paddingSymmetric(horizontal: 24, vertical: 8), + context, + )).paddingAll(2), ).withModalHUD(context, displayModalHUD); } diff --git a/lib/account_manager/views/show_recovery_key_page.dart b/lib/account_manager/views/show_recovery_key_page.dart index 2649bcf..acbb3f3 100644 --- a/lib/account_manager/views/show_recovery_key_page.dart +++ b/lib/account_manager/views/show_recovery_key_page.dart @@ -1,11 +1,11 @@ import 'dart:async'; import 'dart:io'; import 'dart:math'; -import 'dart:typed_data'; import 'package:async_tools/async_tools.dart'; import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:file_saver/file_saver.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_translate/flutter_translate.dart'; import 'package:go_router/go_router.dart'; @@ -61,7 +61,7 @@ class _ShowRecoveryKeyPageState extends WindowSetupState { _isInAsyncCall = false; }); - if (Platform.isLinux) { + if (!kIsWeb && Platform.isLinux) { // Share plus doesn't do Linux yet await FileSaver.instance.saveFile(name: 'recovery_key.png', bytes: bytes); } else { diff --git a/lib/app.dart b/lib/app.dart index 7ef0911..72d845f 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -48,19 +48,24 @@ class VeilidChatApp extends StatelessWidget { final ThemeData initialThemeData; void _reloadTheme(BuildContext context) { - log.info('Reloading theme'); - final theme = - PreferencesRepository.instance.value.themePreference.themeData(); - ThemeSwitcher.of(context).changeTheme(theme: theme); - - // Hack to reload translations - final localizationDelegate = LocalizedApp.of(context).delegate; singleFuture(this, () async { - await LocalizationDelegate.create( - fallbackLocale: localizationDelegate.fallbackLocale.toString(), - supportedLocales: localizationDelegate.supportedLocales - .map((x) => x.toString()) - .toList()); + log.info('Reloading theme'); + + await VeilidChatGlobalInit.loadAssetManifest(); + + final theme = + PreferencesRepository.instance.value.themePreference.themeData(); + if (context.mounted) { + ThemeSwitcher.of(context).changeTheme(theme: theme); + + // Hack to reload translations + final localizationDelegate = LocalizedApp.of(context).delegate; + await LocalizationDelegate.create( + fallbackLocale: localizationDelegate.fallbackLocale.toString(), + supportedLocales: localizationDelegate.supportedLocales + .map((x) => x.toString()) + .toList()); + } }); } @@ -163,23 +168,34 @@ class VeilidChatApp extends StatelessWidget { scale.primaryScale.subtleBackground, ]); - return DecoratedBox( - decoration: BoxDecoration(gradient: gradient), - child: MaterialApp.router( - scrollBehavior: const ScrollBehaviorModified(), - debugShowCheckedModeBanner: false, - routerConfig: context.read().router(), - title: translate('app.title'), - theme: theme, - localizationsDelegates: [ - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - FormBuilderLocalizations.delegate, - localizationDelegate - ], - supportedLocales: localizationDelegate.supportedLocales, - locale: localizationDelegate.currentLocale, - )); + final wallpaper = PreferencesRepository + .instance.value.themePreference + .wallpaper(); + + return Stack( + fit: StackFit.expand, + alignment: Alignment.center, + children: [ + wallpaper ?? + DecoratedBox( + decoration: BoxDecoration(gradient: gradient)), + MaterialApp.router( + scrollBehavior: const ScrollBehaviorModified(), + debugShowCheckedModeBanner: false, + routerConfig: context.read().router(), + title: translate('app.title'), + theme: theme, + localizationsDelegates: [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + FormBuilderLocalizations.delegate, + localizationDelegate + ], + supportedLocales: + localizationDelegate.supportedLocales, + locale: localizationDelegate.currentLocale, + ) + ]); })), )), ); diff --git a/lib/chat/cubits/chat_component_cubit.dart b/lib/chat/cubits/chat_component_cubit.dart index 326a597..9e50e02 100644 --- a/lib/chat/cubits/chat_component_cubit.dart +++ b/lib/chat/cubits/chat_component_cubit.dart @@ -50,8 +50,11 @@ class ChatComponentCubit extends Cubit { messageWindow: const AsyncLoading(), title: '', )) { + // Immediate Init + _init(); + // Async Init - _initWait.add(_init); + _initWait.add(_initAsync); } factory ChatComponentCubit.singleContact( @@ -68,7 +71,7 @@ class ChatComponentCubit extends Cubit { messagesCubit: messagesCubit, ); - Future _init(Completer _cancel) async { + void _init() { // Get local user info and account record cubit _localUserIdentityKey = _accountInfo.identityTypedPublicKey; @@ -77,9 +80,6 @@ class ChatComponentCubit extends Cubit { _accountRecordCubit.stream.listen(_onChangedAccountRecord); _onChangedAccountRecord(_accountRecordCubit.state); - // Subscribe to remote user info - await _updateConversationSubscriptions(); - // Subscribe to messages _messagesSubscription = _messagesCubit.stream.listen(_onChangedMessages); _onChangedMessages(_messagesCubit.state); @@ -90,6 +90,11 @@ class ChatComponentCubit extends Cubit { _onChangedContacts(_contactListCubit.state); } + Future _initAsync(Completer _cancel) async { + // Subscribe to remote user info + await _updateConversationSubscriptions(); + } + @override Future close() async { await _initWait(); diff --git a/lib/chat/models/chat_component_state.freezed.dart b/lib/chat/models/chat_component_state.freezed.dart index 41ab7e2..f967997 100644 --- a/lib/chat/models/chat_component_state.freezed.dart +++ b/lib/chat/models/chat_component_state.freezed.dart @@ -35,7 +35,9 @@ mixin _$ChatComponentState { throw _privateConstructorUsedError; // Title of the chat String get title => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of ChatComponentState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $ChatComponentStateCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -70,6 +72,8 @@ class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of ChatComponentState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -123,6 +127,8 @@ class _$ChatComponentStateCopyWithImpl<$Res, $Val extends ChatComponentState> ) as $Val); } + /// Create a copy of ChatComponentState + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $AsyncValueCopyWith, $Res> get messageWindow { @@ -164,6 +170,8 @@ class __$$ChatComponentStateImplCopyWithImpl<$Res> $Res Function(_$ChatComponentStateImpl) _then) : super(_value, _then); + /// Create a copy of ChatComponentState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -301,7 +309,9 @@ class _$ChatComponentStateImpl implements _ChatComponentState { messageWindow, title); - @JsonKey(ignore: true) + /// Create a copy of ChatComponentState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith => @@ -322,26 +332,33 @@ abstract class _ChatComponentState implements ChatComponentState { required final AsyncValue> messageWindow, required final String title}) = _$ChatComponentStateImpl; - @override // GlobalKey for the chat - GlobalKey get chatKey; - @override // ScrollController for the chat - AutoScrollController get scrollController; - @override // TextEditingController for the chat - InputTextFieldController get textEditingController; - @override // Local user - User? get localUser; - @override // Active remote users - IMap, User> get remoteUsers; - @override // Historical remote users - IMap, User> get historicalRemoteUsers; - @override // Unknown users - IMap, User> get unknownUsers; - @override // Messages state - AsyncValue> get messageWindow; - @override // Title of the chat - String get title; +// GlobalKey for the chat @override - @JsonKey(ignore: true) + GlobalKey get chatKey; // ScrollController for the chat + @override + AutoScrollController + get scrollController; // TextEditingController for the chat + @override + InputTextFieldController get textEditingController; // Local user + @override + User? get localUser; // Active remote users + @override + IMap, User> + get remoteUsers; // Historical remote users + @override + IMap, User> + get historicalRemoteUsers; // Unknown users + @override + IMap, User> get unknownUsers; // Messages state + @override + AsyncValue> get messageWindow; // Title of the chat + @override + String get title; + + /// Create a copy of ChatComponentState + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$ChatComponentStateImplCopyWith<_$ChatComponentStateImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/chat/models/message_state.freezed.dart b/lib/chat/models/message_state.freezed.dart index 96c98e2..baafea6 100644 --- a/lib/chat/models/message_state.freezed.dart +++ b/lib/chat/models/message_state.freezed.dart @@ -30,8 +30,12 @@ mixin _$MessageState { throw _privateConstructorUsedError; // The state of the message MessageSendState? get sendState => throw _privateConstructorUsedError; + /// Serializes this MessageState to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $MessageStateCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -60,6 +64,8 @@ class _$MessageStateCopyWithImpl<$Res, $Val extends MessageState> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -113,6 +119,8 @@ class __$$MessageStateImplCopyWithImpl<$Res> _$MessageStateImpl _value, $Res Function(_$MessageStateImpl) _then) : super(_value, _then); + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -199,12 +207,14 @@ class _$MessageStateImpl with DiagnosticableTreeMixin implements _MessageState { other.sendState == sendState)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, content, sentTimestamp, reconciledTimestamp, sendState); - @JsonKey(ignore: true) + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$MessageStateImplCopyWith<_$MessageStateImpl> get copyWith => @@ -229,17 +239,21 @@ abstract class _MessageState implements MessageState { factory _MessageState.fromJson(Map json) = _$MessageStateImpl.fromJson; - @override // Content of the message - @JsonKey(fromJson: messageFromJson, toJson: messageToJson) - proto.Message get content; - @override // Sent timestamp - Timestamp get sentTimestamp; - @override // Reconciled timestamp - Timestamp? get reconciledTimestamp; - @override // The state of the message - MessageSendState? get sendState; +// Content of the message @override - @JsonKey(ignore: true) + @JsonKey(fromJson: messageFromJson, toJson: messageToJson) + proto.Message get content; // Sent timestamp + @override + Timestamp get sentTimestamp; // Reconciled timestamp + @override + Timestamp? get reconciledTimestamp; // The state of the message + @override + MessageSendState? get sendState; + + /// Create a copy of MessageState + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$MessageStateImplCopyWith<_$MessageStateImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/chat/models/window_state.freezed.dart b/lib/chat/models/window_state.freezed.dart index 604931d..59ff754 100644 --- a/lib/chat/models/window_state.freezed.dart +++ b/lib/chat/models/window_state.freezed.dart @@ -27,7 +27,9 @@ mixin _$WindowState { throw _privateConstructorUsedError; // If we should have the tail following the array bool get follow => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of WindowState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $WindowStateCopyWith> get copyWith => throw _privateConstructorUsedError; } @@ -56,6 +58,8 @@ class _$WindowStateCopyWithImpl> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of WindowState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -114,6 +118,8 @@ class __$$WindowStateImplCopyWithImpl _$WindowStateImpl _value, $Res Function(_$WindowStateImpl) _then) : super(_value, _then); + /// Create a copy of WindowState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -216,7 +222,9 @@ class _$WindowStateImpl windowCount, follow); - @JsonKey(ignore: true) + /// Create a copy of WindowState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$WindowStateImplCopyWith> get copyWith => @@ -232,18 +240,22 @@ abstract class _WindowState implements WindowState { required final int windowCount, required final bool follow}) = _$WindowStateImpl; - @override // List of objects in the window - IList get window; - @override // Total number of objects (windowTail max) - int get length; - @override // One past the end of the last element - int get windowTail; - @override // The total number of elements to try to keep in the window - int get windowCount; - @override // If we should have the tail following the array - bool get follow; +// List of objects in the window @override - @JsonKey(ignore: true) + IList get window; // Total number of objects (windowTail max) + @override + int get length; // One past the end of the last element + @override + int get windowTail; // The total number of elements to try to keep in the window + @override + int get windowCount; // If we should have the tail following the array + @override + bool get follow; + + /// Create a copy of WindowState + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$WindowStateImplCopyWith> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/chat/views/chat_component_widget.dart b/lib/chat/views/chat_component_widget.dart index c4816ae..8e43299 100644 --- a/lib/chat/views/chat_component_widget.dart +++ b/lib/chat/views/chat_component_widget.dart @@ -82,15 +82,16 @@ class ChatComponentWidget extends StatelessWidget { Widget _buildChatComponent(BuildContext context) { final theme = Theme.of(context); - final scale = theme.extension()!; + final scaleScheme = theme.extension()!; final scaleConfig = theme.extension()!; + final scale = scaleScheme.scale(ScaleKind.primary); final textTheme = theme.textTheme; - final chatTheme = makeChatTheme(scale, scaleConfig, textTheme); + final chatTheme = makeChatTheme(scaleScheme, scaleConfig, textTheme); final errorChatTheme = (ChatThemeEditor(chatTheme) - ..inputTextColor = scale.errorScale.primary + ..inputTextColor = scaleScheme.errorScale.primary ..sendButtonIcon = Image.asset( 'assets/icon-send.png', - color: scale.errorScale.primary, + color: scaleScheme.errorScale.primary, package: 'flutter_chat_ui', )) .commit(); @@ -126,7 +127,7 @@ class ChatComponentWidget extends StatelessWidget { Container( height: 48, decoration: BoxDecoration( - color: scale.primaryScale.subtleBorder, + color: scale.border, ), child: Row(children: [ Align( @@ -136,19 +137,17 @@ class ChatComponentWidget extends StatelessWidget { child: Text(title, textAlign: TextAlign.start, style: textTheme.titleMedium! - .copyWith(color: scale.primaryScale.borderText)), + .copyWith(color: scale.borderText)), )), const Spacer(), IconButton( - icon: - Icon(Icons.close, color: scale.primaryScale.borderText), + icon: Icon(Icons.close, color: scale.borderText), onPressed: _onClose) .paddingLTRB(16, 0, 16, 0) ]), ), DecoratedBox( - decoration: - BoxDecoration(color: scale.primaryScale.subtleBackground), + decoration: const BoxDecoration(color: Colors.transparent), child: NotificationListener( onNotification: (notification) { if (chatComponentCubit.scrollOffset != 0) { @@ -202,54 +201,51 @@ class ChatComponentWidget extends StatelessWidget { 2048; return Chat( - key: chatComponentState.chatKey, - theme: - messageIsValid ? chatTheme : errorChatTheme, - messages: messageWindow.window.toList(), - scrollToBottomOnSend: isFirstPage, - scrollController: - chatComponentState.scrollController, - inputOptions: InputOptions( - inputClearMode: messageIsValid - ? InputClearMode.always - : InputClearMode.never, - textEditingController: - chatComponentState.textEditingController), - // isLastPage: isLastPage, - // onEndReached: () async { - // await _handlePageBackward( - // chatComponentCubit, messageWindow); - // }, - //onEndReachedThreshold: onEndReachedThreshold, - //onAttachmentPressed: _handleAttachmentPressed, - //onMessageTap: _handleMessageTap, - //onPreviewDataFetched: _handlePreviewDataFetched, - usePreviewData: false, // - onSendPressed: (pt) { - try { - if (!messageIsValid) { - context.read().error( - text: - translate('chat.message_too_long')); - return; - } - _handleSendPressed(chatComponentCubit, pt); - } on FormatException { - context.read().error( - text: translate('chat.message_too_long')); - } - }, - listBottomWidget: messageIsValid - ? null - : Text(translate('chat.message_too_long'), - style: TextStyle( - color: scale.errorScale.primary)) - .toCenter(), - //showUserAvatars: false, - //showUserNames: true, - user: localUser, - emptyState: const EmptyChatWidget()) - .paddingLTRB(0, 2, 0, 0); + key: chatComponentState.chatKey, + theme: messageIsValid ? chatTheme : errorChatTheme, + messages: messageWindow.window.toList(), + scrollToBottomOnSend: isFirstPage, + scrollController: chatComponentState.scrollController, + inputOptions: InputOptions( + inputClearMode: messageIsValid + ? InputClearMode.always + : InputClearMode.never, + textEditingController: + chatComponentState.textEditingController), + // isLastPage: isLastPage, + // onEndReached: () async { + // await _handlePageBackward( + // chatComponentCubit, messageWindow); + // }, + //onEndReachedThreshold: onEndReachedThreshold, + //onAttachmentPressed: _handleAttachmentPressed, + //onMessageTap: _handleMessageTap, + //onPreviewDataFetched: _handlePreviewDataFetched, + usePreviewData: false, // + onSendPressed: (pt) { + try { + if (!messageIsValid) { + context.read().error( + text: translate('chat.message_too_long')); + return; + } + _handleSendPressed(chatComponentCubit, pt); + } on FormatException { + context.read().error( + text: translate('chat.message_too_long')); + } + }, + listBottomWidget: messageIsValid + ? null + : Text(translate('chat.message_too_long'), + style: TextStyle( + color: + scaleScheme.errorScale.primary)) + .toCenter(), + //showUserAvatars: false, + //showUserNames: true, + user: localUser, + emptyState: const EmptyChatWidget()); }))).expanded(), ], ); diff --git a/lib/chat/views/no_conversation_widget.dart b/lib/chat/views/no_conversation_widget.dart index 77502e1..830e0d6 100644 --- a/lib/chat/views/no_conversation_widget.dart +++ b/lib/chat/views/no_conversation_widget.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_translate/flutter_translate.dart'; -import '../../theme/models/scale_scheme.dart'; +import '../../theme/models/scale_theme/scale_scheme.dart'; class NoConversationWidget extends StatelessWidget { const NoConversationWidget({super.key}); @@ -12,11 +12,13 @@ class NoConversationWidget extends StatelessWidget { BuildContext context, ) { final theme = Theme.of(context); - final scale = theme.extension()!; + final scaleScheme = theme.extension()!; + final scaleConfig = theme.extension()!; + final scale = scaleScheme.scale(ScaleKind.primary); return DecoratedBox( decoration: BoxDecoration( - color: scale.primaryScale.appBackground, + color: scale.appBackground.withAlpha(scaleConfig.wallpaperAlpha), ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, @@ -24,14 +26,14 @@ class NoConversationWidget extends StatelessWidget { children: [ Icon( Icons.diversity_3, - color: scale.primaryScale.subtleBorder, + color: scale.appText.withAlpha(127), size: 48, ), Text( textAlign: TextAlign.center, translate('chat.start_a_conversation'), style: Theme.of(context).textTheme.bodyMedium?.copyWith( - color: scale.primaryScale.subtleBorder, + color: scale.appText.withAlpha(127), ), ), ], diff --git a/lib/chat_list/views/chat_single_contact_item_widget.dart b/lib/chat_list/views/chat_single_contact_item_widget.dart index 826fe37..3bdf645 100644 --- a/lib/chat_list/views/chat_single_contact_item_widget.dart +++ b/lib/chat_list/views/chat_single_contact_item_widget.dart @@ -44,20 +44,22 @@ class ChatSingleContactItemWidget extends StatelessWidget { : _contact.profile.availability; final scaleTileTheme = scaleTheme.tileTheme( - disabled: _disabled, - selected: selected, - scaleKind: ScaleKind.secondary); + disabled: _disabled, + selected: selected, + ); final avatar = AvatarWidget( name: name, size: 34, - borderColor: scaleTileTheme.borderColor, + borderColor: scaleTheme.config.useVisualIndicators + ? scaleTheme.scheme.primaryScale.primaryText + : scaleTheme.scheme.primaryScale.subtleBorder, foregroundColor: _disabled ? scaleTheme.scheme.grayScale.primaryText - : scaleTheme.scheme.secondaryScale.primaryText, + : scaleTheme.scheme.primaryScale.primaryText, backgroundColor: _disabled ? scaleTheme.scheme.grayScale.primary - : scaleTheme.scheme.secondaryScale.primary, + : scaleTheme.scheme.primaryScale.primary, scaleConfig: scaleTheme.config, textStyle: theme.textTheme.titleLarge!, ); @@ -66,7 +68,7 @@ class ChatSingleContactItemWidget extends StatelessWidget { key: ValueKey(_localConversationRecordKey), disabled: _disabled, selected: selected, - tileScale: ScaleKind.secondary, + tileScale: ScaleKind.primary, title: title, subtitle: subtitle, leading: avatar, diff --git a/lib/contact_invitation/cubits/contact_invitation_list_cubit.dart b/lib/contact_invitation/cubits/contact_invitation_list_cubit.dart index 959445c..768cf2f 100644 --- a/lib/contact_invitation/cubits/contact_invitation_list_cubit.dart +++ b/lib/contact_invitation/cubits/contact_invitation_list_cubit.dart @@ -59,6 +59,7 @@ class ContactInvitationListCubit {required proto.Profile profile, required EncryptionKeyType encryptionKeyType, required String encryptionKey, + required String recipient, required String message, required Timestamp? expiration}) async { final pool = DHTRecordPool.instance; @@ -154,7 +155,8 @@ class ContactInvitationListCubit ..localConversationRecordKey = localConversation.key.toProto() ..expiration = expiration?.toInt64() ?? Int64.ZERO ..invitation = signedContactInvitationBytes - ..message = message; + ..message = message + ..recipient = recipient; // Add ContactInvitationRecord to account's list await operateWriteEventual((writer) async { diff --git a/lib/contact_invitation/cubits/invitation_generator_cubit.dart b/lib/contact_invitation/cubits/invitation_generator_cubit.dart index 5c0fa15..8d2226c 100644 --- a/lib/contact_invitation/cubits/invitation_generator_cubit.dart +++ b/lib/contact_invitation/cubits/invitation_generator_cubit.dart @@ -5,5 +5,5 @@ import 'package:veilid_support/veilid_support.dart'; class InvitationGeneratorCubit extends FutureCubit<(Uint8List, TypedKey)> { InvitationGeneratorCubit(super.fut); - InvitationGeneratorCubit.value(super.v) : super.value(); + InvitationGeneratorCubit.value(super.state) : super.value(); } diff --git a/lib/contact_invitation/views/contact_invitation_display.dart b/lib/contact_invitation/views/contact_invitation_display.dart index 83b80d0..b3f048a 100644 --- a/lib/contact_invitation/views/contact_invitation_display.dart +++ b/lib/contact_invitation/views/contact_invitation_display.dart @@ -1,5 +1,6 @@ import 'dart:math'; +import 'package:auto_size_text/auto_size_text.dart'; import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:basic_utils/basic_utils.dart'; import 'package:flutter/foundation.dart'; @@ -20,11 +21,13 @@ import '../contact_invitation.dart'; class ContactInvitationDisplayDialog extends StatelessWidget { const ContactInvitationDisplayDialog._({ required this.locator, + required this.recipient, required this.message, required this.fingerprint, }); final Locator locator; + final String recipient; final String message; final String fingerprint; @@ -32,18 +35,22 @@ class ContactInvitationDisplayDialog extends StatelessWidget { void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); properties + ..add(StringProperty('recipient', recipient)) ..add(StringProperty('message', message)) ..add(DiagnosticsProperty('locator', locator)) ..add(StringProperty('fingerprint', fingerprint)); } - String makeTextInvite(String message, Uint8List data) { + String makeTextInvite(String recipient, String message, Uint8List data) { final invite = StringUtils.addCharAtPosition( base64UrlNoPadEncode(data), '\n', 40, repeat: true); + final to = recipient.isNotEmpty + ? '${translate('invitiation_dialog.to')}: $recipient\n' + : ''; final msg = message.isNotEmpty ? '$message\n' : ''; - - return '$msg' + return '$to' + '$msg' '--- BEGIN VEILIDCHAT CONTACT INVITE ----\n' '$invite\n' '---- END VEILIDCHAT CONTACT INVITE -----\n' @@ -62,6 +69,10 @@ class ContactInvitationDisplayDialog extends StatelessWidget { final cardsize = min(MediaQuery.of(context).size.shortestSide - 48.0, 400); + final fingerprintText = + '${translate('create_invitation_dialog.fingerprint')}\n' + '$fingerprint'; + return BlocListener( bloc: locator(), @@ -110,14 +121,21 @@ class ContactInvitationDisplayDialog extends StatelessWidget { errorCorrectLevel: QrErrorCorrectLevel.L)), ).expanded(), - Text(message, - softWrap: true, - style: textTheme.labelLarge! - .copyWith(color: Colors.black)) - .paddingAll(8), - Text( - '${translate('create_invitation_dialog.fingerprint')}\n' - '$fingerprint', + if (recipient.isNotEmpty) + AutoSizeText(recipient, + softWrap: true, + maxLines: 2, + style: textTheme.labelLarge! + .copyWith(color: Colors.black)) + .paddingAll(8), + if (message.isNotEmpty) + Text(message, + softWrap: true, + maxLines: 2, + style: textTheme.labelMedium! + .copyWith(color: Colors.black)) + .paddingAll(8), + Text(fingerprintText, softWrap: true, textAlign: TextAlign.center, style: textTheme.labelSmall!.copyWith( @@ -137,7 +155,8 @@ class ContactInvitationDisplayDialog extends StatelessWidget { text: translate('create_invitation_dialog' '.invitation_copied')); await Clipboard.setData(ClipboardData( - text: makeTextInvite(message, data.$1))); + text: makeTextInvite( + recipient, message, data.$1))); }, ).paddingAll(16), ]), @@ -148,6 +167,7 @@ class ContactInvitationDisplayDialog extends StatelessWidget { required BuildContext context, required Locator locator, required InvitationGeneratorCubit Function(BuildContext) create, + required String recipient, required String message, }) async { final fingerprint = @@ -159,6 +179,7 @@ class ContactInvitationDisplayDialog extends StatelessWidget { create: create, child: ContactInvitationDisplayDialog._( locator: locator, + recipient: recipient, message: message, fingerprint: fingerprint, ))); diff --git a/lib/contact_invitation/views/contact_invitation_item_widget.dart b/lib/contact_invitation/views/contact_invitation_item_widget.dart index 6e6dfcf..779f962 100644 --- a/lib/contact_invitation/views/contact_invitation_item_widget.dart +++ b/lib/contact_invitation/views/contact_invitation_item_widget.dart @@ -37,14 +37,19 @@ class ContactInvitationItemWidget extends StatelessWidget { final tileDisabled = disabled || context.watch().isBusy; + var title = translate('contact_list.invitation'); + if (contactInvitationRecord.recipient.isNotEmpty) { + title = contactInvitationRecord.recipient; + } else if (contactInvitationRecord.message.isNotEmpty) { + title = contactInvitationRecord.message; + } + return SliderTile( key: ObjectKey(contactInvitationRecord), disabled: tileDisabled, selected: selected, tileScale: ScaleKind.primary, - title: contactInvitationRecord.message.isEmpty - ? translate('contact_list.invitation') - : contactInvitationRecord.message, + title: title, leading: const Icon(Icons.person_add), onTap: () async { if (!context.mounted) { @@ -53,6 +58,7 @@ class ContactInvitationItemWidget extends StatelessWidget { await ContactInvitationDisplayDialog.show( context: context, locator: context.read, + recipient: contactInvitationRecord.recipient, message: contactInvitationRecord.message, create: (context) => InvitationGeneratorCubit.value(( Uint8List.fromList(contactInvitationRecord.invitation), @@ -62,7 +68,7 @@ class ContactInvitationItemWidget extends StatelessWidget { }, endActions: [ SliderTileAction( - icon: Icons.delete, + // icon: Icons.delete, label: translate('button.delete'), actionScale: ScaleKind.tertiary, onPressed: (context) async { diff --git a/lib/contact_invitation/views/create_invitation_dialog.dart b/lib/contact_invitation/views/create_invitation_dialog.dart index f1115d7..d835de8 100644 --- a/lib/contact_invitation/views/create_invitation_dialog.dart +++ b/lib/contact_invitation/views/create_invitation_dialog.dart @@ -18,7 +18,7 @@ class CreateInvitationDialog extends StatefulWidget { const CreateInvitationDialog._({required this.locator}); @override - CreateInvitationDialogState createState() => CreateInvitationDialogState(); + State createState() => _CreateInvitationDialogState(); static Future show(BuildContext context) async { await StyledDialog.show( @@ -36,8 +36,9 @@ class CreateInvitationDialog extends StatefulWidget { } } -class CreateInvitationDialogState extends State { +class _CreateInvitationDialogState extends State { late final TextEditingController _messageTextController; + late final TextEditingController _recipientTextController; EncryptionKeyType _encryptionKeyType = EncryptionKeyType.none; String _encryptionKey = ''; @@ -51,6 +52,7 @@ class CreateInvitationDialogState extends State { _messageTextController = TextEditingController( text: translate('create_invitation_dialog.connect_with_me', args: {'name': name})); + _recipientTextController = TextEditingController(); super.initState(); } @@ -154,6 +156,7 @@ class CreateInvitationDialogState extends State { profile: profile, encryptionKeyType: _encryptionKeyType, encryptionKey: _encryptionKey, + recipient: _recipientTextController.text, message: _messageTextController.text, expiration: _expiration); @@ -162,6 +165,7 @@ class CreateInvitationDialogState extends State { await ContactInvitationDisplayDialog.show( context: context, locator: widget.locator, + recipient: _recipientTextController.text, message: _messageTextController.text, create: (context) => InvitationGeneratorCubit(generator)); } @@ -176,6 +180,7 @@ class CreateInvitationDialogState extends State { final theme = Theme.of(context); //final scale = theme.extension()!; final textTheme = theme.textTheme; + return ConstrainedBox( constraints: BoxConstraints(maxHeight: maxDialogHeight, maxWidth: maxDialogWidth), @@ -185,19 +190,34 @@ class CreateInvitationDialogState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text( - translate('create_invitation_dialog.message_to_contact'), + TextField( + controller: _recipientTextController, + onChanged: (value) { + setState(() {}); + }, + inputFormatters: [ + LengthLimitingTextInputFormatter(128), + ], + decoration: InputDecoration( + hintText: + translate('create_invitation_dialog.recipient_hint'), + labelText: + translate('create_invitation_dialog.recipient_name'), + helperText: + translate('create_invitation_dialog.recipient_helper')), ).paddingAll(8), + const SizedBox(height: 10), TextField( controller: _messageTextController, inputFormatters: [ LengthLimitingTextInputFormatter(128), ], decoration: InputDecoration( - //border: const OutlineInputBorder(), - hintText: - translate('create_invitation_dialog.enter_message_hint'), - labelText: translate('create_invitation_dialog.message')), + hintText: translate('create_invitation_dialog.message_hint'), + labelText: + translate('create_invitation_dialog.message_label'), + helperText: + translate('create_invitation_dialog.message_helper')), ).paddingAll(8), const SizedBox(height: 10), Text(translate('create_invitation_dialog.protect_this_invitation'), @@ -228,7 +248,9 @@ class CreateInvitationDialogState extends State { Container( padding: const EdgeInsets.all(8), child: ElevatedButton( - onPressed: _onGenerateButtonPressed, + onPressed: _recipientTextController.text.isNotEmpty + ? _onGenerateButtonPressed + : null, child: Text( translate('create_invitation_dialog.generate'), ).paddingAll(16), @@ -244,11 +266,4 @@ class CreateInvitationDialogState extends State { ), ); } - - @override - void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); - properties.add(DiagnosticsProperty( - 'messageTextController', _messageTextController)); - } } diff --git a/lib/contact_invitation/views/new_contact_bottom_sheet.dart b/lib/contact_invitation/views/new_contact_bottom_sheet.dart deleted file mode 100644 index a79a07f..0000000 --- a/lib/contact_invitation/views/new_contact_bottom_sheet.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:awesome_extensions/awesome_extensions.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_translate/flutter_translate.dart'; - -import '../../theme/theme.dart'; -import 'create_invitation_dialog.dart'; -import 'paste_invitation_dialog.dart'; -import 'scan_invitation_dialog.dart'; - -Widget newContactBottomSheetBuilder( - BuildContext sheetContext, BuildContext context) { - final theme = Theme.of(sheetContext); - final scale = theme.extension()!; - - return KeyboardListener( - focusNode: FocusNode(), - onKeyEvent: (ke) { - if (ke.logicalKey == LogicalKeyboardKey.escape) { - Navigator.pop(sheetContext); - } - }, - child: styledBottomSheet( - context: context, - title: translate('add_contact_sheet.new_contact'), - child: SizedBox( - height: 160, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Column(children: [ - IconButton( - onPressed: () async { - Navigator.pop(sheetContext); - await CreateInvitationDialog.show(context); - }, - iconSize: 64, - icon: const Icon(Icons.contact_page), - color: scale.primaryScale.hoverBorder), - Text( - translate('add_contact_sheet.create_invite'), - ) - ]), - Column(children: [ - IconButton( - onPressed: () async { - Navigator.pop(sheetContext); - await ScanInvitationDialog.show(context); - }, - iconSize: 64, - icon: const Icon(Icons.qr_code_scanner), - color: scale.primaryScale.hoverBorder), - Text( - translate('add_contact_sheet.scan_invite'), - ) - ]), - Column(children: [ - IconButton( - onPressed: () async { - Navigator.pop(sheetContext); - await PasteInvitationDialog.show(context); - }, - iconSize: 64, - icon: const Icon(Icons.paste), - color: scale.primaryScale.hoverBorder), - Text( - translate('add_contact_sheet.paste_invite'), - ) - ]) - ]).paddingAll(16)))); -} diff --git a/lib/contact_invitation/views/views.dart b/lib/contact_invitation/views/views.dart index 726f0b9..241513d 100644 --- a/lib/contact_invitation/views/views.dart +++ b/lib/contact_invitation/views/views.dart @@ -3,6 +3,5 @@ export 'contact_invitation_item_widget.dart'; export 'contact_invitation_list_widget.dart'; export 'create_invitation_dialog.dart'; export 'invitation_dialog.dart'; -export 'new_contact_bottom_sheet.dart'; export 'paste_invitation_dialog.dart'; export 'scan_invitation_dialog.dart'; diff --git a/lib/contacts/contacts.dart b/lib/contacts/contacts.dart index 6acdd43..08ae2e7 100644 --- a/lib/contacts/contacts.dart +++ b/lib/contacts/contacts.dart @@ -1,2 +1,3 @@ export 'cubits/cubits.dart'; +export 'models/models.dart'; export 'views/views.dart'; diff --git a/lib/contacts/cubits/contact_list_cubit.dart b/lib/contacts/cubits/contact_list_cubit.dart index d3c6483..df70cc0 100644 --- a/lib/contacts/cubits/contact_list_cubit.dart +++ b/lib/contacts/cubits/contact_list_cubit.dart @@ -8,6 +8,7 @@ import 'package:veilid_support/veilid_support.dart'; import '../../account_manager/account_manager.dart'; import '../../proto/proto.dart' as proto; import '../../tools/tools.dart'; +import '../models/models.dart'; ////////////////////////////////////////////////// // Mutable state for per-account contacts @@ -81,9 +82,7 @@ class ContactListCubit extends DHTShortArrayCubit { Future updateContactFields({ required TypedKey localConversationRecordKey, - String? nickname, - String? notes, - bool? showAvailability, + required ContactSpec updatedContactSpec, }) async { // Update contact's locally-modifiable fields await operateWriteEventual((writer) async { @@ -92,17 +91,7 @@ class ContactListCubit extends DHTShortArrayCubit { if (c != null && c.localConversationRecordKey.toVeilid() == localConversationRecordKey) { - final newContact = c.deepCopy(); - - if (nickname != null) { - newContact.nickname = nickname; - } - if (notes != null) { - newContact.notes = notes; - } - if (showAvailability != null) { - newContact.showAvailability = showAvailability; - } + final newContact = await updatedContactSpec.updateProto(c); final updated = await writer.tryWriteItemProtobuf( proto.Contact.fromBuffer, pos, newContact); diff --git a/lib/contacts/models/contact_spec.dart b/lib/contacts/models/contact_spec.dart new file mode 100644 index 0000000..1596434 --- /dev/null +++ b/lib/contacts/models/contact_spec.dart @@ -0,0 +1,37 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/foundation.dart'; +import 'package:protobuf/protobuf.dart'; + +import '../../proto/proto.dart' as proto; + +@immutable +class ContactSpec extends Equatable { + const ContactSpec({ + required this.nickname, + required this.notes, + required this.showAvailability, + }); + + ContactSpec.fromProto(proto.Contact p) + : nickname = p.nickname, + notes = p.notes, + showAvailability = p.showAvailability; + + Future updateProto(proto.Contact old) async { + final newProto = old.deepCopy() + ..nickname = nickname + ..notes = notes + ..showAvailability = showAvailability; + + return newProto; + } + + //////////////////////////////////////////////////////////////////////////// + + final String nickname; + final String notes; + final bool showAvailability; + + @override + List get props => [nickname, notes, showAvailability]; +} diff --git a/lib/contacts/models/models.dart b/lib/contacts/models/models.dart new file mode 100644 index 0000000..d489632 --- /dev/null +++ b/lib/contacts/models/models.dart @@ -0,0 +1 @@ +export 'contact_spec.dart'; diff --git a/lib/contacts/views/availability_widget.dart b/lib/contacts/views/availability_widget.dart index cf3e51a..a79f774 100644 --- a/lib/contacts/views/availability_widget.dart +++ b/lib/contacts/views/availability_widget.dart @@ -10,11 +10,11 @@ class AvailabilityWidget extends StatelessWidget { {required this.availability, required this.color, this.vertical = true, - this.iconSize = 32, + this.iconSize = 24, super.key}); static Widget availabilityIcon(proto.Availability availability, Color color, - {double size = 32}) { + {double size = 24}) { late final Widget iconData; switch (availability) { case proto.Availability.AVAILABILITY_AWAY: @@ -70,7 +70,7 @@ class AvailabilityWidget extends StatelessWidget { ]) : Row(mainAxisSize: MainAxisSize.min, children: [ icon, - Text(name, style: textTheme.labelSmall!.copyWith(color: color)) + Text(name, style: textTheme.labelLarge!.copyWith(color: color)) .paddingLTRB(8, 0, 0, 0) ]); } diff --git a/lib/contacts/views/contact_details_widget.dart b/lib/contacts/views/contact_details_widget.dart index bd4376f..7b5416e 100644 --- a/lib/contacts/views/contact_details_widget.dart +++ b/lib/contacts/views/contact_details_widget.dart @@ -1,13 +1,15 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_translate/flutter_translate.dart'; import '../../proto/proto.dart' as proto; +import '../../tools/tools.dart'; import '../contacts.dart'; class ContactDetailsWidget extends StatefulWidget { - const ContactDetailsWidget({required this.contact, super.key}); - final proto.Contact contact; + const ContactDetailsWidget( + {required this.contact, this.onModifiedState, super.key}); @override State createState() => _ContactDetailsWidgetState(); @@ -15,8 +17,14 @@ class ContactDetailsWidget extends StatefulWidget { @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); - properties.add(DiagnosticsProperty('contact', contact)); + properties + ..add(DiagnosticsProperty('contact', contact)) + ..add(ObjectFlagProperty.has( + 'onModifiedState', onModifiedState)); } + + final proto.Contact contact; + final void Function(bool)? onModifiedState; } class _ContactDetailsWidgetState extends State @@ -24,18 +32,21 @@ class _ContactDetailsWidgetState extends State @override Widget build(BuildContext context) => SingleChildScrollView( child: EditContactForm( - formKey: GlobalKey(), contact: widget.contact, - onSubmit: (fbs) async { + submitText: translate('button.update'), + submitDisabledText: translate('button.waiting_for_network'), + onModifiedState: widget.onModifiedState, + onSubmit: (updatedContactSpec) async { final contactList = context.read(); - await contactList.updateContactFields( - localConversationRecordKey: - widget.contact.localConversationRecordKey.toVeilid(), - nickname: fbs.currentState - ?.value[EditContactForm.formFieldNickname] as String, - notes: fbs.currentState?.value[EditContactForm.formFieldNotes] - as String, - showAvailability: fbs.currentState - ?.value[EditContactForm.formFieldShowAvailability] as bool); + try { + await contactList.updateContactFields( + localConversationRecordKey: + widget.contact.localConversationRecordKey.toVeilid(), + updatedContactSpec: updatedContactSpec); + } on Exception catch (e) { + log.debug('error updating contact: $e', e); + return false; + } + return true; })); } diff --git a/lib/contacts/views/contact_item_widget.dart b/lib/contacts/views/contact_item_widget.dart index 4cb874d..4614f27 100644 --- a/lib/contacts/views/contact_item_widget.dart +++ b/lib/contacts/views/contact_item_widget.dart @@ -40,7 +40,7 @@ class ContactItemWidget extends StatelessWidget { size: 34, borderColor: _disabled ? scale.grayScale.primaryText - : scale.primaryScale.primaryText, + : scale.primaryScale.subtleBorder, foregroundColor: _disabled ? scale.grayScale.primaryText : scale.primaryScale.primaryText, @@ -68,20 +68,32 @@ class ContactItemWidget extends StatelessWidget { : () => singleFuture((this, _kOnTap), () async { await _onTap(_contact); }), - endActions: [ + startActions: [ if (_onDoubleTap != null) SliderTileAction( - icon: Icons.edit, - label: translate('button.edit'), + //icon: Icons.edit, + label: translate('button.chat'), actionScale: ScaleKind.secondary, onPressed: (_context) => singleFuture((this, _kOnTap), () async { await _onDoubleTap(_contact); }), ), + ], + endActions: [ + if (_onTap != null) + SliderTileAction( + //icon: Icons.edit, + label: translate('button.edit'), + actionScale: ScaleKind.secondary, + onPressed: (_context) => + singleFuture((this, _kOnTap), () async { + await _onTap(_contact); + }), + ), if (_onDelete != null) SliderTileAction( - icon: Icons.delete, + //icon: Icons.delete, label: translate('button.delete'), actionScale: ScaleKind.tertiary, onPressed: (_context) => diff --git a/lib/contacts/views/contacts_browser.dart b/lib/contacts/views/contacts_browser.dart index 89cea88..c5a6b22 100644 --- a/lib/contacts/views/contacts_browser.dart +++ b/lib/contacts/views/contacts_browser.dart @@ -39,14 +39,14 @@ class ContactsBrowserElement { class ContactsBrowser extends StatefulWidget { const ContactsBrowser( {required this.onContactSelected, - required this.onChatStarted, + required this.onStartChat, this.selectedContactRecordKey, super.key}); @override State createState() => _ContactsBrowserState(); final Future Function(proto.Contact? contact) onContactSelected; - final Future Function(proto.Contact contact) onChatStarted; + final Future Function(proto.Contact contact) onStartChat; final TypedKey? selectedContactRecordKey; @override @@ -60,7 +60,7 @@ class ContactsBrowser extends StatefulWidget { 'onContactSelected', onContactSelected)) ..add( ObjectFlagProperty Function(proto.Contact contact)>.has( - 'onChatStarted', onChatStarted)); + 'onStartChat', onStartChat)); } } @@ -74,13 +74,10 @@ class _ContactsBrowserState extends State final menuIconColor = scaleConfig.preferBorders ? scale.primaryScale.hoverBorder - : scale.primaryScale.borderText; + : scale.primaryScale.hoverBorder; final menuBackgroundColor = scaleConfig.preferBorders ? scale.primaryScale.elementBackground - : scale.primaryScale.border; - // final menuHoverColor = scaleConfig.preferBorders - // ? scale.primaryScale.hoverElementBackground - // : scale.primaryScale.hoverBorder; + : scale.primaryScale.elementBackground; final menuBorderColor = scale.primaryScale.hoverBorder; @@ -149,13 +146,12 @@ class _ContactsBrowserState extends State }, iconSize: 32, icon: const Icon(Icons.contact_page), - color: scale.primaryScale.hoverBorder, + color: menuIconColor, ), Text(translate('add_contact_sheet.create_invite'), maxLines: 2, textAlign: TextAlign.center, - style: textTheme.labelSmall! - .copyWith(color: scale.primaryScale.hoverBorder)) + style: textTheme.labelSmall!.copyWith(color: menuIconColor)) ]), StarMenu( items: receiveInviteMenuItems, @@ -171,13 +167,12 @@ class _ContactsBrowserState extends State icon: ImageIcon( const AssetImage('assets/images/handshake.png'), size: 32, - color: scale.primaryScale.hoverBorder, + color: menuIconColor, )), Text(translate('add_contact_sheet.receive_invite'), maxLines: 2, textAlign: TextAlign.center, - style: textTheme.labelSmall! - .copyWith(color: scale.primaryScale.hoverBorder)) + style: textTheme.labelSmall!.copyWith(color: menuIconColor)) ]), ), ]).paddingAll(16); @@ -243,8 +238,8 @@ class _ContactsBrowserState extends State selected: widget.selectedContactRecordKey == contact.localConversationRecordKey.toVeilid(), disabled: false, - onDoubleTap: _onTapContact, - onTap: _onStartChat, + onDoubleTap: _onStartChat, + onTap: _onSelectContact, onDelete: _onDeleteContact) .paddingLTRB(0, 4, 0, 0); case ContactsBrowserElementKind.invitation: @@ -274,8 +269,9 @@ class _ContactsBrowserState extends State case ContactsBrowserElementKind.invitation: final invitation = element.invitation!; return invitation.message - .toLowerCase() - .contains(lowerValue); + .toLowerCase() + .contains(lowerValue) || + invitation.recipient.toLowerCase().contains(lowerValue); } }).toList() }; @@ -297,12 +293,12 @@ class _ContactsBrowserState extends State ]); } - Future _onTapContact(proto.Contact contact) async { + Future _onSelectContact(proto.Contact contact) async { await widget.onContactSelected(contact); } Future _onStartChat(proto.Contact contact) async { - await widget.onChatStarted(contact); + await widget.onStartChat(contact); } Future _onDeleteContact(proto.Contact contact) async { diff --git a/lib/contacts/views/contacts_dialog.dart b/lib/contacts/views/contacts_dialog.dart index e6e5391..721043e 100644 --- a/lib/contacts/views/contacts_dialog.dart +++ b/lib/contacts/views/contacts_dialog.dart @@ -1,3 +1,4 @@ +import 'package:async_tools/async_tools.dart'; import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -11,6 +12,8 @@ import '../../proto/proto.dart' as proto; import '../../theme/theme.dart'; import '../contacts.dart'; +const _kDoBackArrow = 'doBackArrow'; + class ContactsDialog extends StatefulWidget { const ContactsDialog._({required this.modalContext}); @@ -44,13 +47,8 @@ class _ContactsDialogState extends State { @override Widget build(BuildContext context) { final theme = Theme.of(context); - // final textTheme = theme.textTheme; final scale = theme.extension()!; - final scaleConfig = theme.extension()!; - - final appBarIconColor = scaleConfig.useVisualIndicators - ? scale.secondaryScale.border - : scale.secondaryScale.borderText; + final appBarIconColor = scale.primaryScale.borderText; final enableSplit = !isMobileWidth(context); final enableLeft = enableSplit || _selectedContact == null; @@ -63,20 +61,22 @@ class _ContactsDialogState extends State { title: Text(!enableSplit && enableRight ? translate('contacts_dialog.edit_contact') : translate('contacts_dialog.contacts')), - leading: Navigator.canPop(context) - ? IconButton( - icon: const Icon(Icons.arrow_back), - onPressed: () { - if (!enableSplit && enableRight) { - setState(() { - _selectedContact = null; - }); - } else { + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + singleFuture((this, _kDoBackArrow), () async { + final confirmed = await _onContactSelected(null); + if (!enableSplit && enableRight) { + } else { + if (confirmed) { + if (context.mounted) { Navigator.pop(context); } - }, - ) - : null, + } + } + }); + }, + ), actions: [ if (_selectedContact != null) FittedBox( @@ -85,9 +85,10 @@ class _ContactsDialogState extends State { Column(mainAxisSize: MainAxisSize.min, children: [ IconButton( icon: const Icon(Icons.chat_bubble), + color: appBarIconColor, tooltip: translate('contacts_dialog.new_chat'), onPressed: () async { - await onChatStarted(_selectedContact!); + await _onChatStarted(_selectedContact!); }), Text(translate('contacts_dialog.new_chat'), style: theme.textTheme.labelSmall! @@ -100,10 +101,11 @@ class _ContactsDialogState extends State { Column(mainAxisSize: MainAxisSize.min, children: [ IconButton( icon: const Icon(Icons.close), + color: appBarIconColor, tooltip: translate('contacts_dialog.close_contact'), onPressed: () async { - await onContactSelected(null); + await _onContactSelected(null); }), Text(translate('contacts_dialog.close_contact'), style: theme.textTheme.labelSmall! @@ -115,41 +117,68 @@ class _ContactsDialogState extends State { return ColoredBox( color: scale.primaryScale.appBackground, - child: Row(children: [ - Offstage( - offstage: !enableLeft, - child: SizedBox( - width: enableLeft && !enableRight - ? maxWidth - : (maxWidth / 3).clamp(200, 500), - child: DecoratedBox( - decoration: BoxDecoration( - color: scale.primaryScale.subtleBackground), - child: ContactsBrowser( - selectedContactRecordKey: _selectedContact - ?.localConversationRecordKey - .toVeilid(), - onContactSelected: onContactSelected, - onChatStarted: onChatStarted, - ).paddingLTRB(8, 0, 8, 8)))), - if (enableRight) - if (_selectedContact == null) - const NoContactWidget().expanded() - else - ContactDetailsWidget(contact: _selectedContact!) - .paddingAll(8) - .expanded(), - ])); + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Offstage( + offstage: !enableLeft, + child: SizedBox( + width: enableLeft && !enableRight + ? maxWidth + : (maxWidth / 3).clamp(200, 500), + child: DecoratedBox( + decoration: BoxDecoration( + color: scale + .primaryScale.subtleBackground), + child: ContactsBrowser( + selectedContactRecordKey: _selectedContact + ?.localConversationRecordKey + .toVeilid(), + onContactSelected: _onContactSelected, + onStartChat: _onChatStarted, + ).paddingLTRB(8, 0, 8, 8)))), + if (enableRight && enableLeft) + Container( + constraints: const BoxConstraints( + minWidth: 1, maxWidth: 1), + color: scale.primaryScale.subtleBorder), + if (enableRight) + if (_selectedContact == null) + const NoContactWidget().expanded() + else + ContactDetailsWidget( + contact: _selectedContact!, + onModifiedState: _onModifiedState) + .paddingLTRB(16, 16, 16, 16) + .expanded(), + ])); }))); } - Future onContactSelected(proto.Contact? contact) async { + void _onModifiedState(bool isModified) { setState(() { - _selectedContact = contact; + _isModified = isModified; }); } - Future onChatStarted(proto.Contact contact) async { + Future _onContactSelected(proto.Contact? contact) async { + if (contact != _selectedContact && _isModified) { + final ok = await showConfirmModal( + context: context, + title: translate('confirmation.discard_changes'), + text: translate('confirmation.are_you_sure_discard')); + if (!ok) { + return false; + } + } + setState(() { + _selectedContact = contact; + _isModified = false; + }); + return true; + } + + Future _onChatStarted(proto.Contact contact) async { final chatListCubit = context.read(); await chatListCubit.getOrCreateChatSingleContact(contact: contact); @@ -163,4 +192,5 @@ class _ContactsDialogState extends State { } proto.Contact? _selectedContact; + bool _isModified = false; } diff --git a/lib/contacts/views/edit_contact_form.dart b/lib/contacts/views/edit_contact_form.dart index 7803ab2..5477c60 100644 --- a/lib/contacts/views/edit_contact_form.dart +++ b/lib/contacts/views/edit_contact_form.dart @@ -1,3 +1,4 @@ +import 'package:async_tools/async_tools.dart'; import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -6,13 +7,18 @@ import 'package:flutter_translate/flutter_translate.dart'; import '../../proto/proto.dart' as proto; import '../../theme/theme.dart'; +import '../models/contact_spec.dart'; import 'availability_widget.dart'; +const _kDoSubmitEditContact = 'doSubmitEditContact'; + class EditContactForm extends StatefulWidget { const EditContactForm({ - required this.formKey, required this.contact, - this.onSubmit, + required this.onSubmit, + required this.submitText, + required this.submitDisabledText, + this.onModifiedState, super.key, }); @@ -20,19 +26,22 @@ class EditContactForm extends StatefulWidget { State createState() => _EditContactFormState(); final proto.Contact contact; - final Future Function(GlobalKey)? onSubmit; - final GlobalKey formKey; + final String submitText; + final String submitDisabledText; + final Future Function(ContactSpec) onSubmit; + final void Function(bool)? onModifiedState; @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); properties - ..add(ObjectFlagProperty< - Future Function( - GlobalKey p1)?>.has('onSubmit', onSubmit)) + ..add(ObjectFlagProperty Function(ContactSpec p1)>.has( + 'onSubmit', onSubmit)) + ..add(ObjectFlagProperty.has( + 'onModifiedState', onModifiedState)) ..add(DiagnosticsProperty('contact', contact)) - ..add( - DiagnosticsProperty>('formKey', formKey)); + ..add(StringProperty('submitText', submitText)) + ..add(StringProperty('submitDisabledText', submitDisabledText)); } static const String formFieldNickname = 'nickname'; @@ -41,16 +50,46 @@ class EditContactForm extends StatefulWidget { } class _EditContactFormState extends State { + final _formKey = GlobalKey(); + @override void initState() { + _savedValue = ContactSpec.fromProto(widget.contact); + _currentValueNickname = _savedValue.nickname; + super.initState(); } - Widget _availabilityWidget(proto.Availability availability, Color color) => - AvailabilityWidget(availability: availability, color: color); + ContactSpec _makeContactSpec() { + final nickname = _formKey.currentState! + .fields[EditContactForm.formFieldNickname]!.value as String; + final notes = _formKey + .currentState!.fields[EditContactForm.formFieldNotes]!.value as String; + final showAvailability = _formKey.currentState! + .fields[EditContactForm.formFieldShowAvailability]!.value as bool; - @override - Widget build(BuildContext context) { + return ContactSpec( + nickname: nickname, notes: notes, showAvailability: showAvailability); + } + + // Check if everything is the same and update state + void _onChanged() { + final currentValue = _makeContactSpec(); + _isModified = currentValue != _savedValue; + final onModifiedState = widget.onModifiedState; + if (onModifiedState != null) { + onModifiedState(_isModified); + } + } + + Widget _availabilityWidget(proto.Availability availability, Color color) => + AvailabilityWidget( + availability: availability, + color: color, + vertical: false, + ); + + Widget _editContactForm(BuildContext context) { final theme = Theme.of(context); final scale = theme.extension()!; final scaleConfig = theme.extension()!; @@ -60,75 +99,94 @@ class _EditContactFormState extends State { if (scaleConfig.useVisualIndicators && !scaleConfig.preferBorders) { border = scale.primaryScale.elementBackground; } else { - border = scale.primaryScale.border; + border = scale.primaryScale.subtleBorder; } return FormBuilder( - key: widget.formKey, + key: _formKey, + autovalidateMode: AutovalidateMode.onUserInteraction, + onChanged: _onChanged, child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - AvatarWidget( - name: widget.contact.profile.name, - size: 128, - borderColor: border, - foregroundColor: scale.primaryScale.primaryText, - backgroundColor: scale.primaryScale.primary, - scaleConfig: scaleConfig, - textStyle: theme.textTheme.titleLarge!.copyWith(fontSize: 64), - ).paddingLTRB(0, 0, 0, 16), - SelectableText(widget.contact.profile.name, - style: textTheme.headlineMedium) - .noEditDecoratorLabel( - context, - translate('contact_form.form_name'), - scale: scale.secondaryScale, - ) - .paddingSymmetric(vertical: 4), - SelectableText(widget.contact.profile.pronouns, - style: textTheme.headlineSmall) - .noEditDecoratorLabel( - context, - translate('contact_form.form_pronouns'), - scale: scale.secondaryScale, - ) - .paddingSymmetric(vertical: 4), - Row(mainAxisSize: MainAxisSize.min, children: [ - _availabilityWidget(widget.contact.profile.availability, - scale.primaryScale.primaryText), - SelectableText(widget.contact.profile.status, - style: textTheme.bodyMedium) - .paddingSymmetric(horizontal: 8) - ]) - .noEditDecoratorLabel( - context, - translate('contact_form.form_status'), - scale: scale.secondaryScale, - ) - .paddingSymmetric(vertical: 4), - SelectableText(widget.contact.profile.about, - minLines: 1, maxLines: 8, style: textTheme.bodyMedium) - .noEditDecoratorLabel( - context, - translate('contact_form.form_about'), - scale: scale.secondaryScale, - ) - .paddingSymmetric(vertical: 4), - SelectableText( - widget.contact.identityPublicKey.value.toVeilid().toString(), - style: textTheme.labelMedium! - .copyWith(fontFamily: 'Source Code Pro')) - .noEditDecoratorLabel( - context, - translate('contact_form.form_fingerprint'), - scale: scale.secondaryScale, - ) - .paddingSymmetric(vertical: 4), - Divider(color: border).paddingLTRB(8, 0, 8, 8), + styledCard( + context: context, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row(children: [ + const Spacer(), + AvatarWidget( + name: _currentValueNickname.isNotEmpty + ? _currentValueNickname + : widget.contact.profile.name, + size: 128, + borderColor: border, + foregroundColor: scale.primaryScale.primaryText, + backgroundColor: scale.primaryScale.primary, + scaleConfig: scaleConfig, + textStyle: theme.textTheme.titleLarge! + .copyWith(fontSize: 64), + ).paddingLTRB(0, 0, 0, 16), + const Spacer() + ]), + SelectableText(widget.contact.profile.name, + style: textTheme.bodyLarge) + .noEditDecoratorLabel( + context, + translate('contact_form.form_name'), + ) + .paddingSymmetric(vertical: 4), + SelectableText(widget.contact.profile.pronouns, + style: textTheme.bodyLarge) + .noEditDecoratorLabel( + context, + translate('contact_form.form_pronouns'), + ) + .paddingSymmetric(vertical: 4), + Row(mainAxisSize: MainAxisSize.min, children: [ + _availabilityWidget( + widget.contact.profile.availability, + scale.primaryScale.appText), + SelectableText(widget.contact.profile.status, + style: textTheme.bodyMedium) + .paddingSymmetric(horizontal: 8) + ]) + .noEditDecoratorLabel( + context, + translate('contact_form.form_status'), + ) + .paddingSymmetric(vertical: 4), + SelectableText(widget.contact.profile.about, + minLines: 1, + maxLines: 8, + style: textTheme.bodyMedium) + .noEditDecoratorLabel( + context, + translate('contact_form.form_about'), + ) + .paddingSymmetric(vertical: 4), + SelectableText( + widget.contact.identityPublicKey.value + .toVeilid() + .toString(), + style: textTheme.bodyMedium! + .copyWith(fontFamily: 'Source Code Pro')) + .noEditDecoratorLabel( + context, + translate('contact_form.form_fingerprint'), + ) + .paddingSymmetric(vertical: 4), + ]).paddingAll(16)) + .paddingLTRB(0, 0, 0, 16), FormBuilderTextField( - //autofocus: true, name: EditContactForm.formFieldNickname, - initialValue: widget.contact.nickname, + initialValue: _currentValueNickname, + onChanged: (x) { + setState(() { + _currentValueNickname = x ?? ''; + }); + }, decoration: InputDecoration( labelText: translate('contact_form.form_nickname')), maxLength: 64, @@ -136,14 +194,16 @@ class _EditContactFormState extends State { ), FormBuilderCheckbox( name: EditContactForm.formFieldShowAvailability, - initialValue: widget.contact.showAvailability, + initialValue: _savedValue.showAvailability, side: BorderSide(color: scale.primaryScale.border, width: 2), + checkColor: scale.primaryScale.borderText, + activeColor: scale.primaryScale.border, title: Text(translate('contact_form.form_show_availability'), style: textTheme.labelMedium), ), FormBuilderTextField( name: EditContactForm.formFieldNotes, - initialValue: widget.contact.notes, + initialValue: _savedValue.notes, minLines: 1, maxLines: 8, maxLength: 1024, @@ -152,24 +212,38 @@ class _EditContactFormState extends State { textInputAction: TextInputAction.newline, ), ElevatedButton( - onPressed: widget.onSubmit == null - ? null - : () async { - if (widget.formKey.currentState?.saveAndValidate() ?? - false) { - await widget.onSubmit!(widget.formKey); - } - }, + onPressed: _isModified ? _doSubmit : null, child: Row(mainAxisSize: MainAxisSize.min, children: [ const Icon(Icons.check, size: 16).paddingLTRB(0, 0, 4, 0), - Text((widget.onSubmit == null) - ? translate('contact_form.save') - : translate('contact_form.save')) - .paddingLTRB(0, 0, 4, 0) + Text(widget.submitText).paddingLTRB(0, 0, 4, 0) ]), - ).paddingSymmetric(vertical: 4).alignAtCenterRight(), + ).paddingSymmetric(vertical: 4).alignAtCenter(), ], ), ); } + + void _doSubmit() { + final onSubmit = widget.onSubmit; + if (_formKey.currentState?.saveAndValidate() ?? false) { + singleFuture((this, _kDoSubmitEditContact), () async { + final updatedContactSpec = _makeContactSpec(); + final saved = await onSubmit(updatedContactSpec); + if (saved) { + setState(() { + _savedValue = updatedContactSpec; + }); + _onChanged(); + } + }); + } + } + + @override + Widget build(BuildContext context) => _editContactForm(context); + + /////////////////////////////////////////////////////////////////////////// + late ContactSpec _savedValue; + late String _currentValueNickname; + bool _isModified = false; } diff --git a/lib/contacts/views/no_contact_widget.dart b/lib/contacts/views/no_contact_widget.dart index c559d8b..8edb5d5 100644 --- a/lib/contacts/views/no_contact_widget.dart +++ b/lib/contacts/views/no_contact_widget.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_translate/flutter_translate.dart'; -import '../../theme/models/scale_scheme.dart'; +import '../../theme/models/scale_theme/scale_scheme.dart'; class NoContactWidget extends StatelessWidget { const NoContactWidget({super.key}); diff --git a/lib/init.dart b/lib/init.dart index d2744c7..8c80bf9 100644 --- a/lib/init.dart +++ b/lib/init.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; import 'package:veilid_support/veilid_support.dart'; import 'account_manager/account_manager.dart'; @@ -8,6 +9,8 @@ import 'app.dart'; import 'tools/tools.dart'; import 'veilid_processor/veilid_processor.dart'; +List rootAssets = []; + class VeilidChatGlobalInit { VeilidChatGlobalInit._(); @@ -28,14 +31,22 @@ class VeilidChatGlobalInit { logger: (message) => log.debug('DHTRecordPool: $message')); } -// Initialize repositories + // Initialize repositories Future _initializeRepositories() async { await AccountRepository.instance.init(); } + // Initialize asset manifest + static Future loadAssetManifest() async { + final assetManifest = await AssetManifest.loadFromAssetBundle(rootBundle); + rootAssets = assetManifest.listAssets(); + } + static Future initialize() async { final veilidChatGlobalInit = VeilidChatGlobalInit._(); + await loadAssetManifest(); + log.info('Initializing Veilid'); await veilidChatGlobalInit._initializeVeilid(); log.info('Initializing Repositories'); diff --git a/lib/layout/default_app_bar.dart b/lib/layout/default_app_bar.dart index 41e3601..fbf2360 100644 --- a/lib/layout/default_app_bar.dart +++ b/lib/layout/default_app_bar.dart @@ -6,6 +6,7 @@ class DefaultAppBar extends AppBar { DefaultAppBar( {required super.title, super.key, Widget? leading, super.actions}) : super( + titleSpacing: 0, leading: leading ?? Container( margin: const EdgeInsets.all(4), diff --git a/lib/layout/home/drawer_menu/drawer_menu.dart b/lib/layout/home/drawer_menu/drawer_menu.dart index 0821bbb..f88a888 100644 --- a/lib/layout/home/drawer_menu/drawer_menu.dart +++ b/lib/layout/home/drawer_menu/drawer_menu.dart @@ -9,12 +9,13 @@ import 'package:go_router/go_router.dart'; import 'package:veilid_support/veilid_support.dart'; import '../../../account_manager/account_manager.dart'; -import '../../../proto/proto.dart' as proto; import '../../../theme/theme.dart'; import '../../../tools/tools.dart'; import '../../../veilid_processor/veilid_processor.dart'; import 'menu_item_widget.dart'; +const _scaleKind = ScaleKind.secondary; + class DrawerMenu extends StatefulWidget { const DrawerMenu({super.key}); @@ -40,7 +41,7 @@ class _DrawerMenuState extends State { } void _doEditClick(TypedKey superIdentityRecordKey, - proto.Account existingAccount, OwnedDHTRecordPointer accountRecord) { + AccountSpec existingAccount, OwnedDHTRecordPointer accountRecord) { singleFuture(this, () async { await GoRouterHelper(context).push('/edit_account', extra: [superIdentityRecordKey, existingAccount, accountRecord]); @@ -58,45 +59,6 @@ class _DrawerMenuState extends State { borderRadius: BorderRadius.circular(borderRadius))), child: child); - Widget _makeAvatarWidget({ - required String name, - required double size, - required Color borderColor, - required Color foregroundColor, - required Color backgroundColor, - required ScaleConfig scaleConfig, - required TextStyle textStyle, - ImageProvider? imageProvider, - }) { - final abbrev = name.split(' ').map((s) => s.isEmpty ? '' : s[0]).join(); - late final String shortname; - if (abbrev.length >= 3) { - shortname = abbrev[0] + abbrev[1] + abbrev[abbrev.length - 1]; - } else { - shortname = abbrev; - } - - return Container( - height: size, - width: size, - decoration: BoxDecoration( - shape: BoxShape.circle, - border: scaleConfig.preferBorders - ? Border.all( - color: borderColor, - width: 2 * (size ~/ 32 + 1), - strokeAlign: BorderSide.strokeAlignOutside) - : null, - color: Colors.blue, - ), - child: AvatarImage( - //size: 32, - backgroundImage: imageProvider, - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - child: Text(shortname, style: textStyle))); - } - Widget _makeAccountWidget( {required String name, required bool selected, @@ -173,6 +135,7 @@ class _DrawerMenuState extends State { footerButtonIconColor: border, footerButtonIconHoverColor: hoverBackground, footerButtonIconFocusColor: activeBackground, + minHeight: 48, )); } @@ -184,6 +147,7 @@ class _DrawerMenuState extends State { final theme = Theme.of(context); final scaleScheme = theme.extension()!; final scaleConfig = theme.extension()!; + final scale = scaleScheme.scale(_scaleKind); final loggedInAccounts = []; final loggedOutAccounts = []; @@ -197,9 +161,6 @@ class _DrawerMenuState extends State { final avAccountRecordState = perAccountState?.avAccountRecordState; if (perAccountState != null && avAccountRecordState != null) { // Account is logged in - final scale = scaleConfig.useVisualIndicators - ? theme.extension()!.primaryScale - : theme.extension()!.tertiaryScale; final loggedInAccount = avAccountRecordState.when( data: (value) => _makeAccountWidget( name: value.profile.name, @@ -213,7 +174,7 @@ class _DrawerMenuState extends State { footerCallback: () { _doEditClick( superIdentityRecordKey, - value, + AccountSpec.fromProto(value), perAccountState.accountInfo.userLogin!.accountRecordInfo .accountRecord); }), @@ -311,13 +272,14 @@ class _DrawerMenuState extends State { Widget _getBottomButtons() { final theme = Theme.of(context); - final scale = theme.extension()!; + final scaleScheme = theme.extension()!; final scaleConfig = theme.extension()!; + final scale = scaleScheme.scale(_scaleKind); final settingsButton = _getButton( icon: const Icon(Icons.settings), tooltip: translate('menu.settings_tooltip'), - scale: scale.tertiaryScale, + scale: scale, scaleConfig: scaleConfig, onPressed: () async { await GoRouterHelper(context).push('/settings'); @@ -326,7 +288,7 @@ class _DrawerMenuState extends State { final addButton = _getButton( icon: const Icon(Icons.add), tooltip: translate('menu.add_account_tooltip'), - scale: scale.tertiaryScale, + scale: scale, scaleConfig: scaleConfig, onPressed: () async { await GoRouterHelper(context).push('/new_account'); @@ -340,8 +302,9 @@ class _DrawerMenuState extends State { @override Widget build(BuildContext context) { final theme = Theme.of(context); - final scale = theme.extension()!; + final scaleScheme = theme.extension()!; final scaleConfig = theme.extension()!; + final scale = scaleScheme.scale(_scaleKind); //final textTheme = theme.textTheme; final localAccounts = context.watch().state; final perAccountCollectionBlocMapState = @@ -351,43 +314,22 @@ class _DrawerMenuState extends State { begin: Alignment.topLeft, end: Alignment.bottomRight, colors: [ - scale.tertiaryScale.border, - scale.tertiaryScale.subtleBorder, + scale.border, + scale.subtleBorder, ]); return DecoratedBox( decoration: ShapeDecoration( - shadows: [ - if (scaleConfig.useVisualIndicators && !scaleConfig.preferBorders) - BoxShadow( - color: scale.tertiaryScale.primary.darken(80), - spreadRadius: 2, - ) - else if (scaleConfig.useVisualIndicators && - scaleConfig.preferBorders) - BoxShadow( - color: scale.tertiaryScale.border, - spreadRadius: 2, - ) - else - BoxShadow( - color: scale.tertiaryScale.primary.darken(40), - blurRadius: 6, - offset: const Offset( - 0, - 4, - ), - ), - ], + shadows: themedShadow(scaleConfig, scale), gradient: scaleConfig.useVisualIndicators ? null : gradient, color: scaleConfig.useVisualIndicators ? (scaleConfig.preferBorders - ? scale.tertiaryScale.appBackground - : scale.tertiaryScale.subtleBorder) + ? scale.appBackground + : scale.subtleBorder) : null, shape: RoundedRectangleBorder( side: scaleConfig.preferBorders - ? BorderSide(color: scale.tertiaryScale.primary, width: 2) + ? BorderSide(color: scale.primary, width: 2) : BorderSide.none, borderRadius: BorderRadius.only( topRight: Radius.circular(16 * scaleConfig.borderRadiusScale), @@ -399,31 +341,31 @@ class _DrawerMenuState extends State { child: ColorFiltered( colorFilter: ColorFilter.mode( theme.brightness == Brightness.light - ? scale.tertiaryScale.primary - : scale.tertiaryScale.border, + ? scale.primary + : scale.border, scaleConfig.preferBorders ? BlendMode.modulate : BlendMode.dst), child: Row(children: [ - SvgPicture.asset( - height: 48, - 'assets/images/icon.svg', - colorFilter: scaleConfig.useVisualIndicators - ? grayColorFilter - : null) - .paddingLTRB(0, 0, 16, 0), + // SvgPicture.asset( + // height: 48, + // 'assets/images/icon.svg', + // colorFilter: scaleConfig.useVisualIndicators + // ? grayColorFilter + // : null) + // .paddingLTRB(0, 0, 16, 0), SvgPicture.asset( height: 48, 'assets/images/title.svg', colorFilter: scaleConfig.useVisualIndicators ? grayColorFilter - : null), + : src96StencilFilter), ]))), Text(translate('menu.accounts'), style: theme.textTheme.titleMedium!.copyWith( color: scaleConfig.preferBorders - ? scale.tertiaryScale.border - : scale.tertiaryScale.borderText)) + ? scale.border + : scale.borderText)) .paddingLTRB(0, 16, 0, 16), ListView( shrinkWrap: true, @@ -438,16 +380,16 @@ class _DrawerMenuState extends State { Text('${translate('menu.version')} $packageInfoVersion', style: theme.textTheme.labelMedium!.copyWith( color: scaleConfig.preferBorders - ? scale.tertiaryScale.hoverBorder - : scale.tertiaryScale.subtleBackground)), + ? scale.hoverBorder + : scale.subtleBackground)), const Spacer(), SignalStrengthMeterWidget( color: scaleConfig.preferBorders - ? scale.tertiaryScale.hoverBorder - : scale.tertiaryScale.subtleBackground, + ? scale.hoverBorder + : scale.subtleBackground, inactiveColor: scaleConfig.preferBorders - ? scale.tertiaryScale.border - : scale.tertiaryScale.elementBackground, + ? scale.border + : scale.elementBackground, ), ]) ]).paddingAll(16), diff --git a/lib/layout/home/drawer_menu/menu_item_widget.dart b/lib/layout/home/drawer_menu/menu_item_widget.dart index 8529411..a786010 100644 --- a/lib/layout/home/drawer_menu/menu_item_widget.dart +++ b/lib/layout/home/drawer_menu/menu_item_widget.dart @@ -22,39 +22,42 @@ class MenuItemWidget extends StatelessWidget { this.footerButtonIconHoverColor, this.footerButtonIconFocusColor, this.footerCallback, + this.minHeight = 0, super.key, }); @override Widget build(BuildContext context) => TextButton( - onPressed: callback, - style: TextButton.styleFrom(foregroundColor: foregroundColor).copyWith( - backgroundColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.hovered)) { - return backgroundHoverColor; - } - if (states.contains(WidgetState.focused)) { - return backgroundFocusColor; - } - return backgroundColor; - }), - side: WidgetStateBorderSide.resolveWith((states) { - if (states.contains(WidgetState.hovered)) { - return borderColor != null - ? BorderSide(width: 2, color: borderHoverColor!) - : null; - } - if (states.contains(WidgetState.focused)) { - return borderColor != null - ? BorderSide(width: 2, color: borderFocusColor!) - : null; - } + onPressed: callback, + style: TextButton.styleFrom(foregroundColor: foregroundColor).copyWith( + backgroundColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.hovered)) { + return backgroundHoverColor; + } + if (states.contains(WidgetState.focused)) { + return backgroundFocusColor; + } + return backgroundColor; + }), + side: WidgetStateBorderSide.resolveWith((states) { + if (states.contains(WidgetState.hovered)) { return borderColor != null - ? BorderSide(width: 2, color: borderColor!) + ? BorderSide(width: 2, color: borderHoverColor!) : null; - }), - shape: WidgetStateProperty.all(RoundedRectangleBorder( - borderRadius: BorderRadius.circular(borderRadius ?? 0)))), + } + if (states.contains(WidgetState.focused)) { + return borderColor != null + ? BorderSide(width: 2, color: borderFocusColor!) + : null; + } + return borderColor != null + ? BorderSide(width: 2, color: borderColor!) + : null; + }), + shape: WidgetStateProperty.all(RoundedRectangleBorder( + borderRadius: BorderRadius.circular(borderRadius ?? 0)))), + child: ConstrainedBox( + constraints: BoxConstraints(minHeight: minHeight), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -81,7 +84,7 @@ class MenuItemWidget extends StatelessWidget { onPressed: footerCallback), ], ).paddingAll(2), - ); + )); @override void debugFillProperties(DiagnosticPropertiesBuilder properties) { @@ -106,7 +109,8 @@ class MenuItemWidget extends StatelessWidget { ..add(ColorProperty('borderColor', borderColor)) ..add(DoubleProperty('borderRadius', borderRadius)) ..add(ColorProperty('borderHoverColor', borderHoverColor)) - ..add(ColorProperty('borderFocusColor', borderFocusColor)); + ..add(ColorProperty('borderFocusColor', borderFocusColor)) + ..add(DoubleProperty('minHeight', minHeight)); } //////////////////////////////////////////////////////////////////////////// @@ -129,4 +133,5 @@ class MenuItemWidget extends StatelessWidget { final Color? footerButtonIconColor; final Color? footerButtonIconHoverColor; final Color? footerButtonIconFocusColor; + final double minHeight; } diff --git a/lib/layout/home/home_account_ready.dart b/lib/layout/home/home_account_ready.dart index 7b67c0f..8710eea 100644 --- a/lib/layout/home/home_account_ready.dart +++ b/lib/layout/home/home_account_ready.dart @@ -146,8 +146,9 @@ class _HomeAccountReadyState extends State { ); final theme = Theme.of(context); - final scale = theme.extension()!; + final scaleScheme = theme.extension()!; final scaleConfig = theme.extension()!; + final scale = scaleScheme.scale(ScaleKind.primary); final activeChat = context.watch().state; final hasActiveChat = activeChat != null; @@ -163,7 +164,9 @@ class _HomeAccountReadyState extends State { visibleLeft = true; visibleRight = true; leftWidth = leftColumnSize; - rightWidth = constraints.maxWidth - leftColumnSize - 2; + rightWidth = constraints.maxWidth - + leftColumnSize - + (scaleConfig.useVisualIndicators ? 2 : 0); } else { if (hasActiveChat) { visibleLeft = false; @@ -180,19 +183,21 @@ class _HomeAccountReadyState extends State { return Row(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Offstage( - offstage: !visibleLeft, - child: ConstrainedBox( - constraints: BoxConstraints(maxWidth: leftWidth), - child: buildLeftPane(context))), - Offstage( - offstage: !(visibleLeft && visibleRight), - child: SizedBox( - width: 2, - height: double.infinity, - child: ColoredBox( - color: scaleConfig.preferBorders - ? scale.primaryScale.subtleBorder - : scale.primaryScale.subtleBackground))), + offstage: !visibleLeft, + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: leftWidth), + child: buildLeftPane(context))) + .withThemedShadow(scaleConfig, scale), + if (scaleConfig.useVisualIndicators) + Offstage( + offstage: !(visibleLeft && visibleRight), + child: SizedBox( + width: 2, + height: double.infinity, + child: ColoredBox( + color: scaleConfig.preferBorders + ? scale.subtleBorder + : scale.subtleBackground))), Offstage( offstage: !visibleRight, child: ConstrainedBox( diff --git a/lib/layout/home/home_screen.dart b/lib/layout/home/home_screen.dart index f226717..0ec1f26 100644 --- a/lib/layout/home/home_screen.dart +++ b/lib/layout/home/home_screen.dart @@ -96,7 +96,7 @@ class HomeScreenState extends State ), Row(mainAxisSize: MainAxisSize.min, children: [ StatefulBuilder( - builder: (context, setState) => Checkbox.adaptive( + builder: (context, setState) => Checkbox( value: displayBetaWarning, onChanged: (value) { setState(() { @@ -213,7 +213,6 @@ class HomeScreenState extends State style: theme.textTheme.bodySmall!, child: ZoomDrawer( controller: _zoomDrawerController, - //menuBackgroundColor: Colors.transparent, menuScreen: Builder(builder: (context) { final zoomDrawer = ZoomDrawer.of(context); zoomDrawer!.stateNotifier.addListener(() { @@ -228,8 +227,9 @@ class HomeScreenState extends State child: Builder(builder: _buildAccountPageView)), borderRadius: 0, angle: 0, - mainScreenOverlayColor: theme.shadowColor.withAlpha(0x2F), + //mainScreenOverlayColor: theme.shadowColor.withAlpha(0x2F), openCurve: Curves.fastEaseInToSlowEaseOut, + closeCurve: Curves.fastEaseInToSlowEaseOut, // duration: const Duration(milliseconds: 250), // reverseDuration: const Duration(milliseconds: 250), menuScreenTapClose: canClose, diff --git a/lib/notifications/models/notifications_preference.freezed.dart b/lib/notifications/models/notifications_preference.freezed.dart index b2cbc67..0335ad8 100644 --- a/lib/notifications/models/notifications_preference.freezed.dart +++ b/lib/notifications/models/notifications_preference.freezed.dart @@ -35,8 +35,12 @@ mixin _$NotificationsPreference { SoundEffect get onMessageReceivedSound => throw _privateConstructorUsedError; SoundEffect get onMessageSentSound => throw _privateConstructorUsedError; + /// Serializes this NotificationsPreference to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of NotificationsPreference + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $NotificationsPreferenceCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -70,6 +74,8 @@ class _$NotificationsPreferenceCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of NotificationsPreference + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -155,6 +161,8 @@ class __$$NotificationsPreferenceImplCopyWithImpl<$Res> $Res Function(_$NotificationsPreferenceImpl) _then) : super(_value, _then); + /// Create a copy of NotificationsPreference + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -289,7 +297,7 @@ class _$NotificationsPreferenceImpl implements _NotificationsPreference { other.onMessageSentSound == onMessageSentSound)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -303,7 +311,9 @@ class _$NotificationsPreferenceImpl implements _NotificationsPreference { onMessageReceivedSound, onMessageSentSound); - @JsonKey(ignore: true) + /// Create a copy of NotificationsPreference + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$NotificationsPreferenceImplCopyWith<_$NotificationsPreferenceImpl> @@ -351,8 +361,11 @@ abstract class _NotificationsPreference implements NotificationsPreference { SoundEffect get onMessageReceivedSound; @override SoundEffect get onMessageSentSound; + + /// Create a copy of NotificationsPreference + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$NotificationsPreferenceImplCopyWith<_$NotificationsPreferenceImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/notifications/models/notifications_state.freezed.dart b/lib/notifications/models/notifications_state.freezed.dart index 90893e6..e052e7a 100644 --- a/lib/notifications/models/notifications_state.freezed.dart +++ b/lib/notifications/models/notifications_state.freezed.dart @@ -20,7 +20,9 @@ mixin _$NotificationItem { String get text => throw _privateConstructorUsedError; String? get title => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of NotificationItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $NotificationItemCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -44,6 +46,8 @@ class _$NotificationItemCopyWithImpl<$Res, $Val extends NotificationItem> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of NotificationItem + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -87,6 +91,8 @@ class __$$NotificationItemImplCopyWithImpl<$Res> $Res Function(_$NotificationItemImpl) _then) : super(_value, _then); + /// Create a copy of NotificationItem + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -142,7 +148,9 @@ class _$NotificationItemImpl implements _NotificationItem { @override int get hashCode => Object.hash(runtimeType, type, text, title); - @JsonKey(ignore: true) + /// Create a copy of NotificationItem + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$NotificationItemImplCopyWith<_$NotificationItemImpl> get copyWith => @@ -162,8 +170,11 @@ abstract class _NotificationItem implements NotificationItem { String get text; @override String? get title; + + /// Create a copy of NotificationItem + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$NotificationItemImplCopyWith<_$NotificationItemImpl> get copyWith => throw _privateConstructorUsedError; } @@ -172,7 +183,9 @@ abstract class _NotificationItem implements NotificationItem { mixin _$NotificationsState { IList get queue => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of NotificationsState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $NotificationsStateCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -196,6 +209,8 @@ class _$NotificationsStateCopyWithImpl<$Res, $Val extends NotificationsState> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of NotificationsState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -229,6 +244,8 @@ class __$$NotificationsStateImplCopyWithImpl<$Res> $Res Function(_$NotificationsStateImpl) _then) : super(_value, _then); + /// Create a copy of NotificationsState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -268,7 +285,9 @@ class _$NotificationsStateImpl implements _NotificationsState { int get hashCode => Object.hash(runtimeType, const DeepCollectionEquality().hash(queue)); - @JsonKey(ignore: true) + /// Create a copy of NotificationsState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$NotificationsStateImplCopyWith<_$NotificationsStateImpl> get copyWith => @@ -283,8 +302,11 @@ abstract class _NotificationsState implements NotificationsState { @override IList get queue; + + /// Create a copy of NotificationsState + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$NotificationsStateImplCopyWith<_$NotificationsStateImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/notifications/views/notifications_preferences.dart b/lib/notifications/views/notifications_preferences.dart index 5967522..95d4a1e 100644 --- a/lib/notifications/views/notifications_preferences.dart +++ b/lib/notifications/views/notifications_preferences.dart @@ -130,6 +130,8 @@ Widget buildSettingsPageNotificationPreferences( FormBuilderCheckbox( name: formFieldDisplayBetaWarning, side: BorderSide(color: scale.primaryScale.border, width: 2), + checkColor: scale.primaryScale.borderText, + activeColor: scale.primaryScale.border, title: Text(translate('settings_page.display_beta_warning'), style: textTheme.labelMedium), initialValue: notificationsPreference.displayBetaWarning, @@ -146,6 +148,8 @@ Widget buildSettingsPageNotificationPreferences( FormBuilderCheckbox( name: formFieldEnableBadge, side: BorderSide(color: scale.primaryScale.border, width: 2), + checkColor: scale.primaryScale.borderText, + activeColor: scale.primaryScale.border, title: Text(translate('settings_page.enable_badge'), style: textTheme.labelMedium), initialValue: notificationsPreference.enableBadge, @@ -161,6 +165,8 @@ Widget buildSettingsPageNotificationPreferences( FormBuilderCheckbox( name: formFieldEnableNotifications, side: BorderSide(color: scale.primaryScale.border, width: 2), + checkColor: scale.primaryScale.borderText, + activeColor: scale.primaryScale.border, title: Text(translate('settings_page.enable_notifications'), style: textTheme.labelMedium), initialValue: notificationsPreference.enableNotifications, diff --git a/lib/notifications/views/notifications_widget.dart b/lib/notifications/views/notifications_widget.dart index 246a570..73fac5f 100644 --- a/lib/notifications/views/notifications_widget.dart +++ b/lib/notifications/views/notifications_widget.dart @@ -1,6 +1,7 @@ +import 'package:awesome_extensions/awesome_extensions.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:motion_toast/motion_toast.dart'; +import 'package:toastification/toastification.dart'; import '../../theme/theme.dart'; import '../notifications.dart'; @@ -43,46 +44,47 @@ class NotificationsWidget extends StatelessWidget { //////////////////////////////////////////////////////////////////////////// // Private Implementation + void _toast( + {required BuildContext context, + required String text, + required ScaleToastTheme toastTheme, + String? title}) { + toastification.show( + context: context, + title: title != null + ? Text(title) + .copyWith(style: toastTheme.titleTextStyle) + .paddingLTRB(0, 0, 0, 8) + : null, + description: Text(text).copyWith(style: toastTheme.descriptionTextStyle), + icon: toastTheme.icon, + primaryColor: toastTheme.primaryColor, + backgroundColor: toastTheme.backgroundColor, + foregroundColor: toastTheme.foregroundColor, + padding: toastTheme.padding, + borderRadius: toastTheme.borderRadius, + borderSide: toastTheme.borderSide, + autoCloseDuration: const Duration(seconds: 2), + animationDuration: const Duration(milliseconds: 500), + ); + } + void _info( {required BuildContext context, required String text, String? title}) { final theme = Theme.of(context); - final scale = theme.extension()!; - final scaleConfig = theme.extension()!; + final toastTheme = + theme.extension()!.toastTheme(ScaleToastKind.info); - MotionToast( - title: title != null ? Text(title) : null, - description: Text(text), - constraints: BoxConstraints.loose(const Size(400, 100)), - contentPadding: const EdgeInsets.all(16), - primaryColor: scale.tertiaryScale.elementBackground, - secondaryColor: scale.tertiaryScale.calloutBackground, - borderRadius: 12 * scaleConfig.borderRadiusScale, - toastDuration: const Duration(seconds: 2), - animationDuration: const Duration(milliseconds: 500), - displayBorder: scaleConfig.useVisualIndicators, - icon: Icons.info, - ).show(context); + _toast(context: context, text: text, toastTheme: toastTheme, title: title); } void _error( {required BuildContext context, required String text, String? title}) { final theme = Theme.of(context); - final scale = theme.extension()!; - final scaleConfig = theme.extension()!; + final toastTheme = + theme.extension()!.toastTheme(ScaleToastKind.error); - MotionToast( - title: title != null ? Text(title) : null, - description: Text(text), - constraints: BoxConstraints.loose(const Size(400, 100)), - contentPadding: const EdgeInsets.all(16), - primaryColor: scale.errorScale.elementBackground, - secondaryColor: scale.errorScale.calloutBackground, - borderRadius: 12 * scaleConfig.borderRadiusScale, - toastDuration: const Duration(seconds: 4), - animationDuration: const Duration(milliseconds: 1000), - displayBorder: scaleConfig.useVisualIndicators, - icon: Icons.error, - ).show(context); + _toast(context: context, text: text, toastTheme: toastTheme, title: title); } //////////////////////////////////////////////////////////////////////////// diff --git a/lib/proto/veilidchat.pb.dart b/lib/proto/veilidchat.pb.dart index 5152594..245f9f3 100644 --- a/lib/proto/veilidchat.pb.dart +++ b/lib/proto/veilidchat.pb.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import @@ -20,8 +20,21 @@ import 'veilidchat.pbenum.dart'; export 'veilidchat.pbenum.dart'; +/// Reference to data on the DHT class DHTDataReference extends $pb.GeneratedMessage { - factory DHTDataReference() => create(); + factory DHTDataReference({ + $0.TypedKey? dhtData, + $0.TypedKey? hash, + }) { + final $result = create(); + if (dhtData != null) { + $result.dhtData = dhtData; + } + if (hash != null) { + $result.hash = hash; + } + return $result; + } DHTDataReference._() : super(); factory DHTDataReference.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory DHTDataReference.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -76,8 +89,17 @@ class DHTDataReference extends $pb.GeneratedMessage { $0.TypedKey ensureHash() => $_ensure(1); } +/// Reference to data on the BlockStore class BlockStoreDataReference extends $pb.GeneratedMessage { - factory BlockStoreDataReference() => create(); + factory BlockStoreDataReference({ + $0.TypedKey? block, + }) { + final $result = create(); + if (block != null) { + $result.block = block; + } + return $result; + } BlockStoreDataReference._() : super(); factory BlockStoreDataReference.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory BlockStoreDataReference.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -126,8 +148,23 @@ enum DataReference_Kind { notSet } +/// DataReference +/// Pointer to data somewhere in Veilid +/// Abstraction over DHTData and BlockStore class DataReference extends $pb.GeneratedMessage { - factory DataReference() => create(); + factory DataReference({ + DHTDataReference? dhtData, + BlockStoreDataReference? blockStoreData, + }) { + final $result = create(); + if (dhtData != null) { + $result.dhtData = dhtData; + } + if (blockStoreData != null) { + $result.blockStoreData = blockStoreData; + } + return $result; + } DataReference._() : super(); factory DataReference.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory DataReference.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -196,8 +233,21 @@ enum Attachment_Kind { notSet } +/// A single attachment class Attachment extends $pb.GeneratedMessage { - factory Attachment() => create(); + factory Attachment({ + AttachmentMedia? media, + $0.Signature? signature, + }) { + final $result = create(); + if (media != null) { + $result.media = media; + } + if (signature != null) { + $result.signature = signature; + } + return $result; + } Attachment._() : super(); factory Attachment.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Attachment.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -248,6 +298,7 @@ class Attachment extends $pb.GeneratedMessage { @$pb.TagNumber(1) AttachmentMedia ensureMedia() => $_ensure(0); + /// Author signature over all attachment fields and content fields and bytes @$pb.TagNumber(2) $0.Signature get signature => $_getN(1); @$pb.TagNumber(2) @@ -260,8 +311,25 @@ class Attachment extends $pb.GeneratedMessage { $0.Signature ensureSignature() => $_ensure(1); } +/// A file, audio, image, or video attachment class AttachmentMedia extends $pb.GeneratedMessage { - factory AttachmentMedia() => create(); + factory AttachmentMedia({ + $core.String? mime, + $core.String? name, + DataReference? content, + }) { + final $result = create(); + if (mime != null) { + $result.mime = mime; + } + if (name != null) { + $result.name = name; + } + if (content != null) { + $result.content = content; + } + return $result; + } AttachmentMedia._() : super(); factory AttachmentMedia.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory AttachmentMedia.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -294,6 +362,7 @@ class AttachmentMedia extends $pb.GeneratedMessage { static AttachmentMedia getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static AttachmentMedia? _defaultInstance; + /// MIME type of the data @$pb.TagNumber(1) $core.String get mime => $_getSZ(0); @$pb.TagNumber(1) @@ -303,6 +372,7 @@ class AttachmentMedia extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearMime() => clearField(1); + /// Title or filename @$pb.TagNumber(2) $core.String get name => $_getSZ(1); @$pb.TagNumber(2) @@ -312,6 +382,7 @@ class AttachmentMedia extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearName() => clearField(2); + /// Pointer to the data content @$pb.TagNumber(3) DataReference get content => $_getN(2); @$pb.TagNumber(3) @@ -324,8 +395,25 @@ class AttachmentMedia extends $pb.GeneratedMessage { DataReference ensureContent() => $_ensure(2); } +/// Permissions of a chat class Permissions extends $pb.GeneratedMessage { - factory Permissions() => create(); + factory Permissions({ + Scope? canAddMembers, + Scope? canEditInfo, + $core.bool? moderated, + }) { + final $result = create(); + if (canAddMembers != null) { + $result.canAddMembers = canAddMembers; + } + if (canEditInfo != null) { + $result.canEditInfo = canEditInfo; + } + if (moderated != null) { + $result.moderated = moderated; + } + return $result; + } Permissions._() : super(); factory Permissions.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Permissions.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -358,6 +446,7 @@ class Permissions extends $pb.GeneratedMessage { static Permissions getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Permissions? _defaultInstance; + /// Parties in this scope or higher can add members to their own group or lower @$pb.TagNumber(1) Scope get canAddMembers => $_getN(0); @$pb.TagNumber(1) @@ -367,6 +456,7 @@ class Permissions extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearCanAddMembers() => clearField(1); + /// Parties in this scope or higher can change the 'info' of a group @$pb.TagNumber(2) Scope get canEditInfo => $_getN(1); @$pb.TagNumber(2) @@ -376,6 +466,7 @@ class Permissions extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearCanEditInfo() => clearField(2); + /// If moderation is enabled or not. @$pb.TagNumber(3) $core.bool get moderated => $_getBF(2); @$pb.TagNumber(3) @@ -386,8 +477,33 @@ class Permissions extends $pb.GeneratedMessage { void clearModerated() => clearField(3); } +/// The membership of a chat class Membership extends $pb.GeneratedMessage { - factory Membership() => create(); + factory Membership({ + $core.Iterable<$0.TypedKey>? watchers, + $core.Iterable<$0.TypedKey>? moderated, + $core.Iterable<$0.TypedKey>? talkers, + $core.Iterable<$0.TypedKey>? moderators, + $core.Iterable<$0.TypedKey>? admins, + }) { + final $result = create(); + if (watchers != null) { + $result.watchers.addAll(watchers); + } + if (moderated != null) { + $result.moderated.addAll(moderated); + } + if (talkers != null) { + $result.talkers.addAll(talkers); + } + if (moderators != null) { + $result.moderators.addAll(moderators); + } + if (admins != null) { + $result.admins.addAll(admins); + } + return $result; + } Membership._() : super(); factory Membership.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Membership.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -422,24 +538,50 @@ class Membership extends $pb.GeneratedMessage { static Membership getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Membership? _defaultInstance; + /// Conversation keys for parties in the 'watchers' group @$pb.TagNumber(1) $core.List<$0.TypedKey> get watchers => $_getList(0); + /// Conversation keys for parties in the 'moderated' group @$pb.TagNumber(2) $core.List<$0.TypedKey> get moderated => $_getList(1); + /// Conversation keys for parties in the 'talkers' group @$pb.TagNumber(3) $core.List<$0.TypedKey> get talkers => $_getList(2); + /// Conversation keys for parties in the 'moderators' group @$pb.TagNumber(4) $core.List<$0.TypedKey> get moderators => $_getList(3); + /// Conversation keys for parties in the 'admins' group @$pb.TagNumber(5) $core.List<$0.TypedKey> get admins => $_getList(4); } +/// The chat settings class ChatSettings extends $pb.GeneratedMessage { - factory ChatSettings() => create(); + factory ChatSettings({ + $core.String? title, + $core.String? description, + DataReference? icon, + $fixnum.Int64? defaultExpiration, + }) { + final $result = create(); + if (title != null) { + $result.title = title; + } + if (description != null) { + $result.description = description; + } + if (icon != null) { + $result.icon = icon; + } + if (defaultExpiration != null) { + $result.defaultExpiration = defaultExpiration; + } + return $result; + } ChatSettings._() : super(); factory ChatSettings.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ChatSettings.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -473,6 +615,7 @@ class ChatSettings extends $pb.GeneratedMessage { static ChatSettings getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ChatSettings? _defaultInstance; + /// Title for the chat @$pb.TagNumber(1) $core.String get title => $_getSZ(0); @$pb.TagNumber(1) @@ -482,6 +625,7 @@ class ChatSettings extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearTitle() => clearField(1); + /// Description for the chat @$pb.TagNumber(2) $core.String get description => $_getSZ(1); @$pb.TagNumber(2) @@ -491,6 +635,7 @@ class ChatSettings extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearDescription() => clearField(2); + /// Icon for the chat @$pb.TagNumber(3) DataReference get icon => $_getN(2); @$pb.TagNumber(3) @@ -502,6 +647,7 @@ class ChatSettings extends $pb.GeneratedMessage { @$pb.TagNumber(3) DataReference ensureIcon() => $_ensure(2); + /// Default message expiration duration (in us) @$pb.TagNumber(4) $fixnum.Int64 get defaultExpiration => $_getI64(3); @$pb.TagNumber(4) @@ -512,8 +658,37 @@ class ChatSettings extends $pb.GeneratedMessage { void clearDefaultExpiration() => clearField(4); } +/// A text message class Message_Text extends $pb.GeneratedMessage { - factory Message_Text() => create(); + factory Message_Text({ + $core.String? text, + $core.String? topic, + $core.List<$core.int>? replyId, + $fixnum.Int64? expiration, + $core.int? viewLimit, + $core.Iterable? attachments, + }) { + final $result = create(); + if (text != null) { + $result.text = text; + } + if (topic != null) { + $result.topic = topic; + } + if (replyId != null) { + $result.replyId = replyId; + } + if (expiration != null) { + $result.expiration = expiration; + } + if (viewLimit != null) { + $result.viewLimit = viewLimit; + } + if (attachments != null) { + $result.attachments.addAll(attachments); + } + return $result; + } Message_Text._() : super(); factory Message_Text.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_Text.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -549,6 +724,7 @@ class Message_Text extends $pb.GeneratedMessage { static Message_Text getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Message_Text? _defaultInstance; + /// Text of the message @$pb.TagNumber(1) $core.String get text => $_getSZ(0); @$pb.TagNumber(1) @@ -558,6 +734,7 @@ class Message_Text extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearText() => clearField(1); + /// Topic of the message / Content warning @$pb.TagNumber(2) $core.String get topic => $_getSZ(1); @$pb.TagNumber(2) @@ -567,6 +744,7 @@ class Message_Text extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearTopic() => clearField(2); + /// Message id replied to (author id + message id) @$pb.TagNumber(3) $core.List<$core.int> get replyId => $_getN(2); @$pb.TagNumber(3) @@ -576,6 +754,7 @@ class Message_Text extends $pb.GeneratedMessage { @$pb.TagNumber(3) void clearReplyId() => clearField(3); + /// Message expiration timestamp @$pb.TagNumber(4) $fixnum.Int64 get expiration => $_getI64(3); @$pb.TagNumber(4) @@ -585,6 +764,7 @@ class Message_Text extends $pb.GeneratedMessage { @$pb.TagNumber(4) void clearExpiration() => clearField(4); + /// Message view limit before deletion @$pb.TagNumber(5) $core.int get viewLimit => $_getIZ(4); @$pb.TagNumber(5) @@ -594,12 +774,26 @@ class Message_Text extends $pb.GeneratedMessage { @$pb.TagNumber(5) void clearViewLimit() => clearField(5); + /// Attachments on the message @$pb.TagNumber(6) $core.List get attachments => $_getList(5); } +/// A secret message class Message_Secret extends $pb.GeneratedMessage { - factory Message_Secret() => create(); + factory Message_Secret({ + $core.List<$core.int>? ciphertext, + $fixnum.Int64? expiration, + }) { + final $result = create(); + if (ciphertext != null) { + $result.ciphertext = ciphertext; + } + if (expiration != null) { + $result.expiration = expiration; + } + return $result; + } Message_Secret._() : super(); factory Message_Secret.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_Secret.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -631,6 +825,7 @@ class Message_Secret extends $pb.GeneratedMessage { static Message_Secret getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Message_Secret? _defaultInstance; + /// Text message protobuf encrypted by a key @$pb.TagNumber(1) $core.List<$core.int> get ciphertext => $_getN(0); @$pb.TagNumber(1) @@ -640,6 +835,8 @@ class Message_Secret extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearCiphertext() => clearField(1); + /// Secret expiration timestamp + /// This is the time after which an un-revealed secret will get deleted @$pb.TagNumber(2) $fixnum.Int64 get expiration => $_getI64(1); @$pb.TagNumber(2) @@ -650,8 +847,18 @@ class Message_Secret extends $pb.GeneratedMessage { void clearExpiration() => clearField(2); } +/// A 'delete' control message +/// Deletes a set of messages by their ids class Message_ControlDelete extends $pb.GeneratedMessage { - factory Message_ControlDelete() => create(); + factory Message_ControlDelete({ + $core.Iterable<$core.List<$core.int>>? ids, + }) { + final $result = create(); + if (ids != null) { + $result.ids.addAll(ids); + } + return $result; + } Message_ControlDelete._() : super(); factory Message_ControlDelete.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_ControlDelete.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -686,8 +893,18 @@ class Message_ControlDelete extends $pb.GeneratedMessage { $core.List<$core.List<$core.int>> get ids => $_getList(0); } +/// An 'erase' control message +/// Deletes a set of messages from before some timestamp class Message_ControlErase extends $pb.GeneratedMessage { - factory Message_ControlErase() => create(); + factory Message_ControlErase({ + $fixnum.Int64? timestamp, + }) { + final $result = create(); + if (timestamp != null) { + $result.timestamp = timestamp; + } + return $result; + } Message_ControlErase._() : super(); factory Message_ControlErase.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_ControlErase.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -718,6 +935,8 @@ class Message_ControlErase extends $pb.GeneratedMessage { static Message_ControlErase getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Message_ControlErase? _defaultInstance; + /// The latest timestamp to delete messages before + /// If this is zero then all messages are cleared @$pb.TagNumber(1) $fixnum.Int64 get timestamp => $_getI64(0); @$pb.TagNumber(1) @@ -728,8 +947,17 @@ class Message_ControlErase extends $pb.GeneratedMessage { void clearTimestamp() => clearField(1); } +/// A 'change settings' control message class Message_ControlSettings extends $pb.GeneratedMessage { - factory Message_ControlSettings() => create(); + factory Message_ControlSettings({ + ChatSettings? settings, + }) { + final $result = create(); + if (settings != null) { + $result.settings = settings; + } + return $result; + } Message_ControlSettings._() : super(); factory Message_ControlSettings.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_ControlSettings.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -772,8 +1000,18 @@ class Message_ControlSettings extends $pb.GeneratedMessage { ChatSettings ensureSettings() => $_ensure(0); } +/// A 'change permissions' control message +/// Changes the permissions of a chat class Message_ControlPermissions extends $pb.GeneratedMessage { - factory Message_ControlPermissions() => create(); + factory Message_ControlPermissions({ + Permissions? permissions, + }) { + final $result = create(); + if (permissions != null) { + $result.permissions = permissions; + } + return $result; + } Message_ControlPermissions._() : super(); factory Message_ControlPermissions.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_ControlPermissions.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -816,8 +1054,18 @@ class Message_ControlPermissions extends $pb.GeneratedMessage { Permissions ensurePermissions() => $_ensure(0); } +/// A 'change membership' control message +/// Changes the class Message_ControlMembership extends $pb.GeneratedMessage { - factory Message_ControlMembership() => create(); + factory Message_ControlMembership({ + Membership? membership, + }) { + final $result = create(); + if (membership != null) { + $result.membership = membership; + } + return $result; + } Message_ControlMembership._() : super(); factory Message_ControlMembership.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_ControlMembership.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -860,8 +1108,22 @@ class Message_ControlMembership extends $pb.GeneratedMessage { Membership ensureMembership() => $_ensure(0); } +/// A 'moderation' control message +/// Accepts or rejects a set of messages class Message_ControlModeration extends $pb.GeneratedMessage { - factory Message_ControlModeration() => create(); + factory Message_ControlModeration({ + $core.Iterable<$core.List<$core.int>>? acceptedIds, + $core.Iterable<$core.List<$core.int>>? rejectedIds, + }) { + final $result = create(); + if (acceptedIds != null) { + $result.acceptedIds.addAll(acceptedIds); + } + if (rejectedIds != null) { + $result.rejectedIds.addAll(rejectedIds); + } + return $result; + } Message_ControlModeration._() : super(); factory Message_ControlModeration.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_ControlModeration.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -900,8 +1162,17 @@ class Message_ControlModeration extends $pb.GeneratedMessage { $core.List<$core.List<$core.int>> get rejectedIds => $_getList(1); } +/// A 'read receipt' control message class Message_ControlReadReceipt extends $pb.GeneratedMessage { - factory Message_ControlReadReceipt() => create(); + factory Message_ControlReadReceipt({ + $core.Iterable<$core.List<$core.int>>? readIds, + }) { + final $result = create(); + if (readIds != null) { + $result.readIds.addAll(readIds); + } + return $result; + } Message_ControlReadReceipt._() : super(); factory Message_ControlReadReceipt.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message_ControlReadReceipt.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -948,8 +1219,61 @@ enum Message_Kind { notSet } +/// A single message as part of a series of messages class Message extends $pb.GeneratedMessage { - factory Message() => create(); + factory Message({ + $core.List<$core.int>? id, + $0.TypedKey? author, + $fixnum.Int64? timestamp, + Message_Text? text, + Message_Secret? secret, + Message_ControlDelete? delete, + Message_ControlErase? erase, + Message_ControlSettings? settings, + Message_ControlPermissions? permissions, + Message_ControlMembership? membership, + Message_ControlModeration? moderation, + $0.Signature? signature, + }) { + final $result = create(); + if (id != null) { + $result.id = id; + } + if (author != null) { + $result.author = author; + } + if (timestamp != null) { + $result.timestamp = timestamp; + } + if (text != null) { + $result.text = text; + } + if (secret != null) { + $result.secret = secret; + } + if (delete != null) { + $result.delete = delete; + } + if (erase != null) { + $result.erase = erase; + } + if (settings != null) { + $result.settings = settings; + } + if (permissions != null) { + $result.permissions = permissions; + } + if (membership != null) { + $result.membership = membership; + } + if (moderation != null) { + $result.moderation = moderation; + } + if (signature != null) { + $result.signature = signature; + } + return $result; + } Message._() : super(); factory Message.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Message.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1006,6 +1330,8 @@ class Message extends $pb.GeneratedMessage { Message_Kind whichKind() => _Message_KindByTag[$_whichOneof(0)]!; void clearKind() => clearField($_whichOneof(0)); + /// Unique id for this author stream + /// Calculated from the hash of the previous message from this author @$pb.TagNumber(1) $core.List<$core.int> get id => $_getN(0); @$pb.TagNumber(1) @@ -1015,6 +1341,7 @@ class Message extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearId() => clearField(1); + /// Author of the message (identity public key) @$pb.TagNumber(2) $0.TypedKey get author => $_getN(1); @$pb.TagNumber(2) @@ -1026,6 +1353,7 @@ class Message extends $pb.GeneratedMessage { @$pb.TagNumber(2) $0.TypedKey ensureAuthor() => $_ensure(1); + /// Time the message was sent according to sender @$pb.TagNumber(3) $fixnum.Int64 get timestamp => $_getI64(2); @$pb.TagNumber(3) @@ -1123,6 +1451,7 @@ class Message extends $pb.GeneratedMessage { @$pb.TagNumber(11) Message_ControlModeration ensureModeration() => $_ensure(10); + /// Author signature over all of the fields and attachment signatures @$pb.TagNumber(12) $0.Signature get signature => $_getN(11); @$pb.TagNumber(12) @@ -1135,8 +1464,21 @@ class Message extends $pb.GeneratedMessage { $0.Signature ensureSignature() => $_ensure(11); } +/// Locally stored messages for chats class ReconciledMessage extends $pb.GeneratedMessage { - factory ReconciledMessage() => create(); + factory ReconciledMessage({ + Message? content, + $fixnum.Int64? reconciledTime, + }) { + final $result = create(); + if (content != null) { + $result.content = content; + } + if (reconciledTime != null) { + $result.reconciledTime = reconciledTime; + } + return $result; + } ReconciledMessage._() : super(); factory ReconciledMessage.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ReconciledMessage.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1168,6 +1510,7 @@ class ReconciledMessage extends $pb.GeneratedMessage { static ReconciledMessage getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ReconciledMessage? _defaultInstance; + /// The message as sent @$pb.TagNumber(1) Message get content => $_getN(0); @$pb.TagNumber(1) @@ -1179,6 +1522,7 @@ class ReconciledMessage extends $pb.GeneratedMessage { @$pb.TagNumber(1) Message ensureContent() => $_ensure(0); + /// The timestamp the message was reconciled @$pb.TagNumber(2) $fixnum.Int64 get reconciledTime => $_getI64(1); @$pb.TagNumber(2) @@ -1189,8 +1533,36 @@ class ReconciledMessage extends $pb.GeneratedMessage { void clearReconciledTime() => clearField(2); } +/// The means of direct communications that is synchronized between +/// two users. Visible and encrypted for the other party. +/// Includes communications for: +/// * Profile changes +/// * Identity changes +/// * 1-1 chat messages +/// * Group chat messages +/// +/// DHT Schema: SMPL(0,1,[identityPublicKey]) +/// DHT Key (UnicastOutbox): localConversation +/// DHT Secret: None +/// Encryption: DH(IdentityA, IdentityB) class Conversation extends $pb.GeneratedMessage { - factory Conversation() => create(); + factory Conversation({ + Profile? profile, + $core.String? superIdentityJson, + $0.TypedKey? messages, + }) { + final $result = create(); + if (profile != null) { + $result.profile = profile; + } + if (superIdentityJson != null) { + $result.superIdentityJson = superIdentityJson; + } + if (messages != null) { + $result.messages = messages; + } + return $result; + } Conversation._() : super(); factory Conversation.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Conversation.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1223,6 +1595,7 @@ class Conversation extends $pb.GeneratedMessage { static Conversation getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Conversation? _defaultInstance; + /// Profile to publish to friend @$pb.TagNumber(1) Profile get profile => $_getN(0); @$pb.TagNumber(1) @@ -1234,6 +1607,7 @@ class Conversation extends $pb.GeneratedMessage { @$pb.TagNumber(1) Profile ensureProfile() => $_ensure(0); + /// SuperIdentity (JSON) to publish to friend or chat room @$pb.TagNumber(2) $core.String get superIdentityJson => $_getSZ(1); @$pb.TagNumber(2) @@ -1243,6 +1617,7 @@ class Conversation extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearSuperIdentityJson() => clearField(2); + /// Messages DHTLog @$pb.TagNumber(3) $0.TypedKey get messages => $_getN(2); @$pb.TagNumber(3) @@ -1255,8 +1630,21 @@ class Conversation extends $pb.GeneratedMessage { $0.TypedKey ensureMessages() => $_ensure(2); } +/// A member of chat which may or may not be associated with a contact class ChatMember extends $pb.GeneratedMessage { - factory ChatMember() => create(); + factory ChatMember({ + $0.TypedKey? remoteIdentityPublicKey, + $0.TypedKey? remoteConversationRecordKey, + }) { + final $result = create(); + if (remoteIdentityPublicKey != null) { + $result.remoteIdentityPublicKey = remoteIdentityPublicKey; + } + if (remoteConversationRecordKey != null) { + $result.remoteConversationRecordKey = remoteConversationRecordKey; + } + return $result; + } ChatMember._() : super(); factory ChatMember.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ChatMember.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1288,6 +1676,7 @@ class ChatMember extends $pb.GeneratedMessage { static ChatMember getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ChatMember? _defaultInstance; + /// The identity public key most recently associated with the chat member @$pb.TagNumber(1) $0.TypedKey get remoteIdentityPublicKey => $_getN(0); @$pb.TagNumber(1) @@ -1299,6 +1688,7 @@ class ChatMember extends $pb.GeneratedMessage { @$pb.TagNumber(1) $0.TypedKey ensureRemoteIdentityPublicKey() => $_ensure(0); + /// Conversation key for the other party @$pb.TagNumber(2) $0.TypedKey get remoteConversationRecordKey => $_getN(1); @$pb.TagNumber(2) @@ -1311,8 +1701,26 @@ class ChatMember extends $pb.GeneratedMessage { $0.TypedKey ensureRemoteConversationRecordKey() => $_ensure(1); } +/// A 1-1 chat +/// Privately encrypted, this is the local user's copy of the chat class DirectChat extends $pb.GeneratedMessage { - factory DirectChat() => create(); + factory DirectChat({ + ChatSettings? settings, + $0.TypedKey? localConversationRecordKey, + ChatMember? remoteMember, + }) { + final $result = create(); + if (settings != null) { + $result.settings = settings; + } + if (localConversationRecordKey != null) { + $result.localConversationRecordKey = localConversationRecordKey; + } + if (remoteMember != null) { + $result.remoteMember = remoteMember; + } + return $result; + } DirectChat._() : super(); factory DirectChat.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory DirectChat.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1345,6 +1753,7 @@ class DirectChat extends $pb.GeneratedMessage { static DirectChat getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static DirectChat? _defaultInstance; + /// Settings @$pb.TagNumber(1) ChatSettings get settings => $_getN(0); @$pb.TagNumber(1) @@ -1356,6 +1765,7 @@ class DirectChat extends $pb.GeneratedMessage { @$pb.TagNumber(1) ChatSettings ensureSettings() => $_ensure(0); + /// Conversation key for this user @$pb.TagNumber(2) $0.TypedKey get localConversationRecordKey => $_getN(1); @$pb.TagNumber(2) @@ -1367,6 +1777,7 @@ class DirectChat extends $pb.GeneratedMessage { @$pb.TagNumber(2) $0.TypedKey ensureLocalConversationRecordKey() => $_ensure(1); + /// Conversation key for the other party @$pb.TagNumber(3) ChatMember get remoteMember => $_getN(2); @$pb.TagNumber(3) @@ -1379,8 +1790,34 @@ class DirectChat extends $pb.GeneratedMessage { ChatMember ensureRemoteMember() => $_ensure(2); } +/// A group chat +/// Privately encrypted, this is the local user's copy of the chat class GroupChat extends $pb.GeneratedMessage { - factory GroupChat() => create(); + factory GroupChat({ + ChatSettings? settings, + Membership? membership, + Permissions? permissions, + $0.TypedKey? localConversationRecordKey, + $core.Iterable? remoteMembers, + }) { + final $result = create(); + if (settings != null) { + $result.settings = settings; + } + if (membership != null) { + $result.membership = membership; + } + if (permissions != null) { + $result.permissions = permissions; + } + if (localConversationRecordKey != null) { + $result.localConversationRecordKey = localConversationRecordKey; + } + if (remoteMembers != null) { + $result.remoteMembers.addAll(remoteMembers); + } + return $result; + } GroupChat._() : super(); factory GroupChat.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory GroupChat.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1415,6 +1852,7 @@ class GroupChat extends $pb.GeneratedMessage { static GroupChat getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static GroupChat? _defaultInstance; + /// Settings @$pb.TagNumber(1) ChatSettings get settings => $_getN(0); @$pb.TagNumber(1) @@ -1426,6 +1864,7 @@ class GroupChat extends $pb.GeneratedMessage { @$pb.TagNumber(1) ChatSettings ensureSettings() => $_ensure(0); + /// Membership @$pb.TagNumber(2) Membership get membership => $_getN(1); @$pb.TagNumber(2) @@ -1437,6 +1876,7 @@ class GroupChat extends $pb.GeneratedMessage { @$pb.TagNumber(2) Membership ensureMembership() => $_ensure(1); + /// Permissions @$pb.TagNumber(3) Permissions get permissions => $_getN(2); @$pb.TagNumber(3) @@ -1448,6 +1888,7 @@ class GroupChat extends $pb.GeneratedMessage { @$pb.TagNumber(3) Permissions ensurePermissions() => $_ensure(2); + /// Conversation key for this user @$pb.TagNumber(4) $0.TypedKey get localConversationRecordKey => $_getN(3); @$pb.TagNumber(4) @@ -1459,6 +1900,7 @@ class GroupChat extends $pb.GeneratedMessage { @$pb.TagNumber(4) $0.TypedKey ensureLocalConversationRecordKey() => $_ensure(3); + /// Conversation keys for the other parties @$pb.TagNumber(5) $core.List get remoteMembers => $_getList(4); } @@ -1469,8 +1911,21 @@ enum Chat_Kind { notSet } +/// Some kind of chat class Chat extends $pb.GeneratedMessage { - factory Chat() => create(); + factory Chat({ + DirectChat? direct, + GroupChat? group, + }) { + final $result = create(); + if (direct != null) { + $result.direct = direct; + } + if (group != null) { + $result.group = group; + } + return $result; + } Chat._() : super(); factory Chat.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Chat.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1534,8 +1989,45 @@ class Chat extends $pb.GeneratedMessage { GroupChat ensureGroup() => $_ensure(1); } +/// Publicly shared profile information for both contacts and accounts +/// Contains: +/// Name - Friendly name +/// Pronouns - Pronouns of user +/// Icon - Little picture to represent user in contact list class Profile extends $pb.GeneratedMessage { - factory Profile() => create(); + factory Profile({ + $core.String? name, + $core.String? pronouns, + $core.String? about, + $core.String? status, + Availability? availability, + DataReference? avatar, + $fixnum.Int64? timestamp, + }) { + final $result = create(); + if (name != null) { + $result.name = name; + } + if (pronouns != null) { + $result.pronouns = pronouns; + } + if (about != null) { + $result.about = about; + } + if (status != null) { + $result.status = status; + } + if (availability != null) { + $result.availability = availability; + } + if (avatar != null) { + $result.avatar = avatar; + } + if (timestamp != null) { + $result.timestamp = timestamp; + } + return $result; + } Profile._() : super(); factory Profile.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Profile.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1572,6 +2064,7 @@ class Profile extends $pb.GeneratedMessage { static Profile getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Profile? _defaultInstance; + /// Friendy name (max length 64) @$pb.TagNumber(1) $core.String get name => $_getSZ(0); @$pb.TagNumber(1) @@ -1581,6 +2074,7 @@ class Profile extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearName() => clearField(1); + /// Pronouns of user (max length 64) @$pb.TagNumber(2) $core.String get pronouns => $_getSZ(1); @$pb.TagNumber(2) @@ -1590,6 +2084,7 @@ class Profile extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearPronouns() => clearField(2); + /// Description of the user (max length 1024) @$pb.TagNumber(3) $core.String get about => $_getSZ(2); @$pb.TagNumber(3) @@ -1599,6 +2094,7 @@ class Profile extends $pb.GeneratedMessage { @$pb.TagNumber(3) void clearAbout() => clearField(3); + /// Status/away message (max length 128) @$pb.TagNumber(4) $core.String get status => $_getSZ(3); @$pb.TagNumber(4) @@ -1608,6 +2104,7 @@ class Profile extends $pb.GeneratedMessage { @$pb.TagNumber(4) void clearStatus() => clearField(4); + /// Availability @$pb.TagNumber(5) Availability get availability => $_getN(4); @$pb.TagNumber(5) @@ -1617,6 +2114,7 @@ class Profile extends $pb.GeneratedMessage { @$pb.TagNumber(5) void clearAvailability() => clearField(5); + /// Avatar @$pb.TagNumber(6) DataReference get avatar => $_getN(5); @$pb.TagNumber(6) @@ -1628,6 +2126,7 @@ class Profile extends $pb.GeneratedMessage { @$pb.TagNumber(6) DataReference ensureAvatar() => $_ensure(5); + /// Timestamp of last change @$pb.TagNumber(7) $fixnum.Int64 get timestamp => $_getI64(6); @$pb.TagNumber(7) @@ -1638,8 +2137,61 @@ class Profile extends $pb.GeneratedMessage { void clearTimestamp() => clearField(7); } +/// A record of an individual account +/// Pointed to by the identity account map in the identity key +/// +/// DHT Schema: DFLT(1) +/// DHT Private: accountSecretKey class Account extends $pb.GeneratedMessage { - factory Account() => create(); + factory Account({ + Profile? profile, + $core.bool? invisible, + $core.int? autoAwayTimeoutMin, + $1.OwnedDHTRecordPointer? contactList, + $1.OwnedDHTRecordPointer? contactInvitationRecords, + $1.OwnedDHTRecordPointer? chatList, + $1.OwnedDHTRecordPointer? groupChatList, + $core.String? freeMessage, + $core.String? busyMessage, + $core.String? awayMessage, + $core.bool? autodetectAway, + }) { + final $result = create(); + if (profile != null) { + $result.profile = profile; + } + if (invisible != null) { + $result.invisible = invisible; + } + if (autoAwayTimeoutMin != null) { + $result.autoAwayTimeoutMin = autoAwayTimeoutMin; + } + if (contactList != null) { + $result.contactList = contactList; + } + if (contactInvitationRecords != null) { + $result.contactInvitationRecords = contactInvitationRecords; + } + if (chatList != null) { + $result.chatList = chatList; + } + if (groupChatList != null) { + $result.groupChatList = groupChatList; + } + if (freeMessage != null) { + $result.freeMessage = freeMessage; + } + if (busyMessage != null) { + $result.busyMessage = busyMessage; + } + if (awayMessage != null) { + $result.awayMessage = awayMessage; + } + if (autodetectAway != null) { + $result.autodetectAway = autodetectAway; + } + return $result; + } Account._() : super(); factory Account.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Account.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1680,6 +2232,7 @@ class Account extends $pb.GeneratedMessage { static Account getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Account? _defaultInstance; + /// The user's profile that gets shared with contacts @$pb.TagNumber(1) Profile get profile => $_getN(0); @$pb.TagNumber(1) @@ -1691,6 +2244,7 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(1) Profile ensureProfile() => $_ensure(0); + /// Invisibility makes you always look 'Offline' @$pb.TagNumber(2) $core.bool get invisible => $_getBF(1); @$pb.TagNumber(2) @@ -1700,6 +2254,7 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearInvisible() => clearField(2); + /// Auto-away sets 'away' mode after an inactivity time (only if autodetect_away is set) @$pb.TagNumber(3) $core.int get autoAwayTimeoutMin => $_getIZ(2); @$pb.TagNumber(3) @@ -1709,6 +2264,8 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(3) void clearAutoAwayTimeoutMin() => clearField(3); + /// The contacts DHTList for this account + /// DHT Private @$pb.TagNumber(4) $1.OwnedDHTRecordPointer get contactList => $_getN(3); @$pb.TagNumber(4) @@ -1720,6 +2277,8 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(4) $1.OwnedDHTRecordPointer ensureContactList() => $_ensure(3); + /// The ContactInvitationRecord DHTShortArray for this account + /// DHT Private @$pb.TagNumber(5) $1.OwnedDHTRecordPointer get contactInvitationRecords => $_getN(4); @$pb.TagNumber(5) @@ -1731,6 +2290,8 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(5) $1.OwnedDHTRecordPointer ensureContactInvitationRecords() => $_ensure(4); + /// The Chats DHTList for this account + /// DHT Private @$pb.TagNumber(6) $1.OwnedDHTRecordPointer get chatList => $_getN(5); @$pb.TagNumber(6) @@ -1742,6 +2303,8 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(6) $1.OwnedDHTRecordPointer ensureChatList() => $_ensure(5); + /// The GroupChats DHTList for this account + /// DHT Private @$pb.TagNumber(7) $1.OwnedDHTRecordPointer get groupChatList => $_getN(6); @$pb.TagNumber(7) @@ -1753,6 +2316,7 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(7) $1.OwnedDHTRecordPointer ensureGroupChatList() => $_ensure(6); + /// Free message (max length 128) @$pb.TagNumber(8) $core.String get freeMessage => $_getSZ(7); @$pb.TagNumber(8) @@ -1762,6 +2326,7 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(8) void clearFreeMessage() => clearField(8); + /// Busy message (max length 128) @$pb.TagNumber(9) $core.String get busyMessage => $_getSZ(8); @$pb.TagNumber(9) @@ -1771,6 +2336,7 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(9) void clearBusyMessage() => clearField(9); + /// Away message (max length 128) @$pb.TagNumber(10) $core.String get awayMessage => $_getSZ(9); @$pb.TagNumber(10) @@ -1780,6 +2346,7 @@ class Account extends $pb.GeneratedMessage { @$pb.TagNumber(10) void clearAwayMessage() => clearField(10); + /// Auto-detect away @$pb.TagNumber(11) $core.bool get autodetectAway => $_getBF(10); @$pb.TagNumber(11) @@ -1790,8 +2357,51 @@ class Account extends $pb.GeneratedMessage { void clearAutodetectAway() => clearField(11); } +/// A record of a contact that has accepted a contact invitation +/// Contains a copy of the most recent remote profile as well as +/// a locally edited profile. +/// Contains a copy of the most recent identity from the contact's +/// Master identity dht key +/// +/// Stored in ContactList DHTList class Contact extends $pb.GeneratedMessage { - factory Contact() => create(); + factory Contact({ + $core.String? nickname, + Profile? profile, + $core.String? superIdentityJson, + $0.TypedKey? identityPublicKey, + $0.TypedKey? remoteConversationRecordKey, + $0.TypedKey? localConversationRecordKey, + $core.bool? showAvailability, + $core.String? notes, + }) { + final $result = create(); + if (nickname != null) { + $result.nickname = nickname; + } + if (profile != null) { + $result.profile = profile; + } + if (superIdentityJson != null) { + $result.superIdentityJson = superIdentityJson; + } + if (identityPublicKey != null) { + $result.identityPublicKey = identityPublicKey; + } + if (remoteConversationRecordKey != null) { + $result.remoteConversationRecordKey = remoteConversationRecordKey; + } + if (localConversationRecordKey != null) { + $result.localConversationRecordKey = localConversationRecordKey; + } + if (showAvailability != null) { + $result.showAvailability = showAvailability; + } + if (notes != null) { + $result.notes = notes; + } + return $result; + } Contact._() : super(); factory Contact.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Contact.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1829,6 +2439,7 @@ class Contact extends $pb.GeneratedMessage { static Contact getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static Contact? _defaultInstance; + /// Friend's nickname @$pb.TagNumber(1) $core.String get nickname => $_getSZ(0); @$pb.TagNumber(1) @@ -1838,6 +2449,7 @@ class Contact extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearNickname() => clearField(1); + /// Copy of friend's profile from remote conversation @$pb.TagNumber(2) Profile get profile => $_getN(1); @$pb.TagNumber(2) @@ -1849,6 +2461,7 @@ class Contact extends $pb.GeneratedMessage { @$pb.TagNumber(2) Profile ensureProfile() => $_ensure(1); + /// Copy of friend's SuperIdentity in JSON from remote conversation @$pb.TagNumber(3) $core.String get superIdentityJson => $_getSZ(2); @$pb.TagNumber(3) @@ -1858,6 +2471,7 @@ class Contact extends $pb.GeneratedMessage { @$pb.TagNumber(3) void clearSuperIdentityJson() => clearField(3); + /// Copy of friend's most recent identity public key from their identityMaster @$pb.TagNumber(4) $0.TypedKey get identityPublicKey => $_getN(3); @$pb.TagNumber(4) @@ -1869,6 +2483,7 @@ class Contact extends $pb.GeneratedMessage { @$pb.TagNumber(4) $0.TypedKey ensureIdentityPublicKey() => $_ensure(3); + /// Remote conversation key to sync from friend @$pb.TagNumber(5) $0.TypedKey get remoteConversationRecordKey => $_getN(4); @$pb.TagNumber(5) @@ -1880,6 +2495,7 @@ class Contact extends $pb.GeneratedMessage { @$pb.TagNumber(5) $0.TypedKey ensureRemoteConversationRecordKey() => $_ensure(4); + /// Our conversation key for friend to sync @$pb.TagNumber(6) $0.TypedKey get localConversationRecordKey => $_getN(5); @$pb.TagNumber(6) @@ -1891,6 +2507,7 @@ class Contact extends $pb.GeneratedMessage { @$pb.TagNumber(6) $0.TypedKey ensureLocalConversationRecordKey() => $_ensure(5); + /// Show availability to this contact @$pb.TagNumber(7) $core.bool get showAvailability => $_getBF(6); @$pb.TagNumber(7) @@ -1900,6 +2517,7 @@ class Contact extends $pb.GeneratedMessage { @$pb.TagNumber(7) void clearShowAvailability() => clearField(7); + /// Notes about this friend @$pb.TagNumber(8) $core.String get notes => $_getSZ(7); @$pb.TagNumber(8) @@ -1910,8 +2528,24 @@ class Contact extends $pb.GeneratedMessage { void clearNotes() => clearField(8); } +/// Invitation that is shared for VeilidChat contact connections +/// serialized to QR code or data blob, not send over DHT, out of band. +/// Writer secret is unique to this invitation. Writer public key is in the ContactRequestPrivate +/// in the ContactRequestInbox subkey 0 DHT key class ContactInvitation extends $pb.GeneratedMessage { - factory ContactInvitation() => create(); + factory ContactInvitation({ + $0.TypedKey? contactRequestInboxKey, + $core.List<$core.int>? writerSecret, + }) { + final $result = create(); + if (contactRequestInboxKey != null) { + $result.contactRequestInboxKey = contactRequestInboxKey; + } + if (writerSecret != null) { + $result.writerSecret = writerSecret; + } + return $result; + } ContactInvitation._() : super(); factory ContactInvitation.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ContactInvitation.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1943,6 +2577,7 @@ class ContactInvitation extends $pb.GeneratedMessage { static ContactInvitation getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ContactInvitation? _defaultInstance; + /// Contact request DHT record key @$pb.TagNumber(1) $0.TypedKey get contactRequestInboxKey => $_getN(0); @$pb.TagNumber(1) @@ -1954,6 +2589,7 @@ class ContactInvitation extends $pb.GeneratedMessage { @$pb.TagNumber(1) $0.TypedKey ensureContactRequestInboxKey() => $_ensure(0); + /// Writer secret key bytes possibly encrypted with nonce appended @$pb.TagNumber(2) $core.List<$core.int> get writerSecret => $_getN(1); @$pb.TagNumber(2) @@ -1964,8 +2600,21 @@ class ContactInvitation extends $pb.GeneratedMessage { void clearWriterSecret() => clearField(2); } +/// Signature of invitation with identity class SignedContactInvitation extends $pb.GeneratedMessage { - factory SignedContactInvitation() => create(); + factory SignedContactInvitation({ + $core.List<$core.int>? contactInvitation, + $0.Signature? identitySignature, + }) { + final $result = create(); + if (contactInvitation != null) { + $result.contactInvitation = contactInvitation; + } + if (identitySignature != null) { + $result.identitySignature = identitySignature; + } + return $result; + } SignedContactInvitation._() : super(); factory SignedContactInvitation.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory SignedContactInvitation.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -1997,6 +2646,7 @@ class SignedContactInvitation extends $pb.GeneratedMessage { static SignedContactInvitation getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static SignedContactInvitation? _defaultInstance; + /// The serialized bytes for the contact invitation @$pb.TagNumber(1) $core.List<$core.int> get contactInvitation => $_getN(0); @$pb.TagNumber(1) @@ -2006,6 +2656,7 @@ class SignedContactInvitation extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearContactInvitation() => clearField(1); + /// The signature of the contact_invitation bytes with the identity @$pb.TagNumber(2) $0.Signature get identitySignature => $_getN(1); @$pb.TagNumber(2) @@ -2018,8 +2669,22 @@ class SignedContactInvitation extends $pb.GeneratedMessage { $0.Signature ensureIdentitySignature() => $_ensure(1); } +/// Contact request unicastinbox on the DHT +/// DHTSchema: SMPL 1 owner key, 1 writer key symmetrically encrypted with writer secret class ContactRequest extends $pb.GeneratedMessage { - factory ContactRequest() => create(); + factory ContactRequest({ + EncryptionKeyType? encryptionKeyType, + $core.List<$core.int>? private, + }) { + final $result = create(); + if (encryptionKeyType != null) { + $result.encryptionKeyType = encryptionKeyType; + } + if (private != null) { + $result.private = private; + } + return $result; + } ContactRequest._() : super(); factory ContactRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ContactRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -2051,6 +2716,7 @@ class ContactRequest extends $pb.GeneratedMessage { static ContactRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ContactRequest? _defaultInstance; + /// The kind of encryption used on the unicastinbox writer key @$pb.TagNumber(1) EncryptionKeyType get encryptionKeyType => $_getN(0); @$pb.TagNumber(1) @@ -2060,6 +2726,7 @@ class ContactRequest extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearEncryptionKeyType() => clearField(1); + /// The private part encoded and symmetrically encrypted with the unicastinbox writer secret @$pb.TagNumber(2) $core.List<$core.int> get private => $_getN(1); @$pb.TagNumber(2) @@ -2070,8 +2737,34 @@ class ContactRequest extends $pb.GeneratedMessage { void clearPrivate() => clearField(2); } +/// The private part of a possibly encrypted contact request +/// Symmetrically encrypted with writer secret class ContactRequestPrivate extends $pb.GeneratedMessage { - factory ContactRequestPrivate() => create(); + factory ContactRequestPrivate({ + $0.CryptoKey? writerKey, + Profile? profile, + $0.TypedKey? superIdentityRecordKey, + $0.TypedKey? chatRecordKey, + $fixnum.Int64? expiration, + }) { + final $result = create(); + if (writerKey != null) { + $result.writerKey = writerKey; + } + if (profile != null) { + $result.profile = profile; + } + if (superIdentityRecordKey != null) { + $result.superIdentityRecordKey = superIdentityRecordKey; + } + if (chatRecordKey != null) { + $result.chatRecordKey = chatRecordKey; + } + if (expiration != null) { + $result.expiration = expiration; + } + return $result; + } ContactRequestPrivate._() : super(); factory ContactRequestPrivate.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ContactRequestPrivate.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -2106,6 +2799,7 @@ class ContactRequestPrivate extends $pb.GeneratedMessage { static ContactRequestPrivate getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ContactRequestPrivate? _defaultInstance; + /// Writer public key for signing writes to contact request unicastinbox @$pb.TagNumber(1) $0.CryptoKey get writerKey => $_getN(0); @$pb.TagNumber(1) @@ -2117,6 +2811,7 @@ class ContactRequestPrivate extends $pb.GeneratedMessage { @$pb.TagNumber(1) $0.CryptoKey ensureWriterKey() => $_ensure(0); + /// Snapshot of profile @$pb.TagNumber(2) Profile get profile => $_getN(1); @$pb.TagNumber(2) @@ -2128,6 +2823,7 @@ class ContactRequestPrivate extends $pb.GeneratedMessage { @$pb.TagNumber(2) Profile ensureProfile() => $_ensure(1); + /// SuperIdentity DHT record key @$pb.TagNumber(3) $0.TypedKey get superIdentityRecordKey => $_getN(2); @$pb.TagNumber(3) @@ -2139,6 +2835,7 @@ class ContactRequestPrivate extends $pb.GeneratedMessage { @$pb.TagNumber(3) $0.TypedKey ensureSuperIdentityRecordKey() => $_ensure(2); + /// Local chat DHT record key @$pb.TagNumber(4) $0.TypedKey get chatRecordKey => $_getN(3); @$pb.TagNumber(4) @@ -2150,6 +2847,7 @@ class ContactRequestPrivate extends $pb.GeneratedMessage { @$pb.TagNumber(4) $0.TypedKey ensureChatRecordKey() => $_ensure(3); + /// Expiration timestamp @$pb.TagNumber(5) $fixnum.Int64 get expiration => $_getI64(4); @$pb.TagNumber(5) @@ -2160,8 +2858,25 @@ class ContactRequestPrivate extends $pb.GeneratedMessage { void clearExpiration() => clearField(5); } +/// To accept or reject a contact request, fill this out and send to the ContactRequest unicastinbox class ContactResponse extends $pb.GeneratedMessage { - factory ContactResponse() => create(); + factory ContactResponse({ + $core.bool? accept, + $0.TypedKey? superIdentityRecordKey, + $0.TypedKey? remoteConversationRecordKey, + }) { + final $result = create(); + if (accept != null) { + $result.accept = accept; + } + if (superIdentityRecordKey != null) { + $result.superIdentityRecordKey = superIdentityRecordKey; + } + if (remoteConversationRecordKey != null) { + $result.remoteConversationRecordKey = remoteConversationRecordKey; + } + return $result; + } ContactResponse._() : super(); factory ContactResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ContactResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -2194,6 +2909,7 @@ class ContactResponse extends $pb.GeneratedMessage { static ContactResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ContactResponse? _defaultInstance; + /// Accept or reject @$pb.TagNumber(1) $core.bool get accept => $_getBF(0); @$pb.TagNumber(1) @@ -2203,6 +2919,7 @@ class ContactResponse extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearAccept() => clearField(1); + /// Remote SuperIdentity DHT record key @$pb.TagNumber(2) $0.TypedKey get superIdentityRecordKey => $_getN(1); @$pb.TagNumber(2) @@ -2214,6 +2931,7 @@ class ContactResponse extends $pb.GeneratedMessage { @$pb.TagNumber(2) $0.TypedKey ensureSuperIdentityRecordKey() => $_ensure(1); + /// Remote chat DHT record key if accepted @$pb.TagNumber(3) $0.TypedKey get remoteConversationRecordKey => $_getN(2); @$pb.TagNumber(3) @@ -2226,8 +2944,22 @@ class ContactResponse extends $pb.GeneratedMessage { $0.TypedKey ensureRemoteConversationRecordKey() => $_ensure(2); } +/// Signature of response with identity +/// Symmetrically encrypted with writer secret class SignedContactResponse extends $pb.GeneratedMessage { - factory SignedContactResponse() => create(); + factory SignedContactResponse({ + $core.List<$core.int>? contactResponse, + $0.Signature? identitySignature, + }) { + final $result = create(); + if (contactResponse != null) { + $result.contactResponse = contactResponse; + } + if (identitySignature != null) { + $result.identitySignature = identitySignature; + } + return $result; + } SignedContactResponse._() : super(); factory SignedContactResponse.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory SignedContactResponse.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -2259,6 +2991,7 @@ class SignedContactResponse extends $pb.GeneratedMessage { static SignedContactResponse getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static SignedContactResponse? _defaultInstance; + /// Serialized bytes for ContactResponse @$pb.TagNumber(1) $core.List<$core.int> get contactResponse => $_getN(0); @$pb.TagNumber(1) @@ -2268,6 +3001,7 @@ class SignedContactResponse extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearContactResponse() => clearField(1); + /// Signature of the contact_accept bytes with the identity @$pb.TagNumber(2) $0.Signature get identitySignature => $_getN(1); @$pb.TagNumber(2) @@ -2280,8 +3014,45 @@ class SignedContactResponse extends $pb.GeneratedMessage { $0.Signature ensureIdentitySignature() => $_ensure(1); } +/// Contact request record kept in Account DHTList to keep track of extant contact invitations class ContactInvitationRecord extends $pb.GeneratedMessage { - factory ContactInvitationRecord() => create(); + factory ContactInvitationRecord({ + $1.OwnedDHTRecordPointer? contactRequestInbox, + $0.CryptoKey? writerKey, + $0.CryptoKey? writerSecret, + $0.TypedKey? localConversationRecordKey, + $fixnum.Int64? expiration, + $core.List<$core.int>? invitation, + $core.String? message, + $core.String? recipient, + }) { + final $result = create(); + if (contactRequestInbox != null) { + $result.contactRequestInbox = contactRequestInbox; + } + if (writerKey != null) { + $result.writerKey = writerKey; + } + if (writerSecret != null) { + $result.writerSecret = writerSecret; + } + if (localConversationRecordKey != null) { + $result.localConversationRecordKey = localConversationRecordKey; + } + if (expiration != null) { + $result.expiration = expiration; + } + if (invitation != null) { + $result.invitation = invitation; + } + if (message != null) { + $result.message = message; + } + if (recipient != null) { + $result.recipient = recipient; + } + return $result; + } ContactInvitationRecord._() : super(); factory ContactInvitationRecord.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory ContactInvitationRecord.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -2294,6 +3065,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { ..a<$fixnum.Int64>(5, _omitFieldNames ? '' : 'expiration', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO) ..a<$core.List<$core.int>>(6, _omitFieldNames ? '' : 'invitation', $pb.PbFieldType.OY) ..aOS(7, _omitFieldNames ? '' : 'message') + ..aOS(8, _omitFieldNames ? '' : 'recipient') ..hasRequiredFields = false ; @@ -2318,6 +3090,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { static ContactInvitationRecord getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static ContactInvitationRecord? _defaultInstance; + /// Contact request unicastinbox DHT record key (parent is accountkey) @$pb.TagNumber(1) $1.OwnedDHTRecordPointer get contactRequestInbox => $_getN(0); @$pb.TagNumber(1) @@ -2329,6 +3102,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { @$pb.TagNumber(1) $1.OwnedDHTRecordPointer ensureContactRequestInbox() => $_ensure(0); + /// Writer key sent to contact for the contact_request_inbox smpl inbox subkey @$pb.TagNumber(2) $0.CryptoKey get writerKey => $_getN(1); @$pb.TagNumber(2) @@ -2340,6 +3114,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { @$pb.TagNumber(2) $0.CryptoKey ensureWriterKey() => $_ensure(1); + /// Writer secret sent encrypted in the invitation @$pb.TagNumber(3) $0.CryptoKey get writerSecret => $_getN(2); @$pb.TagNumber(3) @@ -2351,6 +3126,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { @$pb.TagNumber(3) $0.CryptoKey ensureWriterSecret() => $_ensure(2); + /// Local chat DHT record key (parent is accountkey, will be moved to Contact if accepted) @$pb.TagNumber(4) $0.TypedKey get localConversationRecordKey => $_getN(3); @$pb.TagNumber(4) @@ -2362,6 +3138,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { @$pb.TagNumber(4) $0.TypedKey ensureLocalConversationRecordKey() => $_ensure(3); + /// Expiration timestamp @$pb.TagNumber(5) $fixnum.Int64 get expiration => $_getI64(4); @$pb.TagNumber(5) @@ -2371,6 +3148,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { @$pb.TagNumber(5) void clearExpiration() => clearField(5); + /// A copy of the raw SignedContactInvitation invitation bytes post-encryption and signing @$pb.TagNumber(6) $core.List<$core.int> get invitation => $_getN(5); @$pb.TagNumber(6) @@ -2380,6 +3158,7 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { @$pb.TagNumber(6) void clearInvitation() => clearField(6); + /// The message sent along with the invitation @$pb.TagNumber(7) $core.String get message => $_getSZ(6); @$pb.TagNumber(7) @@ -2388,6 +3167,16 @@ class ContactInvitationRecord extends $pb.GeneratedMessage { $core.bool hasMessage() => $_has(6); @$pb.TagNumber(7) void clearMessage() => clearField(7); + + /// The recipient sent along with the invitation + @$pb.TagNumber(8) + $core.String get recipient => $_getSZ(7); + @$pb.TagNumber(8) + set recipient($core.String v) { $_setString(7, v); } + @$pb.TagNumber(8) + $core.bool hasRecipient() => $_has(7); + @$pb.TagNumber(8) + void clearRecipient() => clearField(8); } diff --git a/lib/proto/veilidchat.pbenum.dart b/lib/proto/veilidchat.pbenum.dart index 9133788..42009e8 100644 --- a/lib/proto/veilidchat.pbenum.dart +++ b/lib/proto/veilidchat.pbenum.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import @@ -13,6 +13,7 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; +/// Contact availability class Availability extends $pb.ProtobufEnum { static const Availability AVAILABILITY_UNSPECIFIED = Availability._(0, _omitEnumNames ? '' : 'AVAILABILITY_UNSPECIFIED'); static const Availability AVAILABILITY_OFFLINE = Availability._(1, _omitEnumNames ? '' : 'AVAILABILITY_OFFLINE'); @@ -34,6 +35,7 @@ class Availability extends $pb.ProtobufEnum { const Availability._($core.int v, $core.String n) : super(v, n); } +/// Encryption used on secret keys class EncryptionKeyType extends $pb.ProtobufEnum { static const EncryptionKeyType ENCRYPTION_KEY_TYPE_UNSPECIFIED = EncryptionKeyType._(0, _omitEnumNames ? '' : 'ENCRYPTION_KEY_TYPE_UNSPECIFIED'); static const EncryptionKeyType ENCRYPTION_KEY_TYPE_NONE = EncryptionKeyType._(1, _omitEnumNames ? '' : 'ENCRYPTION_KEY_TYPE_NONE'); @@ -53,6 +55,7 @@ class EncryptionKeyType extends $pb.ProtobufEnum { const EncryptionKeyType._($core.int v, $core.String n) : super(v, n); } +/// Scope of a chat class Scope extends $pb.ProtobufEnum { static const Scope WATCHERS = Scope._(0, _omitEnumNames ? '' : 'WATCHERS'); static const Scope MODERATED = Scope._(1, _omitEnumNames ? '' : 'MODERATED'); diff --git a/lib/proto/veilidchat.pbjson.dart b/lib/proto/veilidchat.pbjson.dart index ec327f4..81bf741 100644 --- a/lib/proto/veilidchat.pbjson.dart +++ b/lib/proto/veilidchat.pbjson.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import @@ -628,6 +628,7 @@ const ContactInvitationRecord$json = { {'1': 'expiration', '3': 5, '4': 1, '5': 4, '10': 'expiration'}, {'1': 'invitation', '3': 6, '4': 1, '5': 12, '10': 'invitation'}, {'1': 'message', '3': 7, '4': 1, '5': 9, '10': 'message'}, + {'1': 'recipient', '3': 8, '4': 1, '5': 9, '10': 'recipient'}, ], }; @@ -639,5 +640,6 @@ final $typed_data.Uint8List contactInvitationRecordDescriptor = $convert.base64D 'NlY3JldBgDIAEoCzIRLnZlaWxpZC5DcnlwdG9LZXlSDHdyaXRlclNlY3JldBJTCh1sb2NhbF9j' 'b252ZXJzYXRpb25fcmVjb3JkX2tleRgEIAEoCzIQLnZlaWxpZC5UeXBlZEtleVIabG9jYWxDb2' '52ZXJzYXRpb25SZWNvcmRLZXkSHgoKZXhwaXJhdGlvbhgFIAEoBFIKZXhwaXJhdGlvbhIeCgpp' - 'bnZpdGF0aW9uGAYgASgMUgppbnZpdGF0aW9uEhgKB21lc3NhZ2UYByABKAlSB21lc3NhZ2U='); + 'bnZpdGF0aW9uGAYgASgMUgppbnZpdGF0aW9uEhgKB21lc3NhZ2UYByABKAlSB21lc3NhZ2USHA' + 'oJcmVjaXBpZW50GAggASgJUglyZWNpcGllbnQ='); diff --git a/lib/proto/veilidchat.pbserver.dart b/lib/proto/veilidchat.pbserver.dart index 02a9ae4..047feed 100644 --- a/lib/proto/veilidchat.pbserver.dart +++ b/lib/proto/veilidchat.pbserver.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields diff --git a/lib/proto/veilidchat.proto b/lib/proto/veilidchat.proto index 0d4ca0a..e669959 100644 --- a/lib/proto/veilidchat.proto +++ b/lib/proto/veilidchat.proto @@ -478,4 +478,6 @@ message ContactInvitationRecord { bytes invitation = 6; // The message sent along with the invitation string message = 7; + // The recipient sent along with the invitation + string recipient = 8; } \ No newline at end of file diff --git a/lib/router/cubits/router_cubit.dart b/lib/router/cubits/router_cubit.dart index 974319a..48bf95f 100644 --- a/lib/router/cubits/router_cubit.dart +++ b/lib/router/cubits/router_cubit.dart @@ -11,7 +11,6 @@ import 'package:veilid_support/veilid_support.dart'; import '../../../account_manager/account_manager.dart'; import '../../layout/layout.dart'; -import '../../proto/proto.dart' as proto; import '../../settings/settings.dart'; import '../../tools/tools.dart'; import '../../veilid_processor/views/developer.dart'; @@ -43,10 +42,8 @@ class RouterCubit extends Cubit { case AccountRepositoryChange.localAccounts: emit(state.copyWith( hasAnyAccount: accountRepository.getLocalAccounts().isNotEmpty)); - break; case AccountRepositoryChange.userLogins: case AccountRepositoryChange.activeLocalAccount: - break; } }); } @@ -72,7 +69,7 @@ class RouterCubit extends Cubit { final extra = state.extra! as List; return EditAccountPage( superIdentityRecordKey: extra[0]! as TypedKey, - existingAccount: extra[1]! as proto.Account, + initialValue: extra[1]! as AccountSpec, accountRecord: extra[2]! as OwnedDHTRecordPointer, ); }, diff --git a/lib/router/cubits/router_cubit.freezed.dart b/lib/router/cubits/router_cubit.freezed.dart index e44cd91..8377607 100644 --- a/lib/router/cubits/router_cubit.freezed.dart +++ b/lib/router/cubits/router_cubit.freezed.dart @@ -22,8 +22,12 @@ RouterState _$RouterStateFromJson(Map json) { mixin _$RouterState { bool get hasAnyAccount => throw _privateConstructorUsedError; + /// Serializes this RouterState to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of RouterState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $RouterStateCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -47,6 +51,8 @@ class _$RouterStateCopyWithImpl<$Res, $Val extends RouterState> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of RouterState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -80,6 +86,8 @@ class __$$RouterStateImplCopyWithImpl<$Res> _$RouterStateImpl _value, $Res Function(_$RouterStateImpl) _then) : super(_value, _then); + /// Create a copy of RouterState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -127,11 +135,13 @@ class _$RouterStateImpl with DiagnosticableTreeMixin implements _RouterState { other.hasAnyAccount == hasAnyAccount)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, hasAnyAccount); - @JsonKey(ignore: true) + /// Create a copy of RouterState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$RouterStateImplCopyWith<_$RouterStateImpl> get copyWith => @@ -154,8 +164,11 @@ abstract class _RouterState implements RouterState { @override bool get hasAnyAccount; + + /// Create a copy of RouterState + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$RouterStateImplCopyWith<_$RouterStateImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/settings/models/preferences.freezed.dart b/lib/settings/models/preferences.freezed.dart index 1735d45..a7ebed3 100644 --- a/lib/settings/models/preferences.freezed.dart +++ b/lib/settings/models/preferences.freezed.dart @@ -24,8 +24,12 @@ mixin _$LockPreference { bool get lockWhenSwitching => throw _privateConstructorUsedError; bool get lockWithSystemLock => throw _privateConstructorUsedError; + /// Serializes this LockPreference to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of LockPreference + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $LockPreferenceCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -52,6 +56,8 @@ class _$LockPreferenceCopyWithImpl<$Res, $Val extends LockPreference> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of LockPreference + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -98,6 +104,8 @@ class __$$LockPreferenceImplCopyWithImpl<$Res> _$LockPreferenceImpl _value, $Res Function(_$LockPreferenceImpl) _then) : super(_value, _then); + /// Create a copy of LockPreference + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -161,12 +169,14 @@ class _$LockPreferenceImpl implements _LockPreference { other.lockWithSystemLock == lockWithSystemLock)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, inactivityLockSecs, lockWhenSwitching, lockWithSystemLock); - @JsonKey(ignore: true) + /// Create a copy of LockPreference + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$LockPreferenceImplCopyWith<_$LockPreferenceImpl> get copyWith => @@ -196,8 +206,11 @@ abstract class _LockPreference implements LockPreference { bool get lockWhenSwitching; @override bool get lockWithSystemLock; + + /// Create a copy of LockPreference + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$LockPreferenceImplCopyWith<_$LockPreferenceImpl> get copyWith => throw _privateConstructorUsedError; } @@ -215,8 +228,12 @@ mixin _$Preferences { NotificationsPreference get notificationsPreference => throw _privateConstructorUsedError; + /// Serializes this Preferences to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $PreferencesCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -248,6 +265,8 @@ class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -276,6 +295,8 @@ class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences> ) as $Val); } + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $ThemePreferencesCopyWith<$Res> get themePreference { @@ -284,6 +305,8 @@ class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences> }); } + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $LockPreferenceCopyWith<$Res> get lockPreference { @@ -292,6 +315,8 @@ class _$PreferencesCopyWithImpl<$Res, $Val extends Preferences> }); } + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $NotificationsPreferenceCopyWith<$Res> get notificationsPreference { @@ -332,6 +357,8 @@ class __$$PreferencesImplCopyWithImpl<$Res> _$PreferencesImpl _value, $Res Function(_$PreferencesImpl) _then) : super(_value, _then); + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -407,12 +434,14 @@ class _$PreferencesImpl implements _Preferences { other.notificationsPreference == notificationsPreference)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, themePreference, languagePreference, lockPreference, notificationsPreference); - @JsonKey(ignore: true) + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$PreferencesImplCopyWith<_$PreferencesImpl> get copyWith => @@ -445,8 +474,11 @@ abstract class _Preferences implements Preferences { LockPreference get lockPreference; @override NotificationsPreference get notificationsPreference; + + /// Create a copy of Preferences + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$PreferencesImplCopyWith<_$PreferencesImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/settings/settings_page.dart b/lib/settings/settings_page.dart index 94606aa..2a05f08 100644 --- a/lib/settings/settings_page.dart +++ b/lib/settings/settings_page.dart @@ -31,31 +31,42 @@ class SettingsPageState extends State { @override Widget build(BuildContext context) => AsyncBlocBuilder( - builder: (context, state) => StyledScaffold( - appBar: DefaultAppBar( - title: Text(translate('settings_page.titlebar')), - leading: IconButton( - icon: const Icon(Icons.arrow_back), - onPressed: () => GoRouterHelper(context).pop(), - ), - actions: [ - const SignalStrengthMeterWidget().paddingLTRB(16, 0, 16, 0), - ]), - body: ThemeSwitchingArea( - child: FormBuilder( - key: _formKey, - child: ListView( - children: [ - buildSettingsPageColorPreferences( + builder: (context, state) => ThemeSwitcher.withTheme( + builder: (_, switcher, theme) => StyledScaffold( + appBar: DefaultAppBar( + title: Text(translate('settings_page.titlebar')), + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => GoRouterHelper(context).pop(), + ), + actions: [ + const SignalStrengthMeterWidget() + .paddingLTRB(16, 0, 16, 0), + ]), + body: ThemeSwitchingArea( + child: FormBuilder( + key: _formKey, + child: ListView( + padding: const EdgeInsets.all(8), + children: [ + buildSettingsPageColorPreferences( + context: context, + switcher: switcher, + onChanged: () => setState(() {})) + .paddingLTRB(0, 8, 0, 0), + buildSettingsPageBrightnessPreferences( context: context, - onChanged: () => setState(() {})) - .paddingLTRB(0, 8, 0, 0), - buildSettingsPageBrightnessPreferences( - context: context, onChanged: () => setState(() {})), - buildSettingsPageNotificationPreferences( - context: context, onChanged: () => setState(() {})), - ].map((x) => x.paddingLTRB(0, 0, 0, 8)).toList(), - ), - ).paddingSymmetric(horizontal: 24, vertical: 16), - ))); + switcher: switcher, + onChanged: () => setState(() {})), + buildSettingsPageWallpaperPreferences( + context: context, + switcher: switcher, + onChanged: () => setState(() {})), + buildSettingsPageNotificationPreferences( + context: context, + onChanged: () => setState(() {})), + ].map((x) => x.paddingLTRB(0, 0, 0, 8)).toList(), + ), + ).paddingSymmetric(horizontal: 8, vertical: 8), + )))); } diff --git a/lib/theme/models/chat_theme.dart b/lib/theme/models/chat_theme.dart index 8623427..5552979 100644 --- a/lib/theme/models/chat_theme.dart +++ b/lib/theme/models/chat_theme.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_chat_ui/flutter_chat_ui.dart'; -import 'scale_scheme.dart'; +import 'scale_theme/scale_scheme.dart'; ChatTheme makeChatTheme( ScaleScheme scale, ScaleConfig scaleConfig, TextTheme textTheme) => @@ -14,14 +14,15 @@ ChatTheme makeChatTheme( secondaryColor: scaleConfig.preferBorders ? scale.secondaryScale.calloutText : scale.secondaryScale.calloutBackground, - backgroundColor: scale.grayScale.appBackground, + backgroundColor: + scale.grayScale.appBackground.withAlpha(scaleConfig.wallpaperAlpha), messageBorderRadius: scaleConfig.borderRadiusScale * 16, bubbleBorderSide: scaleConfig.preferBorders ? BorderSide( color: scale.primaryScale.calloutBackground, width: 2, ) - : null, + : BorderSide(width: 2, color: Colors.black.withAlpha(96)), sendButtonIcon: Image.asset( 'assets/icon-send.png', color: scaleConfig.preferBorders @@ -86,7 +87,8 @@ ChatTheme makeChatTheme( receivedEmojiMessageTextStyle: const TextStyle( color: Colors.white, fontSize: 64, - )); + ), + dateDividerTextStyle: textTheme.labelSmall!); class EditedChatTheme extends ChatTheme { const EditedChatTheme({ diff --git a/lib/theme/models/contrast_generator.dart b/lib/theme/models/contrast_generator.dart index 4271c1a..861b052 100644 --- a/lib/theme/models/contrast_generator.dart +++ b/lib/theme/models/contrast_generator.dart @@ -1,10 +1,7 @@ import 'package:flutter/material.dart'; import 'radix_generator.dart'; -import 'scale_color.dart'; -import 'scale_input_decorator_theme.dart'; -import 'scale_scheme.dart'; -import 'scale_theme.dart'; +import 'scale_theme/scale_theme.dart'; ScaleColor _contrastScaleColor( {required Brightness brightness, @@ -29,6 +26,7 @@ ScaleColor _contrastScaleColor( primaryText: front, borderText: back, dialogBorder: front, + dialogBorderText: back, calloutBackground: front, calloutText: back, ); @@ -246,7 +244,7 @@ ThemeData contrastGenerator({ TextTheme? customTextTheme, }) { final textTheme = customTextTheme ?? makeRadixTextTheme(brightness); - final scaleScheme = _contrastScaleScheme( + final scheme = _contrastScaleScheme( brightness: brightness, primaryFront: primaryFront, primaryBack: primaryBack, @@ -259,55 +257,51 @@ ThemeData contrastGenerator({ errorFront: errorFront, errorBack: errorBack, ); - final colorScheme = scaleScheme.toColorScheme( - brightness, - ); - final scaleTheme = ScaleTheme( - textTheme: textTheme, scheme: scaleScheme, config: scaleConfig); - final baseThemeData = ThemeData.from( - colorScheme: colorScheme, textTheme: textTheme, useMaterial3: true); + final scaleTheme = + ScaleTheme(textTheme: textTheme, scheme: scheme, config: scaleConfig); + + final baseThemeData = scaleTheme.toThemeData(brightness); + + final elevatedButtonTheme = ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + backgroundColor: scheme.primaryScale.elementBackground, + foregroundColor: scheme.primaryScale.appText, + disabledBackgroundColor: + scheme.grayScale.elementBackground.withAlpha(0x7F), + disabledForegroundColor: scheme.grayScale.appText.withAlpha(0x7F), + shape: RoundedRectangleBorder( + side: BorderSide(color: scheme.primaryScale.border), + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale))) + .copyWith(side: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return BorderSide(color: scheme.grayScale.border.withAlpha(0x7F)); + } else if (states.contains(WidgetState.pressed)) { + return BorderSide( + color: scheme.primaryScale.border, + strokeAlign: BorderSide.strokeAlignOutside); + } else if (states.contains(WidgetState.hovered)) { + return BorderSide(color: scheme.primaryScale.hoverBorder); + } else if (states.contains(WidgetState.focused)) { + return BorderSide(color: scheme.primaryScale.hoverBorder, width: 2); + } + return BorderSide(color: scheme.primaryScale.border); + }))); + final themeData = baseThemeData.copyWith( - appBarTheme: baseThemeData.appBarTheme.copyWith( - backgroundColor: scaleScheme.primaryScale.border, - foregroundColor: scaleScheme.primaryScale.borderText), - bottomSheetTheme: baseThemeData.bottomSheetTheme.copyWith( - elevation: 0, - modalElevation: 0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16 * scaleConfig.borderRadiusScale), - topRight: - Radius.circular(16 * scaleConfig.borderRadiusScale)))), - canvasColor: scaleScheme.primaryScale.subtleBackground, - chipTheme: baseThemeData.chipTheme.copyWith( - backgroundColor: scaleScheme.primaryScale.elementBackground, - selectedColor: scaleScheme.primaryScale.activeElementBackground, - surfaceTintColor: scaleScheme.primaryScale.hoverElementBackground, - checkmarkColor: scaleScheme.primaryScale.border, - side: BorderSide(color: scaleScheme.primaryScale.border)), - elevatedButtonTheme: ElevatedButtonThemeData( - style: ElevatedButton.styleFrom( - backgroundColor: scaleScheme.primaryScale.elementBackground, - foregroundColor: scaleScheme.primaryScale.appText, - disabledBackgroundColor: scaleScheme.grayScale.elementBackground, - disabledForegroundColor: scaleScheme.grayScale.appText, - shape: RoundedRectangleBorder( - side: BorderSide(color: scaleScheme.primaryScale.border), - borderRadius: - BorderRadius.circular(8 * scaleConfig.borderRadiusScale))), - ), + // chipTheme: baseThemeData.chipTheme.copyWith( + // backgroundColor: scaleScheme.primaryScale.elementBackground, + // selectedColor: scaleScheme.primaryScale.activeElementBackground, + // surfaceTintColor: scaleScheme.primaryScale.hoverElementBackground, + // checkmarkColor: scaleScheme.primaryScale.border, + // side: BorderSide(color: scaleScheme.primaryScale.border)), + elevatedButtonTheme: elevatedButtonTheme, textSelectionTheme: TextSelectionThemeData( - cursorColor: scaleScheme.primaryScale.appText, - selectionColor: scaleScheme.primaryScale.appText.withAlpha(0x7F), - selectionHandleColor: scaleScheme.primaryScale.appText), - inputDecorationTheme: - ScaleInputDecoratorTheme(scaleScheme, scaleConfig, textTheme), - extensions: >[ - scaleScheme, - scaleConfig, - scaleTheme - ]); + cursorColor: scheme.primaryScale.appText, + selectionColor: scheme.primaryScale.appText.withAlpha(0x7F), + selectionHandleColor: scheme.primaryScale.appText), + extensions: >[scheme, scaleConfig, scaleTheme]); return themeData; } diff --git a/lib/theme/models/models.dart b/lib/theme/models/models.dart index 45b54f9..be80542 100644 --- a/lib/theme/models/models.dart +++ b/lib/theme/models/models.dart @@ -1,7 +1,4 @@ export 'chat_theme.dart'; export 'radix_generator.dart'; -export 'scale_color.dart'; -export 'scale_scheme.dart'; -export 'scale_theme.dart'; -export 'slider_tile.dart'; +export 'scale_theme/scale_theme.dart'; export 'theme_preference.dart'; diff --git a/lib/theme/models/radix_generator.dart b/lib/theme/models/radix_generator.dart index a2bdbb1..3e3b0e6 100644 --- a/lib/theme/models/radix_generator.dart +++ b/lib/theme/models/radix_generator.dart @@ -1,13 +1,11 @@ import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:radix_colors/radix_colors.dart'; import '../../tools/tools.dart'; -import 'scale_color.dart'; -import 'scale_input_decorator_theme.dart'; -import 'scale_scheme.dart'; -import 'scale_theme.dart'; +import 'scale_theme/scale_theme.dart'; enum RadixThemeColor { scarlet, // red + violet + tomato @@ -290,6 +288,7 @@ extension ToScaleColor on RadixColor { primaryText: scaleExtra.foregroundText, borderText: step12, dialogBorder: step9, + dialogBorderText: scaleExtra.foregroundText, calloutBackground: step9, calloutText: scaleExtra.foregroundText, ); @@ -571,7 +570,11 @@ RadixScheme _radixScheme(Brightness brightness, RadixThemeColor themeColor) { TextTheme makeRadixTextTheme(Brightness brightness) { late final TextTheme textTheme; - if (Platform.isIOS) { + if (kIsWeb) { + textTheme = (brightness == Brightness.light) + ? Typography.blackHelsinki + : Typography.whiteHelsinki; + } else if (Platform.isIOS) { textTheme = (brightness == Brightness.light) ? Typography.blackCupertino : Typography.whiteCupertino; @@ -600,82 +603,48 @@ TextTheme makeRadixTextTheme(Brightness brightness) { return textTheme; } +double wallpaperAlpha(Brightness brightness, RadixThemeColor themeColor) { + switch (themeColor) { + case RadixThemeColor.scarlet: + return 64; + case RadixThemeColor.babydoll: + return 192; + case RadixThemeColor.vapor: + return 192; + case RadixThemeColor.gold: + return 192; + case RadixThemeColor.garden: + return brightness == Brightness.dark ? 192 : 128; + case RadixThemeColor.forest: + return 192; + case RadixThemeColor.arctic: + return brightness == Brightness.dark ? 208 : 180; + case RadixThemeColor.lapis: + return brightness == Brightness.dark ? 128 : 192; + case RadixThemeColor.eggplant: + return brightness == Brightness.dark ? 192 : 192; + case RadixThemeColor.lime: + return brightness == Brightness.dark ? 192 : 128; + case RadixThemeColor.grim: + return brightness == Brightness.dark ? 240 : 224; + } +} + ThemeData radixGenerator(Brightness brightness, RadixThemeColor themeColor) { final textTheme = makeRadixTextTheme(brightness); final radix = _radixScheme(brightness, themeColor); final scaleScheme = radix.toScale(); - final colorScheme = scaleScheme.toColorScheme(brightness); final scaleConfig = ScaleConfig( useVisualIndicators: false, preferBorders: false, borderRadiusScale: 1, + wallpaperAlpha: wallpaperAlpha(brightness, themeColor), ); final scaleTheme = ScaleTheme( textTheme: textTheme, scheme: scaleScheme, config: scaleConfig); - final baseThemeData = ThemeData.from( - colorScheme: colorScheme, textTheme: textTheme, useMaterial3: true); - - final themeData = baseThemeData.copyWith( - scrollbarTheme: baseThemeData.scrollbarTheme.copyWith( - thumbColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.pressed)) { - return scaleScheme.primaryScale.border; - } else if (states.contains(WidgetState.hovered)) { - return scaleScheme.primaryScale.hoverBorder; - } - return scaleScheme.primaryScale.subtleBorder; - }), trackColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.pressed)) { - return scaleScheme.primaryScale.activeElementBackground; - } else if (states.contains(WidgetState.hovered)) { - return scaleScheme.primaryScale.hoverElementBackground; - } - return scaleScheme.primaryScale.elementBackground; - }), trackBorderColor: WidgetStateProperty.resolveWith((states) { - if (states.contains(WidgetState.pressed)) { - return scaleScheme.primaryScale.subtleBorder; - } else if (states.contains(WidgetState.hovered)) { - return scaleScheme.primaryScale.subtleBorder; - } - return scaleScheme.primaryScale.subtleBorder; - })), - appBarTheme: baseThemeData.appBarTheme.copyWith( - backgroundColor: scaleScheme.primaryScale.border, - foregroundColor: scaleScheme.primaryScale.borderText), - bottomSheetTheme: baseThemeData.bottomSheetTheme.copyWith( - elevation: 0, - modalElevation: 0, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(16), - topRight: Radius.circular(16)))), - canvasColor: scaleScheme.primaryScale.subtleBackground, - chipTheme: baseThemeData.chipTheme.copyWith( - backgroundColor: scaleScheme.primaryScale.elementBackground, - selectedColor: scaleScheme.primaryScale.activeElementBackground, - surfaceTintColor: scaleScheme.primaryScale.hoverElementBackground, - checkmarkColor: scaleScheme.primaryScale.primary, - side: BorderSide(color: scaleScheme.primaryScale.border)), - elevatedButtonTheme: ElevatedButtonThemeData( - style: ElevatedButton.styleFrom( - backgroundColor: scaleScheme.primaryScale.elementBackground, - foregroundColor: scaleScheme.primaryScale.primary, - disabledBackgroundColor: scaleScheme.grayScale.elementBackground, - disabledForegroundColor: scaleScheme.grayScale.primary, - shape: RoundedRectangleBorder( - side: BorderSide(color: scaleScheme.primaryScale.border), - borderRadius: - BorderRadius.circular(8 * scaleConfig.borderRadiusScale))), - ), - inputDecorationTheme: - ScaleInputDecoratorTheme(scaleScheme, scaleConfig, textTheme), - extensions: >[ - scaleScheme, - scaleConfig, - scaleTheme - ]); + final themeData = scaleTheme.toThemeData(brightness); return themeData; } diff --git a/lib/theme/models/scale_input_decorator_theme.dart b/lib/theme/models/scale_input_decorator_theme.dart deleted file mode 100644 index 265670e..0000000 --- a/lib/theme/models/scale_input_decorator_theme.dart +++ /dev/null @@ -1,168 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'scale_scheme.dart'; - -class ScaleInputDecoratorTheme extends InputDecorationTheme { - ScaleInputDecoratorTheme( - this._scaleScheme, ScaleConfig scaleConfig, this._textTheme) - : super( - border: OutlineInputBorder( - borderSide: BorderSide(color: _scaleScheme.primaryScale.border), - borderRadius: - BorderRadius.circular(8 * scaleConfig.borderRadiusScale)), - contentPadding: const EdgeInsets.all(8), - labelStyle: TextStyle( - color: _scaleScheme.primaryScale.subtleText.withAlpha(127)), - floatingLabelStyle: - TextStyle(color: _scaleScheme.primaryScale.subtleText), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: _scaleScheme.primaryScale.hoverBorder, width: 2), - borderRadius: - BorderRadius.circular(8 * scaleConfig.borderRadiusScale))); - - final ScaleScheme _scaleScheme; - final TextTheme _textTheme; - - @override - TextStyle? get hintStyle => MaterialStateTextStyle.resolveWith((states) { - if (states.contains(MaterialState.disabled)) { - return TextStyle(color: _scaleScheme.grayScale.border); - } - return TextStyle(color: _scaleScheme.primaryScale.border); - }); - - @override - Color? get fillColor => MaterialStateColor.resolveWith((states) { - if (states.contains(MaterialState.disabled)) { - return _scaleScheme.grayScale.primary.withOpacity(0.04); - } - return _scaleScheme.primaryScale.primary.withOpacity(0.04); - }); - - @override - BorderSide? get activeIndicatorBorder => - MaterialStateBorderSide.resolveWith((states) { - if (states.contains(MaterialState.disabled)) { - return BorderSide( - color: _scaleScheme.grayScale.border.withAlpha(0x7F)); - } - if (states.contains(MaterialState.error)) { - if (states.contains(MaterialState.hovered)) { - return BorderSide(color: _scaleScheme.errorScale.hoverBorder); - } - if (states.contains(MaterialState.focused)) { - return BorderSide(color: _scaleScheme.errorScale.border, width: 2); - } - return BorderSide(color: _scaleScheme.errorScale.subtleBorder); - } - if (states.contains(MaterialState.hovered)) { - return BorderSide(color: _scaleScheme.secondaryScale.hoverBorder); - } - if (states.contains(MaterialState.focused)) { - return BorderSide( - color: _scaleScheme.secondaryScale.border, width: 2); - } - return BorderSide(color: _scaleScheme.secondaryScale.subtleBorder); - }); - - @override - BorderSide? get outlineBorder => - MaterialStateBorderSide.resolveWith((states) { - if (states.contains(MaterialState.disabled)) { - return BorderSide( - color: _scaleScheme.grayScale.border.withAlpha(0x7F)); - } - if (states.contains(MaterialState.error)) { - if (states.contains(MaterialState.hovered)) { - return BorderSide(color: _scaleScheme.errorScale.hoverBorder); - } - if (states.contains(MaterialState.focused)) { - return BorderSide(color: _scaleScheme.errorScale.border, width: 2); - } - return BorderSide(color: _scaleScheme.errorScale.subtleBorder); - } - if (states.contains(MaterialState.hovered)) { - return BorderSide(color: _scaleScheme.primaryScale.hoverBorder); - } - if (states.contains(MaterialState.focused)) { - return BorderSide(color: _scaleScheme.primaryScale.border, width: 2); - } - return BorderSide(color: _scaleScheme.primaryScale.subtleBorder); - }); - - @override - Color? get iconColor => _scaleScheme.primaryScale.primary; - - @override - Color? get prefixIconColor => MaterialStateColor.resolveWith((states) { - if (states.contains(MaterialState.disabled)) { - return _scaleScheme.primaryScale.primary.withAlpha(0x3F); - } - if (states.contains(MaterialState.error)) { - return _scaleScheme.errorScale.primary; - } - return _scaleScheme.primaryScale.primary; - }); - - @override - Color? get suffixIconColor => MaterialStateColor.resolveWith((states) { - if (states.contains(MaterialState.disabled)) { - return _scaleScheme.primaryScale.primary.withAlpha(0x3F); - } - if (states.contains(MaterialState.error)) { - return _scaleScheme.errorScale.primary; - } - return _scaleScheme.primaryScale.primary; - }); - - @override - TextStyle? get labelStyle => MaterialStateTextStyle.resolveWith((states) { - final textStyle = _textTheme.bodyLarge ?? const TextStyle(); - if (states.contains(MaterialState.disabled)) { - return textStyle.copyWith( - color: _scaleScheme.grayScale.border.withAlpha(0x7F)); - } - if (states.contains(MaterialState.error)) { - if (states.contains(MaterialState.hovered)) { - return textStyle.copyWith( - color: _scaleScheme.errorScale.hoverBorder); - } - if (states.contains(MaterialState.focused)) { - return textStyle.copyWith( - color: _scaleScheme.errorScale.hoverBorder); - } - return textStyle.copyWith( - color: _scaleScheme.errorScale.subtleBorder); - } - if (states.contains(MaterialState.hovered)) { - return textStyle.copyWith( - color: _scaleScheme.primaryScale.hoverBorder); - } - if (states.contains(MaterialState.focused)) { - return textStyle.copyWith( - color: _scaleScheme.primaryScale.hoverBorder); - } - return textStyle.copyWith(color: _scaleScheme.primaryScale.border); - }); - - @override - TextStyle? get floatingLabelStyle => labelStyle; - - @override - TextStyle? get helperStyle => MaterialStateTextStyle.resolveWith((states) { - final textStyle = _textTheme.bodySmall ?? const TextStyle(); - if (states.contains(MaterialState.disabled)) { - return textStyle.copyWith( - color: _scaleScheme.grayScale.border.withAlpha(0x7F)); - } - return textStyle.copyWith( - color: _scaleScheme.secondaryScale.border.withAlpha(0x7F)); - }); - - @override - TextStyle? get errorStyle => MaterialStateTextStyle.resolveWith((states) { - final textStyle = _textTheme.bodySmall ?? const TextStyle(); - return textStyle.copyWith(color: _scaleScheme.errorScale.primary); - }); -} diff --git a/lib/theme/models/scale_color.dart b/lib/theme/models/scale_theme/scale_color.dart similarity index 93% rename from lib/theme/models/scale_color.dart rename to lib/theme/models/scale_theme/scale_color.dart index 244f6a3..e50a01b 100644 --- a/lib/theme/models/scale_color.dart +++ b/lib/theme/models/scale_theme/scale_color.dart @@ -17,6 +17,7 @@ class ScaleColor { required this.primaryText, required this.borderText, required this.dialogBorder, + required this.dialogBorderText, required this.calloutBackground, required this.calloutText, }); @@ -36,6 +37,7 @@ class ScaleColor { Color primaryText; Color borderText; Color dialogBorder; + Color dialogBorderText; Color calloutBackground; Color calloutText; @@ -55,6 +57,7 @@ class ScaleColor { Color? foregroundText, Color? borderText, Color? dialogBorder, + Color? dialogBorderText, Color? calloutBackground, Color? calloutText, }) => @@ -76,6 +79,7 @@ class ScaleColor { primaryText: foregroundText ?? this.primaryText, borderText: borderText ?? this.borderText, dialogBorder: dialogBorder ?? this.dialogBorder, + dialogBorderText: dialogBorderText ?? this.dialogBorderText, calloutBackground: calloutBackground ?? this.calloutBackground, calloutText: calloutText ?? this.calloutText); @@ -112,6 +116,9 @@ class ScaleColor { const Color(0x00000000), dialogBorder: Color.lerp(a.dialogBorder, b.dialogBorder, t) ?? const Color(0x00000000), + dialogBorderText: + Color.lerp(a.dialogBorderText, b.dialogBorderText, t) ?? + const Color(0x00000000), calloutBackground: Color.lerp(a.calloutBackground, b.calloutBackground, t) ?? const Color(0x00000000), diff --git a/lib/theme/models/scale_theme/scale_custom_dropdown_theme.dart b/lib/theme/models/scale_theme/scale_custom_dropdown_theme.dart new file mode 100644 index 0000000..692ec85 --- /dev/null +++ b/lib/theme/models/scale_theme/scale_custom_dropdown_theme.dart @@ -0,0 +1,92 @@ +import 'package:animated_custom_dropdown/custom_dropdown.dart'; +import 'package:flutter/material.dart'; + +import 'scale_theme.dart'; + +class ScaleCustomDropdownTheme { + ScaleCustomDropdownTheme({ + required this.decoration, + required this.closedHeaderPadding, + required this.expandedHeaderPadding, + required this.itemsListPadding, + required this.listItemPadding, + required this.disabledDecoration, + required this.textStyle, + }); + + final CustomDropdownDecoration decoration; + final EdgeInsets closedHeaderPadding; + final EdgeInsets expandedHeaderPadding; + final EdgeInsets itemsListPadding; + final EdgeInsets listItemPadding; + final CustomDropdownDisabledDecoration disabledDecoration; + final TextStyle textStyle; +} + +extension ScaleCustomDropdownThemeExt on ScaleTheme { + ScaleCustomDropdownTheme customDropdownTheme() { + final scale = scheme.primaryScale; + final borderColor = scale.borderText; + final fillColor = scale.subtleBorder; + + // final backgroundColor = config.useVisualIndicators && !selected + // ? tileColor.borderText + // : borderColor; + // final textColor = config.useVisualIndicators && !selected + // ? borderColor + // : tileColor.borderText; + + // final largeTextStyle = textTheme.labelMedium!.copyWith(color: textColor); + // final smallTextStyle = textTheme.labelSmall!.copyWith(color: textColor); + + final border = Border.fromBorderSide(config.useVisualIndicators + ? BorderSide(width: 2, color: borderColor, strokeAlign: 0) + : BorderSide.none); + final borderRadius = BorderRadius.circular(8 * config.borderRadiusScale); + + final decoration = CustomDropdownDecoration( + closedFillColor: fillColor, + expandedFillColor: fillColor, + closedShadow: [], + expandedShadow: [], + closedSuffixIcon: Icon(Icons.arrow_drop_down, color: borderColor), + expandedSuffixIcon: Icon(Icons.arrow_drop_up, color: borderColor), + prefixIcon: null, + closedBorder: border, + closedBorderRadius: borderRadius, + closedErrorBorder: null, + closedErrorBorderRadius: null, + expandedBorder: border, + expandedBorderRadius: borderRadius, + hintStyle: null, + headerStyle: null, + noResultFoundStyle: null, + errorStyle: null, + listItemStyle: null, + overlayScrollbarDecoration: null, + searchFieldDecoration: null, + listItemDecoration: null, + ); + + final disabledDecoration = CustomDropdownDisabledDecoration( + fillColor: null, + shadow: null, + suffixIcon: null, + prefixIcon: null, + border: null, + borderRadius: null, + headerStyle: null, + hintStyle: null, + ); + + return ScaleCustomDropdownTheme( + textStyle: textTheme.labelSmall!.copyWith(color: borderColor), + decoration: decoration, + closedHeaderPadding: const EdgeInsets.all(4), + expandedHeaderPadding: const EdgeInsets.all(4), + itemsListPadding: const EdgeInsets.all(4), + listItemPadding: const EdgeInsets.all(4), + disabledDecoration: disabledDecoration, + ); + } +} diff --git a/lib/theme/models/scale_theme/scale_input_decorator_theme.dart b/lib/theme/models/scale_theme/scale_input_decorator_theme.dart new file mode 100644 index 0000000..1fb26a4 --- /dev/null +++ b/lib/theme/models/scale_theme/scale_input_decorator_theme.dart @@ -0,0 +1,234 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; + +import 'scale_theme.dart'; + +class ScaleInputDecoratorTheme extends InputDecorationTheme { + ScaleInputDecoratorTheme( + this._scaleScheme, ScaleConfig scaleConfig, this._textTheme) + : hintAlpha = scaleConfig.preferBorders ? 127 : 255, + super( + contentPadding: const EdgeInsets.all(8), + labelStyle: TextStyle(color: _scaleScheme.primaryScale.subtleText), + floatingLabelStyle: + TextStyle(color: _scaleScheme.primaryScale.subtleText), + border: OutlineInputBorder( + borderSide: BorderSide(color: _scaleScheme.primaryScale.border), + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale)), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: _scaleScheme.primaryScale.border), + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale)), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: _scaleScheme.grayScale.border.withAlpha(0x7F)), + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale)), + errorBorder: OutlineInputBorder( + borderSide: BorderSide(color: _scaleScheme.errorScale.border), + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: _scaleScheme.primaryScale.hoverBorder, width: 2), + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale)), + hoverColor: + _scaleScheme.primaryScale.hoverElementBackground.withAlpha(0x7F), + filled: true, + focusedErrorBorder: OutlineInputBorder( + borderSide: + BorderSide(color: _scaleScheme.errorScale.border, width: 2), + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale)), + ); + + final ScaleScheme _scaleScheme; + final TextTheme _textTheme; + final int hintAlpha; + final int disabledAlpha = 127; + + @override + TextStyle? get hintStyle => WidgetStateTextStyle.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return TextStyle(color: _scaleScheme.grayScale.border); + } + return TextStyle( + color: _scaleScheme.primaryScale.border.withAlpha(hintAlpha)); + }); + + @override + Color? get fillColor => WidgetStateColor.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return _scaleScheme.grayScale.primary.withAlpha(10); + } + return _scaleScheme.primaryScale.primary.withAlpha(10); + }); + + @override + BorderSide? get activeIndicatorBorder => + WidgetStateBorderSide.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return BorderSide( + color: _scaleScheme.grayScale.border.withAlpha(disabledAlpha)); + } + if (states.contains(WidgetState.error)) { + if (states.contains(WidgetState.hovered)) { + return BorderSide(color: _scaleScheme.errorScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return BorderSide(color: _scaleScheme.errorScale.border, width: 2); + } + return BorderSide(color: _scaleScheme.errorScale.subtleBorder); + } + if (states.contains(WidgetState.hovered)) { + return BorderSide(color: _scaleScheme.secondaryScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return BorderSide( + color: _scaleScheme.secondaryScale.border, width: 2); + } + return BorderSide(color: _scaleScheme.secondaryScale.subtleBorder); + }); + + @override + BorderSide? get outlineBorder => WidgetStateBorderSide.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return BorderSide( + color: _scaleScheme.grayScale.border.withAlpha(disabledAlpha)); + } + if (states.contains(WidgetState.error)) { + if (states.contains(WidgetState.hovered)) { + return BorderSide(color: _scaleScheme.errorScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return BorderSide(color: _scaleScheme.errorScale.border, width: 2); + } + return BorderSide(color: _scaleScheme.errorScale.subtleBorder); + } + if (states.contains(WidgetState.hovered)) { + return BorderSide(color: _scaleScheme.primaryScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return BorderSide(color: _scaleScheme.primaryScale.border, width: 2); + } + return BorderSide(color: _scaleScheme.primaryScale.subtleBorder); + }); + + @override + Color? get iconColor => _scaleScheme.primaryScale.primary; + + @override + Color? get prefixIconColor => WidgetStateColor.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return _scaleScheme.primaryScale.primary.withAlpha(disabledAlpha); + } + if (states.contains(WidgetState.error)) { + return _scaleScheme.errorScale.primary; + } + return _scaleScheme.primaryScale.primary; + }); + + @override + Color? get suffixIconColor => WidgetStateColor.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return _scaleScheme.primaryScale.primary.withAlpha(disabledAlpha); + } + if (states.contains(WidgetState.error)) { + return _scaleScheme.errorScale.primary; + } + return _scaleScheme.primaryScale.primary; + }); + + @override + TextStyle? get labelStyle => WidgetStateTextStyle.resolveWith((states) { + final textStyle = _textTheme.bodyLarge ?? const TextStyle(); + if (states.contains(WidgetState.disabled)) { + return textStyle.copyWith( + color: _scaleScheme.grayScale.border.withAlpha(disabledAlpha)); + } + if (states.contains(WidgetState.error)) { + if (states.contains(WidgetState.hovered)) { + return textStyle.copyWith( + color: _scaleScheme.errorScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return textStyle.copyWith( + color: _scaleScheme.errorScale.hoverBorder); + } + return textStyle.copyWith( + color: _scaleScheme.errorScale.subtleBorder); + } + if (states.contains(WidgetState.hovered)) { + return textStyle.copyWith( + color: _scaleScheme.primaryScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return textStyle.copyWith( + color: _scaleScheme.primaryScale.hoverBorder); + } + return textStyle.copyWith( + color: _scaleScheme.primaryScale.border.withAlpha(hintAlpha)); + }); + + @override + TextStyle? get floatingLabelStyle => + WidgetStateTextStyle.resolveWith((states) { + final textStyle = _textTheme.bodyLarge ?? const TextStyle(); + if (states.contains(WidgetState.disabled)) { + return textStyle.copyWith( + color: _scaleScheme.grayScale.border.withAlpha(disabledAlpha)); + } + if (states.contains(WidgetState.error)) { + if (states.contains(WidgetState.hovered)) { + return textStyle.copyWith( + color: _scaleScheme.errorScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return textStyle.copyWith( + color: _scaleScheme.errorScale.hoverBorder); + } + return textStyle.copyWith( + color: _scaleScheme.errorScale.subtleBorder); + } + if (states.contains(WidgetState.hovered)) { + return textStyle.copyWith( + color: _scaleScheme.primaryScale.hoverBorder); + } + if (states.contains(WidgetState.focused)) { + return textStyle.copyWith( + color: _scaleScheme.primaryScale.hoverBorder); + } + return textStyle.copyWith(color: _scaleScheme.primaryScale.border); + }); + + @override + TextStyle? get helperStyle => WidgetStateTextStyle.resolveWith((states) { + final textStyle = _textTheme.bodySmall ?? const TextStyle(); + if (states.contains(WidgetState.disabled)) { + return textStyle.copyWith(color: _scaleScheme.grayScale.border); + } + return textStyle.copyWith( + color: _scaleScheme.primaryScale.border.withAlpha(hintAlpha)); + }); + + @override + TextStyle? get errorStyle => WidgetStateTextStyle.resolveWith((states) { + final textStyle = _textTheme.bodySmall ?? const TextStyle(); + return textStyle.copyWith(color: _scaleScheme.errorScale.primary); + }); + + @override + void debugFillProperties(DiagnosticPropertiesBuilder properties) { + super.debugFillProperties(properties); + properties + ..add(IntProperty('disabledAlpha', disabledAlpha)) + ..add(IntProperty('hintAlpha', hintAlpha)); + } +} + +extension ScaleInputDecoratorThemeExt on ScaleTheme { + ScaleInputDecoratorTheme inputDecoratorTheme() => + ScaleInputDecoratorTheme(scheme, config, textTheme); +} diff --git a/lib/theme/models/scale_scheme.dart b/lib/theme/models/scale_theme/scale_scheme.dart similarity index 86% rename from lib/theme/models/scale_scheme.dart rename to lib/theme/models/scale_theme/scale_scheme.dart index ac266bc..6bdae25 100644 --- a/lib/theme/models/scale_scheme.dart +++ b/lib/theme/models/scale_theme/scale_scheme.dart @@ -76,8 +76,8 @@ class ScaleScheme extends ThemeExtension { ColorScheme toColorScheme(Brightness brightness) => ColorScheme( brightness: brightness, - primary: primaryScale.primary, // reviewed - onPrimary: primaryScale.primaryText, // reviewed + primary: primaryScale.primary, + onPrimary: primaryScale.primaryText, // primaryContainer: primaryScale.hoverElementBackground, // onPrimaryContainer: primaryScale.subtleText, secondary: secondaryScale.primary, @@ -92,15 +92,12 @@ class ScaleScheme extends ThemeExtension { onError: errorScale.primaryText, // errorContainer: errorScale.hoverElementBackground, // onErrorContainer: errorScale.subtleText, - background: grayScale.appBackground, // reviewed - onBackground: grayScale.appText, // reviewed - surface: primaryScale.appBackground, // reviewed - onSurface: primaryScale.appText, // reviewed - surfaceVariant: secondaryScale.appBackground, + surface: primaryScale.appBackground, + onSurface: primaryScale.appText, onSurfaceVariant: secondaryScale.appText, outline: primaryScale.border, outlineVariant: secondaryScale.border, - shadow: primaryScale.primary.darken(80), + shadow: primaryScale.appBackground.darken(60), //scrim: primaryScale.background, // inverseSurface: primaryScale.subtleText, // onInverseSurface: primaryScale.subtleBackground, @@ -114,22 +111,27 @@ class ScaleConfig extends ThemeExtension { required this.useVisualIndicators, required this.preferBorders, required this.borderRadiusScale, - }); + required double wallpaperAlpha, + }) : _wallpaperAlpha = wallpaperAlpha; final bool useVisualIndicators; final bool preferBorders; final double borderRadiusScale; + final double _wallpaperAlpha; + + int get wallpaperAlpha => _wallpaperAlpha.toInt(); @override - ScaleConfig copyWith({ - bool? useVisualIndicators, - bool? preferBorders, - double? borderRadiusScale, - }) => + ScaleConfig copyWith( + {bool? useVisualIndicators, + bool? preferBorders, + double? borderRadiusScale, + double? wallpaperAlpha}) => ScaleConfig( useVisualIndicators: useVisualIndicators ?? this.useVisualIndicators, preferBorders: preferBorders ?? this.preferBorders, borderRadiusScale: borderRadiusScale ?? this.borderRadiusScale, + wallpaperAlpha: wallpaperAlpha ?? this._wallpaperAlpha, ); @override @@ -142,6 +144,8 @@ class ScaleConfig extends ThemeExtension { t < .5 ? useVisualIndicators : other.useVisualIndicators, preferBorders: t < .5 ? preferBorders : other.preferBorders, borderRadiusScale: - lerpDouble(borderRadiusScale, other.borderRadiusScale, t) ?? 1); + lerpDouble(borderRadiusScale, other.borderRadiusScale, t) ?? 1, + wallpaperAlpha: + lerpDouble(_wallpaperAlpha, other._wallpaperAlpha, t) ?? 1); } } diff --git a/lib/theme/models/scale_theme/scale_theme.dart b/lib/theme/models/scale_theme/scale_theme.dart new file mode 100644 index 0000000..4bfc438 --- /dev/null +++ b/lib/theme/models/scale_theme/scale_theme.dart @@ -0,0 +1,127 @@ +import 'package:flutter/material.dart'; + +import 'scale_input_decorator_theme.dart'; +import 'scale_scheme.dart'; + +export 'scale_color.dart'; +export 'scale_input_decorator_theme.dart'; +export 'scale_scheme.dart'; +export 'scale_tile_theme.dart'; +export 'scale_toast_theme.dart'; + +class ScaleTheme extends ThemeExtension { + ScaleTheme({ + required this.textTheme, + required this.scheme, + required this.config, + }); + + final TextTheme textTheme; + final ScaleScheme scheme; + final ScaleConfig config; + + @override + ScaleTheme copyWith({ + TextTheme? textTheme, + ScaleScheme? scheme, + ScaleConfig? config, + }) => + ScaleTheme( + textTheme: textTheme ?? this.textTheme, + scheme: scheme ?? this.scheme, + config: config ?? this.config, + ); + + @override + ScaleTheme lerp(ScaleTheme? other, double t) { + if (other is! ScaleTheme) { + return this; + } + return ScaleTheme( + textTheme: TextTheme.lerp(textTheme, other.textTheme, t), + scheme: scheme.lerp(other.scheme, t), + config: config.lerp(other.config, t)); + } + + ThemeData toThemeData(Brightness brightness) { + final colorScheme = scheme.toColorScheme(brightness); + + final baseThemeData = ThemeData.from( + colorScheme: colorScheme, textTheme: textTheme, useMaterial3: true); + + final elevatedButtonTheme = ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + backgroundColor: scheme.primaryScale.elementBackground, + foregroundColor: scheme.primaryScale.appText, + disabledBackgroundColor: + scheme.grayScale.elementBackground.withAlpha(0x7F), + disabledForegroundColor: + scheme.grayScale.primary.withAlpha(0x7F), + shape: RoundedRectangleBorder( + side: BorderSide(color: scheme.primaryScale.border), + borderRadius: + BorderRadius.circular(8 * config.borderRadiusScale))) + .copyWith(side: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.disabled)) { + return BorderSide(color: scheme.grayScale.border.withAlpha(0x7F)); + } else if (states.contains(WidgetState.pressed)) { + return BorderSide( + color: scheme.primaryScale.border, + strokeAlign: BorderSide.strokeAlignOutside); + } else if (states.contains(WidgetState.hovered)) { + return BorderSide(color: scheme.primaryScale.hoverBorder); + } else if (states.contains(WidgetState.focused)) { + return BorderSide(color: scheme.primaryScale.hoverBorder, width: 2); + } + return BorderSide(color: scheme.primaryScale.border); + }))); + + final themeData = baseThemeData.copyWith( + scrollbarTheme: baseThemeData.scrollbarTheme.copyWith( + thumbColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return scheme.primaryScale.border; + } else if (states.contains(WidgetState.hovered)) { + return scheme.primaryScale.hoverBorder; + } + return scheme.primaryScale.subtleBorder; + }), trackColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return scheme.primaryScale.activeElementBackground; + } else if (states.contains(WidgetState.hovered)) { + return scheme.primaryScale.hoverElementBackground; + } + return scheme.primaryScale.elementBackground; + }), trackBorderColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return scheme.primaryScale.subtleBorder; + } else if (states.contains(WidgetState.hovered)) { + return scheme.primaryScale.subtleBorder; + } + return scheme.primaryScale.subtleBorder; + })), + appBarTheme: baseThemeData.appBarTheme.copyWith( + backgroundColor: scheme.primaryScale.border, + foregroundColor: scheme.primaryScale.borderText), + bottomSheetTheme: baseThemeData.bottomSheetTheme.copyWith( + elevation: 0, + modalElevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(16 * config.borderRadiusScale), + topRight: Radius.circular(16 * config.borderRadiusScale)))), + canvasColor: scheme.primaryScale.subtleBackground, + chipTheme: baseThemeData.chipTheme.copyWith( + backgroundColor: scheme.primaryScale.elementBackground, + selectedColor: scheme.primaryScale.activeElementBackground, + surfaceTintColor: scheme.primaryScale.hoverElementBackground, + checkmarkColor: scheme.primaryScale.primary, + side: BorderSide(color: scheme.primaryScale.border)), + elevatedButtonTheme: elevatedButtonTheme, + inputDecorationTheme: + ScaleInputDecoratorTheme(scheme, config, textTheme), + extensions: >[scheme, config, this]); + + return themeData; + } +} diff --git a/lib/theme/models/scale_theme.dart b/lib/theme/models/scale_theme/scale_tile_theme.dart similarity index 64% rename from lib/theme/models/scale_theme.dart rename to lib/theme/models/scale_theme/scale_tile_theme.dart index 95f7db9..da2c3cd 100644 --- a/lib/theme/models/scale_theme.dart +++ b/lib/theme/models/scale_theme/scale_tile_theme.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'scale_scheme.dart'; +import 'scale_theme.dart'; class ScaleTileTheme { ScaleTileTheme( @@ -19,40 +20,7 @@ class ScaleTileTheme { final TextStyle smallTextStyle; } -class ScaleTheme extends ThemeExtension { - ScaleTheme({ - required this.textTheme, - required this.scheme, - required this.config, - }); - - final TextTheme textTheme; - final ScaleScheme scheme; - final ScaleConfig config; - - @override - ScaleTheme copyWith({ - TextTheme? textTheme, - ScaleScheme? scheme, - ScaleConfig? config, - }) => - ScaleTheme( - textTheme: textTheme ?? this.textTheme, - scheme: scheme ?? this.scheme, - config: config ?? this.config, - ); - - @override - ScaleTheme lerp(ScaleTheme? other, double t) { - if (other is! ScaleTheme) { - return this; - } - return ScaleTheme( - textTheme: TextTheme.lerp(textTheme, other.textTheme, t), - scheme: scheme.lerp(other.scheme, t), - config: config.lerp(other.config, t)); - } - +extension ScaleTileThemeExt on ScaleTheme { ScaleTileTheme tileTheme( {bool disabled = false, bool selected = false, @@ -72,7 +40,10 @@ class ScaleTheme extends ThemeExtension { final shapeBorder = RoundedRectangleBorder( side: config.useVisualIndicators - ? BorderSide(width: 2, color: borderColor, strokeAlign: 0) + ? BorderSide( + width: 2, + color: borderColor, + ) : BorderSide.none, borderRadius: BorderRadius.circular(8 * config.borderRadiusScale)); diff --git a/lib/theme/models/scale_theme/scale_toast_theme.dart b/lib/theme/models/scale_theme/scale_toast_theme.dart new file mode 100644 index 0000000..61f119d --- /dev/null +++ b/lib/theme/models/scale_theme/scale_toast_theme.dart @@ -0,0 +1,70 @@ +import 'package:flutter/material.dart'; + +import 'scale_theme.dart'; + +enum ScaleToastKind { + info, + error, +} + +class ScaleToastTheme { + ScaleToastTheme( + {required this.primaryColor, + required this.backgroundColor, + required this.foregroundColor, + required this.borderSide, + required this.borderRadius, + required this.padding, + required this.icon, + required this.titleTextStyle, + required this.descriptionTextStyle}); + + final Color primaryColor; + final Color backgroundColor; + final Color foregroundColor; + final BorderSide? borderSide; + final BorderRadiusGeometry borderRadius; + final EdgeInsetsGeometry padding; + final Icon icon; + final TextStyle titleTextStyle; + final TextStyle descriptionTextStyle; +} + +extension ScaleToastThemeExt on ScaleTheme { + ScaleToastTheme toastTheme(ScaleToastKind kind) { + final toastScaleColor = scheme.scale(ScaleKind.tertiary); + + final primaryColor = toastScaleColor.calloutText; + final borderColor = toastScaleColor.border; + final backgroundColor = config.useVisualIndicators + ? toastScaleColor.calloutText + : toastScaleColor.calloutBackground; + final textColor = config.useVisualIndicators + ? toastScaleColor.calloutBackground + : toastScaleColor.calloutText; + final titleColor = config.useVisualIndicators + ? toastScaleColor.calloutBackground + : toastScaleColor.calloutText; + Icon icon; + switch (kind) { + case ScaleToastKind.info: + icon = Icon(Icons.info, size: 32, color: primaryColor); + case ScaleToastKind.error: + icon = Icon(Icons.dangerous, size: 32, color: primaryColor); + } + + return ScaleToastTheme( + primaryColor: primaryColor, + backgroundColor: backgroundColor, + foregroundColor: textColor, + borderSide: (config.useVisualIndicators || config.preferBorders) + ? BorderSide(color: borderColor, width: 2) + : const BorderSide(color: Colors.transparent, width: 0), + borderRadius: BorderRadius.circular(12 * config.borderRadiusScale), + padding: const EdgeInsets.all(8), + icon: icon, + titleTextStyle: textTheme.labelMedium!.copyWith(color: titleColor), + descriptionTextStyle: + textTheme.labelMedium!.copyWith(color: textColor)); + } +} diff --git a/lib/theme/models/theme_preference.dart b/lib/theme/models/theme_preference.dart index ec7a40e..dc2e082 100644 --- a/lib/theme/models/theme_preference.dart +++ b/lib/theme/models/theme_preference.dart @@ -1,11 +1,14 @@ import 'package:change_case/change_case.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_svg/svg.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; +import '../../init.dart'; import '../views/widget_helpers.dart'; import 'contrast_generator.dart'; import 'radix_generator.dart'; -import 'scale_scheme.dart'; +import 'scale_theme/scale_scheme.dart'; part 'theme_preference.freezed.dart'; part 'theme_preference.g.dart'; @@ -53,6 +56,7 @@ class ThemePreferences with _$ThemePreferences { BrightnessPreference brightnessPreference, @Default(ColorPreference.vapor) ColorPreference colorPreference, @Default(1) double displayScale, + @Default(true) bool enableWallpaper, }) = _ThemePreferences; factory ThemePreferences.fromJson(dynamic json) => @@ -62,6 +66,17 @@ class ThemePreferences with _$ThemePreferences { } extension ThemePreferencesExt on ThemePreferences { + /// Get wallpaper for existing theme + Widget? wallpaper() { + if (enableWallpaper) { + final assetName = 'assets/images/wallpaper/${colorPreference.name}.svg'; + if (rootAssets.contains(assetName)) { + return SvgPicture.asset(assetName, fit: BoxFit.cover); + } + } + return null; + } + /// Get material 'ThemeData' for existing theme ThemeData themeData() { late final Brightness brightness; @@ -87,7 +102,8 @@ extension ThemePreferencesExt on ThemePreferences { scaleConfig: ScaleConfig( useVisualIndicators: true, preferBorders: false, - borderRadiusScale: 1), + borderRadiusScale: 1, + wallpaperAlpha: 255), primaryFront: Colors.black, primaryBack: Colors.white, secondaryFront: Colors.black, @@ -106,7 +122,8 @@ extension ThemePreferencesExt on ThemePreferences { scaleConfig: ScaleConfig( useVisualIndicators: true, preferBorders: true, - borderRadiusScale: 0.2), + borderRadiusScale: 0.2, + wallpaperAlpha: 208), primaryFront: const Color(0xFF000000), primaryBack: const Color(0xFF00FF00), secondaryFront: const Color(0xFF000000), @@ -123,7 +140,8 @@ extension ThemePreferencesExt on ThemePreferences { scaleConfig: ScaleConfig( useVisualIndicators: true, preferBorders: true, - borderRadiusScale: 0.2), + borderRadiusScale: 0.2, + wallpaperAlpha: 192), primaryFront: const Color(0xFF000000), primaryBack: const Color(0xFF00FF00), secondaryFront: const Color(0xFF000000), diff --git a/lib/theme/models/theme_preference.freezed.dart b/lib/theme/models/theme_preference.freezed.dart index 97e3f81..d96ed38 100644 --- a/lib/theme/models/theme_preference.freezed.dart +++ b/lib/theme/models/theme_preference.freezed.dart @@ -24,9 +24,14 @@ mixin _$ThemePreferences { throw _privateConstructorUsedError; ColorPreference get colorPreference => throw _privateConstructorUsedError; double get displayScale => throw _privateConstructorUsedError; + bool get enableWallpaper => throw _privateConstructorUsedError; + /// Serializes this ThemePreferences to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of ThemePreferences + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $ThemePreferencesCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -40,7 +45,8 @@ abstract class $ThemePreferencesCopyWith<$Res> { $Res call( {BrightnessPreference brightnessPreference, ColorPreference colorPreference, - double displayScale}); + double displayScale, + bool enableWallpaper}); } /// @nodoc @@ -53,12 +59,15 @@ class _$ThemePreferencesCopyWithImpl<$Res, $Val extends ThemePreferences> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of ThemePreferences + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ Object? brightnessPreference = null, Object? colorPreference = null, Object? displayScale = null, + Object? enableWallpaper = null, }) { return _then(_value.copyWith( brightnessPreference: null == brightnessPreference @@ -73,6 +82,10 @@ class _$ThemePreferencesCopyWithImpl<$Res, $Val extends ThemePreferences> ? _value.displayScale : displayScale // ignore: cast_nullable_to_non_nullable as double, + enableWallpaper: null == enableWallpaper + ? _value.enableWallpaper + : enableWallpaper // ignore: cast_nullable_to_non_nullable + as bool, ) as $Val); } } @@ -88,7 +101,8 @@ abstract class _$$ThemePreferencesImplCopyWith<$Res> $Res call( {BrightnessPreference brightnessPreference, ColorPreference colorPreference, - double displayScale}); + double displayScale, + bool enableWallpaper}); } /// @nodoc @@ -99,12 +113,15 @@ class __$$ThemePreferencesImplCopyWithImpl<$Res> $Res Function(_$ThemePreferencesImpl) _then) : super(_value, _then); + /// Create a copy of ThemePreferences + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ Object? brightnessPreference = null, Object? colorPreference = null, Object? displayScale = null, + Object? enableWallpaper = null, }) { return _then(_$ThemePreferencesImpl( brightnessPreference: null == brightnessPreference @@ -119,6 +136,10 @@ class __$$ThemePreferencesImplCopyWithImpl<$Res> ? _value.displayScale : displayScale // ignore: cast_nullable_to_non_nullable as double, + enableWallpaper: null == enableWallpaper + ? _value.enableWallpaper + : enableWallpaper // ignore: cast_nullable_to_non_nullable + as bool, )); } } @@ -129,7 +150,8 @@ class _$ThemePreferencesImpl implements _ThemePreferences { const _$ThemePreferencesImpl( {this.brightnessPreference = BrightnessPreference.system, this.colorPreference = ColorPreference.vapor, - this.displayScale = 1}); + this.displayScale = 1, + this.enableWallpaper = true}); factory _$ThemePreferencesImpl.fromJson(Map json) => _$$ThemePreferencesImplFromJson(json); @@ -143,10 +165,13 @@ class _$ThemePreferencesImpl implements _ThemePreferences { @override @JsonKey() final double displayScale; + @override + @JsonKey() + final bool enableWallpaper; @override String toString() { - return 'ThemePreferences(brightnessPreference: $brightnessPreference, colorPreference: $colorPreference, displayScale: $displayScale)'; + return 'ThemePreferences(brightnessPreference: $brightnessPreference, colorPreference: $colorPreference, displayScale: $displayScale, enableWallpaper: $enableWallpaper)'; } @override @@ -159,15 +184,19 @@ class _$ThemePreferencesImpl implements _ThemePreferences { (identical(other.colorPreference, colorPreference) || other.colorPreference == colorPreference) && (identical(other.displayScale, displayScale) || - other.displayScale == displayScale)); + other.displayScale == displayScale) && + (identical(other.enableWallpaper, enableWallpaper) || + other.enableWallpaper == enableWallpaper)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( - runtimeType, brightnessPreference, colorPreference, displayScale); + int get hashCode => Object.hash(runtimeType, brightnessPreference, + colorPreference, displayScale, enableWallpaper); - @JsonKey(ignore: true) + /// Create a copy of ThemePreferences + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$ThemePreferencesImplCopyWith<_$ThemePreferencesImpl> get copyWith => @@ -186,7 +215,8 @@ abstract class _ThemePreferences implements ThemePreferences { const factory _ThemePreferences( {final BrightnessPreference brightnessPreference, final ColorPreference colorPreference, - final double displayScale}) = _$ThemePreferencesImpl; + final double displayScale, + final bool enableWallpaper}) = _$ThemePreferencesImpl; factory _ThemePreferences.fromJson(Map json) = _$ThemePreferencesImpl.fromJson; @@ -198,7 +228,12 @@ abstract class _ThemePreferences implements ThemePreferences { @override double get displayScale; @override - @JsonKey(ignore: true) + bool get enableWallpaper; + + /// Create a copy of ThemePreferences + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$ThemePreferencesImplCopyWith<_$ThemePreferencesImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/theme/models/theme_preference.g.dart b/lib/theme/models/theme_preference.g.dart index 4cb2d71..23c3d38 100644 --- a/lib/theme/models/theme_preference.g.dart +++ b/lib/theme/models/theme_preference.g.dart @@ -16,6 +16,7 @@ _$ThemePreferencesImpl _$$ThemePreferencesImplFromJson( ? ColorPreference.vapor : ColorPreference.fromJson(json['color_preference']), displayScale: (json['display_scale'] as num?)?.toDouble() ?? 1, + enableWallpaper: json['enable_wallpaper'] as bool? ?? true, ); Map _$$ThemePreferencesImplToJson( @@ -24,4 +25,5 @@ Map _$$ThemePreferencesImplToJson( 'brightness_preference': instance.brightnessPreference.toJson(), 'color_preference': instance.colorPreference.toJson(), 'display_scale': instance.displayScale, + 'enable_wallpaper': instance.enableWallpaper, }; diff --git a/lib/theme/views/avatar_widget.dart b/lib/theme/views/avatar_widget.dart index 7a1f610..42bea11 100644 --- a/lib/theme/views/avatar_widget.dart +++ b/lib/theme/views/avatar_widget.dart @@ -5,7 +5,7 @@ import 'package:flutter/widgets.dart'; import '../theme.dart'; class AvatarWidget extends StatelessWidget { - AvatarWidget({ + const AvatarWidget({ required String name, required double size, required Color borderColor, @@ -38,15 +38,11 @@ class AvatarWidget extends StatelessWidget { height: _size, width: _size, decoration: BoxDecoration( - shape: BoxShape.circle, - border: _scaleConfig.useVisualIndicators - ? Border.all( - color: _borderColor, - width: 1 * (_size ~/ 32 + 1), - strokeAlign: BorderSide.strokeAlignOutside) - : null, - color: _borderColor, - ), + shape: BoxShape.circle, + border: Border.all( + color: _borderColor, + width: 1 * (_size ~/ 32 + 1), + strokeAlign: BorderSide.strokeAlignOutside)), child: AvatarImage( //size: 32, backgroundImage: _imageProvider, @@ -55,14 +51,15 @@ class AvatarWidget extends StatelessWidget { ? _foregroundColor : _backgroundColor, child: Text( - shortname, + shortname.isNotEmpty ? shortname : '?', + softWrap: false, style: _textStyle.copyWith( color: _scaleConfig.useVisualIndicators && !_scaleConfig.preferBorders ? _backgroundColor : _foregroundColor, ), - ))); + ).fit().paddingAll(_size / 16))); } //////////////////////////////////////////////////////////////////////////// diff --git a/lib/theme/views/brightness_preferences.dart b/lib/theme/views/brightness_preferences.dart index 0c39976..7a1bb1d 100644 --- a/lib/theme/views/brightness_preferences.dart +++ b/lib/theme/views/brightness_preferences.dart @@ -22,24 +22,25 @@ List> _getBrightnessDropdownItems() { } Widget buildSettingsPageBrightnessPreferences( - {required BuildContext context, required void Function() onChanged}) { + {required BuildContext context, + required void Function() onChanged, + required ThemeSwitcherState switcher}) { final preferencesRepository = PreferencesRepository.instance; final themePreferences = preferencesRepository.value.themePreference; - return ThemeSwitcher.withTheme( - builder: (_, switcher, theme) => FormBuilderDropdown( - name: formFieldBrightness, - decoration: InputDecoration( - label: Text(translate('settings_page.brightness_mode'))), - items: _getBrightnessDropdownItems(), - initialValue: themePreferences.brightnessPreference, - onChanged: (value) async { - final newThemePrefs = themePreferences.copyWith( - brightnessPreference: value as BrightnessPreference); - final newPrefs = preferencesRepository.value - .copyWith(themePreference: newThemePrefs); + return FormBuilderDropdown( + name: formFieldBrightness, + decoration: InputDecoration( + label: Text(translate('settings_page.brightness_mode'))), + items: _getBrightnessDropdownItems(), + initialValue: themePreferences.brightnessPreference, + onChanged: (value) async { + final newThemePrefs = themePreferences.copyWith( + brightnessPreference: value as BrightnessPreference); + final newPrefs = preferencesRepository.value + .copyWith(themePreference: newThemePrefs); - await preferencesRepository.set(newPrefs); - switcher.changeTheme(theme: newThemePrefs.themeData()); - onChanged(); - })); + await preferencesRepository.set(newPrefs); + switcher.changeTheme(theme: newThemePrefs.themeData()); + onChanged(); + }); } diff --git a/lib/theme/views/color_preferences.dart b/lib/theme/views/color_preferences.dart index ce03c0a..a9a8841 100644 --- a/lib/theme/views/color_preferences.dart +++ b/lib/theme/views/color_preferences.dart @@ -1,4 +1,5 @@ import 'package:animated_theme_switcher/animated_theme_switcher.dart'; +import 'package:async_tools/async_tools.dart'; import 'package:flutter/material.dart'; import 'package:flutter_form_builder/flutter_form_builder.dart'; import 'package:flutter_translate/flutter_translate.dart'; @@ -7,6 +8,7 @@ import '../../settings/settings.dart'; import '../models/models.dart'; const String formFieldTheme = 'theme'; +const String _kSwitchTheme = 'switchTheme'; List> _getThemeDropdownItems() { const colorPrefs = ColorPreference.values; @@ -32,24 +34,27 @@ List> _getThemeDropdownItems() { } Widget buildSettingsPageColorPreferences( - {required BuildContext context, required void Function() onChanged}) { + {required BuildContext context, + required void Function() onChanged, + required ThemeSwitcherState switcher}) { final preferencesRepository = PreferencesRepository.instance; final themePreferences = preferencesRepository.value.themePreference; - return ThemeSwitcher.withTheme( - builder: (_, switcher, theme) => FormBuilderDropdown( - name: formFieldTheme, - decoration: InputDecoration( - label: Text(translate('settings_page.color_theme'))), - items: _getThemeDropdownItems(), - initialValue: themePreferences.colorPreference, - onChanged: (value) async { - final newThemePrefs = themePreferences.copyWith( - colorPreference: value as ColorPreference); - final newPrefs = preferencesRepository.value - .copyWith(themePreference: newThemePrefs); + return FormBuilderDropdown( + name: formFieldTheme, + decoration: + InputDecoration(label: Text(translate('settings_page.color_theme'))), + items: _getThemeDropdownItems(), + initialValue: themePreferences.colorPreference, + onChanged: (value) { + singleFuture(_kSwitchTheme, () async { + final newThemePrefs = themePreferences.copyWith( + colorPreference: value as ColorPreference); + final newPrefs = preferencesRepository.value + .copyWith(themePreference: newThemePrefs); - await preferencesRepository.set(newPrefs); - switcher.changeTheme(theme: newThemePrefs.themeData()); - onChanged(); - })); + await preferencesRepository.set(newPrefs); + switcher.changeTheme(theme: newThemePrefs.themeData()); + onChanged(); + }); + }); } diff --git a/lib/theme/views/option_box.dart b/lib/theme/views/option_box.dart index 508c7ba..06a3293 100644 --- a/lib/theme/views/option_box.dart +++ b/lib/theme/views/option_box.dart @@ -40,7 +40,9 @@ class OptionBox extends StatelessWidget { ElevatedButton( onPressed: _onClick, child: Row(mainAxisSize: MainAxisSize.min, children: [ - Icon(_buttonIcon, size: 24).paddingLTRB(0, 8, 8, 8), + Icon(_buttonIcon, + size: 24, color: scale.primaryScale.appText) + .paddingLTRB(0, 8, 8, 8), Text(textAlign: TextAlign.center, _buttonText) ])).paddingLTRB(0, 12, 0, 0).toCenter() ]).paddingAll(12)) diff --git a/lib/theme/models/slider_tile.dart b/lib/theme/views/slider_tile.dart similarity index 92% rename from lib/theme/models/slider_tile.dart rename to lib/theme/views/slider_tile.dart index 9b6957a..d293fa6 100644 --- a/lib/theme/models/slider_tile.dart +++ b/lib/theme/views/slider_tile.dart @@ -125,16 +125,21 @@ class SliderTile extends StatelessWidget { child: ListTile( onTap: onTap, dense: true, - visualDensity: const VisualDensity(vertical: -4), + visualDensity: + const VisualDensity(horizontal: -4, vertical: -4), title: Text( title, overflow: TextOverflow.fade, softWrap: false, ), subtitle: subtitle.isNotEmpty ? Text(subtitle) : null, + minTileHeight: 48, iconColor: scaleTileTheme.textColor, textColor: scaleTileTheme.textColor, - leading: FittedBox(child: leading), - trailing: FittedBox(child: trailing)))))); + leading: + leading != null ? FittedBox(child: leading) : null, + trailing: trailing != null + ? FittedBox(child: trailing) + : null))))); } } diff --git a/lib/theme/views/styled_alert.dart b/lib/theme/views/styled_alert.dart index 39fa6f2..82218e8 100644 --- a/lib/theme/views/styled_alert.dart +++ b/lib/theme/views/styled_alert.dart @@ -94,16 +94,11 @@ Future showErrorModal( {required BuildContext context, required String title, required String text}) async { - // final theme = Theme.of(context); - // final scale = theme.extension()!; - // final scaleConfig = theme.extension()!; - await Alert( context: context, style: _alertStyle(context), useRootNavigator: false, type: AlertType.error, - //style: AlertStyle(), title: title, desc: text, buttons: [ @@ -122,10 +117,6 @@ Future showErrorModal( ), ) ], - - //backgroundColor: Colors.black, - //titleColor: Colors.white, - //textColor: Colors.white, ).show(); } @@ -144,16 +135,11 @@ Future showWarningModal( {required BuildContext context, required String title, required String text}) async { - // final theme = Theme.of(context); - // final scale = theme.extension()!; - // final scaleConfig = theme.extension()!; - await Alert( context: context, style: _alertStyle(context), useRootNavigator: false, type: AlertType.warning, - //style: AlertStyle(), title: title, desc: text, buttons: [ @@ -172,10 +158,6 @@ Future showWarningModal( ), ) ], - - //backgroundColor: Colors.black, - //titleColor: Colors.white, - //textColor: Colors.white, ).show(); } @@ -183,16 +165,11 @@ Future showWarningWidgetModal( {required BuildContext context, required String title, required Widget child}) async { - // final theme = Theme.of(context); - // final scale = theme.extension()!; - // final scaleConfig = theme.extension()!; - await Alert( context: context, style: _alertStyle(context), useRootNavigator: false, type: AlertType.warning, - //style: AlertStyle(), title: title, content: child, buttons: [ @@ -211,10 +188,6 @@ Future showWarningWidgetModal( ), ) ], - - //backgroundColor: Colors.black, - //titleColor: Colors.white, - //textColor: Colors.white, ).show(); } @@ -222,10 +195,6 @@ Future showConfirmModal( {required BuildContext context, required String title, required String text}) async { - // final theme = Theme.of(context); - // final scale = theme.extension()!; - // final scaleConfig = theme.extension()!; - var confirm = false; await Alert( @@ -266,10 +235,6 @@ Future showConfirmModal( ), ) ], - - //backgroundColor: Colors.black, - //titleColor: Colors.white, - //textColor: Colors.white, ).show(); return confirm; diff --git a/lib/theme/views/styled_dialog.dart b/lib/theme/views/styled_dialog.dart index 4e4bd50..75a0f6b 100644 --- a/lib/theme/views/styled_dialog.dart +++ b/lib/theme/views/styled_dialog.dart @@ -21,7 +21,7 @@ class StyledDialog extends StatelessWidget { Radius.circular(16 * scaleConfig.borderRadiusScale)), ), contentPadding: const EdgeInsets.all(4), - backgroundColor: scale.primaryScale.dialogBorder, + backgroundColor: scale.primaryScale.border, title: Text( title, style: textTheme.titleMedium! diff --git a/lib/theme/views/styled_scaffold.dart b/lib/theme/views/styled_scaffold.dart index 9560ecc..9d02fab 100644 --- a/lib/theme/views/styled_scaffold.dart +++ b/lib/theme/views/styled_scaffold.dart @@ -9,22 +9,26 @@ class StyledScaffold extends StatelessWidget { @override Widget build(BuildContext context) { final theme = Theme.of(context); - final scale = theme.extension()!; + final scaleScheme = theme.extension()!; final scaleConfig = theme.extension()!; + final scale = scaleScheme.scale(ScaleKind.primary); final enableBorder = !isMobileSize(context); - final scaffold = clipBorder( - clipEnabled: enableBorder, - borderEnabled: scaleConfig.useVisualIndicators, - borderRadius: 16 * scaleConfig.borderRadiusScale, - borderColor: scale.primaryScale.border, - child: Scaffold(appBar: appBar, body: body, key: key)) - .paddingAll(enableBorder ? 32 : 0); + var scaffold = clipBorder( + clipEnabled: enableBorder, + borderEnabled: scaleConfig.useVisualIndicators, + borderRadius: 16 * scaleConfig.borderRadiusScale, + borderColor: scale.border, + child: Scaffold(appBar: appBar, body: body, key: key)); + + if (!scaleConfig.useVisualIndicators) { + scaffold = scaffold.withThemedShadow(scaleConfig, scale); + } return GestureDetector( onTap: () => FocusManager.instance.primaryFocus?.unfocus(), - child: scaffold); + child: scaffold.paddingAll(enableBorder ? 32 : 0)); } //////////////////////////////////////////////////////////////////////////// diff --git a/lib/theme/views/views.dart b/lib/theme/views/views.dart index e8aa1d8..88f4a4a 100644 --- a/lib/theme/views/views.dart +++ b/lib/theme/views/views.dart @@ -8,7 +8,9 @@ export 'pop_control.dart'; export 'recovery_key_widget.dart'; export 'responsive.dart'; export 'scanner_error_widget.dart'; +export 'slider_tile.dart'; export 'styled_alert.dart'; export 'styled_dialog.dart'; export 'styled_scaffold.dart'; +export 'wallpaper_preferences.dart'; export 'widget_helpers.dart'; diff --git a/lib/theme/views/wallpaper_preferences.dart b/lib/theme/views/wallpaper_preferences.dart new file mode 100644 index 0000000..48f0a6a --- /dev/null +++ b/lib/theme/views/wallpaper_preferences.dart @@ -0,0 +1,33 @@ +import 'package:animated_theme_switcher/animated_theme_switcher.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_form_builder/flutter_form_builder.dart'; +import 'package:flutter_translate/flutter_translate.dart'; + +import '../../settings/settings.dart'; +import '../models/models.dart'; + +const String formFieldEnableWallpaper = 'enable_wallpaper'; + +Widget buildSettingsPageWallpaperPreferences( + {required BuildContext context, + required void Function() onChanged, + required ThemeSwitcherState switcher}) { + final preferencesRepository = PreferencesRepository.instance; + final themePreferences = preferencesRepository.value.themePreference; + return FormBuilderCheckbox( + name: formFieldEnableWallpaper, + title: Text(translate('settings_page.enable_wallpaper')), + initialValue: themePreferences.enableWallpaper, + onChanged: (value) async { + if (value != null) { + final newThemePrefs = + themePreferences.copyWith(enableWallpaper: value); + final newPrefs = preferencesRepository.value + .copyWith(themePreference: newThemePrefs); + + await preferencesRepository.set(newPrefs); + switcher.changeTheme(theme: newThemePrefs.themeData()); + onChanged(); + } + }); +} diff --git a/lib/theme/views/widget_helpers.dart b/lib/theme/views/widget_helpers.dart index 970e065..1b768dd 100644 --- a/lib/theme/views/widget_helpers.dart +++ b/lib/theme/views/widget_helpers.dart @@ -19,6 +19,40 @@ extension BorderExt on Widget { child: this); } +extension ShadowExt on Widget { + Container withThemedShadow(ScaleConfig scaleConfig, ScaleColor scale) => + // ignore: use_decorated_box + Container( + decoration: BoxDecoration( + boxShadow: themedShadow(scaleConfig, scale), + ), + child: this, + ); +} + +List themedShadow(ScaleConfig scaleConfig, ScaleColor scale) => [ + if (scaleConfig.useVisualIndicators && !scaleConfig.preferBorders) + BoxShadow( + color: scale.primary.darken(60), + spreadRadius: 2, + ) + else if (scaleConfig.useVisualIndicators && scaleConfig.preferBorders) + BoxShadow( + color: scale.border, + spreadRadius: 2, + ) + else + BoxShadow( + color: scale.primary.darken(60).withAlpha(0x7F), + blurRadius: 16, + spreadRadius: 2, + offset: const Offset( + 0, + 2, + ), + ), + ]; + extension SizeToFixExt on Widget { FittedBox fit({BoxFit? fit, Key? key}) => FittedBox( key: key, @@ -114,14 +148,13 @@ extension LabelExt on Widget { {ScaleColor? scale}) { final theme = Theme.of(context); final scaleScheme = theme.extension()!; - // final scaleConfig = theme.extension()!; scale = scale ?? scaleScheme.primaryScale; - return Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: [ + return Wrap(crossAxisAlignment: WrapCrossAlignment.end, children: [ Text( '$label:', - style: theme.textTheme.titleLarge!.copyWith(color: scale.border), - ).paddingLTRB(0, 0, 8, 8), + style: theme.textTheme.bodyLarge!.copyWith(color: scale.hoverBorder), + ).paddingLTRB(0, 0, 8, 0), this ]); } @@ -431,6 +464,31 @@ Widget styledTitleContainer({ ])); } +Widget styledCard({ + required BuildContext context, + required Widget child, + Color? borderColor, + Color? backgroundColor, + Color? titleColor, +}) { + final theme = Theme.of(context); + final scale = theme.extension()!; + final scaleConfig = theme.extension()!; + + return DecoratedBox( + decoration: ShapeDecoration( + color: backgroundColor ?? scale.primaryScale.elementBackground, + shape: RoundedRectangleBorder( + side: (scaleConfig.useVisualIndicators || scaleConfig.preferBorders) + ? BorderSide( + color: borderColor ?? scale.primaryScale.border, width: 2) + : BorderSide.none, + borderRadius: + BorderRadius.circular(12 * scaleConfig.borderRadiusScale), + )), + child: child.paddingAll(4)); +} + Widget styledBottomSheet({ required BuildContext context, required String title, @@ -500,24 +558,33 @@ const grayColorFilter = ColorFilter.matrix([ 0, ]); -Widget clipBorder({ +const src96StencilFilter = + ColorFilter.mode(Color.fromARGB(96, 255, 255, 255), BlendMode.srcIn); + +const dst127StencilFilter = + ColorFilter.mode(Color.fromARGB(127, 255, 255, 255), BlendMode.dstIn); + +Container clipBorder({ required bool clipEnabled, required bool borderEnabled, required double borderRadius, required Color borderColor, required Widget child, }) => - ClipRRect( - borderRadius: clipEnabled - ? BorderRadius.circular(borderRadius) - : BorderRadius.zero, - child: DecoratedBox( - decoration: BoxDecoration(boxShadow: [ - if (borderEnabled) BoxShadow(color: borderColor, spreadRadius: 2) - ]), - child: ClipRRect( - borderRadius: clipEnabled - ? BorderRadius.circular(borderRadius) - : BorderRadius.zero, - child: child, - )).paddingAll(clipEnabled && borderEnabled ? 2 : 0)); + // ignore: avoid_unnecessary_containers, use_decorated_box + Container( + decoration: ShapeDecoration( + shape: RoundedRectangleBorder( + side: borderEnabled && clipEnabled + ? BorderSide(color: borderColor, width: 2) + : BorderSide.none, + borderRadius: clipEnabled + ? BorderRadius.circular(borderRadius) + : BorderRadius.zero, + )), + child: ClipRRect( + clipBehavior: Clip.antiAliasWithSaveLayer, + borderRadius: clipEnabled + ? BorderRadius.circular(borderRadius - 4) + : BorderRadius.zero, + child: child)); diff --git a/lib/tools/loggy.dart b/lib/tools/loggy.dart index d8d4880..2730888 100644 --- a/lib/tools/loggy.dart +++ b/lib/tools/loggy.dart @@ -112,7 +112,7 @@ class CallbackPrinter extends LoggyPrinter { void onLog(LogRecord record) { final out = record.pretty().replaceAll('\uFFFD', ''); - if (Platform.isAndroid) { + if (!kIsWeb && Platform.isAndroid) { debugPrint(out); } else { debugPrintSynchronously(out); diff --git a/lib/veilid_processor/models/processor_connection_state.freezed.dart b/lib/veilid_processor/models/processor_connection_state.freezed.dart index d857318..87ad295 100644 --- a/lib/veilid_processor/models/processor_connection_state.freezed.dart +++ b/lib/veilid_processor/models/processor_connection_state.freezed.dart @@ -19,7 +19,9 @@ mixin _$ProcessorConnectionState { VeilidStateAttachment get attachment => throw _privateConstructorUsedError; VeilidStateNetwork get network => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + /// Create a copy of ProcessorConnectionState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $ProcessorConnectionStateCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -47,6 +49,8 @@ class _$ProcessorConnectionStateCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of ProcessorConnectionState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -65,6 +69,8 @@ class _$ProcessorConnectionStateCopyWithImpl<$Res, ) as $Val); } + /// Create a copy of ProcessorConnectionState + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $VeilidStateAttachmentCopyWith<$Res> get attachment { @@ -73,6 +79,8 @@ class _$ProcessorConnectionStateCopyWithImpl<$Res, }); } + /// Create a copy of ProcessorConnectionState + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $VeilidStateNetworkCopyWith<$Res> get network { @@ -109,6 +117,8 @@ class __$$ProcessorConnectionStateImplCopyWithImpl<$Res> $Res Function(_$ProcessorConnectionStateImpl) _then) : super(_value, _then); + /// Create a copy of ProcessorConnectionState + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -158,7 +168,9 @@ class _$ProcessorConnectionStateImpl extends _ProcessorConnectionState { @override int get hashCode => Object.hash(runtimeType, attachment, network); - @JsonKey(ignore: true) + /// Create a copy of ProcessorConnectionState + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$ProcessorConnectionStateImplCopyWith<_$ProcessorConnectionStateImpl> @@ -177,8 +189,11 @@ abstract class _ProcessorConnectionState extends ProcessorConnectionState { VeilidStateAttachment get attachment; @override VeilidStateNetwork get network; + + /// Create a copy of ProcessorConnectionState + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$ProcessorConnectionStateImplCopyWith<_$ProcessorConnectionStateImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/veilid_processor/views/developer.dart b/lib/veilid_processor/views/developer.dart index e40677d..1899c34 100644 --- a/lib/veilid_processor/views/developer.dart +++ b/lib/veilid_processor/views/developer.dart @@ -1,13 +1,11 @@ import 'dart:async'; +import 'package:animated_custom_dropdown/custom_dropdown.dart'; import 'package:ansicolor/ansicolor.dart'; import 'package:awesome_extensions/awesome_extensions.dart'; -import 'package:cool_dropdown/cool_dropdown.dart'; -import 'package:cool_dropdown/models/cool_dropdown_item.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_translate/flutter_translate.dart'; import 'package:go_router/go_router.dart'; @@ -17,6 +15,7 @@ import 'package:xterm/xterm.dart'; import '../../layout/layout.dart'; import '../../notifications/notifications.dart'; +import '../../theme/models/scale_theme/scale_custom_dropdown_theme.dart'; import '../../theme/theme.dart'; import '../../tools/tools.dart'; import 'history_text_editing_controller.dart'; @@ -30,6 +29,15 @@ const kDefaultTerminalStyle = TerminalStyle( // height: 1.2, fontFamily: 'Source Code Pro'); +class LogLevelDropdownItem { + const LogLevelDropdownItem( + {required this.label, required this.icon, required this.value}); + + final String label; + final Widget icon; + final LogLevel value; +} + class DeveloperPage extends StatefulWidget { const DeveloperPage({super.key}); @@ -49,7 +57,7 @@ class _DeveloperPageState extends State { }); for (var i = 0; i < logLevels.length; i++) { - _logLevelDropdownItems.add(CoolDropdownItem( + _logLevelDropdownItems.add(LogLevelDropdownItem( label: logLevelName(logLevels[i]), icon: Text(logLevelEmoji(logLevels[i])), value: logLevels[i])); @@ -167,29 +175,28 @@ class _DeveloperPageState extends State { @override Widget build(BuildContext context) { final theme = Theme.of(context); - final textTheme = theme.textTheme; final scale = theme.extension()!; + final scaleTheme = theme.extension()!; + final dropdownTheme = scaleTheme.customDropdownTheme(); final scaleConfig = theme.extension()!; - // WidgetsBinding.instance.addPostFrameCallback((_) { - // if (!_isScrolling && _wantsBottom) { - // _scrollToBottom(); - // } - // }); + final hintColor = scaleConfig.useVisualIndicators + ? scale.primaryScale.primaryText + : scale.primaryScale.primary; return Scaffold( - backgroundColor: scale.primaryScale.primary, + backgroundColor: scale.primaryScale.border, appBar: DefaultAppBar( title: Text(translate('developer.title')), leading: IconButton( - icon: Icon(Icons.arrow_back, color: scale.primaryScale.primaryText), + icon: Icon(Icons.arrow_back, color: scale.primaryScale.borderText), onPressed: () => GoRouterHelper(context).pop(), ), actions: [ IconButton( icon: const Icon(Icons.copy), - color: scale.primaryScale.primaryText, - disabledColor: scale.primaryScale.primaryText.withAlpha(0x3F), + color: scale.primaryScale.borderText, + disabledColor: scale.primaryScale.borderText.withAlpha(0x3F), onPressed: _terminalController.selection == null ? null : () async { @@ -197,93 +204,58 @@ class _DeveloperPageState extends State { }), IconButton( icon: const Icon(Icons.copy_all), - color: scale.primaryScale.primaryText, - disabledColor: scale.primaryScale.primaryText.withAlpha(0x3F), + color: scale.primaryScale.borderText, + disabledColor: scale.primaryScale.borderText.withAlpha(0x3F), onPressed: () async { await copyAll(context); }), IconButton( icon: const Icon(Icons.clear_all), - color: scale.primaryScale.primaryText, - disabledColor: scale.primaryScale.primaryText.withAlpha(0x3F), + color: scale.primaryScale.borderText, + disabledColor: scale.primaryScale.borderText.withAlpha(0x3F), onPressed: () async { final confirm = await showConfirmModal( context: context, - title: translate('toast.confirm'), + title: translate('confirmation.confirm'), text: translate('developer.are_you_sure_clear'), ); if (confirm && context.mounted) { await clear(context); } }), - CoolDropdown( - controller: _logLevelController, - defaultItem: _logLevelDropdownItems - .singleWhere((x) => x.value == _logLevelDropDown), - onChange: (value) { - setState(() { - _logLevelDropDown = value; - Loggy('').level = getLogOptions(value); - setVeilidLogLevel(value); - _logLevelController.close(); - }); - }, - resultOptions: ResultOptions( - width: 64, - height: 40, - render: ResultRender.icon, - icon: SizedBox( - width: 10, - height: 10, - child: CustomPaint( - painter: DropdownArrowPainter( - color: scale.primaryScale.primaryText))), - textStyle: textTheme.labelMedium! - .copyWith(color: scale.primaryScale.primaryText), - padding: const EdgeInsets.fromLTRB(8, 4, 8, 4), - openBoxDecoration: BoxDecoration( - //color: scale.primaryScale.border, - border: Border.all( - color: scaleConfig.useVisualIndicators - ? scale.primaryScale.hoverBorder - : scale.primaryScale.borderText), - borderRadius: - BorderRadius.circular(8 * scaleConfig.borderRadiusScale), - ), - boxDecoration: BoxDecoration( - //color: scale.primaryScale.hoverBorder, - border: Border.all( - color: scaleConfig.useVisualIndicators - ? scale.primaryScale.hoverBorder - : scale.primaryScale.borderText), - borderRadius: - BorderRadius.circular(8 * scaleConfig.borderRadiusScale), - ), - ), - dropdownOptions: DropdownOptions( - width: 160, - align: DropdownAlign.right, - duration: 150.ms, - color: scale.primaryScale.elementBackground, - borderSide: BorderSide(color: scale.primaryScale.border), - borderRadius: - BorderRadius.circular(8 * scaleConfig.borderRadiusScale), - padding: const EdgeInsets.fromLTRB(8, 4, 8, 4), - ), - dropdownTriangleOptions: const DropdownTriangleOptions( - align: DropdownTriangleAlign.right), - dropdownItemOptions: DropdownItemOptions( - selectedTextStyle: textTheme.labelMedium! - .copyWith(color: scale.primaryScale.appText), - textStyle: textTheme.labelMedium! - .copyWith(color: scale.primaryScale.appText), - selectedBoxDecoration: BoxDecoration( - color: scale.primaryScale.activeElementBackground), - mainAxisAlignment: MainAxisAlignment.spaceBetween, - padding: const EdgeInsets.fromLTRB(8, 4, 8, 4), - selectedPadding: const EdgeInsets.fromLTRB(8, 4, 8, 4)), - dropdownList: _logLevelDropdownItems, - ).paddingLTRB(0, 0, 8, 0) + SizedBox.fromSize( + size: const Size(140, 48), + child: CustomDropdown( + items: _logLevelDropdownItems, + initialItem: _logLevelDropdownItems + .singleWhere((x) => x.value == _logLevelDropDown), + onChanged: (item) { + if (item != null) { + setState(() { + _logLevelDropDown = item.value; + Loggy('').level = getLogOptions(item.value); + setVeilidLogLevel(item.value); + }); + } + }, + headerBuilder: (context, item, enabled) => Row(children: [ + item.icon, + const Spacer(), + Text(item.label).copyWith(style: dropdownTheme.textStyle) + ]), + listItemBuilder: (context, item, enabled, onItemSelect) => + Row(children: [ + item.icon, + const Spacer(), + Text(item.label).copyWith(style: dropdownTheme.textStyle) + ]), + decoration: dropdownTheme.decoration, + disabledDecoration: dropdownTheme.disabledDecoration, + listItemPadding: dropdownTheme.listItemPadding, + itemsListPadding: dropdownTheme.itemsListPadding, + expandedHeaderPadding: dropdownTheme.expandedHeaderPadding, + closedHeaderPadding: dropdownTheme.closedHeaderPadding, + )).paddingLTRB(0, 4, 8, 4), ], ), body: GestureDetector( @@ -312,21 +284,24 @@ class _DeveloperPageState extends State { decoration: InputDecoration( filled: true, contentPadding: const EdgeInsets.fromLTRB(8, 2, 8, 2), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - 8 * scaleConfig.borderRadiusScale), - borderSide: BorderSide.none), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular( - 8 * scaleConfig.borderRadiusScale), - ), - fillColor: scale.primaryScale.subtleBackground, + enabledBorder: + const OutlineInputBorder(borderSide: BorderSide.none), + border: + const OutlineInputBorder(borderSide: BorderSide.none), + focusedBorder: + const OutlineInputBorder(borderSide: BorderSide.none), + fillColor: scale.primaryScale.elementBackground, + hoverColor: scale.primaryScale.elementBackground, + hintStyle: scaleTheme.textTheme.labelMedium!.copyWith( + color: scaleConfig.useVisualIndicators + ? hintColor.withAlpha(0x7F) + : hintColor), hintText: translate('developer.command'), suffixIcon: IconButton( icon: Icon(Icons.send, color: _historyController.controller.text.isEmpty - ? scale.primaryScale.primary.withAlpha(0x3F) - : scale.primaryScale.primary), + ? hintColor.withAlpha(0x7F) + : hintColor), onPressed: (_historyController.controller.text.isEmpty || _busy) ? null @@ -366,9 +341,9 @@ class _DeveloperPageState extends State { final _terminalController = TerminalController(); late final HistoryTextEditingController _historyController; - final _logLevelController = DropdownController(duration: 250.ms); - final List> _logLevelDropdownItems = []; + final List _logLevelDropdownItems = []; var _logLevelDropDown = log.level.logLevel; + var _showEllet = false; var _busy = false; diff --git a/lib/veilid_processor/views/signal_strength_meter.dart b/lib/veilid_processor/views/signal_strength_meter.dart index 74230ed..5385bb1 100644 --- a/lib/veilid_processor/views/signal_strength_meter.dart +++ b/lib/veilid_processor/views/signal_strength_meter.dart @@ -34,34 +34,33 @@ class SignalStrengthMeterWidget extends StatelessWidget { case AttachmentState.detached: iconWidget = Icon(Icons.signal_cellular_nodata, size: iconSize, - color: this.color ?? scale.primaryScale.primaryText); + color: this.color ?? scale.primaryScale.borderText); return; case AttachmentState.detaching: iconWidget = Icon(Icons.signal_cellular_off, size: iconSize, - color: this.color ?? scale.primaryScale.primaryText); + color: this.color ?? scale.primaryScale.borderText); return; case AttachmentState.attaching: value = 0; - color = this.color ?? scale.primaryScale.primaryText; + color = this.color ?? scale.primaryScale.borderText; case AttachmentState.attachedWeak: value = 1; - color = this.color ?? scale.primaryScale.primaryText; + color = this.color ?? scale.primaryScale.borderText; case AttachmentState.attachedStrong: value = 2; - color = this.color ?? scale.primaryScale.primaryText; + color = this.color ?? scale.primaryScale.borderText; case AttachmentState.attachedGood: value = 3; - color = this.color ?? scale.primaryScale.primaryText; + color = this.color ?? scale.primaryScale.borderText; case AttachmentState.fullyAttached: value = 4; - color = this.color ?? scale.primaryScale.primaryText; + color = this.color ?? scale.primaryScale.borderText; case AttachmentState.overAttached: value = 4; - color = this.color ?? scale.primaryScale.primaryText; + color = this.color ?? scale.primaryScale.borderText; } - inactiveColor = - this.inactiveColor ?? scale.primaryScale.primaryText; + inactiveColor = this.inactiveColor ?? scale.grayScale.borderText; iconWidget = SignalStrengthIndicator.bars( value: value, diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c94b139..408e781 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -48,6 +48,7 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" + enableGPUValidationMode = "1" allowLocationSimulation = "YES"> diff --git a/packages/veilid_support/example/android/settings.gradle b/packages/veilid_support/example/android/settings.gradle index 1d6d19b..b1ae36a 100644 --- a/packages/veilid_support/example/android/settings.gradle +++ b/packages/veilid_support/example/android/settings.gradle @@ -5,10 +5,9 @@ pluginManagement { def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath - } - settings.ext.flutterSdkPath = flutterSdkPath() + }() - includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() @@ -19,8 +18,8 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false - id "org.jetbrains.kotlin.android" version "1.7.10" apply false + id "com.android.application" version "8.8.0" apply false + id "org.jetbrains.kotlin.android" version "1.9.25" apply false } -include ":app" +include ":app" \ No newline at end of file diff --git a/packages/veilid_support/example/integration_test/app_test.dart b/packages/veilid_support/example/integration_test/app_test.dart index a0f3b7f..6912fd3 100644 --- a/packages/veilid_support/example/integration_test/app_test.dart +++ b/packages/veilid_support/example/integration_test/app_test.dart @@ -36,116 +36,116 @@ void main() { setUpAll(veilidFixture.attach); tearDownAll(veilidFixture.detach); - // group('TableDB Tests', () { - // group('TableDBArray Tests', () { - // // test('create/delete TableDBArray', testTableDBArrayCreateDelete); + group('TableDB Tests', () { + group('TableDBArray Tests', () { + // test('create/delete TableDBArray', testTableDBArrayCreateDelete); - // group('TableDBArray Add/Get Tests', () { - // for (final params in [ - // // - // (99, 3, 15), - // (100, 4, 16), - // (101, 5, 17), - // // - // (511, 3, 127), - // (512, 4, 128), - // (513, 5, 129), - // // - // (4095, 3, 1023), - // (4096, 4, 1024), - // (4097, 5, 1025), - // // - // (65535, 3, 16383), - // (65536, 4, 16384), - // (65537, 5, 16385), - // ]) { - // final count = params.$1; - // final singles = params.$2; - // final batchSize = params.$3; + group('TableDBArray Add/Get Tests', () { + for (final params in [ + // + (99, 3, 15), + (100, 4, 16), + (101, 5, 17), + // + (511, 3, 127), + (512, 4, 128), + (513, 5, 129), + // + (4095, 3, 1023), + (4096, 4, 1024), + (4097, 5, 1025), + // + (65535, 3, 16383), + (65536, 4, 16384), + (65537, 5, 16385), + ]) { + final count = params.$1; + final singles = params.$2; + final batchSize = params.$3; - // test( - // timeout: const Timeout(Duration(seconds: 480)), - // 'add/remove TableDBArray count = $count batchSize=$batchSize', - // makeTestTableDBArrayAddGetClear( - // count: count, - // singles: singles, - // batchSize: batchSize, - // crypto: const VeilidCryptoPublic()), - // ); - // } - // }); + test( + timeout: const Timeout(Duration(seconds: 480)), + 'add/remove TableDBArray count = $count batchSize=$batchSize', + makeTestTableDBArrayAddGetClear( + count: count, + singles: singles, + batchSize: batchSize, + crypto: const VeilidCryptoPublic()), + ); + } + }); - // group('TableDBArray Insert Tests', () { - // for (final params in [ - // // - // (99, 3, 15), - // (100, 4, 16), - // (101, 5, 17), - // // - // (511, 3, 127), - // (512, 4, 128), - // (513, 5, 129), - // // - // (4095, 3, 1023), - // (4096, 4, 1024), - // (4097, 5, 1025), - // // - // (65535, 3, 16383), - // (65536, 4, 16384), - // (65537, 5, 16385), - // ]) { - // final count = params.$1; - // final singles = params.$2; - // final batchSize = params.$3; + group('TableDBArray Insert Tests', () { + for (final params in [ + // + (99, 3, 15), + (100, 4, 16), + (101, 5, 17), + // + (511, 3, 127), + (512, 4, 128), + (513, 5, 129), + // + (4095, 3, 1023), + (4096, 4, 1024), + (4097, 5, 1025), + // + (65535, 3, 16383), + (65536, 4, 16384), + (65537, 5, 16385), + ]) { + final count = params.$1; + final singles = params.$2; + final batchSize = params.$3; - // test( - // timeout: const Timeout(Duration(seconds: 480)), - // 'insert TableDBArray count=$count singles=$singles batchSize=$batchSize', - // makeTestTableDBArrayInsert( - // count: count, - // singles: singles, - // batchSize: batchSize, - // crypto: const VeilidCryptoPublic()), - // ); - // } - // }); + test( + timeout: const Timeout(Duration(seconds: 480)), + 'insert TableDBArray count=$count singles=$singles batchSize=$batchSize', + makeTestTableDBArrayInsert( + count: count, + singles: singles, + batchSize: batchSize, + crypto: const VeilidCryptoPublic()), + ); + } + }); - // group('TableDBArray Remove Tests', () { - // for (final params in [ - // // - // (99, 3, 15), - // (100, 4, 16), - // (101, 5, 17), - // // - // (511, 3, 127), - // (512, 4, 128), - // (513, 5, 129), - // // - // (4095, 3, 1023), - // (4096, 4, 1024), - // (4097, 5, 1025), - // // - // (16383, 3, 4095), - // (16384, 4, 4096), - // (16385, 5, 4097), - // ]) { - // final count = params.$1; - // final singles = params.$2; - // final batchSize = params.$3; + group('TableDBArray Remove Tests', () { + for (final params in [ + // + (99, 3, 15), + (100, 4, 16), + (101, 5, 17), + // + (511, 3, 127), + (512, 4, 128), + (513, 5, 129), + // + (4095, 3, 1023), + (4096, 4, 1024), + (4097, 5, 1025), + // + (16383, 3, 4095), + (16384, 4, 4096), + (16385, 5, 4097), + ]) { + final count = params.$1; + final singles = params.$2; + final batchSize = params.$3; - // test( - // timeout: const Timeout(Duration(seconds: 480)), - // 'remove TableDBArray count=$count singles=$singles batchSize=$batchSize', - // makeTestTableDBArrayRemove( - // count: count, - // singles: singles, - // batchSize: batchSize, - // crypto: const VeilidCryptoPublic()), - // ); - // } - // }); - // }); - // }); + test( + timeout: const Timeout(Duration(seconds: 480)), + 'remove TableDBArray count=$count singles=$singles batchSize=$batchSize', + makeTestTableDBArrayRemove( + count: count, + singles: singles, + batchSize: batchSize, + crypto: const VeilidCryptoPublic()), + ); + } + }); + }); + }); group('DHT Support Tests', () { setUpAll(updateProcessorFixture.setUp); diff --git a/packages/veilid_support/example/pubspec.lock b/packages/veilid_support/example/pubspec.lock index ade4030..3844db3 100644 --- a/packages/veilid_support/example/pubspec.lock +++ b/packages/veilid_support/example/pubspec.lock @@ -34,10 +34,10 @@ packages: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 url: "https://pub.dev" source: hosted - version: "2.11.0" + version: "2.12.0" async_tools: dependency: "direct dev" description: @@ -66,10 +66,10 @@ packages: dependency: transitive description: name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" change_case: dependency: transitive description: @@ -82,10 +82,10 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" charcode: dependency: transitive description: @@ -98,18 +98,18 @@ packages: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" collection: dependency: transitive description: name: collection - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.19.0" + version: "1.19.1" convert: dependency: transitive description: @@ -154,10 +154,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" fast_immutable_collections: dependency: transitive description: @@ -178,10 +178,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" fixnum: dependency: transitive description: @@ -296,18 +296,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec url: "https://pub.dev" source: hosted - version: "10.0.7" + version: "10.0.8" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 url: "https://pub.dev" source: hosted - version: "3.0.8" + version: "3.0.9" leak_tracker_testing: dependency: transitive description: @@ -352,10 +352,10 @@ packages: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.17" material_color_utilities: dependency: transitive description: @@ -368,10 +368,10 @@ packages: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.16.0" mime: dependency: transitive description: @@ -400,10 +400,10 @@ packages: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" path_provider: dependency: transitive description: @@ -456,10 +456,10 @@ packages: dependency: transitive description: name: platform - sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" url: "https://pub.dev" source: hosted - version: "3.1.5" + version: "3.1.6" plugin_platform_interface: dependency: transitive description: @@ -480,10 +480,10 @@ packages: dependency: transitive description: name: process - sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" + sha256: "107d8be718f120bbba9dcd1e95e3bd325b1b4a4f07db64154635ba03f2567a0d" url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "5.0.3" protobuf: dependency: transitive description: @@ -557,34 +557,34 @@ packages: dependency: transitive description: name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.10.1" stack_trace: dependency: transitive description: name: stack_trace - sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.12.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" string_scanner: dependency: transitive description: name: string_scanner - sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.1" sync_http: dependency: transitive description: @@ -613,34 +613,34 @@ packages: dependency: transitive description: name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.2" test: dependency: "direct dev" description: name: test - sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f" + sha256: "301b213cd241ca982e9ba50266bd3f5bd1ea33f1455554c5abb85d1be0e2d87e" url: "https://pub.dev" source: hosted - version: "1.25.8" + version: "1.25.15" test_api: dependency: transitive description: name: test_api - sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd url: "https://pub.dev" source: hosted - version: "0.7.3" + version: "0.7.4" test_core: dependency: transitive description: name: test_core - sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d" + sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa" url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.8" typed_data: dependency: transitive description: @@ -663,7 +663,7 @@ packages: path: "../../../../veilid/veilid-flutter" relative: true source: path - version: "0.4.1" + version: "0.4.3" veilid_support: dependency: "direct main" description: @@ -682,10 +682,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" url: "https://pub.dev" source: hosted - version: "14.3.0" + version: "14.3.1" watcher: dependency: transitive description: @@ -751,5 +751,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.5.0 <4.0.0" + dart: ">=3.7.0-0 <4.0.0" flutter: ">=3.24.0" diff --git a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.freezed.dart b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.freezed.dart index e09fc0c..9e51ef8 100644 --- a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.freezed.dart +++ b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool.freezed.dart @@ -29,8 +29,12 @@ mixin _$DHTRecordPoolAllocations { throw _privateConstructorUsedError; IMap get debugNames => throw _privateConstructorUsedError; + /// Serializes this DHTRecordPoolAllocations to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of DHTRecordPoolAllocations + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $DHTRecordPoolAllocationsCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -59,6 +63,8 @@ class _$DHTRecordPoolAllocationsCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of DHTRecordPoolAllocations + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -114,6 +120,8 @@ class __$$DHTRecordPoolAllocationsImplCopyWithImpl<$Res> $Res Function(_$DHTRecordPoolAllocationsImpl) _then) : super(_value, _then); + /// Create a copy of DHTRecordPoolAllocations + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -188,12 +196,14 @@ class _$DHTRecordPoolAllocationsImpl implements _DHTRecordPoolAllocations { other.debugNames == debugNames)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, childrenByParent, parentByChild, const DeepCollectionEquality().hash(rootRecords), debugNames); - @JsonKey(ignore: true) + /// Create a copy of DHTRecordPoolAllocations + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$DHTRecordPoolAllocationsImplCopyWith<_$DHTRecordPoolAllocationsImpl> @@ -226,8 +236,11 @@ abstract class _DHTRecordPoolAllocations implements DHTRecordPoolAllocations { ISet> get rootRecords; @override IMap get debugNames; + + /// Create a copy of DHTRecordPoolAllocations + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$DHTRecordPoolAllocationsImplCopyWith<_$DHTRecordPoolAllocationsImpl> get copyWith => throw _privateConstructorUsedError; } @@ -243,8 +256,12 @@ mixin _$OwnedDHTRecordPointer { throw _privateConstructorUsedError; KeyPair get owner => throw _privateConstructorUsedError; + /// Serializes this OwnedDHTRecordPointer to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of OwnedDHTRecordPointer + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $OwnedDHTRecordPointerCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -269,6 +286,8 @@ class _$OwnedDHTRecordPointerCopyWithImpl<$Res, // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of OwnedDHTRecordPointer + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -309,6 +328,8 @@ class __$$OwnedDHTRecordPointerImplCopyWithImpl<$Res> $Res Function(_$OwnedDHTRecordPointerImpl) _then) : super(_value, _then); + /// Create a copy of OwnedDHTRecordPointer + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -357,11 +378,13 @@ class _$OwnedDHTRecordPointerImpl implements _OwnedDHTRecordPointer { (identical(other.owner, owner) || other.owner == owner)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, recordKey, owner); - @JsonKey(ignore: true) + /// Create a copy of OwnedDHTRecordPointer + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$OwnedDHTRecordPointerImplCopyWith<_$OwnedDHTRecordPointerImpl> @@ -388,8 +411,11 @@ abstract class _OwnedDHTRecordPointer implements OwnedDHTRecordPointer { Typed get recordKey; @override KeyPair get owner; + + /// Create a copy of OwnedDHTRecordPointer + /// with the given fields replaced by the non-null parameter values. @override - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) _$$OwnedDHTRecordPointerImplCopyWith<_$OwnedDHTRecordPointerImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool_private.dart b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool_private.dart index b7cbba8..d1fb5d1 100644 --- a/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool_private.dart +++ b/packages/veilid_support/lib/dht_support/src/dht_record/dht_record_pool_private.dart @@ -1,8 +1,5 @@ part of 'dht_record_pool.dart'; -const int _watchBackoffMultiplier = 2; -const int _watchBackoffMax = 30; - const int? _defaultWatchDurationSecs = null; // 600 const int _watchRenewalNumerator = 4; const int _watchRenewalDenominator = 5; diff --git a/packages/veilid_support/lib/identity_support/account_record_info.freezed.dart b/packages/veilid_support/lib/identity_support/account_record_info.freezed.dart index 0d5b327..a266230 100644 --- a/packages/veilid_support/lib/identity_support/account_record_info.freezed.dart +++ b/packages/veilid_support/lib/identity_support/account_record_info.freezed.dart @@ -23,8 +23,12 @@ mixin _$AccountRecordInfo { // Top level account keys and secrets OwnedDHTRecordPointer get accountRecord => throw _privateConstructorUsedError; + /// Serializes this AccountRecordInfo to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of AccountRecordInfo + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $AccountRecordInfoCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -50,6 +54,8 @@ class _$AccountRecordInfoCopyWithImpl<$Res, $Val extends AccountRecordInfo> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of AccountRecordInfo + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -63,6 +69,8 @@ class _$AccountRecordInfoCopyWithImpl<$Res, $Val extends AccountRecordInfo> ) as $Val); } + /// Create a copy of AccountRecordInfo + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $OwnedDHTRecordPointerCopyWith<$Res> get accountRecord { @@ -94,6 +102,8 @@ class __$$AccountRecordInfoImplCopyWithImpl<$Res> $Res Function(_$AccountRecordInfoImpl) _then) : super(_value, _then); + /// Create a copy of AccountRecordInfo + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -134,11 +144,13 @@ class _$AccountRecordInfoImpl implements _AccountRecordInfo { other.accountRecord == accountRecord)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, accountRecord); - @JsonKey(ignore: true) + /// Create a copy of AccountRecordInfo + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$AccountRecordInfoImplCopyWith<_$AccountRecordInfoImpl> get copyWith => @@ -161,10 +173,14 @@ abstract class _AccountRecordInfo implements AccountRecordInfo { factory _AccountRecordInfo.fromJson(Map json) = _$AccountRecordInfoImpl.fromJson; - @override // Top level account keys and secrets - OwnedDHTRecordPointer get accountRecord; +// Top level account keys and secrets @override - @JsonKey(ignore: true) + OwnedDHTRecordPointer get accountRecord; + + /// Create a copy of AccountRecordInfo + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$AccountRecordInfoImplCopyWith<_$AccountRecordInfoImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/veilid_support/lib/identity_support/identity.freezed.dart b/packages/veilid_support/lib/identity_support/identity.freezed.dart index 5977a26..3a276b0 100644 --- a/packages/veilid_support/lib/identity_support/identity.freezed.dart +++ b/packages/veilid_support/lib/identity_support/identity.freezed.dart @@ -24,8 +24,12 @@ mixin _$Identity { IMap> get accountRecords => throw _privateConstructorUsedError; + /// Serializes this Identity to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of Identity + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $IdentityCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -48,6 +52,8 @@ class _$IdentityCopyWithImpl<$Res, $Val extends Identity> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of Identity + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -81,6 +87,8 @@ class __$$IdentityImplCopyWithImpl<$Res> _$IdentityImpl _value, $Res Function(_$IdentityImpl) _then) : super(_value, _then); + /// Create a copy of Identity + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -121,11 +129,13 @@ class _$IdentityImpl implements _Identity { other.accountRecords == accountRecords)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash(runtimeType, accountRecords); - @JsonKey(ignore: true) + /// Create a copy of Identity + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$IdentityImplCopyWith<_$IdentityImpl> get copyWith => @@ -147,10 +157,14 @@ abstract class _Identity implements Identity { factory _Identity.fromJson(Map json) = _$IdentityImpl.fromJson; - @override // Top level account keys and secrets - IMap> get accountRecords; +// Top level account keys and secrets @override - @JsonKey(ignore: true) + IMap> get accountRecords; + + /// Create a copy of Identity + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$IdentityImplCopyWith<_$IdentityImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/veilid_support/lib/identity_support/identity_instance.freezed.dart b/packages/veilid_support/lib/identity_support/identity_instance.freezed.dart index a7c3e78..28bbad4 100644 --- a/packages/veilid_support/lib/identity_support/identity_instance.freezed.dart +++ b/packages/veilid_support/lib/identity_support/identity_instance.freezed.dart @@ -38,8 +38,12 @@ mixin _$IdentityInstance { // by SuperIdentity publicKey FixedEncodedString86 get signature => throw _privateConstructorUsedError; + /// Serializes this IdentityInstance to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of IdentityInstance + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $IdentityInstanceCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -68,6 +72,8 @@ class _$IdentityInstanceCopyWithImpl<$Res, $Val extends IdentityInstance> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of IdentityInstance + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -126,6 +132,8 @@ class __$$IdentityInstanceImplCopyWithImpl<$Res> $Res Function(_$IdentityInstanceImpl) _then) : super(_value, _then); + /// Create a copy of IdentityInstance + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -219,7 +227,7 @@ class _$IdentityInstanceImpl extends _IdentityInstance { other.signature == signature)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -229,7 +237,9 @@ class _$IdentityInstanceImpl extends _IdentityInstance { superSignature, signature); - @JsonKey(ignore: true) + /// Create a copy of IdentityInstance + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$IdentityInstanceImplCopyWith<_$IdentityInstanceImpl> get copyWith => @@ -256,25 +266,31 @@ abstract class _IdentityInstance extends IdentityInstance { factory _IdentityInstance.fromJson(Map json) = _$IdentityInstanceImpl.fromJson; - @override // Private DHT record storing identity account mapping - Typed get recordKey; - @override // Public key of identity instance - FixedEncodedString43 get publicKey; - @override // Secret key of identity instance +// Private DHT record storing identity account mapping + @override + Typed get recordKey; // Public key of identity instance + @override + FixedEncodedString43 get publicKey; // Secret key of identity instance // Encrypted with appended salt, key is DeriveSharedSecret( // password = SuperIdentity.secret, // salt = publicKey) // Used to recover accounts without generating a new instance - @Uint8ListJsonConverter() - Uint8List get encryptedSecretKey; - @override // Signature of SuperInstance recordKey and SuperInstance publicKey -// by publicKey - FixedEncodedString86 get superSignature; - @override // Signature of recordKey, publicKey, encryptedSecretKey, and superSignature -// by SuperIdentity publicKey - FixedEncodedString86 get signature; @override - @JsonKey(ignore: true) + @Uint8ListJsonConverter() + Uint8List + get encryptedSecretKey; // Signature of SuperInstance recordKey and SuperInstance publicKey +// by publicKey + @override + FixedEncodedString86 + get superSignature; // Signature of recordKey, publicKey, encryptedSecretKey, and superSignature +// by SuperIdentity publicKey + @override + FixedEncodedString86 get signature; + + /// Create a copy of IdentityInstance + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$IdentityInstanceImplCopyWith<_$IdentityInstanceImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/veilid_support/lib/identity_support/super_identity.freezed.dart b/packages/veilid_support/lib/identity_support/super_identity.freezed.dart index dc1c69a..9c5c6a7 100644 --- a/packages/veilid_support/lib/identity_support/super_identity.freezed.dart +++ b/packages/veilid_support/lib/identity_support/super_identity.freezed.dart @@ -53,8 +53,12 @@ mixin _$SuperIdentity { /// by publicKey FixedEncodedString86 get signature => throw _privateConstructorUsedError; + /// Serializes this SuperIdentity to a JSON map. Map toJson() => throw _privateConstructorUsedError; - @JsonKey(ignore: true) + + /// Create a copy of SuperIdentity + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) $SuperIdentityCopyWith get copyWith => throw _privateConstructorUsedError; } @@ -86,6 +90,8 @@ class _$SuperIdentityCopyWithImpl<$Res, $Val extends SuperIdentity> // ignore: unused_field final $Res Function($Val) _then; + /// Create a copy of SuperIdentity + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -124,6 +130,8 @@ class _$SuperIdentityCopyWithImpl<$Res, $Val extends SuperIdentity> ) as $Val); } + /// Create a copy of SuperIdentity + /// with the given fields replaced by the non-null parameter values. @override @pragma('vm:prefer-inline') $IdentityInstanceCopyWith<$Res> get currentInstance { @@ -161,6 +169,8 @@ class __$$SuperIdentityImplCopyWithImpl<$Res> _$SuperIdentityImpl _value, $Res Function(_$SuperIdentityImpl) _then) : super(_value, _then); + /// Create a copy of SuperIdentity + /// with the given fields replaced by the non-null parameter values. @pragma('vm:prefer-inline') @override $Res call({ @@ -298,7 +308,7 @@ class _$SuperIdentityImpl extends _SuperIdentity { other.signature == signature)); } - @JsonKey(ignore: true) + @JsonKey(includeFromJson: false, includeToJson: false) @override int get hashCode => Object.hash( runtimeType, @@ -309,7 +319,9 @@ class _$SuperIdentityImpl extends _SuperIdentity { const DeepCollectionEquality().hash(_deprecatedSuperRecordKeys), signature); - @JsonKey(ignore: true) + /// Create a copy of SuperIdentity + /// with the given fields replaced by the non-null parameter values. + @JsonKey(includeFromJson: false, includeToJson: false) @override @pragma('vm:prefer-inline') _$$SuperIdentityImplCopyWith<_$SuperIdentityImpl> get copyWith => @@ -337,44 +349,46 @@ abstract class _SuperIdentity extends SuperIdentity { factory _SuperIdentity.fromJson(Map json) = _$SuperIdentityImpl.fromJson; - @override - /// Public DHT record storing this structure for account recovery /// changing this can migrate/forward the SuperIdentity to a new DHT record /// Instances should not hash this recordKey, rather the actual record /// key used to store the superIdentity, as this may change. - Typed get recordKey; @override + Typed get recordKey; /// Public key of the SuperIdentity used to sign identity keys for recovery /// This must match the owner of the superRecord DHT record and can not be /// changed without changing the record - FixedEncodedString43 get publicKey; @override + FixedEncodedString43 get publicKey; /// Current identity instance /// The most recently generated identity instance for this SuperIdentity - IdentityInstance get currentInstance; @override + IdentityInstance get currentInstance; /// Deprecated identity instances /// These may be compromised and should not be considered valid for /// new signatures, but may be used to validate old signatures - List get deprecatedInstances; @override + List get deprecatedInstances; /// Deprecated superRecords /// These may be compromised and should not be considered valid for /// new signatures, but may be used to validate old signatures - List> get deprecatedSuperRecordKeys; @override + List> get deprecatedSuperRecordKeys; /// Signature of recordKey, currentInstance signature, /// signatures of deprecatedInstances, and deprecatedSuperRecordKeys /// by publicKey - FixedEncodedString86 get signature; @override - @JsonKey(ignore: true) + FixedEncodedString86 get signature; + + /// Create a copy of SuperIdentity + /// with the given fields replaced by the non-null parameter values. + @override + @JsonKey(includeFromJson: false, includeToJson: false) _$$SuperIdentityImplCopyWith<_$SuperIdentityImpl> get copyWith => throw _privateConstructorUsedError; } diff --git a/packages/veilid_support/lib/proto/dht.pb.dart b/packages/veilid_support/lib/proto/dht.pb.dart index 7a9ac9a..b1c0b47 100644 --- a/packages/veilid_support/lib/proto/dht.pb.dart +++ b/packages/veilid_support/lib/proto/dht.pb.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import @@ -16,7 +16,27 @@ import 'package:protobuf/protobuf.dart' as $pb; import 'veilid.pb.dart' as $0; class DHTData extends $pb.GeneratedMessage { - factory DHTData() => create(); + factory DHTData({ + $core.Iterable<$0.TypedKey>? keys, + $0.TypedKey? hash, + $core.int? chunk, + $core.int? size, + }) { + final $result = create(); + if (keys != null) { + $result.keys.addAll(keys); + } + if (hash != null) { + $result.hash = hash; + } + if (chunk != null) { + $result.chunk = chunk; + } + if (size != null) { + $result.size = size; + } + return $result; + } DHTData._() : super(); factory DHTData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory DHTData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -50,9 +70,12 @@ class DHTData extends $pb.GeneratedMessage { static DHTData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static DHTData? _defaultInstance; + /// Other keys to concatenate + /// Uses the same writer as this DHTList with SMPL schema @$pb.TagNumber(1) $core.List<$0.TypedKey> get keys => $_getList(0); + /// Hash of reassembled data to verify contents @$pb.TagNumber(2) $0.TypedKey get hash => $_getN(1); @$pb.TagNumber(2) @@ -64,6 +87,7 @@ class DHTData extends $pb.GeneratedMessage { @$pb.TagNumber(2) $0.TypedKey ensureHash() => $_ensure(1); + /// Chunk size per subkey @$pb.TagNumber(3) $core.int get chunk => $_getIZ(2); @$pb.TagNumber(3) @@ -73,6 +97,7 @@ class DHTData extends $pb.GeneratedMessage { @$pb.TagNumber(3) void clearChunk() => clearField(3); + /// Total data size @$pb.TagNumber(4) $core.int get size => $_getIZ(3); @$pb.TagNumber(4) @@ -83,8 +108,26 @@ class DHTData extends $pb.GeneratedMessage { void clearSize() => clearField(4); } +/// DHTLog - represents a ring buffer of many elements with append/truncate semantics +/// Header in subkey 0 of first key follows this structure class DHTLog extends $pb.GeneratedMessage { - factory DHTLog() => create(); + factory DHTLog({ + $core.int? head, + $core.int? tail, + $core.int? stride, + }) { + final $result = create(); + if (head != null) { + $result.head = head; + } + if (tail != null) { + $result.tail = tail; + } + if (stride != null) { + $result.stride = stride; + } + return $result; + } DHTLog._() : super(); factory DHTLog.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory DHTLog.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -117,6 +160,7 @@ class DHTLog extends $pb.GeneratedMessage { static DHTLog getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static DHTLog? _defaultInstance; + /// Position of the start of the log (oldest items) @$pb.TagNumber(1) $core.int get head => $_getIZ(0); @$pb.TagNumber(1) @@ -126,6 +170,7 @@ class DHTLog extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearHead() => clearField(1); + /// Position of the end of the log (newest items) @$pb.TagNumber(2) $core.int get tail => $_getIZ(1); @$pb.TagNumber(2) @@ -135,6 +180,7 @@ class DHTLog extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearTail() => clearField(2); + /// Stride of each segment of the dhtlog @$pb.TagNumber(3) $core.int get stride => $_getIZ(2); @$pb.TagNumber(3) @@ -145,8 +191,32 @@ class DHTLog extends $pb.GeneratedMessage { void clearStride() => clearField(3); } +/// DHTShortArray - represents a re-orderable collection of up to 256 individual elements +/// Header in subkey 0 of first key follows this structure +/// +/// stride = descriptor subkey count on first key - 1 +/// Subkeys 1..=stride on the first key are individual elements +/// Subkeys 0..stride on the 'keys' keys are also individual elements +/// +/// Keys must use writable schema in order to make this list mutable class DHTShortArray extends $pb.GeneratedMessage { - factory DHTShortArray() => create(); + factory DHTShortArray({ + $core.Iterable<$0.TypedKey>? keys, + $core.List<$core.int>? index, + $core.Iterable<$core.int>? seqs, + }) { + final $result = create(); + if (keys != null) { + $result.keys.addAll(keys); + } + if (index != null) { + $result.index = index; + } + if (seqs != null) { + $result.seqs.addAll(seqs); + } + return $result; + } DHTShortArray._() : super(); factory DHTShortArray.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory DHTShortArray.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -179,9 +249,16 @@ class DHTShortArray extends $pb.GeneratedMessage { static DHTShortArray getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static DHTShortArray? _defaultInstance; + /// Other keys to concatenate + /// Uses the same writer as this DHTList with SMPL schema @$pb.TagNumber(1) $core.List<$0.TypedKey> get keys => $_getList(0); + /// Item position index (uint8[256./]) + /// Actual item location is: + /// idx = index[n] + 1 (offset for header at idx 0) + /// key = idx / stride + /// subkey = idx % stride @$pb.TagNumber(2) $core.List<$core.int> get index => $_getN(1); @$pb.TagNumber(2) @@ -191,12 +268,26 @@ class DHTShortArray extends $pb.GeneratedMessage { @$pb.TagNumber(2) void clearIndex() => clearField(2); + /// Most recent sequence numbers for elements @$pb.TagNumber(3) $core.List<$core.int> get seqs => $_getList(2); } +/// A pointer to an child DHT record class OwnedDHTRecordPointer extends $pb.GeneratedMessage { - factory OwnedDHTRecordPointer() => create(); + factory OwnedDHTRecordPointer({ + $0.TypedKey? recordKey, + $0.KeyPair? owner, + }) { + final $result = create(); + if (recordKey != null) { + $result.recordKey = recordKey; + } + if (owner != null) { + $result.owner = owner; + } + return $result; + } OwnedDHTRecordPointer._() : super(); factory OwnedDHTRecordPointer.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory OwnedDHTRecordPointer.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -228,6 +319,7 @@ class OwnedDHTRecordPointer extends $pb.GeneratedMessage { static OwnedDHTRecordPointer getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static OwnedDHTRecordPointer? _defaultInstance; + /// DHT Record key @$pb.TagNumber(1) $0.TypedKey get recordKey => $_getN(0); @$pb.TagNumber(1) @@ -239,6 +331,7 @@ class OwnedDHTRecordPointer extends $pb.GeneratedMessage { @$pb.TagNumber(1) $0.TypedKey ensureRecordKey() => $_ensure(0); + /// DHT record owner key @$pb.TagNumber(2) $0.KeyPair get owner => $_getN(1); @$pb.TagNumber(2) diff --git a/packages/veilid_support/lib/proto/dht.pbenum.dart b/packages/veilid_support/lib/proto/dht.pbenum.dart index f76992d..7059e85 100644 --- a/packages/veilid_support/lib/proto/dht.pbenum.dart +++ b/packages/veilid_support/lib/proto/dht.pbenum.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/veilid_support/lib/proto/dht.pbjson.dart b/packages/veilid_support/lib/proto/dht.pbjson.dart index 9d505f0..dd14566 100644 --- a/packages/veilid_support/lib/proto/dht.pbjson.dart +++ b/packages/veilid_support/lib/proto/dht.pbjson.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/veilid_support/lib/proto/dht.pbserver.dart b/packages/veilid_support/lib/proto/dht.pbserver.dart index ffbf990..02e8c03 100644 --- a/packages/veilid_support/lib/proto/dht.pbserver.dart +++ b/packages/veilid_support/lib/proto/dht.pbserver.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields diff --git a/packages/veilid_support/lib/proto/veilid.pb.dart b/packages/veilid_support/lib/proto/veilid.pb.dart index a53133a..5431b80 100644 --- a/packages/veilid_support/lib/proto/veilid.pb.dart +++ b/packages/veilid_support/lib/proto/veilid.pb.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import @@ -13,8 +13,45 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; +/// 32-byte value in bigendian format class CryptoKey extends $pb.GeneratedMessage { - factory CryptoKey() => create(); + factory CryptoKey({ + $core.int? u0, + $core.int? u1, + $core.int? u2, + $core.int? u3, + $core.int? u4, + $core.int? u5, + $core.int? u6, + $core.int? u7, + }) { + final $result = create(); + if (u0 != null) { + $result.u0 = u0; + } + if (u1 != null) { + $result.u1 = u1; + } + if (u2 != null) { + $result.u2 = u2; + } + if (u3 != null) { + $result.u3 = u3; + } + if (u4 != null) { + $result.u4 = u4; + } + if (u5 != null) { + $result.u5 = u5; + } + if (u6 != null) { + $result.u6 = u6; + } + if (u7 != null) { + $result.u7 = u7; + } + return $result; + } CryptoKey._() : super(); factory CryptoKey.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory CryptoKey.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -125,8 +162,77 @@ class CryptoKey extends $pb.GeneratedMessage { void clearU7() => clearField(8); } +/// 64-byte value in bigendian format class Signature extends $pb.GeneratedMessage { - factory Signature() => create(); + factory Signature({ + $core.int? u0, + $core.int? u1, + $core.int? u2, + $core.int? u3, + $core.int? u4, + $core.int? u5, + $core.int? u6, + $core.int? u7, + $core.int? u8, + $core.int? u9, + $core.int? u10, + $core.int? u11, + $core.int? u12, + $core.int? u13, + $core.int? u14, + $core.int? u15, + }) { + final $result = create(); + if (u0 != null) { + $result.u0 = u0; + } + if (u1 != null) { + $result.u1 = u1; + } + if (u2 != null) { + $result.u2 = u2; + } + if (u3 != null) { + $result.u3 = u3; + } + if (u4 != null) { + $result.u4 = u4; + } + if (u5 != null) { + $result.u5 = u5; + } + if (u6 != null) { + $result.u6 = u6; + } + if (u7 != null) { + $result.u7 = u7; + } + if (u8 != null) { + $result.u8 = u8; + } + if (u9 != null) { + $result.u9 = u9; + } + if (u10 != null) { + $result.u10 = u10; + } + if (u11 != null) { + $result.u11 = u11; + } + if (u12 != null) { + $result.u12 = u12; + } + if (u13 != null) { + $result.u13 = u13; + } + if (u14 != null) { + $result.u14 = u14; + } + if (u15 != null) { + $result.u15 = u15; + } + return $result; + } Signature._() : super(); factory Signature.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Signature.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -317,8 +423,37 @@ class Signature extends $pb.GeneratedMessage { void clearU15() => clearField(16); } +/// 24-byte value in bigendian format class Nonce extends $pb.GeneratedMessage { - factory Nonce() => create(); + factory Nonce({ + $core.int? u0, + $core.int? u1, + $core.int? u2, + $core.int? u3, + $core.int? u4, + $core.int? u5, + }) { + final $result = create(); + if (u0 != null) { + $result.u0 = u0; + } + if (u1 != null) { + $result.u1 = u1; + } + if (u2 != null) { + $result.u2 = u2; + } + if (u3 != null) { + $result.u3 = u3; + } + if (u4 != null) { + $result.u4 = u4; + } + if (u5 != null) { + $result.u5 = u5; + } + return $result; + } Nonce._() : super(); factory Nonce.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory Nonce.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -409,8 +544,21 @@ class Nonce extends $pb.GeneratedMessage { void clearU5() => clearField(6); } +/// 36-byte typed crypto key class TypedKey extends $pb.GeneratedMessage { - factory TypedKey() => create(); + factory TypedKey({ + $core.int? kind, + CryptoKey? value, + }) { + final $result = create(); + if (kind != null) { + $result.kind = kind; + } + if (value != null) { + $result.value = value; + } + return $result; + } TypedKey._() : super(); factory TypedKey.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory TypedKey.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -442,6 +590,7 @@ class TypedKey extends $pb.GeneratedMessage { static TypedKey getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static TypedKey? _defaultInstance; + /// CryptoKind FourCC in bigendian format @$pb.TagNumber(1) $core.int get kind => $_getIZ(0); @$pb.TagNumber(1) @@ -451,6 +600,7 @@ class TypedKey extends $pb.GeneratedMessage { @$pb.TagNumber(1) void clearKind() => clearField(1); + /// Key value @$pb.TagNumber(2) CryptoKey get value => $_getN(1); @$pb.TagNumber(2) @@ -463,8 +613,21 @@ class TypedKey extends $pb.GeneratedMessage { CryptoKey ensureValue() => $_ensure(1); } +/// Key pair class KeyPair extends $pb.GeneratedMessage { - factory KeyPair() => create(); + factory KeyPair({ + CryptoKey? key, + CryptoKey? secret, + }) { + final $result = create(); + if (key != null) { + $result.key = key; + } + if (secret != null) { + $result.secret = secret; + } + return $result; + } KeyPair._() : super(); factory KeyPair.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); factory KeyPair.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); @@ -496,6 +659,7 @@ class KeyPair extends $pb.GeneratedMessage { static KeyPair getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static KeyPair? _defaultInstance; + /// Public key @$pb.TagNumber(1) CryptoKey get key => $_getN(0); @$pb.TagNumber(1) @@ -507,6 +671,7 @@ class KeyPair extends $pb.GeneratedMessage { @$pb.TagNumber(1) CryptoKey ensureKey() => $_ensure(0); + /// Private key @$pb.TagNumber(2) CryptoKey get secret => $_getN(1); @$pb.TagNumber(2) diff --git a/packages/veilid_support/lib/proto/veilid.pbenum.dart b/packages/veilid_support/lib/proto/veilid.pbenum.dart index 1ade7e9..89c0019 100644 --- a/packages/veilid_support/lib/proto/veilid.pbenum.dart +++ b/packages/veilid_support/lib/proto/veilid.pbenum.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/veilid_support/lib/proto/veilid.pbjson.dart b/packages/veilid_support/lib/proto/veilid.pbjson.dart index b92b4e5..db8318e 100644 --- a/packages/veilid_support/lib/proto/veilid.pbjson.dart +++ b/packages/veilid_support/lib/proto/veilid.pbjson.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields // ignore_for_file: unnecessary_import, unnecessary_this, unused_import diff --git a/packages/veilid_support/lib/proto/veilid.pbserver.dart b/packages/veilid_support/lib/proto/veilid.pbserver.dart index 2de2834..f799a3f 100644 --- a/packages/veilid_support/lib/proto/veilid.pbserver.dart +++ b/packages/veilid_support/lib/proto/veilid.pbserver.dart @@ -4,7 +4,7 @@ // // @dart = 2.12 -// ignore_for_file: annotate_overrides, camel_case_types +// ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names // ignore_for_file: deprecated_member_use_from_same_package, library_prefixes // ignore_for_file: non_constant_identifier_names, prefer_final_fields diff --git a/packages/veilid_support/lib/src/config.dart b/packages/veilid_support/lib/src/config.dart index 9f7703c..47bd84e 100644 --- a/packages/veilid_support/lib/src/config.dart +++ b/packages/veilid_support/lib/src/config.dart @@ -49,8 +49,7 @@ Future> getDefaultVeilidPlatformConfig( return VeilidFFIConfig( logging: VeilidFFIConfigLogging( terminal: VeilidFFIConfigLoggingTerminal( - enabled: - kIsDebugMode && (Platform.isIOS || Platform.isAndroid), + enabled: false, level: kIsDebugMode ? VeilidConfigLogLevel.debug : VeilidConfigLogLevel.info, @@ -116,6 +115,7 @@ Future getVeilidConfig(bool isWeb, String programName) async { const VeilidConfigCapabilities(disable: ['DHTV', 'DHTW', 'TUNL']), protectedStore: // XXX: Linux often does not have a secret storage mechanism installed - config.protectedStore.copyWith(allowInsecureFallback: Platform.isLinux), + config.protectedStore + .copyWith(allowInsecureFallback: !isWeb && Platform.isLinux), ); } diff --git a/packages/veilid_support/pubspec.lock b/packages/veilid_support/pubspec.lock index 260c991..447a27c 100644 --- a/packages/veilid_support/pubspec.lock +++ b/packages/veilid_support/pubspec.lock @@ -36,10 +36,9 @@ packages: async_tools: dependency: "direct main" description: - name: async_tools - sha256: bbded696bfcb1437d0ca510ac047f261f9c7494fea2c488dd32ba2800e7f49e8 - url: "https://pub.dev" - source: hosted + path: "../../../dart_async_tools" + relative: true + source: path version: "0.1.7" bloc: dependency: "direct main" @@ -141,10 +140,10 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" charcode: dependency: "direct main" description: @@ -173,10 +172,10 @@ packages: dependency: "direct main" description: name: collection - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.19.0" + version: "1.19.1" convert: dependency: transitive description: @@ -407,10 +406,10 @@ packages: dependency: "direct main" description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.16.0" mime: dependency: transitive description: @@ -726,7 +725,7 @@ packages: path: "../../../veilid/veilid-flutter" relative: true source: path - version: "0.4.1" + version: "0.4.3" vm_service: dependency: transitive description: @@ -792,5 +791,5 @@ packages: source: hosted version: "3.1.3" sdks: - dart: ">=3.6.0 <4.0.0" + dart: ">=3.7.0-0 <4.0.0" flutter: ">=3.24.0" diff --git a/packages/veilid_support/pubspec.yaml b/packages/veilid_support/pubspec.yaml index 8ed1f58..bcd965d 100644 --- a/packages/veilid_support/pubspec.yaml +++ b/packages/veilid_support/pubspec.yaml @@ -26,9 +26,9 @@ dependencies: # veilid: ^0.0.1 path: ../../../veilid/veilid-flutter -# dependency_overrides: -# async_tools: -# path: ../../../dart_async_tools +dependency_overrides: + async_tools: + path: ../../../dart_async_tools # bloc_advanced_tools: # path: ../../../bloc_advanced_tools diff --git a/pubspec.lock b/pubspec.lock index 9555644..93fdce8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -33,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" + animated_custom_dropdown: + dependency: "direct main" + description: + name: animated_custom_dropdown + sha256: "5a72dc209041bb53f6c7164bc2e366552d5197cdb032b1c9b2c36e3013024486" + url: "https://pub.dev" + source: hosted + version: "3.1.1" animated_switcher_transitions: dependency: "direct main" description: @@ -61,18 +69,18 @@ packages: dependency: "direct main" description: name: archive - sha256: "6199c74e3db4fbfbd04f66d739e72fe11c8a8957d5f219f1f4482dbde6420b5a" + sha256: "0c64e928dcbefddecd234205422bcfc2b5e6d31be0b86fef0d0dd48d7b4c9742" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.4" args: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.7.0" async: dependency: transitive description: @@ -85,18 +93,26 @@ packages: dependency: "direct main" description: name: async_tools - sha256: bbded696bfcb1437d0ca510ac047f261f9c7494fea2c488dd32ba2800e7f49e8 + sha256: a258558160d6adc18612d0c635ce0d18ceabc022f7933ce78ca4806075d79578 url: "https://pub.dev" source: hosted - version: "0.1.7" + version: "0.1.8" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + sha256: "3f5261cd3fb5f2a9ab4e2fc3fba84fd9fcaac8821f20a1d4e71f557521b22599" + url: "https://pub.dev" + source: hosted + version: "3.0.0" awesome_extensions: dependency: "direct main" description: name: awesome_extensions - sha256: "91dc128e8cf01fbd3d3567b8f1dd1e3183cbf9fd6b1850e8b0fafce9a7eee0da" + sha256: "9b1693e986e4045141add298fa2d7f9aa6cdd3c125b951e2cde739a5058ed879" url: "https://pub.dev" source: hosted - version: "2.0.20" + version: "2.0.21" badges: dependency: "direct main" description: @@ -117,10 +133,10 @@ packages: dependency: "direct main" description: name: basic_utils - sha256: "2064b21d3c41ed7654bc82cc476fd65542e04d60059b74d5eed490a4da08fc6c" + sha256: "548047bef0b3b697be19fa62f46de54d99c9019a69fb7db92c69e19d87f633c7" url: "https://pub.dev" source: hosted - version: "5.7.0" + version: "5.8.2" bidi: dependency: transitive description: @@ -141,10 +157,10 @@ packages: dependency: "direct main" description: name: bloc_advanced_tools - sha256: d8a680d8a0469456399fb26bae9f7a1d2a1420b5bdf75e204e0fadab9edb0811 + sha256: "977f3c7e3f9a19aec2f2c734ae99c8f0799c1b78f9fd7e4dce91a2dbf773e11b" url: "https://pub.dev" source: hosted - version: "0.1.8" + version: "0.1.9" blurry_modal_progress_hud: dependency: "direct main" description: @@ -221,10 +237,10 @@ packages: dependency: transitive description: name: built_value - sha256: "28a712df2576b63c6c005c465989a348604960c0958d28be5303ba9baa841ac2" + sha256: ea90e81dc4a25a043d9bee692d20ed6d1c4a1662a28c03a96417446c093ed6b4 url: "https://pub.dev" source: hosted - version: "8.9.3" + version: "8.9.5" cached_network_image: dependency: transitive description: @@ -261,18 +277,18 @@ packages: dependency: transitive description: name: camera_android_camerax - sha256: "7cc6adf1868bdcf4e63a56b24b41692dfbad2bec1cdceea451c77798f6a605c3" + sha256: "13784f539c7f104766bff84e4479a70f03b29d78b208278be45c939250d9d7f5" url: "https://pub.dev" source: hosted - version: "0.6.13" + version: "0.6.14+1" camera_avfoundation: dependency: transitive description: name: camera_avfoundation - sha256: "1eeb9ce7c9a397e312343fd7db337d95f35c3e65ad5a62ff637c8abce5102b98" + sha256: "3057ada0b30402e3a9b6dffec365c9736a36edbf04abaecc67c4309eadc86b49" url: "https://pub.dev" source: hosted - version: "0.9.18+8" + version: "0.9.18+9" camera_platform_interface: dependency: transitive description: @@ -301,10 +317,10 @@ packages: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.4.0" charcode: dependency: "direct main" description: @@ -349,10 +365,10 @@ packages: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" code_builder: dependency: transitive description: @@ -365,10 +381,10 @@ packages: dependency: transitive description: name: collection - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" url: "https://pub.dev" source: hosted - version: "1.19.0" + version: "1.19.1" convert: dependency: transitive description: @@ -377,14 +393,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.2" - cool_dropdown: - dependency: "direct main" - description: - name: cool_dropdown - sha256: "23926fd242b625bcb7ab30c1336498d60f78267518db439141ca19de403ab030" - url: "https://pub.dev" - source: hosted - version: "2.1.1" cross_file: dependency: transitive description: @@ -445,10 +453,10 @@ packages: dependency: transitive description: name: dio_web_adapter - sha256: e485c7a39ff2b384fa1d7e09b4e25f755804de8384358049124830b04fc4f93a + sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" equatable: dependency: "direct main" description: @@ -477,10 +485,10 @@ packages: dependency: transitive description: name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" file: dependency: transitive description: @@ -592,10 +600,10 @@ packages: dependency: "direct main" description: name: flutter_native_splash - sha256: "7062602e0dbd29141fb8eb19220b5871ca650be5197ab9c1f193a28b17537bc7" + sha256: edb09c35ee9230c4b03f13dd45bb3a276d0801865f0a4650b7e2a3bba61a803a url: "https://pub.dev" source: hosted - version: "2.4.4" + version: "2.4.5" flutter_parsed_text: dependency: transitive description: @@ -608,10 +616,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "615a505aef59b151b46bbeef55b36ce2b6ed299d160c51d84281946f0aa0ce0e" + sha256: "5a1e6fb2c0561958d7e4c33574674bda7b77caaca7a33b758876956f2902eea3" url: "https://pub.dev" source: hosted - version: "2.0.24" + version: "2.0.27" flutter_shaders: dependency: transitive description: @@ -677,10 +685,10 @@ packages: dependency: "direct main" description: name: form_builder_validators - sha256: "517fb884183fff7a0ef3db7d375981011da26ee452f20fb3d2e788ad527ad01d" + sha256: cd617fa346250293ff3e2709961d0faf7b80e6e4f0ff7b500126b28d7422dd67 url: "https://pub.dev" source: hosted - version: "11.1.1" + version: "11.1.2" freezed: dependency: "direct dev" description: @@ -733,10 +741,10 @@ packages: dependency: "direct main" description: name: go_router - sha256: "04539267a740931c6d4479a10d466717ca5901c6fdfd3fcda09391bbb8ebd651" + sha256: f02fd7d2a4dc512fec615529824fdd217fecb3a3d3de68360293a551f21634b3 url: "https://pub.dev" source: hosted - version: "14.8.0" + version: "14.8.1" graphs: dependency: transitive description: @@ -797,18 +805,26 @@ packages: dependency: "direct dev" description: name: icons_launcher - sha256: a7c83fbc837dc6f81944ef35c3756f533bb2aba32fcca5cbcdb2dbcd877d5ae9 + sha256: "2949eef3d336028d89133f69ef221d877e09deed04ebd8e738ab4a427850a7a2" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.0.1" + iconsax_flutter: + dependency: transitive + description: + name: iconsax_flutter + sha256: "95b65699da8ea98f87c5d232f06b0debaaf1ec1332b697e4d90969ec9a93037d" + url: "https://pub.dev" + source: hosted + version: "1.0.0" image: dependency: "direct main" description: name: image - sha256: "8346ad4b5173924b5ddddab782fc7d8a6300178c8b1dc427775405a01701c4a6" + sha256: "13d3349ace88f12f4a0d175eb5c12dcdd39d35c4c109a8a13dfeb6d0bd9e31c3" url: "https://pub.dev" source: hosted - version: "4.5.2" + version: "4.5.3" intl: dependency: "direct main" description: @@ -829,10 +845,10 @@ packages: dependency: transitive description: name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc" url: "https://pub.dev" source: hosted - version: "0.7.1" + version: "0.7.2" json_annotation: dependency: "direct main" description: @@ -901,10 +917,10 @@ packages: dependency: "direct main" description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.16.0" mime: dependency: transitive description: @@ -917,18 +933,10 @@ packages: dependency: "direct main" description: name: mobile_scanner - sha256: "91d28b825784e15572fdc39165c5733099ce0e69c6f6f0964ebdbf98a62130fd" + sha256: "9cb9e371ee9b5b548714f9ab5fd33b530d799745c83d5729ecd1e8ab2935dbd1" url: "https://pub.dev" source: hosted - version: "6.0.6" - motion_toast: - dependency: "direct main" - description: - name: motion_toast - sha256: "5a4775bf5a89a2402456047f194df5a5d6ac717af0d7694c8b9e37f324d1efd7" - url: "https://pub.dev" - source: hosted - version: "2.11.0" + version: "6.0.7" native_device_orientation: dependency: "direct main" description: @@ -957,26 +965,26 @@ packages: dependency: transitive description: name: package_config - sha256: "92d4488434b520a62570293fbd33bb556c7d49230791c1b4bbd973baf6d2dc67" + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.2.0" package_info_plus: dependency: "direct main" description: name: package_info_plus - sha256: "67eae327b1b0faf761964a1d2e5d323c797f3799db0e85aa232db8d9e922bc35" + sha256: "7976bfe4c583170d6cdc7077e3237560b364149fcd268b5f53d95a991963b191" url: "https://pub.dev" source: hosted - version: "8.2.1" + version: "8.3.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - sha256: "205ec83335c2ab9107bbba3f8997f9356d72ca3c715d2f038fc773d0366b4c76" + sha256: "6c935fb612dff8e3cc9632c2b301720c77450a126114126ffaafe28d2e87956c" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.0" pasteboard: dependency: "direct main" description: @@ -989,10 +997,10 @@ packages: dependency: "direct main" description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" path_parsing: dependency: transitive description: @@ -1013,10 +1021,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "4adf4fd5423ec60a29506c76581bc05854c55e3a0b72d35bb28d661c9686edf2" + sha256: "0ca7359dad67fd7063cb2892ab0c0737b2daafd807cf1acecd62374c8fae6c12" url: "https://pub.dev" source: hosted - version: "2.2.15" + version: "2.2.16" path_provider_foundation: dependency: transitive description: @@ -1049,6 +1057,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.0" + pausable_timer: + dependency: transitive + description: + name: pausable_timer + sha256: "6ef1a95441ec3439de6fb63f39a011b67e693198e7dae14e20675c3c00e86074" + url: "https://pub.dev" + source: hosted + version: "3.1.0+3" pdf: dependency: "direct main" description: @@ -1069,10 +1085,10 @@ packages: dependency: transitive description: name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646" url: "https://pub.dev" source: hosted - version: "6.0.2" + version: "6.1.0" photo_view: dependency: transitive description: @@ -1109,10 +1125,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" + sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5" url: "https://pub.dev" source: hosted - version: "3.9.1" + version: "4.0.0" pool: dependency: transitive description: @@ -1165,10 +1181,10 @@ packages: dependency: transitive description: name: pub_semver - sha256: "7b3cfbf654f3edd0c6298ecd5be782ce997ddf0e00531b9464b55245185bbbbd" + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" url: "https://pub.dev" source: hosted - version: "2.1.5" + version: "2.2.0" pubspec_parse: dependency: transitive description: @@ -1334,10 +1350,10 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: a768fc8ede5f0c8e6150476e14f38e2417c0864ca36bb4582be8e21925a03c22 + sha256: "3ec7210872c4ba945e3244982918e502fa2bfb5230dff6832459ca0e1879b7ad" url: "https://pub.dev" source: hosted - version: "2.4.6" + version: "2.4.8" shared_preferences_foundation: dependency: transitive description: @@ -1484,34 +1500,34 @@ packages: dependency: transitive description: name: sqflite - sha256: "2d7299468485dca85efeeadf5d38986909c5eb0cd71fd3db2c2f000e6c9454bb" + sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.4.2" sqflite_android: dependency: transitive description: name: sqflite_android - sha256: "78f489aab276260cdd26676d2169446c7ecd3484bbd5fead4ca14f3ed4dd9ee3" + sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.1" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "761b9740ecbd4d3e66b8916d784e581861fd3c3553eda85e167bc49fdb68f709" + sha256: "84731e8bfd8303a3389903e01fb2141b6e59b5973cacbb0929021df08dddbe8b" url: "https://pub.dev" source: hosted - version: "2.5.4+6" + version: "2.5.5" sqflite_darwin: dependency: transitive description: name: sqflite_darwin - sha256: "22adfd9a2c7d634041e96d6241e6e1c8138ca6817018afc5d443fef91dcefa9c" + sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" url: "https://pub.dev" source: hosted - version: "2.4.1+1" + version: "2.4.2" sqflite_platform_interface: dependency: transitive description: @@ -1564,10 +1580,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "69fe30f3a8b04a0be0c15ae6490fc859a78ef4c43ae2dd5e8a623d45bfcf9225" + sha256: "0669c70faae6270521ee4f05bffd2919892d42d1276e6c495be80174b6bc0ef6" url: "https://pub.dev" source: hosted - version: "3.3.0+3" + version: "3.3.1" system_info2: dependency: transitive description: @@ -1608,6 +1624,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + toastification: + dependency: "direct main" + description: + name: toastification + sha256: "9713989549d60754fd0522425d1251501919cfb7bab4ffbbb36ef40de5ea72b9" + url: "https://pub.dev" + source: hosted + version: "3.0.2" transitioned_indexed_stack: dependency: "direct main" description: @@ -1652,10 +1676,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193" + sha256: "1d0eae19bd7606ef60fe69ef3b312a437a16549476c42321d5dc1506c9ca3bf4" url: "https://pub.dev" source: hosted - version: "6.3.14" + version: "6.3.15" url_launcher_ios: dependency: transitive description: @@ -1758,7 +1782,7 @@ packages: path: "../veilid/veilid-flutter" relative: true source: path - version: "0.4.1" + version: "0.4.3" veilid_support: dependency: "direct main" description: @@ -1786,10 +1810,10 @@ packages: dependency: transitive description: name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" web_socket: dependency: transitive description: @@ -1810,10 +1834,10 @@ packages: dependency: transitive description: name: win32 - sha256: daf97c9d80197ed7b619040e86c8ab9a9dad285e7671ee7390f9180cc828a51e + sha256: dc6ecaa00a7c708e5b4d10ee7bec8c270e9276dfcab1783f57e9962d7884305f url: "https://pub.dev" source: hosted - version: "5.10.1" + version: "5.12.0" window_manager: dependency: "direct main" description: @@ -1879,5 +1903,5 @@ packages: source: hosted version: "1.1.2" sdks: - dart: ">=3.6.0 <4.0.0" + dart: ">=3.7.0 <4.0.0" flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index 5bc5e26..8b4a0a7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,69 +9,69 @@ environment: dependencies: accordion: ^2.6.0 - animated_bottom_navigation_bar: ^1.3.3 + animated_bottom_navigation_bar: ^1.4.0 + animated_custom_dropdown: ^3.1.1 animated_switcher_transitions: ^1.0.0 animated_theme_switcher: ^2.0.10 - ansicolor: ^2.0.2 - archive: ^4.0.2 - async_tools: ^0.1.7 - awesome_extensions: ^2.0.16 + ansicolor: ^2.0.3 + archive: ^4.0.4 + async_tools: ^0.1.8 + auto_size_text: ^3.0.0 + awesome_extensions: ^2.0.21 badges: ^3.1.2 - basic_utils: ^5.7.0 + basic_utils: ^5.8.2 bloc: ^8.1.4 - bloc_advanced_tools: ^0.1.8 + bloc_advanced_tools: ^0.1.9 blurry_modal_progress_hud: ^1.1.1 - change_case: ^2.1.0 - charcode: ^1.3.1 + change_case: ^2.2.0 + charcode: ^1.4.0 circular_profile_avatar: ^2.0.5 circular_reveal_animation: ^2.0.1 - cool_dropdown: ^2.1.0 cupertino_icons: ^1.0.8 - equatable: ^2.0.5 + equatable: ^2.0.7 expansion_tile_group: ^2.2.0 fast_immutable_collections: ^10.2.4 - file_saver: ^0.2.13 - fixnum: ^1.1.0 + file_saver: ^0.2.14 + fixnum: ^1.1.1 flutter: sdk: flutter - flutter_animate: ^4.5.0 - flutter_bloc: ^8.1.5 + flutter_animate: ^4.5.2 + flutter_bloc: ^8.1.6 flutter_chat_types: ^3.6.2 flutter_chat_ui: git: url: https://gitlab.com/veilid/flutter-chat-ui.git ref: main - flutter_form_builder: ^9.3.0 + flutter_form_builder: ^9.7.0 flutter_hooks: ^0.20.5 flutter_localizations: sdk: flutter - flutter_native_splash: ^2.4.0 + flutter_native_splash: ^2.4.5 flutter_slidable: ^4.0.0 flutter_spinkit: ^5.2.1 flutter_sticky_header: ^0.7.0 - flutter_svg: ^2.0.10+1 + flutter_svg: ^2.0.17 flutter_translate: ^4.1.0 flutter_zoom_drawer: ^3.2.0 - form_builder_validators: ^11.0.0 - freezed_annotation: ^2.4.1 - go_router: ^14.1.4 + form_builder_validators: ^11.1.2 + freezed_annotation: ^2.4.4 + go_router: ^14.8.1 hydrated_bloc: ^9.1.5 - image: ^4.2.0 + image: ^4.5.3 intl: ^0.19.0 json_annotation: ^4.9.0 loggy: ^2.0.3 - meta: ^1.12.0 - mobile_scanner: ^6.0.6 - motion_toast: ^2.10.0 + meta: ^1.16.0 + mobile_scanner: ^6.0.7 native_device_orientation: ^2.0.3 - package_info_plus: ^8.0.0 + package_info_plus: ^8.3.0 pasteboard: ^0.3.0 - path: ^1.9.0 - path_provider: ^2.1.3 - pdf: ^3.11.0 + path: ^1.9.1 + path_provider: ^2.1.5 + pdf: ^3.11.3 pinput: ^5.0.1 preload_page_view: ^0.2.0 - printing: ^5.13.1 + printing: ^5.14.2 protobuf: ^3.1.0 provider: ^6.1.2 qr_code_dart_scan: ^0.9.11 @@ -86,7 +86,7 @@ dependencies: url: https://gitlab.com/veilid/Searchable-Listview.git ref: main share_plus: ^10.1.4 - shared_preferences: ^2.2.3 + shared_preferences: ^2.5.2 signal_strength_indicator: ^0.4.1 sliver_expandable: ^1.1.1 sliver_fill_remaining_box_adapter: ^1.0.0 @@ -96,12 +96,13 @@ dependencies: url: https://gitlab.com/veilid/dart-sorted-list-improved.git ref: main split_view: ^3.2.1 - stack_trace: ^1.11.1 + stack_trace: ^1.12.1 star_menu: ^4.0.1 - stream_transform: ^2.1.0 + stream_transform: ^2.1.1 + toastification: ^3.0.2 transitioned_indexed_stack: ^1.0.2 - url_launcher: ^6.3.0 - uuid: ^4.4.0 + url_launcher: ^6.3.1 + uuid: ^4.5.1 veilid: # veilid: ^0.0.1 path: ../veilid/veilid-flutter @@ -111,8 +112,8 @@ dependencies: xterm: ^4.0.0 zxing2: ^0.2.3 -# dependency_overrides: -# async_tools: +#dependency_overrides: +# async_tools: # path: ../dart_async_tools # bloc_advanced_tools: # path: ../bloc_advanced_tools @@ -122,10 +123,10 @@ dependencies: # path: ../flutter_chat_ui dev_dependencies: - build_runner: ^2.4.11 - freezed: ^2.5.2 - icons_launcher: ^3.0.0 - json_serializable: ^6.8.0 + build_runner: ^2.4.15 + freezed: ^2.5.8 + icons_launcher: ^3.0.1 + json_serializable: ^6.9.4 lint_hard: ^5.0.0 flutter_native_splash: @@ -158,14 +159,28 @@ flutter: - assets/i18n/en.json # Launcher icon - assets/launcher/icon.png - # Images - - assets/images/splash.svg + # Theme wallpaper + - assets/images/wallpaper/arctic.svg + - assets/images/wallpaper/babydoll.svg + - assets/images/wallpaper/eggplant.svg + - assets/images/wallpaper/elite.svg + - assets/images/wallpaper/forest.svg + - assets/images/wallpaper/garden.svg + - assets/images/wallpaper/gold.svg + - assets/images/wallpaper/grim.svg + - assets/images/wallpaper/lapis.svg + - assets/images/wallpaper/lime.svg + - assets/images/wallpaper/scarlet.svg + - assets/images/wallpaper/vapor.svg + # Vector Images - assets/images/icon.svg + - assets/images/splash.svg - assets/images/title.svg - assets/images/vlogo.svg + # Raster Images - assets/images/ellet.png - - assets/images/toilet.png - assets/images/handshake.png + - assets/images/toilet.png # Printing - assets/js/pdf/3.2.146/pdf.min.js # Sounds diff --git a/build.bat b/update_generated_files.bat similarity index 100% rename from build.bat rename to update_generated_files.bat diff --git a/build.sh b/update_generated_files.sh similarity index 100% rename from build.sh rename to update_generated_files.sh