diff --git a/.gitea/ISSUE_TEMPLATE/bug.yaml b/.gitea/ISSUE_TEMPLATE/bug.yaml new file mode 100644 index 00000000..f9441722 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/bug.yaml @@ -0,0 +1,68 @@ +name: Bug report +about: File a bug report +labels: + - Bug +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! Please provide a short but a descriptive title for your issue. + - type: textarea + id: expected-behaviour + attributes: + label: Expected Behavior + description: What did you expect to happen? + validations: + required: true + - type: textarea + id: actual-behaviour + attributes: + label: Actual Behavior + description: What actually happened? + validations: + required: true + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to Reproduce + description: What steps can we follow to reproduce this issue? + placeholder: | + 1. First step + 2. Second step + 3. and so on... + validations: + required: true + - type: textarea + id: context + attributes: + label: Context and notes + description: Additional information about environment or what were you trying to do. If you have an idea how to fix this issue, please describe it here too. + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output, if you have any. This will be automatically formatted into code, so no need for backticks. + render: shell + - type: input + id: app-version + attributes: + label: App Version + description: What version of SelfPrivacy app are you running? You can find it in the "About" section of the app. + validations: + required: true + - type: input + id: api-version + attributes: + label: Server API Version + description: What version of SelfPrivacy API are you running? You can find it in the "About" section of the app. Leave it empty if your app is not connected to the server yet. + - type: dropdown + id: os + attributes: + label: Operating System + description: What operating system are you using? + options: + - Android + - iOS + - Linux + - macOS + - Windows diff --git a/.gitea/ISSUE_TEMPLATE/feature.yaml b/.gitea/ISSUE_TEMPLATE/feature.yaml new file mode 100644 index 00000000..8ff40a0f --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/feature.yaml @@ -0,0 +1,23 @@ +name: Feature request +about: Suggest an idea for this project +label: + - Feature request +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this feature request! Please provide a short but a descriptive title for your issue. + - type: textarea + id: description + attributes: + label: Description + description: Describe the feature you'd like to see. + placeholder: | + As a user, I want to be able to... + validations: + required: true + - type: textarea + id: context + attributes: + label: Context and notes + description: Additional information about environment and what were you trying to do. If you have an idea how to implement this feature, please describe it here too. diff --git a/.gitea/ISSUE_TEMPLATE/translation.yaml b/.gitea/ISSUE_TEMPLATE/translation.yaml new file mode 100644 index 00000000..c7348b94 --- /dev/null +++ b/.gitea/ISSUE_TEMPLATE/translation.yaml @@ -0,0 +1,29 @@ +name: Translation issue +about: File a translation (localization) issue +labels: + - Translations +body: + - type: markdown + attributes: + value: | + Translations can be modified and discussed on [Weblate](https://weblate.selfprivacy.org/projects/selfprivacy/). You can fix the mistranslation issue yourself there. Using the search, you can also find the string ID of the mistranslated string. If your issue is more complex, please file it here + + If you are a member of SelfPrivacy core team, you **must** fix the issue yourself on Weblate. + - type: input + id: language + attributes: + label: Language + description: What language is affected? + placeholder: | + English + validations: + required: true + - type: textarea + id: description + attributes: + label: Description + description: Describe the issue in detail. If you have an idea how to fix this issue, please describe it here too. Include the string ID of the mistranslated string, if possible. + placeholder: | + The string `string.id` is translated as "foo", but it should be "bar". + validations: + required: true diff --git a/appimage.yml b/appimage.yml index ce7bab35..40bcc3c3 100644 --- a/appimage.yml +++ b/appimage.yml @@ -10,7 +10,7 @@ AppDir: id: org.selfprivacy.app name: SelfPrivacy icon: org.selfprivacy.app - version: 0.8.0 + version: 0.9.1 exec: selfprivacy exec_args: $@ apt: diff --git a/assets/translations/az.json b/assets/translations/az.json index aae7107a..763d6b61 100644 --- a/assets/translations/az.json +++ b/assets/translations/az.json @@ -123,7 +123,6 @@ "disk": "Disk", "monthly_cost": "Aylıq xərc", "location": "Yerləşdirmə", - "provider": "Provayder", "core_count": { "one": "{} nüvəs", "two": "{} nüvələr", @@ -300,7 +299,6 @@ "manage_domain_dns": "Domeninizin DNS-ni idarə etmək üçün", "use_this_domain": "Biz bu domendən istifadə edirik?", "use_this_domain_text": "Göstərdiyiniz token bu domen üzərində nəzarəti təmin edir", - "cloudflare_api_token": "CloudFlare API Açarı", "connect_backblaze_storage": "Backblaze bulud yaddaşınızı birləşdirin", "no_connected_domains": "Hazırda heç bir bağlı domen yoxdur", "loading_domain_list": "Domenlərin siyahısı yüklənir", @@ -500,4 +498,4 @@ "reset_onboarding_description": "Enerji ekranını yenidən göstərmək üçün güc açarının sıfırlanması", "cubit_statuses": "Yükləmə kubitlərinin cari vəziyyəti" } -} \ No newline at end of file +} diff --git a/assets/translations/be.json b/assets/translations/be.json index c6dbf7e9..d634d64b 100644 --- a/assets/translations/be.json +++ b/assets/translations/be.json @@ -32,7 +32,6 @@ "manage_domain_dns": "Для кіравання DNS вашага дамена", "use_this_domain": "Ужываем гэты дамен?", "use_this_domain_text": "Указаны вамі токен дае кантроль над гэтым даменам", - "cloudflare_api_token": "API ключ DNS правайдэра", "connect_backblaze_storage": "Падлучыце хмарнае сховішча Backblaze", "no_connected_domains": "У дадзены момант падлучаных даменаў няма", "loading_domain_list": "Загружаем спіс даменаў", @@ -425,7 +424,6 @@ "disk": "Дыск", "monthly_cost": "Штомесячны кошт", "location": "Размяшчэнне", - "provider": "Правайдэр", "core_count": { "one": "{} ядро", "two": "{} ядра", @@ -510,4 +508,4 @@ "support": { "title": "Падтрымка SelfPrivacy" } -} \ No newline at end of file +} diff --git a/assets/translations/cs.json b/assets/translations/cs.json index 5186b74e..d989c463 100644 --- a/assets/translations/cs.json +++ b/assets/translations/cs.json @@ -118,7 +118,6 @@ "disk": "Místní disk", "monthly_cost": "Měsíční náklady", "location": "Umístění", - "provider": "Poskytovatel", "core_count": { "two": "{} jádra", "few": "{} jádra", @@ -144,7 +143,6 @@ "found_more_domains": "Nalezeno více než jedna doména. V zájmu vlastní bezpečnosti vás prosíme o odstranění nepotřebných domén", "server_created": "Vytvořený server. Probíhá kontrola DNS a spouštění serveru…", "choose_server_type_notice": "Důležité je zaměřit se na procesor a paměť RAM. Data vašich služeb budou uložena na připojeném svazku, který lze snadno rozšířit a za který se platí zvlášť.", - "cloudflare_api_token": "Klíč API poskytovatele DNS", "connect_backblaze_storage": "Připojení úložiště Backblaze", "save_domain": "Uložit doménu", "final": "Závěrečný krok", @@ -510,4 +508,4 @@ "ignore_tls": "Nekontrolujte certifikáty TLS", "ignore_tls_description": "Aplikace nebude při připojování k serveru ověřovat certifikáty TLS." } -} \ No newline at end of file +} diff --git a/assets/translations/de.json b/assets/translations/de.json index 86cc3518..4a39b818 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -123,7 +123,6 @@ "disk": "Festplatte", "monthly_cost": "Monatliche Kosten", "location": "Standort", - "provider": "Provider", "core_count": { "one": "{} Kern", "two": "{} Kerne", @@ -278,7 +277,6 @@ "manage_domain_dns": "Zum Verwalten des DNS Ihrer Domain", "use_this_domain": "Diese Domäne verwenden?", "use_this_domain_text": "Das von Ihnen bereitgestellte Token gewährt Zugriff auf die folgende Domäne", - "cloudflare_api_token": "API-Schlüssel des DNS-Anbieters", "connect_backblaze_storage": "Backblaze-Speicher verbinden", "no_connected_domains": "Derzeit keine verbundenen Domains", "loading_domain_list": "Domänenliste wird geladen", @@ -510,4 +508,4 @@ "ignore_tls": "Überprüfen Sie keine TLS-Zertifikate", "ignore_tls_description": "Die Anwendung validiert TLS-Zertifikate nicht, wenn sie eine Verbindung zum Server herstellt." } -} \ No newline at end of file +} diff --git a/assets/translations/en.json b/assets/translations/en.json index be15c159..95a22f58 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -35,7 +35,8 @@ "done": "Done", "continue": "Continue", "alert": "Alert", - "copied_to_clipboard": "Copied to clipboard!" + "copied_to_clipboard": "Copied to clipboard!", + "please_connect": "Please connect your server, domain and DNS provider to dive in!" }, "more_page": { "configuration_wizard": "Setup wizard", @@ -82,7 +83,7 @@ "no_key_name": "Unnamed key", "root_title": "These are superuser keys", "root_subtitle": "Owners of these keys get full access to the server and can do anything on it. Only add your own keys to the server.", - "input_label": "Public ED25519 or RSA key" + "input_label": "Public ED25519, ECDSA or RSA key" }, "onboarding": { "page1_title": "Digital independence, available to all of us", @@ -124,6 +125,7 @@ "disk": "Disk local", "monthly_cost": "Monthly cost", "location": "Location", + "pricing_error": "Couldn't fetch provider prices", "server_provider": "Server Provider", "dns_provider": "DNS Provider", "core_count": { @@ -219,7 +221,73 @@ "snapshot_modal_inplace_option_title": "Replace in place", "snapshot_modal_inplace_option_description": "Less free space needed, but more risk. Replaces current data with the snapshot data during the download.", "snapshot_modal_service_not_found": "This is a snapshot of a service you don't have on your server anymore. Usually this shouldn't happen, and we cannot do the automatic restore. You can still download the snapshot and restore it manually. Contact SelfPrivacy support if you need help.", - "restore_started": "Restore started, check the jobs list for the current status" + "restore_started": "Restore started, check the jobs list for the current status", + "snapshot_reason_title": "Creation reason", + "snapshot_reasons": { + "auto": "Created automatically", + "explicit": "Created by your explicit request", + "pre_restore": "Created as a precaution before risky restore", + "unknown": "Unknown" + }, + "rotation_quotas_title": "Snapshot rotation settings", + "set_rotation_quotas": "Set new rotation quotas", + "quotas_set": "New backup rotation quotas set", + "quotas_only_applied_to_autobackups": "These settings are only applied to automatic backups. Manual backups won't get deleted.", + "quota_titles": { + "last": "How many latest backups to keep", + "daily": "How many daily backups to keep", + "weekly": "How many weekly backups to keep", + "monthly": "How many monthly backups to keep", + "yearly": "How many yearly backups to keep" + }, + "quota_subtitles": { + "no_effect": "This rule has no effect because another rule will keep more backups", + "last": { + "zero": "Rule is disabled", + "one": "Last {} backup will be kept regardless of its age", + "two": "Last {} backups will be kept regardless of their age", + "few": "Last {} backups will be kept regardless of their age", + "many": "Last {} backups will be kept regardless of their age", + "other": "Last {} backups will be kept regardless of their age" + }, + "last_infinite": "All backups will be kept", + "daily": { + "zero": "Rule is disabled", + "one": "Last {} daily backup will be kept", + "two": "Last {} daily backups will be kept", + "few": "Last {} daily backups will be kept", + "many": "Last {} daily backups will be kept", + "other": "Last {} daily backups will be kept" + }, + "daily_infinite": "All daily backups will be kept", + "weekly": { + "zero": "Rule is disabled", + "one": "Last {} weekly backup will be kept", + "two": "Last {} weekly backups will be kept", + "few": "Last {} weekly backups will be kept", + "many": "Last {} weekly backups will be kept", + "other": "Last {} weekly backups will be kept" + }, + "weekly_infinite": "All weekly backups will be kept", + "monthly": { + "zero": "Rule is disabled", + "one": "Last {} monthly backup will be kept", + "two": "Last {} monthly backups will be kept", + "few": "Last {} monthly backups will be kept", + "many": "Last {} monthly backups will be kept", + "other": "Last {} monthly backups will be kept" + }, + "monthly_infinite": "All monthly backups will be kept", + "yearly": { + "zero": "Rule is disabled", + "one": "Last {} yearly backup will be kept", + "two": "Last {} yearly backups will be kept", + "few": "Last {} yearly backups will be kept", + "many": "Last {} yearly backups will be kept", + "other": "Last {} yearly backups will be kept" + }, + "yearly_infinite": "All yearly backups will be kept" + } }, "storage": { "card_title": "Server Storage", @@ -236,7 +304,9 @@ "extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.", "extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by your server provider. Server will be rebooted after resizing.", "extending_volume_error": "Couldn't initialize volume extending.", + "extending_volume_modal_description": "Upgrade to {} for {} plan per month.", "size": "Size", + "price": "Price", "data_migration_title": "Data migration", "data_migration_notice": "During migration all services will be turned off.", "start_migration_button": "Start migration", @@ -247,6 +317,7 @@ "in_menu": "Server is not set up yet. Please finish setup using setup wizard for further work." }, "service_page": { + "nothing_here": "Nothing here", "open_in_browser": "Open in browser", "restart": "Restart service", "disable": "Disable service", @@ -303,7 +374,6 @@ "add_new_user": "Add a first user", "new_user": "New user", "delete_user": "Delete user", - "not_ready": "Please connect server, domain and DNS in the Providers tab, to be able to add a first user", "nobody_here": "Nobody here", "login": "Login", "new_user_info_note": "New user will automatically be granted an access to all of the services", @@ -357,6 +427,9 @@ "choose_server_type_ram": "{} GB of RAM", "choose_server_type_storage": "{} GB of system storage", "choose_server_type_payment_per_month": "{} per month", + "choose_server_type_payment_server": "{} for the server", + "choose_server_type_payment_storage": "{} for additional storage", + "choose_server_type_payment_ip": "{} for the public IPv4 address", "no_server_types_found": "No available server types found. Make sure your account is accessible and try to change your server location.", "dns_provider_bad_key_error": "API key is invalid", "backblaze_bad_key_error": "Backblaze storage information is invalid", @@ -366,7 +439,8 @@ "manage_domain_dns": "To manage your domain's DNS", "use_this_domain": "Use this domain?", "use_this_domain_text": "The token you provided gives access to the following domain", - "cloudflare_api_token": "DNS Provider API Token", + "multiple_domains_found": "Multiple domains found", + "multiple_domains_found_text": "The token you provided gives access to the following domains. Please select the one you want to use. For the security of your other domains, you should restrict this token's access to only the domain you want to use with SelfPrivacy.", "connect_backblaze_storage": "Connect Backblaze storage", "no_connected_domains": "No connected domains at the moment", "loading_domain_list": "Loading domain list", @@ -554,4 +628,4 @@ "reset_onboarding_description": "Reset onboarding switch to show onboarding screen again", "cubit_statuses": "Cubit loading statuses" } -} +} \ No newline at end of file diff --git a/assets/translations/fr.json b/assets/translations/fr.json index e015c782..5fa6d1cc 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -111,7 +111,6 @@ "disk": "Disque local", "monthly_cost": "Coût mensuel", "location": "Localisation", - "provider": "Fournisseur", "core_count": { "one": "{} cœur", "two": "{} cœurs", @@ -286,4 +285,4 @@ "title": "Serveur VPN", "subtitle": "Serveur VPN privé" } -} \ No newline at end of file +} diff --git a/assets/translations/lv.json b/assets/translations/lv.json index 7fbfb797..bac9a852 100644 --- a/assets/translations/lv.json +++ b/assets/translations/lv.json @@ -121,7 +121,6 @@ "disk": "Disks lokāls", "monthly_cost": "Mēneša maksa", "location": "Vieta", - "provider": "Sniedzējs", "core_count": { "one": "{} kodols", "two": "{} kodoli", diff --git a/assets/translations/pl.json b/assets/translations/pl.json index 5a90cc86..ce1158ed 100644 --- a/assets/translations/pl.json +++ b/assets/translations/pl.json @@ -118,7 +118,6 @@ "disk": "Dysk lokalny", "monthly_cost": "Koszt miesięczny", "location": "Lokalizacja danych", - "provider": "Dostawca", "core_count": { "one": "{} jądro", "two": "{} jądra", @@ -321,7 +320,6 @@ "choose_server_type_payment_per_month": "{} miesięcznie", "no_server_types_found": "Nie znaleziono dostępnych typów serwerów! Proszę upewnić się, że masz dostęp do dostawcy serwera...", "use_this_domain": "Kto używa ten domen?", - "cloudflare_api_token": "Klucz API dostawcy DNS", "connect_backblaze_storage": "Dodajcie Blackblaze", "no_connected_domains": "Niema podłączonych domenów", "what": "Co to znaczy?", @@ -509,4 +507,4 @@ "cubit_statuses": "Aktualny stan qubitów ładujących", "ignore_tls": "Używane podczas konfigurowania nowego serwera." } -} \ No newline at end of file +} diff --git a/assets/translations/ru.json b/assets/translations/ru.json index ae4dac6b..2371da85 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -68,8 +68,8 @@ "reset_config_description": "Сбросить API ключи и root пользователя.", "delete_server_title": "Удалить сервер", "delete_server_description": "Действие приведёт к удалению сервера. После этого он будет недоступен.", - "system_dark_theme_title": "Системная тема по-умолчанию", - "system_dark_theme_description": "Используйте светлую или темную темы в зависимости от системных настроек", + "system_dark_theme_title": "Системная тема", + "system_dark_theme_description": "Будет использована светлая или тёмная тема в зависимости от системных настроек", "dangerous_settings": "Опасные настройки" }, "ssh": { @@ -124,14 +124,16 @@ "disk": "Диск", "monthly_cost": "Ежемесячная стоимость", "location": "Размещение", - "provider": "Провайдер", + "pricing_error": "Не удалось получить цены провайдера", "core_count": { "one": "{} ядро", "two": "{} ядра", "few": "{} ядра", "many": "{} ядер", "other": "{} ядер" - } + }, + "server_provider": "Провайдер сервера", + "dns_provider": "Провайдер DNS" }, "record": { "root": "Корневой домен", @@ -181,7 +183,7 @@ "reupload_key_subtitle": "Ещё раз проинициализирует хранилище резервных копий. Используйте, если что-то сломалось.", "service_busy": "Сейчас создаются другие резервные копии", "autobackup_period_never": "Автоматическое копирование отключено", - "pending_jobs": "Активные задачи на копирование", + "pending_jobs": "Активные задачи резервного копирования", "card_subtitle": "Управляйте резервными копиями", "refetch_backups_subtitle": "Сбросить кэш и запросить данные у провайдера. Может повлечь дополнительные расходы.", "select_all": "Копировать всё", @@ -200,7 +202,91 @@ "autobackup_period_set": "Период установлен", "backups_encryption_key": "Ключ шифрования", "snapshots_title": "Список снимков", - "forget_snapshot_error": "Не удалось забыть снимок" + "forget_snapshot_error": "Не удалось забыть снимок", + "backups_encryption_key_not_found": "Ключ шифрования пока не найден, повторите попытку позже.", + "forget_snapshot_alert": "Вы уверены что хотите удалить этот снимок? Это действие обычно нельзя отменить.", + "snapshot_modal_select_strategy": "Выберите стратегию восстановления", + "snapshot_modal_download_verify_option_description": "Меньше риск, но требуется больше свободного места. Загрузка всей резервной копии во временное хранилище, проверка целостности копии, и последующая замена текущих данных.", + "snapshot_modal_service_not_found": "Это снимок сервиса, которого больше нет на вашем сервере. Обычно этого не должно происходить, и мы не сможем выполнить автоматическое восстановление. Вы можете загрузить снимок и восстановить его вручную. Обратитесь в службу поддержки SelfPrivacy, если вам нужна помощь.", + "backups_encryption_key_subtitle": "Храните его в безопасном месте.", + "backups_encryption_key_copy": "Скопируйте ключ шифрования", + "backups_encryption_key_show": "Показать ключ шифрования", + "backups_encryption_key_description": "Этот ключ используется для шифрования резервных копий. Если вы его потеряете, то не сможете восстановить данные из резервной копии. Храните его в надежном месте. Он может пригодиться, если придётся восстанавливать данные вручную.", + "forget_snapshot": "Забудьте о моментальном снимке", + "snapshot_modal_heading": "Сведения о снимке", + "snapshot_service_title": "Сервис", + "snapshot_creation_time_title": "Время создания", + "snapshot_id_title": "ID снимка", + "snapshot_modal_download_verify_option_title": "Загрузить, проверить, и затем заменить", + "snapshot_modal_inplace_option_title": "Заменить на месте", + "snapshot_modal_inplace_option_description": "Требуется меньше свободного места, но выше риск. При загрузке данных из резервной копии заменяют текущие данные сразу.", + "restore_started": "Восстановление началось, проверьте текущий статус в списке заданий", + "quota_subtitles": { + "no_effect": "Это правило не имеет эффекта, так ак перекрыто другим правилом", + "last": { + "two": "Последние {} снимка будут сохраняться вне зависимости от даты создания", + "many": "Последние {} снимков будут сохраняться вне зависимости от даты создания", + "other": "Последние {} снимков будут сохраняться вне зависимости от даты создания", + "zero": "Правило отключено", + "one": "Последний {} снимок будет сохраняться вне зависимости от даты создания", + "few": "Последние {} снимка будут сохраняться вне зависимости от даты создания" + }, + "daily": { + "two": "Последние {} ежедневных снимка будут сохраняться", + "other": "Последние {} ежедневных снимков будут сохраняться", + "zero": "Правило отключено", + "one": "Последний {} ежедневный снимок будет сохраняться", + "few": "Последние {} ежедневных снимка будут сохраняться", + "many": "Последние {} ежедневных снимков будут сохраняться" + }, + "weekly": { + "two": "Последние {} еженедельных снимка будут сохраняться", + "other": "Последние {} еженедельных снимков будут сохраняться", + "zero": "Правило отключено", + "one": "Последний {} еженедельный снимок будет сохраняться", + "few": "Последние {} еженедельных снимка будут сохраняться", + "many": "Последние {} еженедельных снимков будут сохраняться" + }, + "monthly": { + "two": "Последние {} ежемесячных снимка будут сохраняться", + "other": "Последние {} ежемесячных снимков будут сохраняться", + "zero": "Правило отключено", + "one": "Последний {} ежемесячный снимок будет сохраняться", + "few": "Последние {} ежемесячных снимка будут сохраняться", + "many": "Последние {} ежемесячных снимков будут сохраняться" + }, + "yearly": { + "two": "Последние {} ежегодных снимка будут сохраняться", + "many": "Последние {} ежегодных снимков будут сохраняться", + "zero": "Правило отключено", + "one": "Последний {} ежегодный снимок будет сохраняться", + "few": "Последние {} ежегодных снимка будут сохраняться", + "other": "Последние {} ежегодных снимков будут сохраняться" + }, + "last_infinite": "Все снимки будут сохранены", + "daily_infinite": "Все ежедневные снимки будут сохраняться", + "weekly_infinite": "Все еженедельные снимки будут сохраняться", + "monthly_infinite": "Все ежемесячные снимки будут сохраняться", + "yearly_infinite": "Все ежегодные снимки будут сохраняться" + }, + "snapshot_reason_title": "Причина создания", + "snapshot_reasons": { + "auto": "Создано автоматически", + "explicit": "Создано по вашему явному запросу", + "pre_restore": "Создано в качестве меры предосторожности перед рискованным восстановлением", + "unknown": "Неизвестно" + }, + "rotation_quotas_title": "Настройки ротации снимков", + "set_rotation_quotas": "Задать новые квоты ротации", + "quotas_set": "Новые квоты ротации резервных копий заданы", + "quota_titles": { + "last": "Сколько последних снимков сохранять", + "daily": "Сколько ежедневных снимков сохранять", + "weekly": "Сколько еженедельных снимков сохранять", + "monthly": "Сколько ежемесячных снимков сохранять", + "yearly": "Сколько ежегодных снимков сохранять" + }, + "quotas_only_applied_to_autobackups": "Эти настройки применяются только к резервным копиям, созданным автоматически. Созданные вручную резервные копии не будут удалены этими правилами." }, "storage": { "card_title": "Хранилище", @@ -300,7 +386,7 @@ "username_rule": "Имя может содержать только маленькие латинские буквы, цифры, подчёркивания, не может начинаться с цифр", "email_login": "Авторизация по Email", "no_ssh_notice": "Для этого пользователя созданы только SSH и Email аккаунт. Единая авторизация для всех сервисов ещё не реализована.", - "details_title": "Пользовательские данные" + "details_title": "Пользователь" }, "initializing": { "dns_provider_description": "Это позволит связать ваш домен с IP адресом:", @@ -337,6 +423,9 @@ "choose_server_type_ram": "{} GB у RAM", "choose_server_type_storage": "{} GB системного хранилища", "choose_server_type_payment_per_month": "{} в месяц", + "choose_server_type_payment_server": "{} за сам сервер", + "choose_server_type_payment_storage": "{} за расширяемое хранилище", + "choose_server_type_payment_ip": "{} за публичный IPv4", "no_server_types_found": "Не найдено доступных типов сервера! Пожалуйста, убедитесь, что у вас есть доступ к провайдеру сервера...", "dns_provider_bad_key_error": "API ключ неверен", "backblaze_bad_key_error": "Информация о Backblaze хранилище неверна", @@ -345,7 +434,6 @@ "manage_domain_dns": "Для управления DNS вашего домена", "use_this_domain": "Используем этот домен?", "use_this_domain_text": "Указанный вами токен даёт контроль над этим доменом", - "cloudflare_api_token": "API ключ DNS провайдера", "connect_backblaze_storage": "Подключите облачное хранилище Backblaze", "no_connected_domains": "На данный момент подлюченных доменов нет", "loading_domain_list": "Загружаем список доменов", @@ -370,15 +458,17 @@ "server_type": "Тип сервера", "nixos_installation": "Установка NixOS", "dns_provider": "DNS провайдер", - "backups_provider": "Резервные копии", + "backups_provider": "Резервное копирование", "domain": "Домен", - "master_account": "Мастер аккаунт", + "master_account": "Главная учетная запись", "server": "Сервер", "dns_setup": "Установка DNS", "server_reboot": "Перезагрузка сервера", "final_checks": "Финальные проверки" }, - "server_provider_description": "Место, где будут находиться ваши данные и службы SelfPrivacy:" + "server_provider_description": "Место, где будут находиться ваши данные и сервисы SelfPrivacy:", + "multiple_domains_found": "Найдено несколько доменов", + "multiple_domains_found_text": "Предоставленный токен дает доступ к следующим доменам. Пожалуйста, выберите тот, который вы хотите использовать. Для обеспечения безопасности других доменов следует ограничить доступ этого токена только тем доменом, который вы хотите использовать с SelfPrivacy." }, "recovering": { "generic_error": "Ошибка проведения операции, попробуйте ещё раз.", @@ -481,7 +571,7 @@ "you_cant_use_this_api": "Нельзя использовать этот API для доменом с подобным TLD.", "yes": "Да", "no": "Нет", - "volume_creation_error": "Не удалось создать том." + "volume_creation_error": "Не удалось создать хранилище." }, "timer": { "sec": "{} сек" @@ -528,11 +618,11 @@ "server_setup": "Мастер установки сервера", "use_staging_acme": "Использование тестового ACME сервера", "use_staging_acme_description": "Применяется при настройке нового сервера.", - "routing": "Маршрутизация приложений", + "routing": "Роутинг приложения", "reset_onboarding": "Сбросить флаг посещения приветствия", "cubit_statuses": "Текущий статут кубитов загрузки", - "reset_onboarding_description": "Сброс переключателя включения для повторного отображения экрана включения", + "reset_onboarding_description": "Принудить показ приветственного экрана", "ignore_tls_description": "Приложение не будет проверять сертификаты TLS при подключении к серверу.", "ignore_tls": "Не проверять сертификаты TLS" } -} \ No newline at end of file +} diff --git a/assets/translations/sk.json b/assets/translations/sk.json index c79d251e..514b47eb 100644 --- a/assets/translations/sk.json +++ b/assets/translations/sk.json @@ -173,7 +173,6 @@ "disk": "Lokálny disk", "monthly_cost": "Mesačná cena", "location": "Lokalita", - "provider": "Poskytovateľ", "core_count": { "one": "{} jadro", "two": "{} jadrá", @@ -280,7 +279,6 @@ "enter_username_and_password": "Zadajte používateľské meno a zložité heslo", "finish": "Všetko je inicializované", "use_this_domain_text": "Token, ktorý ste poskytli, poskytuje prístup k nasledujúcej doméne", - "cloudflare_api_token": "CloudFlare API Token", "connect_backblaze_storage": "Pripojte svoje cloudové úložisko Backblaze", "no_connected_domains": "Momentálne nie sú pripojené žiadne domény", "loading_domain_list": "Načítava sa zoznam domén", @@ -500,4 +498,4 @@ "reset_onboarding_description": "Resetovanie vypínača na opätovné zobrazenie obrazovky zapnutia", "cubit_statuses": "Aktuálny stav načítavania qubitov" } -} \ No newline at end of file +} diff --git a/assets/translations/sl.json b/assets/translations/sl.json index 4cbf91d1..f8250745 100644 --- a/assets/translations/sl.json +++ b/assets/translations/sl.json @@ -116,8 +116,7 @@ "ram": "Glavni pomnilnik", "disk": "Lokalni disk", "monthly_cost": "Mesečni stroški", - "location": "Lokacija", - "provider": "Ponudnik" + "location": "Lokacija" }, "ssh": { "root_subtitle": "Lastniki tukaj navedenih ključev imajo popoln dostop do podatkov in nastavitev strežnika. Dodajte samo svoje ključe.", diff --git a/assets/translations/th.json b/assets/translations/th.json index aa54a203..de7c5082 100644 --- a/assets/translations/th.json +++ b/assets/translations/th.json @@ -149,7 +149,6 @@ "ram": "หน่วยความจำ", "monthly_cost": "รายจ่ายต่อเดือน", "location": "สถานที่", - "provider": "ผู้ให้บริการ", "core_count": { "one": "{} core", "two": "{} จำนวนคอร์", @@ -293,4 +292,4 @@ "title": "เซิฟเวอร์ VPN", "subtitle": "เซิฟเวอร์ VPN ส่วนตัว" } -} \ No newline at end of file +} diff --git a/assets/translations/uk.json b/assets/translations/uk.json index d3384ca5..4ddfe3ff 100644 --- a/assets/translations/uk.json +++ b/assets/translations/uk.json @@ -33,7 +33,8 @@ "delete": "Видалити", "close": "Закрити", "connect": "Підключіться", - "app_name": "SelfPrivacy" + "app_name": "SelfPrivacy", + "copied_to_clipboard": "Скопійовано в буфер обміну!" }, "locale": "ua", "application_settings": { @@ -43,7 +44,10 @@ "dark_theme_description": "Змінити тему додатка", "reset_config_description": "Скинути API ключі та root користувача.", "delete_server_title": "Видалити сервер", - "delete_server_description": "Це видалить ваш сервер. Він більше не буде доступний." + "delete_server_description": "Це видалить ваш сервер. Він більше не буде доступний.", + "system_dark_theme_title": "Системна тема за замовчуванням", + "system_dark_theme_description": "Використовуйте світлу або темну теми залежно від системних налаштувань", + "dangerous_settings": "Небезпечні налаштування" }, "ssh": { "delete_confirm_question": "Ви впевнені, що хочете видалити SSH-ключ?", @@ -134,7 +138,6 @@ "select_dns": "Тепер давайте оберемо DNS-провайдера", "manage_domain_dns": "Для управління DNS домену", "use_this_domain": "Скористатися цим доменом?", - "cloudflare_api_token": "CloudFlare API токен", "connect_backblaze_storage": "Підключити Backblaze сховище", "no_connected_domains": "Наразі немає пов'язаних доменів", "save_domain": "Зберегти домен", @@ -210,7 +213,6 @@ "server_id": "Сервер ID", "cpu": "Процессор", "ram": "Пам'ять", - "provider": "Провайдер", "core_count": { "one": "{} ядро", "few": "{} ядра", @@ -224,7 +226,9 @@ "server_timezone": "Часовий пояс сервера", "timezone_search_bar": "Ім'я часового поясу або значення зсуву часу", "monthly_cost": "Щомісячна вартість", - "location": "Місцезнаходження" + "location": "Місцезнаходження", + "server_provider": "Провайдер сервера", + "dns_provider": "Провайдер DNS" }, "record": { "api": "SelfPrivacy API", @@ -251,7 +255,7 @@ "email_title": "Електронна пошта", "email_subtitle": "Записи, необхідні для безпечного обміну електронною поштою.", "update_list": "Лист оновлень", - "error_subtitle": "Нажміть сюди, щоб виправити їх", + "error_subtitle": "Натисніть тут, щоб виправити їх. При цьому також буде видалено користувацькі записи.", "services_subtitle": "Введіть \"А\" записи, необхідні для кожної служби." }, "backup": { @@ -270,7 +274,29 @@ "description": "Врятує ваш день у разі аварії: хакерська атака, видаленя серверу, тощо.", "waiting_for_rebuild": "Ви зможете створити свою першу резервну копію через кілька хвилин.", "restoring": "Відновлення з резервної копії", - "restore_alert": "Ви збираєтеся відновити з резервної копії. створеної на {}. Усі поточні дані будуть втрачені. Ви згодні?" + "restore_alert": "Ви збираєтеся відновити з резервної копії. створеної на {}. Усі поточні дані будуть втрачені. Ви згодні?", + "refetch_backups_subtitle": "Скинути кеш і запросити дані у провайдера. Може спричинити додаткові витрати.", + "reupload_key_subtitle": "Ще раз проініціалізує сховище резервних копій. Використовуйте, якщо щось зламалося.", + "create_new_select_heading": "Вибрати сервіси для копіювання", + "start": "Почати створення копій", + "service_busy": "Зараз створюються інші резервні копії", + "latest_snapshots": "Останні знімки", + "latest_snapshots_subtitle": "Останні 15 знімків", + "show_more": "Показати ще", + "autobackup_period_title": "Період автоматичного копіювання", + "autobackup_period_subtitle": "Створення копій раз на {period}", + "autobackup_period_never": "Автоматичне копіювання вимкнено", + "autobackup_period_every": "Раз у {period}", + "autobackup_period_disable": "Вимкнути автоматичні копіювання", + "autobackup_custom": "Інше", + "autobackup_custom_hint": "Введіть період у хвилинах", + "autobackup_set_period": "Встановити період", + "autobackup_period_set": "Період встановлено", + "backups_encryption_key": "Ключ шифрування", + "backups_encryption_key_subtitle": "Зберігайте його в безпечному місці.", + "backups_encryption_key_copy": "Скопіюйте ключ шифрування", + "card_subtitle": "Керуйте резервними копіями", + "select_all": "Копіювати все" }, "storage": { "card_title": "Серверне сховище", @@ -469,4 +495,4 @@ "root_name": "Не може бути 'root'", "length_not_equal": "Довжина [], має бути {}" } -} \ No newline at end of file +} diff --git a/fastlane/metadata/android/en-US/changelogs/0.9.0.txt b/fastlane/metadata/android/en-US/changelogs/0.9.0.txt new file mode 100644 index 00000000..29ac8043 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/0.9.0.txt @@ -0,0 +1,145 @@ +### Features + +- New backups implementation ([#228](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/228), [#274](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/274), [#324](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/324), [#325](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/325), [#326](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/326), [#331](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/331), [#332](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/332)) +- DigitalOcean as a DNS provider ([#213](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/213)) +- DeSEC as a DNS provider ([#211](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/211)) +- Support drawer and basic support documentation logic unit ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Automatic day/night theme ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- New router and adaptive layouts ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- New Material 3 animation curves ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Jobs button to the app bar of more screens ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Refreshed UI of modal sheets ([#228](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/228)) +- Support for `XDG_DATA_HOME` storage path on Linux for app data ([#240](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/240)) +- Accept-Language header for the server API ([#243](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/243), resolves [#205](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/205)) +- Visible providers names during server recovery ([#264](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/264), resolves [#249](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/249)) +- Visible volume and IPv4 cost added to overall monthly cost of the server ([#270](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/270), resolves [#115](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/115)) +- Support for autofocus on text fields for keyboard displaying ([#294](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/294), resolves [#292](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/292)) +- New dialogue to choose a domain if user DNS token provides access to several ([#330](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/330), resolves [#328](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/328)) + +### Bug Fixes + +- Fix opening URLs from the app ([#213](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/213)) +- Fix parsing of RAM size with DigitalOcean ([#200](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/200), resolves [#199](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/199)) +- Devices and Recovery Key cubits couldn't initialize right after server installation ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Fix BottomBar showing incorrect animation when navigating from sibling routes ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- PopUpDialogs couldn't find the context. ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Update recovery flow to use new support drawer ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- New app log console ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Improve installation failure dialogues ([#213](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/213)) +- Privacy policy link pointed at wrong domain ([#207](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/207)) +- Remove price lists for DNS ([#211](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/211)) +- Implement better domain id check on DNS restoration ([#211](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/211)) +- Add forced JSON content type to REST APIs ([#212](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/212)) +- Remove unneded DNS check depending on CLOUDFLARE ([#212](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/212)) +- Add background for dialogue pop ups and move them to root navigator ([#233](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/233), resolves [#231](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/231)) +- Make currency be properly shown again via shortcode ([#234](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/234), related to [#223](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/223)) +- Add proper server type value loading ([#236](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/236), resolves [#215](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/215)) +- Implement proper load functions for DNS and Server providers ([#237](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/237), resolves [#220](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/220)) +- Prevent moving a service if volume is null for some reason ([#245](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/245)) +- Replace hard reset from server provider with direct server reboot ([#269](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/269), resolves [#266](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/266)) +- Normalize Hetzner CPU usage percentage by cached amount of cores ([#272](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/272), resolves [#156](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/156)) +- Change broken validations string for superuser SSH ([#276](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/27)) +- Don't let service migration to start bif the same volume was picked ([#297](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/297), resolves [#289](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/289)) +- Wrap DNS check in catch to avoid runtime crash ([#322](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/322)) +- Implement Backblaze bucket restoration on server recovery ([#324](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/324)) + +### Refactor + +- Migrate to Flutter 3.10 and Dart 3.0 +- Migrate to AutoRouter v6 ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Get rid of BrandText and restructure the buttons ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Remove brand alert dialogs and bottom sheet ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Remove unused UI components ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Remove BrandCards ([#203](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/203)) +- Allow changing values for TLS settings +- Replace String shortcode with Currency class ([#226](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/226)) +- Rearrange Server Provider interface ([#227](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/227)) +- Remove unused service state getters ([#228](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/228)) +- Remove unused utils, add duration formatter ([#228](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/228)) +- Move rest api methods according to their business logic files positions ([#235](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/235), partially resolves [#217](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/217) and [#219](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/219)) +- Make flag getter a part of server provider location object ([#238](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/238), resolves [#222](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/222)) + + +### Translation contributions + +* Ukrainian + + * FoxMeste (3) + * Mithras (31) + +* Latvian + + * Not Telling Lol (183) + + +* German + + * Mithras (41) + * FoxMeste (213) + + +* Thai + + * FoxMeste (77) + + +* Polish + + * Mithras (41) + * Thary (43) + * FoxMeste (163) + + +* Slovenian + + * Mithras (212) + + +* Czech + + * NaiJi ✨ (2) + * Mithras (109) + * FoxMeste (308) + + +* Russian + + * FoxMeste (4) + * Revertron (8) + * NaiJi ✨ (23) + * Mithras (54) + * Inex Code (59) + + +* Slovak + + * Mithras (29) + * Revertron (396) + + +* Macedonian + + * FoxMeste (7) + + +* Belarusian + + * Thary (1) + * FoxMeste (3) + * Mithras (47) + + +* French + + * Côme (211) + + +* Spanish + + * FoxMeste (7) + + +* Azerbaijani + + * Mithras (28) + * Ortibexon (403) diff --git a/fastlane/metadata/android/en-US/changelogs/0.9.1.txt b/fastlane/metadata/android/en-US/changelogs/0.9.1.txt new file mode 100644 index 00000000..59b28862 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/0.9.1.txt @@ -0,0 +1,20 @@ +### Bug Fixes + +- Fix volume resizing on Digital Ocean ([#368](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/368), resolves [#367](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/367)) +- Disable the storage card while volume information is being fetched ([#369](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/369), resolves [#317](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/317)) + + +### Features + +- Add copy-to-clipboard for email on user page ([#329](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/329), resolves [#287](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/287)) +- Add support for ECDSA SSH keys ([#362](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/362), resolves [#319](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/319)) +- Implement confirmation modal for the volume resize ([#372](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/372), resolves [#308](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/308)) + +### Other changes + +- Move service descriptions above login info for service cards ([#342](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/342), resolves [#341](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/341)) +- Add measure units to 'Extending volume' page ([#344](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/344), resolves [#301](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/301)) +- Make users to be ordered properly on users page ([#343](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/343), resolves [#340](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/340)) +- Move service card name to its icon row ([#352](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/352), resolves [#350](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/350)) +- Reorganize placeholders for empty pages ([#359](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/359), resolves [#348](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/348)) +- Remove redundant zone id cache for Cloudflare ([#371](https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/issues/371)) diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/5.jpg b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.jpg new file mode 100644 index 00000000..11477ad3 Binary files /dev/null and b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.jpg differ diff --git a/flake.lock b/flake.lock index cfd8ecfe..14cdcc98 100644 --- a/flake.lock +++ b/flake.lock @@ -66,16 +66,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1662096612, - "narHash": "sha256-R+Q8l5JuyJryRPdiIaYpO5O3A55rT+/pItBrKcy7LM4=", + "lastModified": 1693250523, + "narHash": "sha256-y3up5gXMTbnCsXrNEB5j+7TVantDLUYyQLu/ueiXuyg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "21de2b973f9fee595a7a1ac4693efff791245c34", + "rev": "3efb0f6f404ec8dae31bdb1a9b17705ce0d6986e", "type": "github" }, "original": { "id": "nixpkgs", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "type": "indirect" } }, diff --git a/flake.nix b/flake.nix index d1895b0a..a124dc2c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { nixConfig.bash-prompt = "\[selfprivacy\]$ "; - inputs.nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.nixgl.url = "github:guibou/nixGL"; @@ -9,19 +9,48 @@ flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { + inherit system; config.allowUnfree = true; config.android_sdk.accept_license = true; - system = "x86_64-linux"; overlays = [ nixgl.overlay ]; }; androidComposition = pkgs.androidenv.composeAndroidPackages { - toolsVersion = "26.1.1"; - platformToolsVersion = "33.0.2"; - buildToolsVersions = [ "30.0.3" ]; - platformVersions = [ "31" "30" "29" ]; + platformToolsVersion = "34.0.4"; + buildToolsVersions = [ "34.0.0" ]; + platformVersions = [ "34" "33" "32" "31" "30" ]; }; + spAndroidStudio = pkgs.symlinkJoin { + name = "spAndroidStudio"; + paths = with pkgs; [ + android-studio + flutter.unwrapped + # dart + gnumake + check + pkg-config + glibc + android-tools + jdk + git + ]; + + nativeBuildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/flutter \ + --prefix ANDROID_SDK_ROOT=${androidComposition.androidsdk}/libexec/android-sdk \ + --prefix ANDROID_HOME=${androidComposition.androidsdk}/libexec/android-sdk \ + --prefix ANDROID_JAVA_HOME=${pkgs.jdk.home} + + wrapProgram $out/bin/android-studio \ + --prefix FLUTTER_SDK=${pkgs.flutter.unwrapped} \ + --prefix ANDROID_SDKz_ROOT=${androidComposition.androidsdk}/libexec/android-sdk \ + --prefix ANDROID_HOME=${androidComposition.androidsdk}/libexec/android-sdk \ + --prefix ANDROID_JAVA_HOME=${pkgs.jdk.home} + ''; + }; + buildDeps = with pkgs; [ gtk3 glib @@ -62,23 +91,23 @@ openjdk11_headless clang ]; - + releaseDerivation = pkgs.flutter.mkFlutterApp rec { pname = "selfprivacy"; version = "0.6.0"; - + vendorHash = "sha256-7cbiAyIlaz3HqEsZN/nZxaLZjseJv5CmiIHqsoGa4ZI="; - + nativeBuildInputs = [ pkgs.nixgl.auto.nixGLDefault ]; - + src = ./.; - + desktopItem = pkgs.makeDesktopItem { name = "${pname}"; exec = "@out@/bin/${pname}"; desktopName = "SelfPrivacy"; }; - + postInstall = '' rm $out/bin/$pname @@ -86,7 +115,7 @@ patchShebangs $out/bin/$pname chmod +x $out/bin/$pname wrapProgram $out/bin/$pname --set PATH ${pkgs.lib.makeBinPath [ pkgs.xdg-user-dirs ]} - + mkdir -p $out/share/applications cp $desktopItem/share/applications/*.desktop $out/share/applications substituteInPlace $out/share/applications/*.desktop --subst-var out diff --git a/lib/logic/api_maps/graphql_maps/schema/backups.graphql b/lib/logic/api_maps/graphql_maps/schema/backups.graphql index 9b60564c..16930940 100644 --- a/lib/logic/api_maps/graphql_maps/schema/backups.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/backups.graphql @@ -7,6 +7,13 @@ query BackupConfiguration { locationId locationName provider + autobackupQuotas { + last + daily + weekly + monthly + yearly + } } } } @@ -20,6 +27,7 @@ query AllBackupSnapshots { displayName id } + reason } } } @@ -35,6 +43,13 @@ fragment genericBackupConfigReturn on GenericBackupConfigReturn { autobackupPeriod locationName locationId + autobackupQuotas { + last + daily + weekly + monthly + yearly + } } } @@ -65,6 +80,14 @@ mutation SetAutobackupPeriod($period: Int = null) { } } +mutation setAutobackupQuotas($quotas: AutobackupQuotasInput!) { + backup { + setAutobackupQuotas(quotas: $quotas) { + ...genericBackupConfigReturn + } + } +} + mutation RemoveRepository { backup { removeRepository { @@ -98,4 +121,4 @@ mutation ForgetSnapshot($snapshotId: String!) { ...basicMutationReturnFields } } -} \ No newline at end of file +} diff --git a/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart index 7a814aac..1df1e8ac 100644 --- a/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/backups.graphql.dart @@ -287,6 +287,56 @@ const fragmentDefinitiongenericBackupConfigReturn = FragmentDefinitionNode( directives: [], selectionSet: null, ), + FieldNode( + name: NameNode(value: 'autobackupQuotas'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'last'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'daily'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'weekly'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'monthly'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'yearly'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -356,6 +406,7 @@ class Fragment$genericBackupConfigReturn$configuration { this.autobackupPeriod, this.locationName, this.locationId, + required this.autobackupQuotas, this.$__typename = 'BackupConfiguration', }); @@ -367,6 +418,7 @@ class Fragment$genericBackupConfigReturn$configuration { final l$autobackupPeriod = json['autobackupPeriod']; final l$locationName = json['locationName']; final l$locationId = json['locationId']; + final l$autobackupQuotas = json['autobackupQuotas']; final l$$__typename = json['__typename']; return Fragment$genericBackupConfigReturn$configuration( provider: fromJson$Enum$BackupProvider((l$provider as String)), @@ -375,6 +427,9 @@ class Fragment$genericBackupConfigReturn$configuration { autobackupPeriod: (l$autobackupPeriod as int?), locationName: (l$locationName as String?), locationId: (l$locationId as String?), + autobackupQuotas: + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas + .fromJson((l$autobackupQuotas as Map)), $__typename: (l$$__typename as String), ); } @@ -391,6 +446,9 @@ class Fragment$genericBackupConfigReturn$configuration { final String? locationId; + final Fragment$genericBackupConfigReturn$configuration$autobackupQuotas + autobackupQuotas; + final String $__typename; Map toJson() { @@ -407,6 +465,8 @@ class Fragment$genericBackupConfigReturn$configuration { _resultData['locationName'] = l$locationName; final l$locationId = locationId; _resultData['locationId'] = l$locationId; + final l$autobackupQuotas = autobackupQuotas; + _resultData['autobackupQuotas'] = l$autobackupQuotas.toJson(); final l$$__typename = $__typename; _resultData['__typename'] = l$$__typename; return _resultData; @@ -420,6 +480,7 @@ class Fragment$genericBackupConfigReturn$configuration { final l$autobackupPeriod = autobackupPeriod; final l$locationName = locationName; final l$locationId = locationId; + final l$autobackupQuotas = autobackupQuotas; final l$$__typename = $__typename; return Object.hashAll([ l$provider, @@ -428,6 +489,7 @@ class Fragment$genericBackupConfigReturn$configuration { l$autobackupPeriod, l$locationName, l$locationId, + l$autobackupQuotas, l$$__typename, ]); } @@ -471,6 +533,11 @@ class Fragment$genericBackupConfigReturn$configuration { if (l$locationId != lOther$locationId) { return false; } + final l$autobackupQuotas = autobackupQuotas; + final lOther$autobackupQuotas = other.autobackupQuotas; + if (l$autobackupQuotas != lOther$autobackupQuotas) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; if (l$$__typename != lOther$$__typename) { @@ -507,8 +574,12 @@ abstract class CopyWith$Fragment$genericBackupConfigReturn$configuration { int? autobackupPeriod, String? locationName, String? locationId, + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas? + autobackupQuotas, String? $__typename, }); + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> get autobackupQuotas; } class _CopyWithImpl$Fragment$genericBackupConfigReturn$configuration @@ -531,6 +602,7 @@ class _CopyWithImpl$Fragment$genericBackupConfigReturn$configuration Object? autobackupPeriod = _undefined, Object? locationName = _undefined, Object? locationId = _undefined, + Object? autobackupQuotas = _undefined, Object? $__typename = _undefined, }) => _then(Fragment$genericBackupConfigReturn$configuration( @@ -552,10 +624,21 @@ class _CopyWithImpl$Fragment$genericBackupConfigReturn$configuration locationId: locationId == _undefined ? _instance.locationId : (locationId as String?), + autobackupQuotas: autobackupQuotas == _undefined || + autobackupQuotas == null + ? _instance.autobackupQuotas + : (autobackupQuotas + as Fragment$genericBackupConfigReturn$configuration$autobackupQuotas), $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String), )); + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> get autobackupQuotas { + final local$autobackupQuotas = _instance.autobackupQuotas; + return CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas( + local$autobackupQuotas, (e) => call(autobackupQuotas: e)); + } } class _CopyWithStubImpl$Fragment$genericBackupConfigReturn$configuration @@ -571,6 +654,234 @@ class _CopyWithStubImpl$Fragment$genericBackupConfigReturn$configuration int? autobackupPeriod, String? locationName, String? locationId, + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas? + autobackupQuotas, + String? $__typename, + }) => + _res; + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> + get autobackupQuotas => + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas + .stub(_res); +} + +class Fragment$genericBackupConfigReturn$configuration$autobackupQuotas { + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas({ + required this.last, + required this.daily, + required this.weekly, + required this.monthly, + required this.yearly, + this.$__typename = 'AutobackupQuotas', + }); + + factory Fragment$genericBackupConfigReturn$configuration$autobackupQuotas.fromJson( + Map json) { + final l$last = json['last']; + final l$daily = json['daily']; + final l$weekly = json['weekly']; + final l$monthly = json['monthly']; + final l$yearly = json['yearly']; + final l$$__typename = json['__typename']; + return Fragment$genericBackupConfigReturn$configuration$autobackupQuotas( + last: (l$last as int), + daily: (l$daily as int), + weekly: (l$weekly as int), + monthly: (l$monthly as int), + yearly: (l$yearly as int), + $__typename: (l$$__typename as String), + ); + } + + final int last; + + final int daily; + + final int weekly; + + final int monthly; + + final int yearly; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$last = last; + _resultData['last'] = l$last; + final l$daily = daily; + _resultData['daily'] = l$daily; + final l$weekly = weekly; + _resultData['weekly'] = l$weekly; + final l$monthly = monthly; + _resultData['monthly'] = l$monthly; + final l$yearly = yearly; + _resultData['yearly'] = l$yearly; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$last = last; + final l$daily = daily; + final l$weekly = weekly; + final l$monthly = monthly; + final l$yearly = yearly; + final l$$__typename = $__typename; + return Object.hashAll([ + l$last, + l$daily, + l$weekly, + l$monthly, + l$yearly, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Fragment$genericBackupConfigReturn$configuration$autobackupQuotas) || + runtimeType != other.runtimeType) { + return false; + } + final l$last = last; + final lOther$last = other.last; + if (l$last != lOther$last) { + return false; + } + final l$daily = daily; + final lOther$daily = other.daily; + if (l$daily != lOther$daily) { + return false; + } + final l$weekly = weekly; + final lOther$weekly = other.weekly; + if (l$weekly != lOther$weekly) { + return false; + } + final l$monthly = monthly; + final lOther$monthly = other.monthly; + if (l$monthly != lOther$monthly) { + return false; + } + final l$yearly = yearly; + final lOther$yearly = other.yearly; + if (l$yearly != lOther$yearly) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas + on Fragment$genericBackupConfigReturn$configuration$autobackupQuotas { + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas> + get copyWith => + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas( + this, + (i) => i, + ); +} + +abstract class CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> { + factory CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas( + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas instance, + TRes Function( + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas) + then, + ) = _CopyWithImpl$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas; + + factory CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas.stub( + TRes res) = + _CopyWithStubImpl$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas; + + TRes call({ + int? last, + int? daily, + int? weekly, + int? monthly, + int? yearly, + String? $__typename, + }); +} + +class _CopyWithImpl$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> + implements + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> { + _CopyWithImpl$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas( + this._instance, + this._then, + ); + + final Fragment$genericBackupConfigReturn$configuration$autobackupQuotas + _instance; + + final TRes Function( + Fragment$genericBackupConfigReturn$configuration$autobackupQuotas) _then; + + static const _undefined = {}; + + TRes call({ + Object? last = _undefined, + Object? daily = _undefined, + Object? weekly = _undefined, + Object? monthly = _undefined, + Object? yearly = _undefined, + Object? $__typename = _undefined, + }) => + _then(Fragment$genericBackupConfigReturn$configuration$autobackupQuotas( + last: + last == _undefined || last == null ? _instance.last : (last as int), + daily: daily == _undefined || daily == null + ? _instance.daily + : (daily as int), + weekly: weekly == _undefined || weekly == null + ? _instance.weekly + : (weekly as int), + monthly: monthly == _undefined || monthly == null + ? _instance.monthly + : (monthly as int), + yearly: yearly == _undefined || yearly == null + ? _instance.yearly + : (yearly as int), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> + implements + CopyWith$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas< + TRes> { + _CopyWithStubImpl$Fragment$genericBackupConfigReturn$configuration$autobackupQuotas( + this._res); + + TRes _res; + + call({ + int? last, + int? daily, + int? weekly, + int? monthly, + int? yearly, String? $__typename, }) => _res; @@ -771,6 +1082,56 @@ const documentNodeQueryBackupConfiguration = DocumentNode(definitions: [ directives: [], selectionSet: null, ), + FieldNode( + name: NameNode(value: 'autobackupQuotas'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'last'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'daily'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'weekly'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'monthly'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: 'yearly'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -1070,6 +1431,7 @@ class Query$BackupConfiguration$backup$configuration { this.locationId, this.locationName, required this.provider, + required this.autobackupQuotas, this.$__typename = 'BackupConfiguration', }); @@ -1081,6 +1443,7 @@ class Query$BackupConfiguration$backup$configuration { final l$locationId = json['locationId']; final l$locationName = json['locationName']; final l$provider = json['provider']; + final l$autobackupQuotas = json['autobackupQuotas']; final l$$__typename = json['__typename']; return Query$BackupConfiguration$backup$configuration( autobackupPeriod: (l$autobackupPeriod as int?), @@ -1089,6 +1452,9 @@ class Query$BackupConfiguration$backup$configuration { locationId: (l$locationId as String?), locationName: (l$locationName as String?), provider: fromJson$Enum$BackupProvider((l$provider as String)), + autobackupQuotas: + Query$BackupConfiguration$backup$configuration$autobackupQuotas + .fromJson((l$autobackupQuotas as Map)), $__typename: (l$$__typename as String), ); } @@ -1105,6 +1471,9 @@ class Query$BackupConfiguration$backup$configuration { final Enum$BackupProvider provider; + final Query$BackupConfiguration$backup$configuration$autobackupQuotas + autobackupQuotas; + final String $__typename; Map toJson() { @@ -1121,6 +1490,8 @@ class Query$BackupConfiguration$backup$configuration { _resultData['locationName'] = l$locationName; final l$provider = provider; _resultData['provider'] = toJson$Enum$BackupProvider(l$provider); + final l$autobackupQuotas = autobackupQuotas; + _resultData['autobackupQuotas'] = l$autobackupQuotas.toJson(); final l$$__typename = $__typename; _resultData['__typename'] = l$$__typename; return _resultData; @@ -1134,6 +1505,7 @@ class Query$BackupConfiguration$backup$configuration { final l$locationId = locationId; final l$locationName = locationName; final l$provider = provider; + final l$autobackupQuotas = autobackupQuotas; final l$$__typename = $__typename; return Object.hashAll([ l$autobackupPeriod, @@ -1142,6 +1514,7 @@ class Query$BackupConfiguration$backup$configuration { l$locationId, l$locationName, l$provider, + l$autobackupQuotas, l$$__typename, ]); } @@ -1185,6 +1558,11 @@ class Query$BackupConfiguration$backup$configuration { if (l$provider != lOther$provider) { return false; } + final l$autobackupQuotas = autobackupQuotas; + final lOther$autobackupQuotas = other.autobackupQuotas; + if (l$autobackupQuotas != lOther$autobackupQuotas) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; if (l$$__typename != lOther$$__typename) { @@ -1221,8 +1599,12 @@ abstract class CopyWith$Query$BackupConfiguration$backup$configuration { String? locationId, String? locationName, Enum$BackupProvider? provider, + Query$BackupConfiguration$backup$configuration$autobackupQuotas? + autobackupQuotas, String? $__typename, }); + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas + get autobackupQuotas; } class _CopyWithImpl$Query$BackupConfiguration$backup$configuration @@ -1245,6 +1627,7 @@ class _CopyWithImpl$Query$BackupConfiguration$backup$configuration Object? locationId = _undefined, Object? locationName = _undefined, Object? provider = _undefined, + Object? autobackupQuotas = _undefined, Object? $__typename = _undefined, }) => _then(Query$BackupConfiguration$backup$configuration( @@ -1266,10 +1649,21 @@ class _CopyWithImpl$Query$BackupConfiguration$backup$configuration provider: provider == _undefined || provider == null ? _instance.provider : (provider as Enum$BackupProvider), + autobackupQuotas: autobackupQuotas == _undefined || + autobackupQuotas == null + ? _instance.autobackupQuotas + : (autobackupQuotas + as Query$BackupConfiguration$backup$configuration$autobackupQuotas), $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String), )); + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas + get autobackupQuotas { + final local$autobackupQuotas = _instance.autobackupQuotas; + return CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas( + local$autobackupQuotas, (e) => call(autobackupQuotas: e)); + } } class _CopyWithStubImpl$Query$BackupConfiguration$backup$configuration @@ -1285,6 +1679,233 @@ class _CopyWithStubImpl$Query$BackupConfiguration$backup$configuration String? locationId, String? locationName, Enum$BackupProvider? provider, + Query$BackupConfiguration$backup$configuration$autobackupQuotas? + autobackupQuotas, + String? $__typename, + }) => + _res; + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas + get autobackupQuotas => + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas + .stub(_res); +} + +class Query$BackupConfiguration$backup$configuration$autobackupQuotas { + Query$BackupConfiguration$backup$configuration$autobackupQuotas({ + required this.last, + required this.daily, + required this.weekly, + required this.monthly, + required this.yearly, + this.$__typename = 'AutobackupQuotas', + }); + + factory Query$BackupConfiguration$backup$configuration$autobackupQuotas.fromJson( + Map json) { + final l$last = json['last']; + final l$daily = json['daily']; + final l$weekly = json['weekly']; + final l$monthly = json['monthly']; + final l$yearly = json['yearly']; + final l$$__typename = json['__typename']; + return Query$BackupConfiguration$backup$configuration$autobackupQuotas( + last: (l$last as int), + daily: (l$daily as int), + weekly: (l$weekly as int), + monthly: (l$monthly as int), + yearly: (l$yearly as int), + $__typename: (l$$__typename as String), + ); + } + + final int last; + + final int daily; + + final int weekly; + + final int monthly; + + final int yearly; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$last = last; + _resultData['last'] = l$last; + final l$daily = daily; + _resultData['daily'] = l$daily; + final l$weekly = weekly; + _resultData['weekly'] = l$weekly; + final l$monthly = monthly; + _resultData['monthly'] = l$monthly; + final l$yearly = yearly; + _resultData['yearly'] = l$yearly; + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$last = last; + final l$daily = daily; + final l$weekly = weekly; + final l$monthly = monthly; + final l$yearly = yearly; + final l$$__typename = $__typename; + return Object.hashAll([ + l$last, + l$daily, + l$weekly, + l$monthly, + l$yearly, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other + is Query$BackupConfiguration$backup$configuration$autobackupQuotas) || + runtimeType != other.runtimeType) { + return false; + } + final l$last = last; + final lOther$last = other.last; + if (l$last != lOther$last) { + return false; + } + final l$daily = daily; + final lOther$daily = other.daily; + if (l$daily != lOther$daily) { + return false; + } + final l$weekly = weekly; + final lOther$weekly = other.weekly; + if (l$weekly != lOther$weekly) { + return false; + } + final l$monthly = monthly; + final lOther$monthly = other.monthly; + if (l$monthly != lOther$monthly) { + return false; + } + final l$yearly = yearly; + final lOther$yearly = other.yearly; + if (l$yearly != lOther$yearly) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Query$BackupConfiguration$backup$configuration$autobackupQuotas + on Query$BackupConfiguration$backup$configuration$autobackupQuotas { + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas< + Query$BackupConfiguration$backup$configuration$autobackupQuotas> + get copyWith => + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas( + this, + (i) => i, + ); +} + +abstract class CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas< + TRes> { + factory CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas( + Query$BackupConfiguration$backup$configuration$autobackupQuotas instance, + TRes Function( + Query$BackupConfiguration$backup$configuration$autobackupQuotas) + then, + ) = _CopyWithImpl$Query$BackupConfiguration$backup$configuration$autobackupQuotas; + + factory CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas.stub( + TRes res) = + _CopyWithStubImpl$Query$BackupConfiguration$backup$configuration$autobackupQuotas; + + TRes call({ + int? last, + int? daily, + int? weekly, + int? monthly, + int? yearly, + String? $__typename, + }); +} + +class _CopyWithImpl$Query$BackupConfiguration$backup$configuration$autobackupQuotas< + TRes> + implements + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas< + TRes> { + _CopyWithImpl$Query$BackupConfiguration$backup$configuration$autobackupQuotas( + this._instance, + this._then, + ); + + final Query$BackupConfiguration$backup$configuration$autobackupQuotas + _instance; + + final TRes Function( + Query$BackupConfiguration$backup$configuration$autobackupQuotas) _then; + + static const _undefined = {}; + + TRes call({ + Object? last = _undefined, + Object? daily = _undefined, + Object? weekly = _undefined, + Object? monthly = _undefined, + Object? yearly = _undefined, + Object? $__typename = _undefined, + }) => + _then(Query$BackupConfiguration$backup$configuration$autobackupQuotas( + last: + last == _undefined || last == null ? _instance.last : (last as int), + daily: daily == _undefined || daily == null + ? _instance.daily + : (daily as int), + weekly: weekly == _undefined || weekly == null + ? _instance.weekly + : (weekly as int), + monthly: monthly == _undefined || monthly == null + ? _instance.monthly + : (monthly as int), + yearly: yearly == _undefined || yearly == null + ? _instance.yearly + : (yearly as int), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); +} + +class _CopyWithStubImpl$Query$BackupConfiguration$backup$configuration$autobackupQuotas< + TRes> + implements + CopyWith$Query$BackupConfiguration$backup$configuration$autobackupQuotas< + TRes> { + _CopyWithStubImpl$Query$BackupConfiguration$backup$configuration$autobackupQuotas( + this._res); + + TRes _res; + + call({ + int? last, + int? daily, + int? weekly, + int? monthly, + int? yearly, String? $__typename, }) => _res; @@ -1486,6 +2107,13 @@ const documentNodeQueryAllBackupSnapshots = DocumentNode(definitions: [ ), ]), ), + FieldNode( + name: NameNode(value: 'reason'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), FieldNode( name: NameNode(value: '__typename'), alias: null, @@ -1801,6 +2429,7 @@ class Query$AllBackupSnapshots$backup$allSnapshots { required this.id, required this.createdAt, required this.service, + required this.reason, this.$__typename = 'SnapshotInfo', }); @@ -1809,12 +2438,14 @@ class Query$AllBackupSnapshots$backup$allSnapshots { final l$id = json['id']; final l$createdAt = json['createdAt']; final l$service = json['service']; + final l$reason = json['reason']; final l$$__typename = json['__typename']; return Query$AllBackupSnapshots$backup$allSnapshots( id: (l$id as String), createdAt: dateTimeFromJson(l$createdAt), service: Query$AllBackupSnapshots$backup$allSnapshots$service.fromJson( (l$service as Map)), + reason: fromJson$Enum$BackupReason((l$reason as String)), $__typename: (l$$__typename as String), ); } @@ -1825,6 +2456,8 @@ class Query$AllBackupSnapshots$backup$allSnapshots { final Query$AllBackupSnapshots$backup$allSnapshots$service service; + final Enum$BackupReason reason; + final String $__typename; Map toJson() { @@ -1835,6 +2468,8 @@ class Query$AllBackupSnapshots$backup$allSnapshots { _resultData['createdAt'] = dateTimeToJson(l$createdAt); final l$service = service; _resultData['service'] = l$service.toJson(); + final l$reason = reason; + _resultData['reason'] = toJson$Enum$BackupReason(l$reason); final l$$__typename = $__typename; _resultData['__typename'] = l$$__typename; return _resultData; @@ -1845,11 +2480,13 @@ class Query$AllBackupSnapshots$backup$allSnapshots { final l$id = id; final l$createdAt = createdAt; final l$service = service; + final l$reason = reason; final l$$__typename = $__typename; return Object.hashAll([ l$id, l$createdAt, l$service, + l$reason, l$$__typename, ]); } @@ -1878,6 +2515,11 @@ class Query$AllBackupSnapshots$backup$allSnapshots { if (l$service != lOther$service) { return false; } + final l$reason = reason; + final lOther$reason = other.reason; + if (l$reason != lOther$reason) { + return false; + } final l$$__typename = $__typename; final lOther$$__typename = other.$__typename; if (l$$__typename != lOther$$__typename) { @@ -1910,6 +2552,7 @@ abstract class CopyWith$Query$AllBackupSnapshots$backup$allSnapshots { String? id, DateTime? createdAt, Query$AllBackupSnapshots$backup$allSnapshots$service? service, + Enum$BackupReason? reason, String? $__typename, }); CopyWith$Query$AllBackupSnapshots$backup$allSnapshots$service @@ -1933,6 +2576,7 @@ class _CopyWithImpl$Query$AllBackupSnapshots$backup$allSnapshots Object? id = _undefined, Object? createdAt = _undefined, Object? service = _undefined, + Object? reason = _undefined, Object? $__typename = _undefined, }) => _then(Query$AllBackupSnapshots$backup$allSnapshots( @@ -1943,6 +2587,9 @@ class _CopyWithImpl$Query$AllBackupSnapshots$backup$allSnapshots service: service == _undefined || service == null ? _instance.service : (service as Query$AllBackupSnapshots$backup$allSnapshots$service), + reason: reason == _undefined || reason == null + ? _instance.reason + : (reason as Enum$BackupReason), $__typename: $__typename == _undefined || $__typename == null ? _instance.$__typename : ($__typename as String), @@ -1965,6 +2612,7 @@ class _CopyWithStubImpl$Query$AllBackupSnapshots$backup$allSnapshots String? id, DateTime? createdAt, Query$AllBackupSnapshots$backup$allSnapshots$service? service, + Enum$BackupReason? reason, String? $__typename, }) => _res; @@ -4024,6 +4672,546 @@ class _CopyWithStubImpl$Mutation$SetAutobackupPeriod$backup CopyWith$Fragment$genericBackupConfigReturn.stub(_res); } +class Variables$Mutation$setAutobackupQuotas { + factory Variables$Mutation$setAutobackupQuotas( + {required Input$AutobackupQuotasInput quotas}) => + Variables$Mutation$setAutobackupQuotas._({ + r'quotas': quotas, + }); + + Variables$Mutation$setAutobackupQuotas._(this._$data); + + factory Variables$Mutation$setAutobackupQuotas.fromJson( + Map data) { + final result$data = {}; + final l$quotas = data['quotas']; + result$data['quotas'] = Input$AutobackupQuotasInput.fromJson( + (l$quotas as Map)); + return Variables$Mutation$setAutobackupQuotas._(result$data); + } + + Map _$data; + + Input$AutobackupQuotasInput get quotas => + (_$data['quotas'] as Input$AutobackupQuotasInput); + Map toJson() { + final result$data = {}; + final l$quotas = quotas; + result$data['quotas'] = l$quotas.toJson(); + return result$data; + } + + CopyWith$Variables$Mutation$setAutobackupQuotas< + Variables$Mutation$setAutobackupQuotas> + get copyWith => CopyWith$Variables$Mutation$setAutobackupQuotas( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Variables$Mutation$setAutobackupQuotas) || + runtimeType != other.runtimeType) { + return false; + } + final l$quotas = quotas; + final lOther$quotas = other.quotas; + if (l$quotas != lOther$quotas) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$quotas = quotas; + return Object.hashAll([l$quotas]); + } +} + +abstract class CopyWith$Variables$Mutation$setAutobackupQuotas { + factory CopyWith$Variables$Mutation$setAutobackupQuotas( + Variables$Mutation$setAutobackupQuotas instance, + TRes Function(Variables$Mutation$setAutobackupQuotas) then, + ) = _CopyWithImpl$Variables$Mutation$setAutobackupQuotas; + + factory CopyWith$Variables$Mutation$setAutobackupQuotas.stub(TRes res) = + _CopyWithStubImpl$Variables$Mutation$setAutobackupQuotas; + + TRes call({Input$AutobackupQuotasInput? quotas}); +} + +class _CopyWithImpl$Variables$Mutation$setAutobackupQuotas + implements CopyWith$Variables$Mutation$setAutobackupQuotas { + _CopyWithImpl$Variables$Mutation$setAutobackupQuotas( + this._instance, + this._then, + ); + + final Variables$Mutation$setAutobackupQuotas _instance; + + final TRes Function(Variables$Mutation$setAutobackupQuotas) _then; + + static const _undefined = {}; + + TRes call({Object? quotas = _undefined}) => + _then(Variables$Mutation$setAutobackupQuotas._({ + ..._instance._$data, + if (quotas != _undefined && quotas != null) + 'quotas': (quotas as Input$AutobackupQuotasInput), + })); +} + +class _CopyWithStubImpl$Variables$Mutation$setAutobackupQuotas + implements CopyWith$Variables$Mutation$setAutobackupQuotas { + _CopyWithStubImpl$Variables$Mutation$setAutobackupQuotas(this._res); + + TRes _res; + + call({Input$AutobackupQuotasInput? quotas}) => _res; +} + +class Mutation$setAutobackupQuotas { + Mutation$setAutobackupQuotas({ + required this.backup, + this.$__typename = 'Mutation', + }); + + factory Mutation$setAutobackupQuotas.fromJson(Map json) { + final l$backup = json['backup']; + final l$$__typename = json['__typename']; + return Mutation$setAutobackupQuotas( + backup: Mutation$setAutobackupQuotas$backup.fromJson( + (l$backup as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Mutation$setAutobackupQuotas$backup backup; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$backup = backup; + _resultData['backup'] = l$backup.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$backup = backup; + final l$$__typename = $__typename; + return Object.hashAll([ + l$backup, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$setAutobackupQuotas) || + runtimeType != other.runtimeType) { + return false; + } + final l$backup = backup; + final lOther$backup = other.backup; + if (l$backup != lOther$backup) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Mutation$setAutobackupQuotas + on Mutation$setAutobackupQuotas { + CopyWith$Mutation$setAutobackupQuotas + get copyWith => CopyWith$Mutation$setAutobackupQuotas( + this, + (i) => i, + ); +} + +abstract class CopyWith$Mutation$setAutobackupQuotas { + factory CopyWith$Mutation$setAutobackupQuotas( + Mutation$setAutobackupQuotas instance, + TRes Function(Mutation$setAutobackupQuotas) then, + ) = _CopyWithImpl$Mutation$setAutobackupQuotas; + + factory CopyWith$Mutation$setAutobackupQuotas.stub(TRes res) = + _CopyWithStubImpl$Mutation$setAutobackupQuotas; + + TRes call({ + Mutation$setAutobackupQuotas$backup? backup, + String? $__typename, + }); + CopyWith$Mutation$setAutobackupQuotas$backup get backup; +} + +class _CopyWithImpl$Mutation$setAutobackupQuotas + implements CopyWith$Mutation$setAutobackupQuotas { + _CopyWithImpl$Mutation$setAutobackupQuotas( + this._instance, + this._then, + ); + + final Mutation$setAutobackupQuotas _instance; + + final TRes Function(Mutation$setAutobackupQuotas) _then; + + static const _undefined = {}; + + TRes call({ + Object? backup = _undefined, + Object? $__typename = _undefined, + }) => + _then(Mutation$setAutobackupQuotas( + backup: backup == _undefined || backup == null + ? _instance.backup + : (backup as Mutation$setAutobackupQuotas$backup), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Mutation$setAutobackupQuotas$backup get backup { + final local$backup = _instance.backup; + return CopyWith$Mutation$setAutobackupQuotas$backup( + local$backup, (e) => call(backup: e)); + } +} + +class _CopyWithStubImpl$Mutation$setAutobackupQuotas + implements CopyWith$Mutation$setAutobackupQuotas { + _CopyWithStubImpl$Mutation$setAutobackupQuotas(this._res); + + TRes _res; + + call({ + Mutation$setAutobackupQuotas$backup? backup, + String? $__typename, + }) => + _res; + CopyWith$Mutation$setAutobackupQuotas$backup get backup => + CopyWith$Mutation$setAutobackupQuotas$backup.stub(_res); +} + +const documentNodeMutationsetAutobackupQuotas = DocumentNode(definitions: [ + OperationDefinitionNode( + type: OperationType.mutation, + name: NameNode(value: 'setAutobackupQuotas'), + variableDefinitions: [ + VariableDefinitionNode( + variable: VariableNode(name: NameNode(value: 'quotas')), + type: NamedTypeNode( + name: NameNode(value: 'AutobackupQuotasInput'), + isNonNull: true, + ), + defaultValue: DefaultValueNode(value: null), + directives: [], + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'backup'), + alias: null, + arguments: [], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FieldNode( + name: NameNode(value: 'setAutobackupQuotas'), + alias: null, + arguments: [ + ArgumentNode( + name: NameNode(value: 'quotas'), + value: VariableNode(name: NameNode(value: 'quotas')), + ) + ], + directives: [], + selectionSet: SelectionSetNode(selections: [ + FragmentSpreadNode( + name: NameNode(value: 'genericBackupConfigReturn'), + directives: [], + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + FieldNode( + name: NameNode(value: '__typename'), + alias: null, + arguments: [], + directives: [], + selectionSet: null, + ), + ]), + ), + fragmentDefinitiongenericBackupConfigReturn, +]); +Mutation$setAutobackupQuotas _parserFn$Mutation$setAutobackupQuotas( + Map data) => + Mutation$setAutobackupQuotas.fromJson(data); +typedef OnMutationCompleted$Mutation$setAutobackupQuotas = FutureOr + Function( + Map?, + Mutation$setAutobackupQuotas?, +); + +class Options$Mutation$setAutobackupQuotas + extends graphql.MutationOptions { + Options$Mutation$setAutobackupQuotas({ + String? operationName, + required Variables$Mutation$setAutobackupQuotas variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Mutation$setAutobackupQuotas? typedOptimisticResult, + graphql.Context? context, + OnMutationCompleted$Mutation$setAutobackupQuotas? onCompleted, + graphql.OnMutationUpdate? update, + graphql.OnError? onError, + }) : onCompletedWithParsed = onCompleted, + super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), + context: context, + onCompleted: onCompleted == null + ? null + : (data) => onCompleted( + data, + data == null + ? null + : _parserFn$Mutation$setAutobackupQuotas(data), + ), + update: update, + onError: onError, + document: documentNodeMutationsetAutobackupQuotas, + parserFn: _parserFn$Mutation$setAutobackupQuotas, + ); + + final OnMutationCompleted$Mutation$setAutobackupQuotas? onCompletedWithParsed; + + @override + List get properties => [ + ...super.onCompleted == null + ? super.properties + : super.properties.where((property) => property != onCompleted), + onCompletedWithParsed, + ]; +} + +class WatchOptions$Mutation$setAutobackupQuotas + extends graphql.WatchQueryOptions { + WatchOptions$Mutation$setAutobackupQuotas({ + String? operationName, + required Variables$Mutation$setAutobackupQuotas variables, + graphql.FetchPolicy? fetchPolicy, + graphql.ErrorPolicy? errorPolicy, + graphql.CacheRereadPolicy? cacheRereadPolicy, + Object? optimisticResult, + Mutation$setAutobackupQuotas? typedOptimisticResult, + graphql.Context? context, + Duration? pollInterval, + bool? eagerlyFetchResults, + bool carryForwardDataOnException = true, + bool fetchResults = false, + }) : super( + variables: variables.toJson(), + operationName: operationName, + fetchPolicy: fetchPolicy, + errorPolicy: errorPolicy, + cacheRereadPolicy: cacheRereadPolicy, + optimisticResult: optimisticResult ?? typedOptimisticResult?.toJson(), + context: context, + document: documentNodeMutationsetAutobackupQuotas, + pollInterval: pollInterval, + eagerlyFetchResults: eagerlyFetchResults, + carryForwardDataOnException: carryForwardDataOnException, + fetchResults: fetchResults, + parserFn: _parserFn$Mutation$setAutobackupQuotas, + ); +} + +extension ClientExtension$Mutation$setAutobackupQuotas + on graphql.GraphQLClient { + Future> + mutate$setAutobackupQuotas( + Options$Mutation$setAutobackupQuotas options) async => + await this.mutate(options); + graphql.ObservableQuery + watchMutation$setAutobackupQuotas( + WatchOptions$Mutation$setAutobackupQuotas options) => + this.watchMutation(options); +} + +class Mutation$setAutobackupQuotas$backup { + Mutation$setAutobackupQuotas$backup({ + required this.setAutobackupQuotas, + this.$__typename = 'BackupMutations', + }); + + factory Mutation$setAutobackupQuotas$backup.fromJson( + Map json) { + final l$setAutobackupQuotas = json['setAutobackupQuotas']; + final l$$__typename = json['__typename']; + return Mutation$setAutobackupQuotas$backup( + setAutobackupQuotas: Fragment$genericBackupConfigReturn.fromJson( + (l$setAutobackupQuotas as Map)), + $__typename: (l$$__typename as String), + ); + } + + final Fragment$genericBackupConfigReturn setAutobackupQuotas; + + final String $__typename; + + Map toJson() { + final _resultData = {}; + final l$setAutobackupQuotas = setAutobackupQuotas; + _resultData['setAutobackupQuotas'] = l$setAutobackupQuotas.toJson(); + final l$$__typename = $__typename; + _resultData['__typename'] = l$$__typename; + return _resultData; + } + + @override + int get hashCode { + final l$setAutobackupQuotas = setAutobackupQuotas; + final l$$__typename = $__typename; + return Object.hashAll([ + l$setAutobackupQuotas, + l$$__typename, + ]); + } + + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Mutation$setAutobackupQuotas$backup) || + runtimeType != other.runtimeType) { + return false; + } + final l$setAutobackupQuotas = setAutobackupQuotas; + final lOther$setAutobackupQuotas = other.setAutobackupQuotas; + if (l$setAutobackupQuotas != lOther$setAutobackupQuotas) { + return false; + } + final l$$__typename = $__typename; + final lOther$$__typename = other.$__typename; + if (l$$__typename != lOther$$__typename) { + return false; + } + return true; + } +} + +extension UtilityExtension$Mutation$setAutobackupQuotas$backup + on Mutation$setAutobackupQuotas$backup { + CopyWith$Mutation$setAutobackupQuotas$backup< + Mutation$setAutobackupQuotas$backup> + get copyWith => CopyWith$Mutation$setAutobackupQuotas$backup( + this, + (i) => i, + ); +} + +abstract class CopyWith$Mutation$setAutobackupQuotas$backup { + factory CopyWith$Mutation$setAutobackupQuotas$backup( + Mutation$setAutobackupQuotas$backup instance, + TRes Function(Mutation$setAutobackupQuotas$backup) then, + ) = _CopyWithImpl$Mutation$setAutobackupQuotas$backup; + + factory CopyWith$Mutation$setAutobackupQuotas$backup.stub(TRes res) = + _CopyWithStubImpl$Mutation$setAutobackupQuotas$backup; + + TRes call({ + Fragment$genericBackupConfigReturn? setAutobackupQuotas, + String? $__typename, + }); + CopyWith$Fragment$genericBackupConfigReturn get setAutobackupQuotas; +} + +class _CopyWithImpl$Mutation$setAutobackupQuotas$backup + implements CopyWith$Mutation$setAutobackupQuotas$backup { + _CopyWithImpl$Mutation$setAutobackupQuotas$backup( + this._instance, + this._then, + ); + + final Mutation$setAutobackupQuotas$backup _instance; + + final TRes Function(Mutation$setAutobackupQuotas$backup) _then; + + static const _undefined = {}; + + TRes call({ + Object? setAutobackupQuotas = _undefined, + Object? $__typename = _undefined, + }) => + _then(Mutation$setAutobackupQuotas$backup( + setAutobackupQuotas: + setAutobackupQuotas == _undefined || setAutobackupQuotas == null + ? _instance.setAutobackupQuotas + : (setAutobackupQuotas as Fragment$genericBackupConfigReturn), + $__typename: $__typename == _undefined || $__typename == null + ? _instance.$__typename + : ($__typename as String), + )); + CopyWith$Fragment$genericBackupConfigReturn get setAutobackupQuotas { + final local$setAutobackupQuotas = _instance.setAutobackupQuotas; + return CopyWith$Fragment$genericBackupConfigReturn( + local$setAutobackupQuotas, (e) => call(setAutobackupQuotas: e)); + } +} + +class _CopyWithStubImpl$Mutation$setAutobackupQuotas$backup + implements CopyWith$Mutation$setAutobackupQuotas$backup { + _CopyWithStubImpl$Mutation$setAutobackupQuotas$backup(this._res); + + TRes _res; + + call({ + Fragment$genericBackupConfigReturn? setAutobackupQuotas, + String? $__typename, + }) => + _res; + CopyWith$Fragment$genericBackupConfigReturn get setAutobackupQuotas => + CopyWith$Fragment$genericBackupConfigReturn.stub(_res); +} + class Mutation$RemoveRepository { Mutation$RemoveRepository({ required this.backup, diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql b/lib/logic/api_maps/graphql_maps/schema/schema.graphql index 368c2b90..cb154193 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql @@ -75,6 +75,22 @@ type AutoUpgradeSettingsMutationReturn implements MutationReturnInterface { allowReboot: Boolean! } +type AutobackupQuotas { + last: Int! + daily: Int! + weekly: Int! + monthly: Int! + yearly: Int! +} + +input AutobackupQuotasInput { + last: Int! + daily: Int! + weekly: Int! + monthly: Int! + yearly: Int! +} + type Backup { configuration: BackupConfiguration! allSnapshots: [SnapshotInfo!]! @@ -85,6 +101,7 @@ type BackupConfiguration { encryptionKey: String! isInitialized: Boolean! autobackupPeriod: Int + autobackupQuotas: AutobackupQuotas! locationName: String locationId: String } @@ -93,6 +110,7 @@ type BackupMutations { initializeRepository(repository: InitializeRepositoryInput!): GenericBackupConfigReturn! removeRepository: GenericBackupConfigReturn! setAutobackupPeriod(period: Int = null): GenericBackupConfigReturn! + setAutobackupQuotas(quotas: AutobackupQuotasInput!): GenericBackupConfigReturn! startBackup(serviceId: String!): GenericJobMutationReturn! restoreBackup(snapshotId: String!, strategy: RestoreStrategy! = DOWNLOAD_VERIFY_OVERWRITE): GenericJobMutationReturn! forgetSnapshot(snapshotId: String!): GenericMutationReturn! @@ -106,6 +124,12 @@ enum BackupProvider { FILE } +enum BackupReason { + EXPLICIT + AUTO + PRE_RESTORE +} + """Date with time (isoformat)""" scalar DateTime @@ -326,6 +350,7 @@ type SnapshotInfo { id: String! service: Service! createdAt: DateTime! + reason: BackupReason! } input SshMutationInput { diff --git a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart index 8a78a6f8..538a05ff 100644 --- a/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart +++ b/lib/logic/api_maps/graphql_maps/schema/schema.graphql.dart @@ -141,6 +141,185 @@ class _CopyWithStubImpl$Input$AutoUpgradeSettingsInput _res; } +class Input$AutobackupQuotasInput { + factory Input$AutobackupQuotasInput({ + required int last, + required int daily, + required int weekly, + required int monthly, + required int yearly, + }) => + Input$AutobackupQuotasInput._({ + r'last': last, + r'daily': daily, + r'weekly': weekly, + r'monthly': monthly, + r'yearly': yearly, + }); + + Input$AutobackupQuotasInput._(this._$data); + + factory Input$AutobackupQuotasInput.fromJson(Map data) { + final result$data = {}; + final l$last = data['last']; + result$data['last'] = (l$last as int); + final l$daily = data['daily']; + result$data['daily'] = (l$daily as int); + final l$weekly = data['weekly']; + result$data['weekly'] = (l$weekly as int); + final l$monthly = data['monthly']; + result$data['monthly'] = (l$monthly as int); + final l$yearly = data['yearly']; + result$data['yearly'] = (l$yearly as int); + return Input$AutobackupQuotasInput._(result$data); + } + + Map _$data; + + int get last => (_$data['last'] as int); + int get daily => (_$data['daily'] as int); + int get weekly => (_$data['weekly'] as int); + int get monthly => (_$data['monthly'] as int); + int get yearly => (_$data['yearly'] as int); + Map toJson() { + final result$data = {}; + final l$last = last; + result$data['last'] = l$last; + final l$daily = daily; + result$data['daily'] = l$daily; + final l$weekly = weekly; + result$data['weekly'] = l$weekly; + final l$monthly = monthly; + result$data['monthly'] = l$monthly; + final l$yearly = yearly; + result$data['yearly'] = l$yearly; + return result$data; + } + + CopyWith$Input$AutobackupQuotasInput + get copyWith => CopyWith$Input$AutobackupQuotasInput( + this, + (i) => i, + ); + @override + bool operator ==(Object other) { + if (identical(this, other)) { + return true; + } + if (!(other is Input$AutobackupQuotasInput) || + runtimeType != other.runtimeType) { + return false; + } + final l$last = last; + final lOther$last = other.last; + if (l$last != lOther$last) { + return false; + } + final l$daily = daily; + final lOther$daily = other.daily; + if (l$daily != lOther$daily) { + return false; + } + final l$weekly = weekly; + final lOther$weekly = other.weekly; + if (l$weekly != lOther$weekly) { + return false; + } + final l$monthly = monthly; + final lOther$monthly = other.monthly; + if (l$monthly != lOther$monthly) { + return false; + } + final l$yearly = yearly; + final lOther$yearly = other.yearly; + if (l$yearly != lOther$yearly) { + return false; + } + return true; + } + + @override + int get hashCode { + final l$last = last; + final l$daily = daily; + final l$weekly = weekly; + final l$monthly = monthly; + final l$yearly = yearly; + return Object.hashAll([ + l$last, + l$daily, + l$weekly, + l$monthly, + l$yearly, + ]); + } +} + +abstract class CopyWith$Input$AutobackupQuotasInput { + factory CopyWith$Input$AutobackupQuotasInput( + Input$AutobackupQuotasInput instance, + TRes Function(Input$AutobackupQuotasInput) then, + ) = _CopyWithImpl$Input$AutobackupQuotasInput; + + factory CopyWith$Input$AutobackupQuotasInput.stub(TRes res) = + _CopyWithStubImpl$Input$AutobackupQuotasInput; + + TRes call({ + int? last, + int? daily, + int? weekly, + int? monthly, + int? yearly, + }); +} + +class _CopyWithImpl$Input$AutobackupQuotasInput + implements CopyWith$Input$AutobackupQuotasInput { + _CopyWithImpl$Input$AutobackupQuotasInput( + this._instance, + this._then, + ); + + final Input$AutobackupQuotasInput _instance; + + final TRes Function(Input$AutobackupQuotasInput) _then; + + static const _undefined = {}; + + TRes call({ + Object? last = _undefined, + Object? daily = _undefined, + Object? weekly = _undefined, + Object? monthly = _undefined, + Object? yearly = _undefined, + }) => + _then(Input$AutobackupQuotasInput._({ + ..._instance._$data, + if (last != _undefined && last != null) 'last': (last as int), + if (daily != _undefined && daily != null) 'daily': (daily as int), + if (weekly != _undefined && weekly != null) 'weekly': (weekly as int), + if (monthly != _undefined && monthly != null) + 'monthly': (monthly as int), + if (yearly != _undefined && yearly != null) 'yearly': (yearly as int), + })); +} + +class _CopyWithStubImpl$Input$AutobackupQuotasInput + implements CopyWith$Input$AutobackupQuotasInput { + _CopyWithStubImpl$Input$AutobackupQuotasInput(this._res); + + TRes _res; + + call({ + int? last, + int? daily, + int? weekly, + int? monthly, + int? yearly, + }) => + _res; +} + class Input$InitializeRepositoryInput { factory Input$InitializeRepositoryInput({ required Enum$BackupProvider provider, @@ -1310,6 +1489,34 @@ Enum$BackupProvider fromJson$Enum$BackupProvider(String value) { } } +enum Enum$BackupReason { EXPLICIT, AUTO, PRE_RESTORE, $unknown } + +String toJson$Enum$BackupReason(Enum$BackupReason e) { + switch (e) { + case Enum$BackupReason.EXPLICIT: + return r'EXPLICIT'; + case Enum$BackupReason.AUTO: + return r'AUTO'; + case Enum$BackupReason.PRE_RESTORE: + return r'PRE_RESTORE'; + case Enum$BackupReason.$unknown: + return r'$unknown'; + } +} + +Enum$BackupReason fromJson$Enum$BackupReason(String value) { + switch (value) { + case r'EXPLICIT': + return Enum$BackupReason.EXPLICIT; + case r'AUTO': + return Enum$BackupReason.AUTO; + case r'PRE_RESTORE': + return Enum$BackupReason.PRE_RESTORE; + default: + return Enum$BackupReason.$unknown; + } +} + enum Enum$DnsProvider { CLOUDFLARE, DIGITALOCEAN, DESEC, $unknown } String toJson$Enum$DnsProvider(Enum$DnsProvider e) { diff --git a/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart b/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart index ed54bd53..8e77d452 100644 --- a/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart +++ b/lib/logic/api_maps/graphql_maps/server_api/backups_api.dart @@ -143,6 +143,51 @@ mixin BackupsApi on GraphQLApiMap { return result; } + Future setAutobackupQuotas( + final AutobackupQuotas quotas, + ) async { + QueryResult response; + GenericResult? result; + + try { + final GraphQLClient client = await getClient(); + final variables = Variables$Mutation$setAutobackupQuotas( + quotas: Input$AutobackupQuotasInput( + last: quotas.last, + daily: quotas.daily, + weekly: quotas.weekly, + monthly: quotas.monthly, + yearly: quotas.yearly, + ), + ); + final options = + Options$Mutation$setAutobackupQuotas(variables: variables); + response = await client.mutate$setAutobackupQuotas(options); + if (response.hasException) { + final message = response.exception.toString(); + print(message); + result = GenericResult( + success: false, + data: null, + message: message, + ); + } + result = GenericResult( + success: true, + data: null, + ); + } catch (e) { + print(e); + result = GenericResult( + success: false, + data: null, + message: e.toString(), + ); + } + + return result; + } + Future removeRepository() async { try { final GraphQLClient client = await getClient(); diff --git a/lib/logic/api_maps/rest_maps/backblaze.dart b/lib/logic/api_maps/rest_maps/backblaze.dart index b9df76c2..d908cd26 100644 --- a/lib/logic/api_maps/rest_maps/backblaze.dart +++ b/lib/logic/api_maps/rest_maps/backblaze.dart @@ -2,6 +2,8 @@ import 'dart:io'; import 'package:dio/dio.dart'; import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/logic/models/backup.dart'; +import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; import 'package:selfprivacy/logic/models/hive/backups_credential.dart'; import 'package:selfprivacy/logic/api_maps/generic_result.dart'; import 'package:selfprivacy/logic/api_maps/rest_maps/rest_api_map.dart'; @@ -179,6 +181,42 @@ class BackblazeApi extends RestApiMap { } } + Future fetchBucket( + final BackupsCredential credentials, + final BackupConfiguration configuration, + ) async { + BackblazeBucket? bucket; + final BackblazeApiAuth auth = await getAuthorizationToken(); + final Dio client = await getClient(); + client.options.baseUrl = auth.apiUrl; + final Response response = await client.get( + '$apiPrefix/b2_list_buckets', + queryParameters: { + 'accountId': getIt().backblazeCredential!.keyId, + }, + options: Options( + headers: {'Authorization': auth.authorizationToken}, + ), + ); + close(client); + if (response.statusCode == HttpStatus.ok) { + for (final rawBucket in response.data['buckets']) { + if (rawBucket['bucketId'] == configuration.locationId) { + bucket = BackblazeBucket( + bucketId: rawBucket['bucketId'], + bucketName: rawBucket['bucketName'], + encryptionKey: configuration.encryptionKey, + applicationKeyId: '', + applicationKey: '', + ); + } + } + return bucket; + } else { + throw Exception('code: ${response.statusCode}'); + } + } + @override bool hasLogger; diff --git a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart index 6a886e75..9ffdb666 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/digital_ocean/digital_ocean_api.dart @@ -320,7 +320,7 @@ class DigitalOceanApi extends RestApiMap { ); } - Future> createVolume() async { + Future> createVolume(final int gb) async { DigitalOceanVolume? volume; Response? createVolumeResponse; final Dio client = await getClient(); @@ -330,7 +330,7 @@ class DigitalOceanApi extends RestApiMap { createVolumeResponse = await client.post( '/volumes', data: { - 'size_gigabytes': 10, + 'size_gigabytes': gb, 'name': 'volume${StringGenerators.storageName()}', 'labels': {'labelkey': 'value'}, 'region': region, @@ -455,8 +455,8 @@ class DigitalOceanApi extends RestApiMap { } Future> resizeVolume( - final String name, - final DiskSize size, + final String uuid, + final int gb, ) async { bool success = false; @@ -464,11 +464,10 @@ class DigitalOceanApi extends RestApiMap { final Dio client = await getClient(); try { resizeVolumeResponse = await client.post( - '/volumes/actions', + '/volumes/$uuid/actions', data: { 'type': 'resize', - 'volume_name': name, - 'size_gigabytes': size.gibibyte, + 'size_gigabytes': gb, 'region': region, }, ); diff --git a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart index afb061d1..5029561d 100644 --- a/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart +++ b/lib/logic/api_maps/rest_maps/server_providers/hetzner/hetzner_api.dart @@ -320,8 +320,8 @@ class HetznerApi extends RestApiMap { return GenericResult(success: true, data: null); } - Future> getPricePerGb() async { - double? price; + Future> getPricing() async { + HetznerPricing? pricing; final Response pricingResponse; final Dio client = await getClient(); @@ -330,19 +330,34 @@ class HetznerApi extends RestApiMap { final volume = pricingResponse.data['pricing']['volume']; final volumePrice = volume['price_per_gb_month']['gross']; - price = double.parse(volumePrice); + final primaryIps = pricingResponse.data['pricing']['primary_ips']; + String? ipPrice; + for (final primaryIp in primaryIps) { + if (primaryIp['type'] == 'ipv4') { + for (final primaryIpPrice in primaryIp['prices']) { + if (primaryIpPrice['location'] == region!) { + ipPrice = primaryIpPrice['price_monthly']['gross']; + } + } + } + } + pricing = HetznerPricing( + region!, + double.parse(volumePrice), + double.parse(ipPrice!), + ); } catch (e) { print(e); return GenericResult( success: false, - data: price, + data: pricing, message: e.toString(), ); } finally { client.close(); } - return GenericResult(success: true, data: price); + return GenericResult(success: true, data: pricing); } Future>> getVolumes({ @@ -381,7 +396,7 @@ class HetznerApi extends RestApiMap { ); } - Future> createVolume() async { + Future> createVolume(final int gb) async { Response? createVolumeResponse; HetznerVolume? volume; final Dio client = await getClient(); @@ -389,7 +404,7 @@ class HetznerApi extends RestApiMap { createVolumeResponse = await client.post( '/volumes', data: { - 'size': 10, + 'size': gb, 'name': StringGenerators.storageName(), 'labels': {'labelkey': 'value'}, 'location': region, diff --git a/lib/logic/cubit/backups/backups_cubit.dart b/lib/logic/cubit/backups/backups_cubit.dart index 938b606a..ca7e0a50 100644 --- a/lib/logic/cubit/backups/backups_cubit.dart +++ b/lib/logic/cubit/backups/backups_cubit.dart @@ -36,6 +36,7 @@ class BackupsCubit extends ServerInstallationDependendCubit { backblazeBucket: bucket, isInitialized: backupConfig?.isInitialized, autobackupPeriod: backupConfig?.autobackupPeriod ?? Duration.zero, + autobackupQuotas: backupConfig?.autobackupQuotas, backups: backups, preventActions: false, refreshing: false, @@ -109,17 +110,34 @@ class BackupsCubit extends ServerInstallationDependendCubit { Future reuploadKey() async { emit(state.copyWith(preventActions: true)); - final BackblazeBucket? bucket = getIt().backblazeBucket; + BackblazeBucket? bucket = getIt().backblazeBucket; if (bucket == null) { emit(state.copyWith(isInitialized: false)); } else { + String login = bucket.applicationKeyId; + String password = bucket.applicationKey; + if (login.isEmpty || password.isEmpty) { + final BackblazeApplicationKey key = + await backblaze.createKey(bucket.bucketId); + login = key.applicationKeyId; + password = key.applicationKey; + bucket = BackblazeBucket( + bucketId: bucket.bucketId, + bucketName: bucket.bucketName, + encryptionKey: bucket.encryptionKey, + applicationKey: password, + applicationKeyId: login, + ); + await getIt().storeBackblazeBucket(bucket); + emit(state.copyWith(backblazeBucket: bucket)); + } final GenericResult result = await api.initializeRepository( InitializeRepositoryInput( provider: BackupsProviderType.backblaze, locationId: bucket.bucketId, locationName: bucket.bucketName, - login: bucket.applicationKeyId, - password: bucket.applicationKey, + login: login, + password: password, ), ); if (result.success == false) { @@ -129,7 +147,7 @@ class BackupsCubit extends ServerInstallationDependendCubit { return; } else { emit(state.copyWith(preventActions: false)); - getIt().showSnackBar('backup.reuploaded_key'); + getIt().showSnackBar('backup.reuploaded_key'.tr()); await updateBackups(); } } @@ -151,6 +169,7 @@ class BackupsCubit extends ServerInstallationDependendCubit { refreshing: false, isInitialized: backupConfig?.isInitialized ?? false, autobackupPeriod: backupConfig?.autobackupPeriod, + autobackupQuotas: backupConfig?.autobackupQuotas, ), ); if (useTimer) { @@ -210,6 +229,25 @@ class BackupsCubit extends ServerInstallationDependendCubit { await updateBackups(); } + Future setAutobackupQuotas(final AutobackupQuotas quotas) async { + emit(state.copyWith(preventActions: true)); + final result = await api.setAutobackupQuotas(quotas); + if (result.success == false) { + getIt() + .showSnackBar(result.message ?? 'Unknown error'); + emit(state.copyWith(preventActions: false)); + } else { + getIt().showSnackBar('backup.quotas_set'.tr()); + emit( + state.copyWith( + preventActions: false, + autobackupQuotas: quotas, + ), + ); + } + await updateBackups(); + } + Future forgetSnapshot(final String snapshotId) async { final result = await api.forgetSnapshot(snapshotId); if (!result.success) { diff --git a/lib/logic/cubit/backups/backups_state.dart b/lib/logic/cubit/backups/backups_state.dart index 52b9b106..887396d7 100644 --- a/lib/logic/cubit/backups/backups_state.dart +++ b/lib/logic/cubit/backups/backups_state.dart @@ -9,6 +9,7 @@ class BackupsState extends ServerInstallationDependendState { this.refreshing = true, this.autobackupPeriod, this.backblazeBucket, + this.autobackupQuotas, }); final bool isInitialized; @@ -18,6 +19,7 @@ class BackupsState extends ServerInstallationDependendState { final bool refreshing; final Duration? autobackupPeriod; final BackblazeBucket? backblazeBucket; + final AutobackupQuotas? autobackupQuotas; List serviceBackups(final String serviceId) => backups .where((final backup) => backup.serviceId == serviceId) @@ -40,6 +42,7 @@ class BackupsState extends ServerInstallationDependendState { final bool? refreshing, final Duration? autobackupPeriod, final BackblazeBucket? backblazeBucket, + final AutobackupQuotas? autobackupQuotas, }) => BackupsState( isInitialized: isInitialized ?? this.isInitialized, @@ -53,5 +56,6 @@ class BackupsState extends ServerInstallationDependendState { ? null : autobackupPeriod ?? this.autobackupPeriod, backblazeBucket: backblazeBucket ?? this.backblazeBucket, + autobackupQuotas: autobackupQuotas ?? this.autobackupQuotas, ); } diff --git a/lib/logic/cubit/dns_records/dns_records_cubit.dart b/lib/logic/cubit/dns_records/dns_records_cubit.dart index 3fc2d199..6f295274 100644 --- a/lib/logic/cubit/dns_records/dns_records_cubit.dart +++ b/lib/logic/cubit/dns_records/dns_records_cubit.dart @@ -75,7 +75,7 @@ class DnsRecordsCubit @override Future clear() async { - emit(const DnsRecordsState(dnsState: DnsRecordsStatus.error)); + emit(const DnsRecordsState(dnsState: DnsRecordsStatus.uninitialized)); } Future refresh() async { diff --git a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart index f4597439..bccbc551 100644 --- a/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart +++ b/lib/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart @@ -18,13 +18,11 @@ class DomainSetupCubit extends Cubit { } else if (result.data.length == 1) { emit(Loaded(result.data.first)); } else { - emit(MoreThenOne()); + emit(MoreThenOne(result.data)); } } - Future saveDomain() async { - assert(state is Loaded, 'wrong state'); - final String domainName = (state as Loaded).domain; + Future saveDomain(final String domainName) async { emit(Loading(LoadingTypes.saving)); final dnsProvider = ProvidersController.currentDnsProvider!; @@ -45,7 +43,10 @@ class Initial extends DomainSetupState {} class Empty extends DomainSetupState {} -class MoreThenOne extends DomainSetupState {} +class MoreThenOne extends DomainSetupState { + MoreThenOne(this.domains); + final List domains; +} class Loading extends DomainSetupState { Loading(this.type); diff --git a/lib/logic/cubit/forms/user/ssh_form_cubit.dart b/lib/logic/cubit/forms/user/ssh_form_cubit.dart index 707e54c3..3305d647 100644 --- a/lib/logic/cubit/forms/user/ssh_form_cubit.dart +++ b/lib/logic/cubit/forms/user/ssh_form_cubit.dart @@ -12,7 +12,7 @@ class SshFormCubit extends FormCubit { required this.user, }) { final RegExp keyRegExp = RegExp( - r'^(ssh-rsa AAAAB3NzaC1yc2|ssh-ed25519 AAAAC3NzaC1lZDI1NTE5)[0-9A-Za-z+/]+[=]{0,3}( .*)?$', + r'^(ecdsa-sha2-nistp256 AAAAE2VjZH|ssh-rsa AAAAB3NzaC1yc2|ssh-ed25519 AAAAC3NzaC1lZDI1NTE5)[0-9A-Za-z+/]+[=]{0,3}( .*)?$', ); key = FieldCubit( diff --git a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart index 46137c59..fed7b083 100644 --- a/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart +++ b/lib/logic/cubit/provider_volumes/provider_volume_cubit.dart @@ -26,8 +26,17 @@ class ApiProviderVolumeCubit } } - Future getPricePerGb() async => - (await ProvidersController.currentServerProvider!.getPricePerGb()).data; + Future getPricePerGb() async { + Price? price; + final pricingResult = + await ProvidersController.currentServerProvider!.getAdditionalPricing(); + if (pricingResult.data == null || !pricingResult.success) { + getIt().showSnackBar('server.pricing_error'.tr()); + return price; + } + price = pricingResult.data!.perVolumeGb; + return price; + } Future refresh() async { emit(const ApiProviderVolumeState([], LoadingStatus.refreshing, false)); @@ -113,9 +122,11 @@ class ApiProviderVolumeCubit return true; } - Future createVolume() async { - final ServerVolume? volume = - (await ProvidersController.currentServerProvider!.createVolume()).data; + Future createVolume(final DiskSize size) async { + final ServerVolume? volume = (await ProvidersController + .currentServerProvider! + .createVolume(size.gibibyte.toInt())) + .data; final diskVolume = DiskVolume(providerVolume: volume); await attachVolume(diskVolume); diff --git a/lib/logic/cubit/server_installation/server_installation_cubit.dart b/lib/logic/cubit/server_installation/server_installation_cubit.dart index a10532ef..8884b472 100644 --- a/lib/logic/cubit/server_installation/server_installation_cubit.dart +++ b/lib/logic/cubit/server_installation/server_installation_cubit.dart @@ -5,7 +5,10 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:equatable/equatable.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart'; +import 'package:selfprivacy/logic/api_maps/rest_maps/backblaze.dart'; import 'package:selfprivacy/logic/api_maps/tls_options.dart'; +import 'package:selfprivacy/logic/models/disk_size.dart'; +import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart'; import 'package:selfprivacy/logic/models/hive/backups_credential.dart'; import 'package:selfprivacy/logic/models/callback_dialogue_branching.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; @@ -13,6 +16,7 @@ import 'package:selfprivacy/logic/models/hive/user.dart'; import 'package:selfprivacy/logic/models/launch_installation_data.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_repository.dart'; +import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_basic_info.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; @@ -32,6 +36,8 @@ class ServerInstallationCubit extends Cubit { Timer? timer; + final DiskSize initialStorage = DiskSize.fromGibibyte(10); + Future load() async { final ServerInstallationState state = await repository.load(); @@ -147,6 +153,19 @@ class ServerInstallationCubit extends Cubit { return apiResult.data; } + Future fetchAvailableAdditionalPricing() async { + AdditionalPricing? prices; + final pricingResult = + await ProvidersController.currentServerProvider!.getAdditionalPricing(); + if (pricingResult.data == null || !pricingResult.success) { + getIt().showSnackBar('server.pricing_error'.tr()); + return prices; + } + + prices = pricingResult.data; + return prices; + } + void setServerProviderKey(final String serverProviderKey) async { await repository.saveServerProviderKey(serverProviderKey); @@ -167,12 +186,14 @@ class ServerInstallationCubit extends Cubit { ); } + Future setLocationIdentifier(final String locationId) async { + await ProvidersController.currentServerProvider! + .trySetServerLocation(locationId); + } + void setServerType(final ServerType serverType) async { await repository.saveServerType(serverType); - await ProvidersController.currentServerProvider! - .trySetServerLocation(serverType.location.identifier); - emit( (state as ServerInstallationNotFinished).copyWith( serverTypeIdentificator: serverType.identifier, @@ -199,8 +220,23 @@ class ServerInstallationCubit extends Cubit { applicationKey: applicationKey, provider: BackupsProviderType.backblaze, ); + final BackblazeBucket? bucket; await repository.saveBackblazeKey(backblazeCredential); if (state is ServerInstallationRecovery) { + final configuration = await ServerApi( + customToken: + (state as ServerInstallationRecovery).serverDetails!.apiToken, + isWithToken: true, + ).getBackupsConfiguration(); + if (configuration != null) { + try { + bucket = await BackblazeApi() + .fetchBucket(backblazeCredential, configuration); + await getIt().storeBackblazeBucket(bucket!); + } catch (e) { + print(e); + } + } finishRecoveryProcess(backblazeCredential); return; } @@ -257,6 +293,7 @@ class ServerInstallationCubit extends Cubit { serverTypeId: state.serverTypeIdentificator!, errorCallback: clearAppConfig, successCallback: onCreateServerSuccess, + storageSize: initialStorage, ); final result = diff --git a/lib/logic/cubit/server_installation/server_installation_repository.dart b/lib/logic/cubit/server_installation/server_installation_repository.dart index c3fd6811..30bccfd5 100644 --- a/lib/logic/cubit/server_installation/server_installation_repository.dart +++ b/lib/logic/cubit/server_installation/server_installation_repository.dart @@ -155,7 +155,7 @@ class ServerInstallationRepository { RecoveryStep _getCurrentRecoveryStep( final String? serverProviderToken, - final String? cloudflareToken, + final String? dnsProviderToken, final ServerDomain serverDomain, final ServerHostingDetails? serverDetails, ) { @@ -209,7 +209,7 @@ class ServerInstallationRepository { return false; } - return domain == domainResult.data[0]; + return domainResult.data.contains(domain); } Future> isDnsAddressesMatch( @@ -218,24 +218,28 @@ class ServerInstallationRepository { final Map skippedMatches, ) async { final Map matches = {}; - await InternetAddress.lookup(domainName!).then( - (final records) { - for (final record in records) { - if (skippedMatches[record.host] ?? false) { - matches[record.host] = true; - continue; + try { + await InternetAddress.lookup(domainName!).then( + (final records) { + for (final record in records) { + if (skippedMatches[record.host] ?? false) { + matches[record.host] = true; + continue; + } + if (record.address == ip4!) { + matches[record.host] = true; + } } - if (record.address == ip4!) { - matches[record.host] = true; - } - } - }, - ); + }, + ); + } catch (e) { + print(e); + } return matches; } - Future createDkimRecord(final ServerDomain cloudFlareDomain) async { + Future createDkimRecord(final ServerDomain domain) async { final ServerApi api = ServerApi(); late DnsRecord record; @@ -248,7 +252,7 @@ class ServerInstallationRepository { await ProvidersController.currentDnsProvider!.setDnsRecord( record, - cloudFlareDomain, + domain, ); } diff --git a/lib/logic/cubit/users/users_state.dart b/lib/logic/cubit/users/users_state.dart index dbd931d7..4e2ed42e 100644 --- a/lib/logic/cubit/users/users_state.dart +++ b/lib/logic/cubit/users/users_state.dart @@ -18,6 +18,32 @@ class UsersState extends ServerInstallationDependendState { @override List get props => [users, isLoading]; + /// Makes a copy of existing users list, but places 'primary' + /// to the beginning and sorts the rest alphabetically + /// + /// If found a 'root' user, it doesn't get copied into the result + List get orderedUsers { + User? primaryUser; + final List normalUsers = []; + for (final User user in users) { + if (user.type == UserType.primary) { + primaryUser = user; + continue; + } + if (user.type == UserType.root) { + continue; + } + normalUsers.add(user); + } + + normalUsers.sort( + (final User a, final User b) => + a.login.toLowerCase().compareTo(b.login.toLowerCase()), + ); + + return primaryUser == null ? normalUsers : [primaryUser] + normalUsers; + } + UsersState copyWith({ final List? users, final bool? isLoading, diff --git a/lib/logic/get_it/navigation.dart b/lib/logic/get_it/navigation.dart index 90f67203..dac1dc8d 100644 --- a/lib/logic/get_it/navigation.dart +++ b/lib/logic/get_it/navigation.dart @@ -21,11 +21,12 @@ class NavigationService { ); } - void showSnackBar(final String text) { + void showSnackBar(final String text, {final SnackBarBehavior? behavior}) { final ScaffoldMessengerState state = scaffoldMessengerKey.currentState!; final SnackBar snack = SnackBar( content: Text(text), duration: const Duration(seconds: 2), + behavior: behavior, ); state.showSnackBar(snack); } diff --git a/lib/logic/models/backup.dart b/lib/logic/models/backup.dart index 2199e223..1dcf9129 100644 --- a/lib/logic/models/backup.dart +++ b/lib/logic/models/backup.dart @@ -11,6 +11,7 @@ class Backup { time: snapshot.createdAt, serviceId: snapshot.service.id, fallbackServiceName: snapshot.service.displayName, + reason: snapshot.reason, ); Backup({ @@ -18,6 +19,7 @@ class Backup { required this.id, required this.serviceId, required this.fallbackServiceName, + required this.reason, }); // Time of the backup @@ -26,6 +28,16 @@ class Backup { final String id; final String serviceId; final String fallbackServiceName; + final Enum$BackupReason reason; +} + +extension BackupReasonExtension on Enum$BackupReason { + String get displayName => switch (this) { + Enum$BackupReason.AUTO => 'backup.snapshot_reasons.auto', + Enum$BackupReason.EXPLICIT => 'backup.snapshot_reasons.explicit', + Enum$BackupReason.PRE_RESTORE => 'backup.snapshot_reasons.pre_restore', + Enum$BackupReason.$unknown => 'backup.snapshot_reasons.unknown', + }; } class BackupConfiguration { @@ -41,6 +53,9 @@ class BackupConfiguration { locationId: configuration.locationId, locationName: configuration.locationName, provider: BackupsProviderType.fromGraphQL(configuration.provider), + autobackupQuotas: AutobackupQuotas.fromGraphQL( + configuration.autobackupQuotas, + ), ); BackupConfiguration({ @@ -50,6 +65,7 @@ class BackupConfiguration { required this.locationId, required this.locationName, required this.provider, + required this.autobackupQuotas, }); final Duration? autobackupPeriod; @@ -58,6 +74,49 @@ class BackupConfiguration { final String? locationId; final String? locationName; final BackupsProviderType provider; + final AutobackupQuotas autobackupQuotas; +} + +class AutobackupQuotas { + AutobackupQuotas.fromGraphQL( + final Query$BackupConfiguration$backup$configuration$autobackupQuotas + autobackupQuotas, + ) : this( + last: autobackupQuotas.last, + daily: autobackupQuotas.daily, + weekly: autobackupQuotas.weekly, + monthly: autobackupQuotas.monthly, + yearly: autobackupQuotas.yearly, + ); + + AutobackupQuotas({ + required this.last, + required this.daily, + required this.weekly, + required this.monthly, + required this.yearly, + }); + + final int last; + final int daily; + final int weekly; + final int monthly; + final int yearly; + + AutobackupQuotas copyWith({ + final int? last, + final int? daily, + final int? weekly, + final int? monthly, + final int? yearly, + }) => + AutobackupQuotas( + last: last ?? this.last, + daily: daily ?? this.daily, + weekly: weekly ?? this.weekly, + monthly: monthly ?? this.monthly, + yearly: yearly ?? this.yearly, + ); } enum BackupRestoreStrategy { diff --git a/lib/logic/models/json/hetzner_server_info.dart b/lib/logic/models/json/hetzner_server_info.dart index ece29de0..6d51f2b8 100644 --- a/lib/logic/models/json/hetzner_server_info.dart +++ b/lib/logic/models/json/hetzner_server_info.dart @@ -190,3 +190,22 @@ class HetznerVolume { static HetznerVolume fromJson(final Map json) => _$HetznerVolumeFromJson(json); } + +/// Prices for Hetzner resources in Euro (monthly). +/// https://docs.hetzner.cloud/#pricing +class HetznerPricing { + HetznerPricing( + this.region, + this.perVolumeGb, + this.perPublicIpv4, + ); + + /// Region name to which current price listing applies + final String region; + + /// The cost of Volume per GB/month + final double perVolumeGb; + + /// Costs of Primary IP type + final double perPublicIpv4; +} diff --git a/lib/logic/models/launch_installation_data.dart b/lib/logic/models/launch_installation_data.dart index c1f32ee6..00d89335 100644 --- a/lib/logic/models/launch_installation_data.dart +++ b/lib/logic/models/launch_installation_data.dart @@ -1,3 +1,4 @@ +import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/hive/server_details.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; import 'package:selfprivacy/logic/models/hive/user.dart'; @@ -11,6 +12,7 @@ class LaunchInstallationData { required this.serverTypeId, required this.errorCallback, required this.successCallback, + required this.storageSize, }); final User rootUser; @@ -20,4 +22,5 @@ class LaunchInstallationData { final String serverTypeId; final Function() errorCallback; final Function(ServerHostingDetails details) successCallback; + final DiskSize storageSize; } diff --git a/lib/logic/models/price.dart b/lib/logic/models/price.dart index b60cf5bf..494b1511 100644 --- a/lib/logic/models/price.dart +++ b/lib/logic/models/price.dart @@ -53,3 +53,12 @@ class Currency { final String? fontcode; final String? symbol; } + +class AdditionalPricing { + AdditionalPricing({ + required this.perVolumeGb, + required this.perPublicIpv4, + }); + final Price perVolumeGb; + final Price perPublicIpv4; +} diff --git a/lib/logic/models/service.dart b/lib/logic/models/service.dart index d79615e8..b7fee609 100644 --- a/lib/logic/models/service.dart +++ b/lib/logic/models/service.dart @@ -56,7 +56,7 @@ class Service { /// TODO Turn loginInfo into dynamic data, not static! String get loginInfo { switch (id) { - case 'mailserver': + case 'email': return 'mail.login_info'.tr(); case 'bitwarden': return 'password_manager.login_info'.tr(); diff --git a/lib/logic/providers/dns_providers/cloudflare.dart b/lib/logic/providers/dns_providers/cloudflare.dart index 4a8062f1..6cf4a494 100644 --- a/lib/logic/providers/dns_providers/cloudflare.dart +++ b/lib/logic/providers/dns_providers/cloudflare.dart @@ -69,13 +69,6 @@ class CloudflareDnsProvider extends DnsProvider { ) .toList(); - /// TODO: Remove when domain selection for more than one domain on account is implemented, move cachedZoneId writing to domain saving method - _adapter = ApiAdapter( - isWithToken: true, - cachedDomain: result.data[0].name, - cachedZoneId: result.data[0].id, - ); - return GenericResult( success: true, data: domains, diff --git a/lib/logic/providers/server_providers/digital_ocean.dart b/lib/logic/providers/server_providers/digital_ocean.dart index 945977fb..6e699723 100644 --- a/lib/logic/providers/server_providers/digital_ocean.dart +++ b/lib/logic/providers/server_providers/digital_ocean.dart @@ -254,7 +254,9 @@ class DigitalOceanServerProvider extends ServerProvider { try { final int dropletId = serverResult.data!; - final newVolume = (await createVolume()).data; + final newVolume = + (await createVolume(installationData.storageSize.gibibyte.toInt())) + .data; final bool attachedVolume = (await _adapter.api().attachVolume( newVolume!.name, dropletId, @@ -527,14 +529,20 @@ class DigitalOceanServerProvider extends ServerProvider { ); } - /// Hardcoded on their documentation and there is no pricing API at all - /// Probably we should scrap the doc page manually @override - Future> getPricePerGb() async => GenericResult( + Future> getAdditionalPricing() async => + GenericResult( success: true, - data: Price( - value: 0.10, - currency: currency, + data: AdditionalPricing( + perVolumeGb: Price( + /// Hardcoded in their documentation and there is no pricing API + value: 0.10, + currency: currency, + ), + perPublicIpv4: Price( + value: 0, + currency: currency, + ), ), ); @@ -588,10 +596,10 @@ class DigitalOceanServerProvider extends ServerProvider { } @override - Future> createVolume() async { + Future> createVolume(final int gb) async { ServerVolume? volume; - final result = await _adapter.api().createVolume(); + final result = await _adapter.api().createVolume(gb); if (!result.success || result.data == null) { return GenericResult( @@ -690,8 +698,8 @@ class DigitalOceanServerProvider extends ServerProvider { final DiskSize size, ) async => _adapter.api().resizeVolume( - volume.name, - size, + volume.uuid!, + size.gibibyte.toInt(), ); @override @@ -708,13 +716,37 @@ class DigitalOceanServerProvider extends ServerProvider { message: result.message, ); } + final resultVolumes = await _adapter.api().getVolumes(); + if (resultVolumes.data.isEmpty || !resultVolumes.success) { + return GenericResult( + success: false, + data: metadata, + code: resultVolumes.code, + message: resultVolumes.message, + ); + } + final resultPricePerGb = await getAdditionalPricing(); + if (resultPricePerGb.data == null || !resultPricePerGb.success) { + return GenericResult( + success: false, + data: metadata, + code: resultPricePerGb.code, + message: resultPricePerGb.message, + ); + } final List servers = result.data; + final List volumes = resultVolumes.data; try { + final Price pricePerGb = resultPricePerGb.data!.perVolumeGb; final droplet = servers.firstWhere( (final server) => server['id'] == serverId, ); + final volume = volumes.firstWhere( + (final volume) => droplet['volume_ids'].contains(volume.id), + ); + metadata = [ ServerMetadataEntity( type: MetadataType.id, @@ -739,7 +771,8 @@ class DigitalOceanServerProvider extends ServerProvider { ServerMetadataEntity( type: MetadataType.cost, trId: 'server.monthly_cost', - value: '${droplet['size']['price_monthly']} ${currency.shortcode}', + value: + '${droplet['size']['price_monthly']} + ${(volume.sizeGigabytes * pricePerGb.value).toStringAsFixed(2)} ${currency.shortcode}', ), ServerMetadataEntity( type: MetadataType.location, diff --git a/lib/logic/providers/server_providers/hetzner.dart b/lib/logic/providers/server_providers/hetzner.dart index d931e34f..ff8e04c8 100644 --- a/lib/logic/providers/server_providers/hetzner.dart +++ b/lib/logic/providers/server_providers/hetzner.dart @@ -165,7 +165,9 @@ class HetznerServerProvider extends ServerProvider { Future> launchInstallation( final LaunchInstallationData installationData, ) async { - final volumeResult = await _adapter.api().createVolume(); + final volumeResult = await _adapter.api().createVolume( + installationData.storageSize.gibibyte.toInt(), + ); if (!volumeResult.success || volumeResult.data == null) { return GenericResult( @@ -546,8 +548,8 @@ class HetznerServerProvider extends ServerProvider { } @override - Future> getPricePerGb() async { - final result = await _adapter.api().getPricePerGb(); + Future> getAdditionalPricing() async { + final result = await _adapter.api().getPricing(); if (!result.success || result.data == null) { return GenericResult( @@ -560,9 +562,15 @@ class HetznerServerProvider extends ServerProvider { return GenericResult( success: true, - data: Price( - value: result.data!, - currency: currency, + data: AdditionalPricing( + perVolumeGb: Price( + value: result.data!.perVolumeGb, + currency: currency, + ), + perPublicIpv4: Price( + value: result.data!.perPublicIpv4, + currency: currency, + ), ), ); } @@ -617,10 +625,10 @@ class HetznerServerProvider extends ServerProvider { } @override - Future> createVolume() async { + Future> createVolume(final int gb) async { ServerVolume? volume; - final result = await _adapter.api().createVolume(); + final result = await _adapter.api().createVolume(gb); if (!result.success || result.data == null) { return GenericResult( @@ -705,21 +713,46 @@ class HetznerServerProvider extends ServerProvider { final int serverId, ) async { List metadata = []; - final result = await _adapter.api().getServers(); - if (result.data.isEmpty || !result.success) { + final resultServers = await _adapter.api().getServers(); + if (resultServers.data.isEmpty || !resultServers.success) { return GenericResult( success: false, data: metadata, - code: result.code, - message: result.message, + code: resultServers.code, + message: resultServers.message, + ); + } + final resultVolumes = await _adapter.api().getVolumes(); + if (resultVolumes.data.isEmpty || !resultVolumes.success) { + return GenericResult( + success: false, + data: metadata, + code: resultVolumes.code, + message: resultVolumes.message, + ); + } + final resultPricePerGb = await getAdditionalPricing(); + if (resultPricePerGb.data == null || !resultPricePerGb.success) { + return GenericResult( + success: false, + data: metadata, + code: resultPricePerGb.code, + message: resultPricePerGb.message, ); } - final List servers = result.data; + final List servers = resultServers.data; + final List volumes = resultVolumes.data; + try { + final Price pricePerGb = resultPricePerGb.data!.perVolumeGb; + final Price pricePerIp = resultPricePerGb.data!.perPublicIpv4; final HetznerServerInfo server = servers.firstWhere( (final server) => server.id == serverId, ); + final HetznerVolume volume = volumes.firstWhere( + (final volume) => server.volumes.contains(volume.id), + ); metadata = [ ServerMetadataEntity( @@ -746,7 +779,8 @@ class HetznerServerProvider extends ServerProvider { type: MetadataType.cost, trId: 'server.monthly_cost', value: - '${server.serverType.prices[1].monthly.toStringAsFixed(2)} ${currency.shortcode}', + // TODO: Make more descriptive + '${server.serverType.prices[1].monthly.toStringAsFixed(2)} + ${(volume.size * pricePerGb.value).toStringAsFixed(2)} + ${pricePerIp.value.toStringAsFixed(2)} ${currency.shortcode}', ), ServerMetadataEntity( type: MetadataType.location, diff --git a/lib/logic/providers/server_providers/server_provider.dart b/lib/logic/providers/server_providers/server_provider.dart index cfcf3f5e..ce7b6944 100644 --- a/lib/logic/providers/server_providers/server_provider.dart +++ b/lib/logic/providers/server_providers/server_provider.dart @@ -90,9 +90,9 @@ abstract class ServerProvider { /// answered the request. Future> restart(final int serverId); - /// Returns [Price] information per one gigabyte of storage extension for - /// the requested accessible machine. - Future> getPricePerGb(); + /// Returns [Price] information map of all additional resources, excluding + /// main server type pricing + Future> getAdditionalPricing(); /// Returns [ServerVolume] of all available volumes /// assigned to the authorized user and attached to active machine. @@ -101,7 +101,7 @@ abstract class ServerProvider { /// Tries to create an empty unattached [ServerVolume]. /// /// If success, returns this volume information. - Future> createVolume(); + Future> createVolume(final int gb); /// Tries to delete the requested accessible [ServerVolume]. Future> deleteVolume(final ServerVolume volume); diff --git a/lib/ui/components/drawers/support_drawer.dart b/lib/ui/components/drawers/support_drawer.dart index 7b4c5c2b..01fc292d 100644 --- a/lib/ui/components/drawers/support_drawer.dart +++ b/lib/ui/components/drawers/support_drawer.dart @@ -16,8 +16,8 @@ class SupportDrawer extends StatelessWidget { return Drawer( width: 440, child: SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(8.0), + child: SafeArea( + minimum: const EdgeInsets.all(8.0), child: Column( children: [ Row( diff --git a/lib/ui/components/list_tiles/log_list_tile.dart b/lib/ui/components/list_tiles/log_list_tile.dart index 76bc6150..e83765e9 100644 --- a/lib/ui/components/list_tiles/log_list_tile.dart +++ b/lib/ui/components/list_tiles/log_list_tile.dart @@ -1,7 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:selfprivacy/logic/models/message.dart'; +import 'package:selfprivacy/utils/platform_adapter.dart'; class LogListItem extends StatelessWidget { const LogListItem({ @@ -71,7 +71,7 @@ class _RestApiRequestMessageItem extends StatelessWidget { if (message.text != null) TextButton( onPressed: () { - Clipboard.setData(ClipboardData(text: message.text ?? '')); + PlatformAdapter.setClipboard(message.text ?? ''); }, child: Text('console_page.copy'.tr()), ), @@ -121,7 +121,7 @@ class _RestApiResponseMessageItem extends StatelessWidget { if (message.text != null) TextButton( onPressed: () { - Clipboard.setData(ClipboardData(text: message.text ?? '')); + PlatformAdapter.setClipboard(message.text ?? ''); }, child: Text('console_page.copy'.tr()), ), @@ -195,7 +195,7 @@ class _GraphQlResponseMessageItem extends StatelessWidget { if (message.text != null) TextButton( onPressed: () { - Clipboard.setData(ClipboardData(text: message.text ?? '')); + PlatformAdapter.setClipboard(message.text ?? ''); }, child: Text('console_page.copy'.tr()), ), @@ -264,7 +264,7 @@ class _GraphQlRequestMessageItem extends StatelessWidget { if (message.text != null) TextButton( onPressed: () { - Clipboard.setData(ClipboardData(text: message.text ?? '')); + PlatformAdapter.setClipboard(message.text ?? ''); }, child: Text('console_page.copy'.tr()), ), diff --git a/lib/ui/helpers/empty_page_placeholder.dart b/lib/ui/helpers/empty_page_placeholder.dart new file mode 100644 index 00000000..e1bb0d7b --- /dev/null +++ b/lib/ui/helpers/empty_page_placeholder.dart @@ -0,0 +1,67 @@ +import 'package:flutter/material.dart'; +import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; + +class EmptyPagePlaceholder extends StatelessWidget { + const EmptyPagePlaceholder({ + required this.title, + required this.iconData, + required this.description, + this.showReadyCard = false, + super.key, + }); + + final String title; + final String description; + final IconData iconData; + final bool showReadyCard; + + @override + Widget build(final BuildContext context) => !showReadyCard + ? _expandedContent(context) + : Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const Padding( + padding: EdgeInsets.symmetric(horizontal: 15), + child: NotReadyCard(), + ), + Expanded( + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 15), + child: Center( + child: _expandedContent(context), + ), + ), + ) + ], + ); + + Widget _expandedContent(final BuildContext context) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + iconData, + size: 50, + color: Theme.of(context).colorScheme.onBackground, + ), + const SizedBox(height: 16), + Text( + title, + style: Theme.of(context).textTheme.headlineMedium?.copyWith( + color: Theme.of(context).colorScheme.onBackground, + ), + ), + const SizedBox(height: 8), + Text( + description, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.titleSmall?.copyWith( + color: Theme.of(context).colorScheme.onBackground, + ), + ), + ], + ), + ); +} diff --git a/lib/ui/pages/backups/backup_details.dart b/lib/ui/pages/backups/backup_details.dart index 1d08dfac..344876b1 100644 --- a/lib/ui/pages/backups/backup_details.dart +++ b/lib/ui/pages/backups/backup_details.dart @@ -16,6 +16,7 @@ import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/ui/pages/backups/change_period_modal.dart'; +import 'package:selfprivacy/ui/pages/backups/change_rotation_quotas_modal.dart'; import 'package:selfprivacy/ui/pages/backups/copy_encryption_key_modal.dart'; import 'package:selfprivacy/ui/pages/backups/create_backups_modal.dart'; import 'package:selfprivacy/ui/pages/backups/snapshot_modal.dart'; @@ -83,6 +84,9 @@ class BackupDetailsPage extends StatelessWidget { ); } + final Color? overrideColor = + preventActions ? Theme.of(context).colorScheme.secondary : null; + return BrandHeroScreen( heroIcon: BrandIcons.save, heroTitle: 'backup.card_title'.tr(), @@ -110,11 +114,15 @@ class BackupDetailsPage extends StatelessWidget { ), ); }, - leading: const Icon( + leading: Icon( Icons.add_circle_outline_rounded, + color: overrideColor, ), title: Text( 'backup.create_new'.tr(), + style: TextStyle( + color: overrideColor, + ), ), ), ListTile( @@ -138,13 +146,20 @@ class BackupDetailsPage extends StatelessWidget { ), ); }, - leading: const Icon( + leading: Icon( Icons.manage_history_outlined, + color: overrideColor, ), title: Text( 'backup.autobackup_period_title'.tr(), + style: TextStyle( + color: overrideColor, + ), ), subtitle: Text( + style: TextStyle( + color: overrideColor, + ), autobackupPeriod != null ? 'backup.autobackup_period_subtitle'.tr( namedArgs: { @@ -154,6 +169,38 @@ class BackupDetailsPage extends StatelessWidget { : 'backup.autobackup_period_never'.tr(), ), ), + ListTile( + onTap: preventActions + ? null + : () { + showModalBottomSheet( + useRootNavigator: true, + context: context, + isScrollControlled: true, + builder: (final BuildContext context) => + DraggableScrollableSheet( + expand: false, + maxChildSize: 0.9, + minChildSize: 0.4, + initialChildSize: 0.6, + builder: (final context, final scrollController) => + ChangeRotationQuotasModal( + scrollController: scrollController, + ), + ), + ); + }, + leading: Icon( + Icons.auto_delete_outlined, + color: overrideColor, + ), + title: Text( + 'backup.rotation_quotas_title'.tr(), + style: TextStyle( + color: overrideColor, + ), + ), + ), ListTile( onTap: preventActions ? null @@ -175,14 +222,21 @@ class BackupDetailsPage extends StatelessWidget { ), ); }, - leading: const Icon( + leading: Icon( Icons.key_outlined, + color: overrideColor, ), title: Text( 'backup.backups_encryption_key'.tr(), + style: TextStyle( + color: overrideColor, + ), ), subtitle: Text( 'backup.backups_encryption_key_subtitle'.tr(), + style: TextStyle( + color: overrideColor, + ), ), ), const SizedBox(height: 8), @@ -227,10 +281,16 @@ class BackupDetailsPage extends StatelessWidget { ), if (backups.isEmpty) ListTile( - leading: const Icon( + leading: Icon( Icons.error_outline, + color: overrideColor, + ), + title: Text( + 'backup.no_backups'.tr(), + style: TextStyle( + color: overrideColor, + ), ), - title: Text('backup.no_backups'.tr()), ), if (backups.isNotEmpty) Column( @@ -282,9 +342,15 @@ class BackupDetailsPage extends StatelessWidget { ); }, title: Text( + style: TextStyle( + color: overrideColor, + ), '${MaterialLocalizations.of(context).formatShortDate(backup.time)} ${TimeOfDay.fromDateTime(backup.time).format(context)}', ), subtitle: Text( + style: TextStyle( + color: overrideColor, + ), service?.displayName ?? backup.fallbackServiceName, ), leading: service != null @@ -293,12 +359,16 @@ class BackupDetailsPage extends StatelessWidget { height: 24, width: 24, colorFilter: ColorFilter.mode( - Theme.of(context).colorScheme.onBackground, + overrideColor ?? + Theme.of(context) + .colorScheme + .onBackground, BlendMode.srcIn, ), ) - : const Icon( + : Icon( Icons.question_mark_outlined, + color: overrideColor, ), ); }, @@ -339,12 +409,19 @@ class BackupDetailsPage extends StatelessWidget { ListTile( title: Text( 'backup.refetch_backups'.tr(), + style: TextStyle( + color: overrideColor, + ), ), subtitle: Text( 'backup.refetch_backups_subtitle'.tr(), + style: TextStyle( + color: overrideColor, + ), ), - leading: const Icon( + leading: Icon( Icons.cached_outlined, + color: overrideColor, ), onTap: preventActions ? null @@ -356,12 +433,19 @@ class BackupDetailsPage extends StatelessWidget { ListTile( title: Text( 'backup.reupload_key'.tr(), + style: TextStyle( + color: overrideColor, + ), ), subtitle: Text( 'backup.reupload_key_subtitle'.tr(), + style: TextStyle( + color: overrideColor, + ), ), - leading: const Icon( + leading: Icon( Icons.warning_amber_outlined, + color: overrideColor, ), onTap: preventActions ? null diff --git a/lib/ui/pages/backups/change_rotation_quotas_modal.dart b/lib/ui/pages/backups/change_rotation_quotas_modal.dart new file mode 100644 index 00000000..0ce97eee --- /dev/null +++ b/lib/ui/pages/backups/change_rotation_quotas_modal.dart @@ -0,0 +1,250 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; +import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; +import 'package:selfprivacy/logic/models/backup.dart'; + +class ChangeRotationQuotasModal extends StatefulWidget { + const ChangeRotationQuotasModal({ + required this.scrollController, + super.key, + }); + + final ScrollController scrollController; + + @override + State createState() => + _ChangeRotationQuotasModalState(); +} + +enum QuotaUnits { + last, + daily, + weekly, + monthly, + yearly, +} + +class _ChangeRotationQuotasModalState extends State { + AutobackupQuotas selectedQuotas = AutobackupQuotas( + last: 3, + daily: 7, + weekly: 4, + monthly: 6, + yearly: -1, + ); + + // Set initial period to the one currently set + @override + void initState() { + super.initState(); + selectedQuotas = + context.read().state.autobackupQuotas ?? selectedQuotas; + } + + String generateSubtitle(final int value, final QuotaUnits unit) { + switch (unit) { + case QuotaUnits.last: + return value == -1 + ? 'backup.quota_subtitles.last_infinite'.tr() + : 'backup.quota_subtitles.last'.plural(value); + case QuotaUnits.daily: + if (selectedQuotas.last == -1) { + return 'backup.quota_subtitles.no_effect'.tr(); + } + return value == -1 + ? 'backup.quota_subtitles.daily_infinite'.tr() + : 'backup.quota_subtitles.daily'.plural(value); + case QuotaUnits.weekly: + if (selectedQuotas.last == -1 || selectedQuotas.daily == -1) { + return 'backup.quota_subtitles.no_effect'.tr(); + } + return value == -1 + ? 'backup.quota_subtitles.weekly_infinite'.tr() + : 'backup.quota_subtitles.weekly'.plural(value); + case QuotaUnits.monthly: + if (selectedQuotas.last == -1 || selectedQuotas.daily == -1) { + return 'backup.quota_subtitles.no_effect'.tr(); + } + return value == -1 + ? 'backup.quota_subtitles.monthly_infinite'.tr() + : 'backup.quota_subtitles.monthly'.plural(value); + case QuotaUnits.yearly: + if (selectedQuotas.last == -1 || selectedQuotas.daily == -1) { + return 'backup.quota_subtitles.no_effect'.tr(); + } + return value == -1 + ? 'backup.quota_subtitles.yearly_infinite'.tr() + : 'backup.quota_subtitles.yearly'.plural(value); + } + } + + @override + Widget build(final BuildContext context) { + final AutobackupQuotas? initialAutobackupQuotas = + context.watch().state.autobackupQuotas; + return ListView( + controller: widget.scrollController, + padding: const EdgeInsets.all(16), + children: [ + const SizedBox(height: 16), + Text( + 'backup.rotation_quotas_title'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + textAlign: TextAlign.center, + ), + const SizedBox(height: 8), + Text( + 'backup.quotas_only_applied_to_autobackups'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + textAlign: TextAlign.center, + ), + const SizedBox(height: 16), + // Accordions for each quota type. When tapped allows to enter a new int value + // for the quota. + QuotaSelectionTile( + title: 'backup.quota_titles.last'.tr(), + subtitle: generateSubtitle(selectedQuotas.last, QuotaUnits.last), + value: selectedQuotas.last, + min: 1, + max: 30, + callback: (final double value) { + setState(() { + if (value == 31) { + selectedQuotas = selectedQuotas.copyWith(last: -1); + return; + } + selectedQuotas = selectedQuotas.copyWith(last: value.toInt()); + }); + }, + ), + QuotaSelectionTile( + title: 'backup.quota_titles.daily'.tr(), + subtitle: generateSubtitle(selectedQuotas.daily, QuotaUnits.daily), + value: selectedQuotas.daily, + min: 0, + max: 30, + callback: (final double value) { + setState(() { + if (value == 31) { + selectedQuotas = selectedQuotas.copyWith(daily: -1); + return; + } + selectedQuotas = selectedQuotas.copyWith(daily: value.toInt()); + }); + }, + ), + QuotaSelectionTile( + title: 'backup.quota_titles.weekly'.tr(), + subtitle: generateSubtitle(selectedQuotas.weekly, QuotaUnits.weekly), + value: selectedQuotas.weekly, + min: 0, + max: 15, + callback: (final double value) { + setState(() { + if (value == 16) { + selectedQuotas = selectedQuotas.copyWith(weekly: -1); + return; + } + selectedQuotas = selectedQuotas.copyWith(weekly: value.toInt()); + }); + }, + ), + QuotaSelectionTile( + title: 'backup.quota_titles.monthly'.tr(), + subtitle: + generateSubtitle(selectedQuotas.monthly, QuotaUnits.monthly), + value: selectedQuotas.monthly, + min: 0, + max: 24, + callback: (final double value) { + setState(() { + if (value == 25) { + selectedQuotas = selectedQuotas.copyWith(monthly: -1); + return; + } + selectedQuotas = selectedQuotas.copyWith(monthly: value.toInt()); + }); + }, + ), + QuotaSelectionTile( + title: 'backup.quota_titles.yearly'.tr(), + subtitle: generateSubtitle(selectedQuotas.yearly, QuotaUnits.yearly), + value: selectedQuotas.yearly, + min: 0, + max: 5, + callback: (final double value) { + setState(() { + if (value == 6) { + selectedQuotas = selectedQuotas.copyWith(yearly: -1); + return; + } + selectedQuotas = selectedQuotas.copyWith(yearly: value.toInt()); + }); + }, + ), + const SizedBox(height: 16), + FilledButton( + onPressed: selectedQuotas == initialAutobackupQuotas + ? null + : () { + context + .read() + .setAutobackupQuotas(selectedQuotas); + Navigator.of(context).pop(); + }, + child: Text( + 'backup.set_rotation_quotas'.tr(), + ), + ), + ], + ); + } +} + +class QuotaSelectionTile extends StatelessWidget { + const QuotaSelectionTile({ + required this.title, + required this.subtitle, + required this.value, + required this.min, + required this.max, + required this.callback, + super.key, + }); + + final String title; + final String subtitle; + final int value; + final int min; + final int max; + final void Function(double) callback; + + @override + Widget build(final BuildContext context) => ExpansionTile( + title: Text(title), + subtitle: Text(subtitle), + trailing: Text( + value == -1 ? '∞' : value.toString(), + style: Theme.of(context).textTheme.headlineMedium, + ), + children: [ + // Discrete slider to select the new value + if (value >= -1 && value <= max) + Slider( + value: value == -1 ? max + 1 : value.toDouble(), + min: min.toDouble(), + max: (max + 1).toDouble(), + divisions: max - min + 1, + label: value == -1 ? '∞' : value.toString(), + onChanged: callback, + ), + if (value < -1 || value > max) + Text( + 'Manually set to $value', + style: Theme.of(context).textTheme.headlineSmall, + ), + ], + ); +} diff --git a/lib/ui/pages/backups/copy_encryption_key_modal.dart b/lib/ui/pages/backups/copy_encryption_key_modal.dart index dca9d705..fc16c356 100644 --- a/lib/ui/pages/backups/copy_encryption_key_modal.dart +++ b/lib/ui/pages/backups/copy_encryption_key_modal.dart @@ -2,11 +2,11 @@ import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; +import 'package:selfprivacy/utils/platform_adapter.dart'; class CopyEncryptionKeyModal extends StatefulWidget { const CopyEncryptionKeyModal({ @@ -144,11 +144,7 @@ class _CopyEncryptionKeyModalState extends State { }, ); }); - Clipboard.setData( - ClipboardData( - text: encryptionKey, - ), - ); + PlatformAdapter.setClipboard(encryptionKey); }, icon: const Icon(Icons.copy_all_outlined), label: Text( diff --git a/lib/ui/pages/backups/snapshot_id_list_tile.dart b/lib/ui/pages/backups/snapshot_id_list_tile.dart new file mode 100644 index 00000000..802b90ee --- /dev/null +++ b/lib/ui/pages/backups/snapshot_id_list_tile.dart @@ -0,0 +1,30 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; +import 'package:selfprivacy/utils/platform_adapter.dart'; + +class SnapshotIdListTile extends StatelessWidget { + const SnapshotIdListTile({ + required this.snapshotId, + super.key, + }); + + final String snapshotId; + + @override + Widget build(final BuildContext context) => ListTile( + onLongPress: () { + PlatformAdapter.setClipboard(snapshotId); + getIt().showSnackBar( + 'basis.copied_to_clipboard'.tr(), + behavior: SnackBarBehavior.floating, + ); + }, + leading: Icon( + Icons.numbers_outlined, + color: Theme.of(context).colorScheme.onSurface, + ), + title: Text('backup.snapshot_id_title'.tr()), + subtitle: Text(snapshotId), + ); +} diff --git a/lib/ui/pages/backups/snapshot_modal.dart b/lib/ui/pages/backups/snapshot_modal.dart index 147fe72a..9d714c25 100644 --- a/lib/ui/pages/backups/snapshot_modal.dart +++ b/lib/ui/pages/backups/snapshot_modal.dart @@ -11,6 +11,7 @@ import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; +import 'package:selfprivacy/ui/pages/backups/snapshot_id_list_tile.dart'; class SnapshotModal extends StatefulWidget { const SnapshotModal({ @@ -51,125 +52,129 @@ class _SnapshotModalState extends State { .state .getServiceById(widget.snapshot.serviceId); - return ListView( - controller: widget.scrollController, - padding: const EdgeInsets.all(16), - children: [ - const SizedBox(height: 16), - Text( - 'backup.snapshot_modal_heading'.tr(), - style: Theme.of(context).textTheme.headlineSmall, - textAlign: TextAlign.center, - ), - const SizedBox(height: 16), - ListTile( - leading: service != null - ? SvgPicture.string( - service.svgIcon, - height: 24, - width: 24, - colorFilter: ColorFilter.mode( - Theme.of(context).colorScheme.onSurface, - BlendMode.srcIn, + return Scaffold( + backgroundColor: Colors.transparent, + body: ListView( + controller: widget.scrollController, + padding: const EdgeInsets.all(16), + children: [ + const SizedBox(height: 16), + Text( + 'backup.snapshot_modal_heading'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + textAlign: TextAlign.center, + ), + const SizedBox(height: 16), + ListTile( + leading: service != null + ? SvgPicture.string( + service.svgIcon, + height: 24, + width: 24, + colorFilter: ColorFilter.mode( + Theme.of(context).colorScheme.onSurface, + BlendMode.srcIn, + ), + ) + : const Icon( + Icons.question_mark_outlined, ), - ) - : const Icon( - Icons.question_mark_outlined, - ), - title: Text( - 'backup.snapshot_service_title'.tr(), - ), - subtitle: Text( - service?.displayName ?? widget.snapshot.fallbackServiceName, - ), - ), - ListTile( - leading: Icon( - Icons.access_time_outlined, - color: Theme.of(context).colorScheme.onSurface, - ), - title: Text( - 'backup.snapshot_creation_time_title'.tr(), - ), - subtitle: Text( - '${MaterialLocalizations.of(context).formatShortDate(widget.snapshot.time)} ${TimeOfDay.fromDateTime(widget.snapshot.time).format(context)}', - ), - ), - ListTile( - leading: Icon( - Icons.numbers_outlined, - color: Theme.of(context).colorScheme.onSurface, - ), - title: Text( - 'backup.snapshot_id_title'.tr(), - ), - subtitle: Text( - widget.snapshot.id, - ), - ), - if (service != null) - Column( - children: [ - const SizedBox(height: 8), - Text( - 'backup.snapshot_modal_select_strategy'.tr(), - style: Theme.of(context).textTheme.titleMedium, - ), - const SizedBox(height: 8), - _BackupStrategySelectionCard( - isSelected: selectedStrategy == - BackupRestoreStrategy.downloadVerifyOverwrite, - onTap: () { - setState(() { - selectedStrategy = - BackupRestoreStrategy.downloadVerifyOverwrite; - }); - }, - title: - 'backup.snapshot_modal_download_verify_option_title'.tr(), - subtitle: - 'backup.snapshot_modal_download_verify_option_description' - .tr(), - ), - const SizedBox(height: 8), - _BackupStrategySelectionCard( - isSelected: selectedStrategy == BackupRestoreStrategy.inplace, - onTap: () { - setState(() { - selectedStrategy = BackupRestoreStrategy.inplace; - }); - }, - title: 'backup.snapshot_modal_inplace_option_title'.tr(), - subtitle: - 'backup.snapshot_modal_inplace_option_description'.tr(), - ), - const SizedBox(height: 8), - // Restore backup button - BrandButton.filled( - onPressed: isServiceBusy - ? null - : () { - context.read().restoreBackup( - widget.snapshot.id, - selectedStrategy, - ); - Navigator.of(context).pop(); - getIt() - .showSnackBar('backup.restore_started'.tr()); - }, - text: 'backup.restore'.tr(), - ), - ], - ) - else - Padding( - padding: const EdgeInsets.all(16.0), - child: InfoBox( - isWarning: true, - text: 'backup.snapshot_modal_service_not_found'.tr(), + title: Text( + 'backup.snapshot_service_title'.tr(), ), - ) - ], + subtitle: Text( + service?.displayName ?? widget.snapshot.fallbackServiceName, + ), + ), + ListTile( + leading: Icon( + Icons.access_time_outlined, + color: Theme.of(context).colorScheme.onSurface, + ), + title: Text( + 'backup.snapshot_creation_time_title'.tr(), + ), + subtitle: Text( + '${MaterialLocalizations.of(context).formatShortDate(widget.snapshot.time)} ${TimeOfDay.fromDateTime(widget.snapshot.time).format(context)}', + ), + ), + SnapshotIdListTile(snapshotId: widget.snapshot.id), + ListTile( + leading: Icon( + Icons.info_outline, + color: Theme.of(context).colorScheme.onSurface, + ), + title: Text( + 'backup.snapshot_reason_title'.tr(), + ), + subtitle: Text( + widget.snapshot.reason.displayName.tr(), + ), + ), + if (service != null) + Column( + children: [ + const SizedBox(height: 8), + Text( + 'backup.snapshot_modal_select_strategy'.tr(), + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 8), + _BackupStrategySelectionCard( + isSelected: selectedStrategy == + BackupRestoreStrategy.downloadVerifyOverwrite, + onTap: () { + setState(() { + selectedStrategy = + BackupRestoreStrategy.downloadVerifyOverwrite; + }); + }, + title: + 'backup.snapshot_modal_download_verify_option_title'.tr(), + subtitle: + 'backup.snapshot_modal_download_verify_option_description' + .tr(), + ), + const SizedBox(height: 8), + _BackupStrategySelectionCard( + isSelected: selectedStrategy == BackupRestoreStrategy.inplace, + onTap: () { + setState(() { + selectedStrategy = BackupRestoreStrategy.inplace; + }); + }, + title: 'backup.snapshot_modal_inplace_option_title'.tr(), + subtitle: + 'backup.snapshot_modal_inplace_option_description'.tr(), + ), + const SizedBox(height: 8), + // Restore backup button + BrandButton.filled( + onPressed: isServiceBusy + ? null + : () { + context.read().restoreBackup( + widget.snapshot.id, + selectedStrategy, + ); + Navigator.of(context).pop(); + getIt() + .showSnackBar('backup.restore_started'.tr()); + }, + text: 'backup.restore'.tr(), + ), + ], + ) + else + Padding( + padding: const EdgeInsets.all(16.0), + child: InfoBox( + isWarning: true, + text: 'backup.snapshot_modal_service_not_found'.tr(), + ), + ) + ], + ), ); } } diff --git a/lib/ui/pages/providers/providers.dart b/lib/ui/pages/providers/providers.dart index 64b87d34..5b2285f3 100644 --- a/lib/ui/pages/providers/providers.dart +++ b/lib/ui/pages/providers/providers.dart @@ -49,6 +49,8 @@ class _ProvidersPageState extends State { return StateType.stable; } + bool isClickable() => getServerStatus() != StateType.uninitialized; + StateType getDnsStatus() { if (dnsStatus == DnsRecordsStatus.uninitialized || dnsStatus == DnsRecordsStatus.refreshing) { @@ -83,7 +85,9 @@ class _ProvidersPageState extends State { subtitle: diskStatus.isDiskOkay ? 'storage.status_ok'.tr() : 'storage.status_error'.tr(), - onTap: () => context.pushRoute(const ServerDetailsRoute()), + onTap: isClickable() + ? () => context.pushRoute(const ServerDetailsRoute()) + : null, ), const SizedBox(height: 16), _Card( @@ -93,7 +97,9 @@ class _ProvidersPageState extends State { subtitle: appConfig.isDomainSelected ? appConfig.serverDomain!.domainName : '', - onTap: () => context.pushRoute(const DnsDetailsRoute()), + onTap: isClickable() + ? () => context.pushRoute(const DnsDetailsRoute()) + : null, ), const SizedBox(height: 16), _Card( @@ -103,7 +109,9 @@ class _ProvidersPageState extends State { icon: BrandIcons.save, title: 'backup.card_title'.tr(), subtitle: isBackupInitialized ? 'backup.card_subtitle'.tr() : '', - onTap: () => context.pushRoute(const BackupDetailsRoute()), + onTap: isClickable() + ? () => context.pushRoute(const BackupDetailsRoute()) + : null, ), ], ), diff --git a/lib/ui/pages/server_storage/extending_volume.dart b/lib/ui/pages/server_storage/extending_volume.dart index 004995a0..fd8213b1 100644 --- a/lib/ui/pages/server_storage/extending_volume.dart +++ b/lib/ui/pages/server_storage/extending_volume.dart @@ -8,6 +8,7 @@ import 'package:selfprivacy/logic/models/disk_size.dart'; import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; +import 'package:selfprivacy/ui/helpers/modals.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/logic/models/disk_status.dart'; @@ -78,10 +79,12 @@ class _ExtendingVolumePageState extends State { } final price = snapshot.data as Price; _pricePerGb = price.value; - _sizeController.text = _currentSliderGbValue.truncate().toString(); + final currentSizeValue = _currentSliderGbValue.truncate().toString(); + _sizeController.text = 'storage.gb'.tr(args: [currentSizeValue]); _priceController.text = - (_pricePerGb * double.parse(_sizeController.text)) - .toStringAsFixed(2); + '${(_pricePerGb * double.parse(currentSizeValue)).toStringAsFixed(2)}' + ' ' + '${price.currency.shortcode}'; minSize = widget.diskVolumeToResize.sizeTotal + DiskSize.fromGibibyte(3); if (_currentSliderGbValue < 0) { @@ -129,7 +132,7 @@ class _ExtendingVolumePageState extends State { decoration: InputDecoration( border: const OutlineInputBorder(), errorText: _isError ? ' ' : null, - labelText: price.currency.shortcode, + labelText: 'storage.price'.tr(), ), ), ), @@ -152,12 +155,24 @@ class _ExtendingVolumePageState extends State { onPressed: _isError || isAlreadyResizing ? null : () { - context.read().resizeVolume( - widget.diskVolumeToResize, - DiskSize.fromGibibyte(_currentSliderGbValue), - context.read().reload, - ); - context.router.popUntilRoot(); + showPopUpAlert( + alertTitle: 'storage.extending_volume_title'.tr(), + description: + 'storage.extending_volume_modal_description'.tr( + args: [_sizeController.text, _priceController.text], + ), + actionButtonTitle: 'basis.continue'.tr(), + actionButtonOnPressed: () { + context.read().resizeVolume( + widget.diskVolumeToResize, + DiskSize.fromGibibyte( + _currentSliderGbValue.truncate().toDouble(), + ), + context.read().reload, + ); + context.router.popUntilRoot(); + }, + ); }, child: Text('storage.extend_volume_button.title'.tr()), ), diff --git a/lib/ui/pages/server_storage/storage_card.dart b/lib/ui/pages/server_storage/storage_card.dart index ac633463..fbda9bee 100644 --- a/lib/ui/pages/server_storage/storage_card.dart +++ b/lib/ui/pages/server_storage/storage_card.dart @@ -45,8 +45,11 @@ class StorageCard extends StatelessWidget { clipBehavior: Clip.antiAlias, child: InkResponse( highlightShape: BoxShape.rectangle, - onTap: () => - context.pushRoute(ServerStorageRoute(diskStatus: diskStatus)), + + /// TODO: when 'isEmpty' replace with a skeleton + onTap: () => diskStatus.diskVolumes.isEmpty + ? null + : context.pushRoute(ServerStorageRoute(diskStatus: diskStatus)), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( diff --git a/lib/ui/pages/services/services.dart b/lib/ui/pages/services/services.dart index 99bb848e..36af585f 100644 --- a/lib/ui/pages/services/services.dart +++ b/lib/ui/pages/services/services.dart @@ -7,9 +7,10 @@ import 'package:selfprivacy/logic/cubit/services/services_cubit.dart'; import 'package:selfprivacy/logic/models/service.dart'; import 'package:selfprivacy/logic/models/state_types.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; +import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/icon_status_mask/icon_status_mask.dart'; -import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:easy_localization/easy_localization.dart'; +import 'package:selfprivacy/ui/helpers/empty_page_placeholder.dart'; import 'package:selfprivacy/ui/router/router.dart'; import 'package:selfprivacy/utils/breakpoints.dart'; import 'package:selfprivacy/utils/launch_url.dart'; @@ -42,30 +43,36 @@ class _ServicesPageState extends State { ), ) : null, - body: RefreshIndicator( - onRefresh: () async { - await context.read().reload(); - }, - child: ListView( - padding: paddingH15V0, - children: [ - Text( - 'basis.services_title'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - const SizedBox(height: 24), - if (!isReady) ...[const NotReadyCard(), const SizedBox(height: 24)], - ...services.map( - (final service) => Padding( - padding: const EdgeInsets.only( - bottom: 30, - ), - child: _Card(service: service), - ), + body: !isReady + ? EmptyPagePlaceholder( + showReadyCard: true, + title: 'service_page.nothing_here'.tr(), + description: 'basis.please_connect'.tr(), + iconData: BrandIcons.box, ) - ], - ), - ), + : RefreshIndicator( + onRefresh: () async { + await context.read().reload(); + }, + child: ListView( + padding: paddingH15V0, + children: [ + Text( + 'basis.services_title'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + const SizedBox(height: 24), + ...services.map( + (final service) => Padding( + padding: const EdgeInsets.only( + bottom: 30, + ), + child: _Card(service: service), + ), + ) + ], + ), + ), ); } } @@ -129,16 +136,16 @@ class _Card extends StatelessWidget { ), ), ), + const SizedBox(width: 8), + Text( + service.displayName, + style: Theme.of(context).textTheme.headlineMedium, + ), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const SizedBox(height: 12), - Text( - service.displayName, - style: Theme.of(context).textTheme.headlineMedium, - ), const SizedBox(height: 8), if (service.url != '' && service.url != null) Column( @@ -146,7 +153,7 @@ class _Card extends StatelessWidget { _ServiceLink( url: service.url ?? '', ), - const SizedBox(height: 10), + const SizedBox(height: 8), ], ), if (service.id == 'mailserver') @@ -156,19 +163,21 @@ class _Card extends StatelessWidget { url: domainName, isActive: false, ), - const SizedBox(height: 10), + const SizedBox(height: 8), ], ), - Text( - service.loginInfo, - style: Theme.of(context).textTheme.bodyMedium, - ), - const SizedBox(height: 10), Text( service.description, style: Theme.of(context).textTheme.bodyMedium, ), - const SizedBox(height: 10), + const SizedBox(height: 8), + Text( + service.loginInfo, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context).colorScheme.secondary, + ), + ), + const SizedBox(height: 8), ], ) ], diff --git a/lib/ui/pages/setup/initializing/dns_provider_picker.dart b/lib/ui/pages/setup/initializing/dns_provider_picker.dart index 772c093e..69560f5c 100644 --- a/lib/ui/pages/setup/initializing/dns_provider_picker.dart +++ b/lib/ui/pages/setup/initializing/dns_provider_picker.dart @@ -2,11 +2,10 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:selfprivacy/config/brand_theme.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/setup/initializing/dns_provider_form_cubit.dart'; +import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart'; import 'package:selfprivacy/logic/models/hive/server_domain.dart'; -import 'package:selfprivacy/ui/components/brand_md/brand_md.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; @@ -125,22 +124,10 @@ class ProviderInputDataPage extends StatelessWidget { const SizedBox(height: 10), BrandOutlinedButton( child: Text('initializing.how'.tr()), - onPressed: () => showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (final BuildContext context) => Padding( - padding: paddingH15V0, - child: ListView( - padding: const EdgeInsets.symmetric(vertical: 16), - children: [ - BrandMarkdown( - fileName: providerInfo.pathToHow, - ), - ], + onPressed: () => context.read().showArticle( + article: providerInfo.pathToHow, + context: context, ), - ), - ), ), ], ); diff --git a/lib/ui/pages/setup/initializing/domain_picker.dart b/lib/ui/pages/setup/initializing/domain_picker.dart new file mode 100644 index 00000000..1d64349c --- /dev/null +++ b/lib/ui/pages/setup/initializing/domain_picker.dart @@ -0,0 +1,163 @@ +import 'package:cubit_form/cubit_form.dart'; +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; +import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; +import 'package:selfprivacy/logic/cubit/forms/setup/initializing/domain_setup_cubit.dart'; +import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; +import 'package:selfprivacy/ui/components/cards/outlined_card.dart'; +import 'package:selfprivacy/ui/layouts/responsive_layout_with_infobox.dart'; + +class DomainPicker extends StatefulWidget { + const DomainPicker({ + super.key, + }); + + @override + State createState() => _DomainPickerState(); +} + +class _DomainPickerState extends State { + String? selectedDomain; + + @override + Widget build(final BuildContext context) { + final DomainSetupState state = context.watch().state; + + return ResponsiveLayoutWithInfobox( + topChild: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + (state is MoreThenOne) + ? 'initializing.multiple_domains_found'.tr() + : 'initializing.use_this_domain'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 16), + Text( + (state is MoreThenOne) + ? 'initializing.multiple_domains_found_text'.tr() + : 'initializing.use_this_domain_text'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + ], + ), + primaryColumn: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (state is Empty) + Text( + 'initializing.no_connected_domains'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + if (state is Loading) + Text( + state.type == LoadingTypes.loadingDomain + ? 'initializing.loading_domain_list'.tr() + : 'basis.saving'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + if (state is MoreThenOne) + ...state.domains.map( + (final domain) => Column( + children: [ + SizedBox( + width: double.infinity, + child: OutlinedCard( + borderColor: domain == selectedDomain + ? Theme.of(context).colorScheme.primary + : null, + borderWidth: domain == selectedDomain ? 3 : 1, + child: InkResponse( + highlightShape: BoxShape.rectangle, + onTap: () => setState(() { + selectedDomain = domain; + }), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Radio( + value: domain, + groupValue: selectedDomain, + onChanged: (final String? value) { + setState(() { + selectedDomain = value; + }); + }, + ), + Text( + domain, + style: Theme.of(context).textTheme.bodyLarge, + ), + ], + ), + ), + ), + ), + ), + const SizedBox(height: 8), + // Button to select and save domain + ], + ), + ), + if (state is MoreThenOne) + BrandButton.filled( + onPressed: (selectedDomain != null && + state.domains.contains(selectedDomain)) + ? () => context + .read() + .saveDomain(selectedDomain!) + : null, + child: Text('initializing.use_this_domain'.tr()), + ), + if (state is Loaded) ...[ + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + state.domain, + style: Theme.of(context).textTheme.headlineMedium?.copyWith( + color: Theme.of(context).colorScheme.onBackground, + ), + textAlign: TextAlign.center, + ), + ], + ), + ], + if (state is Empty) ...[ + const SizedBox(height: 30), + BrandButton.filled( + onPressed: () => context.read().load(), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon( + Icons.refresh, + color: Colors.white, + ), + const SizedBox(width: 10), + Text( + 'domain.update_list'.tr(), + style: Theme.of(context).textTheme.bodyLarge, + ), + ], + ), + ), + ], + if (state is Loaded) ...[ + const SizedBox(height: 32), + BrandButton.filled( + onPressed: () => + context.read().saveDomain(state.domain), + text: 'initializing.save_domain'.tr(), + ), + ], + ], + ), + ); + } +} diff --git a/lib/ui/pages/setup/initializing/initializing.dart b/lib/ui/pages/setup/initializing/initializing.dart index 5d54935a..a681c07a 100644 --- a/lib/ui/pages/setup/initializing/initializing.dart +++ b/lib/ui/pages/setup/initializing/initializing.dart @@ -18,6 +18,7 @@ import 'package:selfprivacy/ui/components/progress_bar/progress_bar.dart'; import 'package:selfprivacy/ui/components/drawers/support_drawer.dart'; import 'package:selfprivacy/ui/layouts/responsive_layout_with_infobox.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/dns_provider_picker.dart'; +import 'package:selfprivacy/ui/pages/setup/initializing/domain_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_provider_picker.dart'; import 'package:selfprivacy/ui/pages/setup/initializing/server_type_picker.dart'; import 'package:selfprivacy/ui/pages/setup/recovering/recovery_routing.dart'; @@ -99,7 +100,7 @@ class InitializingPage extends StatelessWidget { steps: const [ 'Hosting', 'Server Type', - 'CloudFlare', + 'DNS Provider', 'Backblaze', 'Domain', 'User', @@ -319,98 +320,7 @@ class InitializingPage extends StatelessWidget { Widget _stepDomain(final ServerInstallationCubit initializingCubit) => BlocProvider( create: (final context) => DomainSetupCubit(initializingCubit)..load(), - child: Builder( - builder: (final context) { - final DomainSetupState state = - context.watch().state; - return ResponsiveLayoutWithInfobox( - topChild: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'initializing.use_this_domain'.tr(), - style: Theme.of(context).textTheme.headlineSmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.use_this_domain_text'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - ], - ), - primaryColumn: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (state is Empty) - Text( - 'initializing.no_connected_domains'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - if (state is Loading) - Text( - state.type == LoadingTypes.loadingDomain - ? 'initializing.loading_domain_list'.tr() - : 'basis.saving'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - if (state is MoreThenOne) - Text( - 'initializing.found_more_domains'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - if (state is Loaded) ...[ - Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - state.domain, - style: Theme.of(context) - .textTheme - .headlineMedium - ?.copyWith( - color: - Theme.of(context).colorScheme.onBackground, - ), - textAlign: TextAlign.center, - ), - ], - ), - ], - if (state is Empty) ...[ - const SizedBox(height: 30), - BrandButton.filled( - onPressed: () => context.read().load(), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Icon( - Icons.refresh, - color: Colors.white, - ), - const SizedBox(width: 10), - Text( - 'domain.update_list'.tr(), - style: Theme.of(context).textTheme.bodyLarge, - ), - ], - ), - ), - ], - if (state is Loaded) ...[ - const SizedBox(height: 32), - BrandButton.filled( - onPressed: () => - context.read().saveDomain(), - text: 'initializing.save_domain'.tr(), - ), - ], - ], - ), - ); - }, - ), + child: const DomainPicker(), ); Widget _stepUser(final ServerInstallationCubit initializingCubit) => diff --git a/lib/ui/pages/setup/initializing/server_type_picker.dart b/lib/ui/pages/setup/initializing/server_type_picker.dart index 6212bec3..3ce0f94b 100644 --- a/lib/ui/pages/setup/initializing/server_type_picker.dart +++ b/lib/ui/pages/setup/initializing/server_type_picker.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:selfprivacy/illustrations/stray_deer.dart'; import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart'; import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; +import 'package:selfprivacy/logic/models/price.dart'; import 'package:selfprivacy/logic/models/server_provider_location.dart'; import 'package:selfprivacy/logic/models/server_type.dart'; import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; @@ -25,7 +26,12 @@ class _ServerTypePickerState extends State { ServerProviderLocation? serverProviderLocation; ServerType? serverType; - void setServerProviderLocation(final ServerProviderLocation? location) { + void setServerProviderLocation(final ServerProviderLocation? location) async { + if (location != null) { + await widget.serverInstallationCubit.setLocationIdentifier( + location.identifier, + ); + } setState(() { serverProviderLocation = location; }); @@ -153,194 +159,320 @@ class SelectTypePage extends StatelessWidget { final Function backToLocationPickingCallback; @override - Widget build(final BuildContext context) => FutureBuilder( - future: serverInstallationCubit.fetchAvailableTypesByLocation(location), - builder: ( - final BuildContext context, - final AsyncSnapshot snapshot, - ) { - if (snapshot.hasData) { - if ((snapshot.data as List).isEmpty) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'initializing.locations_not_found'.tr(), - style: Theme.of(context).textTheme.headlineSmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.locations_not_found_text'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - LayoutBuilder( - builder: (final context, final constraints) => CustomPaint( - size: Size( - constraints.maxWidth, - (constraints.maxWidth * 1).toDouble(), - ), - painter: StrayDeerPainter( - colorScheme: Theme.of(context).colorScheme, - colorPalette: context - .read() - .state - .corePaletteOrDefault, - ), + Widget build(final BuildContext context) { + final Future> serverTypes = + serverInstallationCubit.fetchAvailableTypesByLocation(location); + final Future prices = + serverInstallationCubit.fetchAvailableAdditionalPricing(); + return FutureBuilder( + future: Future.wait([ + serverTypes, + prices, + ]), + builder: ( + final BuildContext context, + final AsyncSnapshot> snapshot, + ) { + if (snapshot.hasData) { + if ((snapshot.data![0] as List).isEmpty || + (snapshot.data![1] as AdditionalPricing?) == null) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'initializing.locations_not_found'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.locations_not_found_text'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + LayoutBuilder( + builder: (final context, final constraints) => CustomPaint( + size: Size( + constraints.maxWidth, + (constraints.maxWidth * 1).toDouble(), + ), + painter: StrayDeerPainter( + colorScheme: Theme.of(context).colorScheme, + colorPalette: context + .read() + .state + .corePaletteOrDefault, ), ), - const SizedBox(height: 16), - BrandButton.rised( - onPressed: () { - backToLocationPickingCallback(); - }, - text: 'initializing.back_to_locations'.tr(), - ), - ], - ); - } - return ResponsiveLayoutWithInfobox( - topChild: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'initializing.choose_server_type'.tr(), - style: Theme.of(context).textTheme.headlineSmall, - ), - const SizedBox(height: 16), - Text( - 'initializing.choose_server_type_text'.tr(), - style: Theme.of(context).textTheme.bodyMedium, - ), - ], - ), - primaryColumn: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...(snapshot.data! as List).map( - (final type) => Column( - children: [ - SizedBox( - width: double.infinity, - child: InkWell( - onTap: () { - serverInstallationCubit.setServerType(type); - }, - child: Card( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - type.title, - style: Theme.of(context) - .textTheme - .titleMedium, - ), - const SizedBox(height: 8), - Row( + ), + const SizedBox(height: 16), + BrandButton.rised( + onPressed: () { + backToLocationPickingCallback(); + }, + text: 'initializing.back_to_locations'.tr(), + ), + ], + ); + } + final prices = snapshot.data![1] as AdditionalPricing; + final storagePrice = serverInstallationCubit.initialStorage.gibibyte * + prices.perVolumeGb.value; + final publicIpPrice = prices.perPublicIpv4.value; + return ResponsiveLayoutWithInfobox( + topChild: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'initializing.choose_server_type'.tr(), + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 16), + Text( + 'initializing.choose_server_type_text'.tr(), + style: Theme.of(context).textTheme.bodyMedium, + ), + ], + ), + primaryColumn: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...(snapshot.data![0] as List).map( + (final type) => Column( + children: [ + SizedBox( + width: double.infinity, + child: InkWell( + onTap: () { + serverInstallationCubit.setServerType(type); + }, + child: Card( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + type.title, + style: + Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 8), + Row( + children: [ + Icon( + Icons.memory_outlined, + color: Theme.of(context) + .colorScheme + .onSurface, + ), + const SizedBox(width: 8), + Text( + 'server.core_count'.plural(type.cores), + style: Theme.of(context) + .textTheme + .bodyMedium, + ), + ], + ), + const SizedBox(height: 8), + Row( + children: [ + Icon( + Icons.memory_outlined, + color: Theme.of(context) + .colorScheme + .onSurface, + ), + const SizedBox(width: 8), + Text( + 'initializing.choose_server_type_ram' + .tr(args: [type.ram.toString()]), + style: Theme.of(context) + .textTheme + .bodyMedium, + ), + ], + ), + const SizedBox(height: 8), + Row( + children: [ + Icon( + Icons.sd_card_outlined, + color: Theme.of(context) + .colorScheme + .onSurface, + ), + const SizedBox(width: 8), + Text( + 'initializing.choose_server_type_storage' + .tr( + args: [type.disk.gibibyte.toString()], + ), + style: Theme.of(context) + .textTheme + .bodyMedium, + ), + ], + ), + const SizedBox(height: 8), + const Divider(height: 8), + const SizedBox(height: 8), + Row( + children: [ + Icon( + Icons.payments_outlined, + color: Theme.of(context) + .colorScheme + .onSurface, + ), + const SizedBox(width: 8), + Text( + 'initializing.choose_server_type_payment_per_month' + .tr( + args: [ + '${(type.price.value + storagePrice + publicIpPrice).toStringAsFixed(4)} ${type.price.currency.shortcode}' + ], + ), + style: Theme.of(context) + .textTheme + .bodyLarge, + ), + ], + ), + IntrinsicHeight( + child: Row( children: [ - Icon( - Icons.memory_outlined, + VerticalDivider( + width: 24.0, + indent: 4.0, + endIndent: 4.0, color: Theme.of(context) .colorScheme - .onSurface, + .onSurface + .withAlpha(128), ), const SizedBox(width: 8), - Text( - 'server.core_count' - .plural(type.cores), - style: Theme.of(context) - .textTheme - .bodyMedium, + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + Icons.memory_outlined, + color: Theme.of(context) + .colorScheme + .onSurface + .withAlpha(128), + size: 16, + ), + const SizedBox(width: 8), + Text( + 'initializing.choose_server_type_payment_server' + .tr( + args: [ + type.price.value + .toString() + ], + ), + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith( + color: Theme.of(context) + .colorScheme + .onSurface + .withAlpha(128), + ), + ), + ], + ), + Row( + children: [ + Icon( + Icons.sd_card_outlined, + color: Theme.of(context) + .colorScheme + .onSurface + .withAlpha(128), + size: 16, + ), + const SizedBox(width: 8), + Text( + 'initializing.choose_server_type_payment_storage' + .tr( + args: [ + storagePrice.toString() + ], + ), + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith( + color: Theme.of(context) + .colorScheme + .onSurface + .withAlpha(128), + ), + ), + ], + ), + if (publicIpPrice != 0) + Row( + children: [ + Icon( + Icons.lan_outlined, + color: Theme.of(context) + .colorScheme + .onSurface + .withAlpha(128), + size: 16, + ), + const SizedBox(width: 8), + Text( + 'initializing.choose_server_type_payment_ip' + .tr( + args: [ + publicIpPrice.toString() + ], + ), + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith( + color: Theme.of( + context, + ) + .colorScheme + .onSurface + .withAlpha(128), + ), + ), + ], + ), + ], ), ], ), - const SizedBox(height: 8), - Row( - children: [ - Icon( - Icons.memory_outlined, - color: Theme.of(context) - .colorScheme - .onSurface, - ), - const SizedBox(width: 8), - Text( - 'initializing.choose_server_type_ram' - .tr(args: [type.ram.toString()]), - style: Theme.of(context) - .textTheme - .bodyMedium, - ), - ], - ), - const SizedBox(height: 8), - Row( - children: [ - Icon( - Icons.sd_card_outlined, - color: Theme.of(context) - .colorScheme - .onSurface, - ), - const SizedBox(width: 8), - Text( - 'initializing.choose_server_type_storage' - .tr( - args: [ - type.disk.gibibyte.toString() - ], - ), - style: Theme.of(context) - .textTheme - .bodyMedium, - ), - ], - ), - const SizedBox(height: 8), - const Divider(height: 8), - const SizedBox(height: 8), - Row( - children: [ - Icon( - Icons.payments_outlined, - color: Theme.of(context) - .colorScheme - .onSurface, - ), - const SizedBox(width: 8), - Text( - 'initializing.choose_server_type_payment_per_month' - .tr( - args: [ - '${type.price.value.toString()} ${type.price.currency.shortcode}' - ], - ), - style: Theme.of(context) - .textTheme - .bodyLarge, - ), - ], - ), - ], - ), + ), + ], ), ), ), ), - const SizedBox(height: 8), - ], - ), + ), + const SizedBox(height: 8), + ], ), - ], - ), - secondaryColumn: - InfoBox(text: 'initializing.choose_server_type_notice'.tr()), - ); - } else { - return const Center(child: CircularProgressIndicator()); - } - }, - ); + ), + ], + ), + secondaryColumn: + InfoBox(text: 'initializing.choose_server_type_notice'.tr()), + ); + } else { + return const Center(child: CircularProgressIndicator()); + } + }, + ); + } } diff --git a/lib/ui/pages/users/empty.dart b/lib/ui/pages/users/empty.dart deleted file mode 100644 index f58dc740..00000000 --- a/lib/ui/pages/users/empty.dart +++ /dev/null @@ -1,73 +0,0 @@ -part of 'users.dart'; - -class _NoUsers extends StatelessWidget { - const _NoUsers({required this.text}); - - final String text; - - @override - Widget build(final BuildContext context) => Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - BrandIcons.users, - size: 50, - color: Theme.of(context).colorScheme.onBackground, - ), - const SizedBox(height: 20), - Text( - 'users.nobody_here'.tr(), - style: Theme.of(context).textTheme.headlineMedium?.copyWith( - color: Theme.of(context).colorScheme.onBackground, - ), - ), - const SizedBox(height: 10), - Text( - text, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.titleSmall?.copyWith( - color: Theme.of(context).colorScheme.onBackground, - ), - ), - ], - ), - ); -} - -class _CouldNotLoadUsers extends StatelessWidget { - const _CouldNotLoadUsers({required this.text}); - - final String text; - - @override - Widget build(final BuildContext context) => Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - BrandIcons.users, - size: 50, - color: Theme.of(context).colorScheme.onBackground, - ), - const SizedBox(height: 20), - Text( - 'users.could_not_fetch_users'.tr(), - style: Theme.of(context).textTheme.headlineMedium?.copyWith( - color: Theme.of(context).colorScheme.onBackground, - ), - ), - const SizedBox(height: 10), - Text( - text, - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.titleSmall?.copyWith( - color: Theme.of(context).colorScheme.onBackground, - ), - ), - ], - ), - ); -} diff --git a/lib/ui/pages/users/user.dart b/lib/ui/pages/users/user.dart index bbc01012..9a90857b 100644 --- a/lib/ui/pages/users/user.dart +++ b/lib/ui/pages/users/user.dart @@ -3,11 +3,11 @@ part of 'users.dart'; class _User extends StatelessWidget { const _User({ required this.user, - required this.isRootUser, + required this.isPrimaryUser, }); final User user; - final bool isRootUser; + final bool isPrimaryUser; @override Widget build(final BuildContext context) => InkWell( onTap: () { @@ -32,7 +32,7 @@ class _User extends StatelessWidget { user.login, style: Theme.of(context).textTheme.titleMedium?.copyWith( color: Theme.of(context).colorScheme.onBackground, - decoration: isRootUser + decoration: isPrimaryUser ? TextDecoration.underline : user.isFoundOnServer ? TextDecoration.none diff --git a/lib/ui/pages/users/user_details.dart b/lib/ui/pages/users/user_details.dart index 7ee3a7bd..90ab1603 100644 --- a/lib/ui/pages/users/user_details.dart +++ b/lib/ui/pages/users/user_details.dart @@ -143,17 +143,27 @@ class _UserLogins extends StatelessWidget { final String domainName; @override - Widget build(final BuildContext context) => FilledCard( - child: Column( - children: [ - ListTileOnSurfaceVariant( - title: '${user.login}@$domainName', - subtitle: 'users.email_login'.tr(), - leadingIcon: Icons.alternate_email_outlined, - ), - ], - ), - ); + Widget build(final BuildContext context) { + final email = '${user.login}@$domainName'; + return FilledCard( + child: Column( + children: [ + ListTileOnSurfaceVariant( + onTap: () { + PlatformAdapter.setClipboard(email); + getIt().showSnackBar( + 'basis.copied_to_clipboard'.tr(), + behavior: SnackBarBehavior.floating, + ); + }, + title: email, + subtitle: 'users.email_login'.tr(), + leadingIcon: Icons.alternate_email_outlined, + ), + ], + ), + ); + } } class _SshKeysCard extends StatelessWidget { diff --git a/lib/ui/pages/users/users.dart b/lib/ui/pages/users/users.dart index 58cb3b7d..a3c0d319 100644 --- a/lib/ui/pages/users/users.dart +++ b/lib/ui/pages/users/users.dart @@ -3,6 +3,7 @@ import 'package:cubit_form/cubit_form.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/brand_theme.dart'; +import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/cubit/forms/user/ssh_form_cubit.dart'; import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart'; import 'package:selfprivacy/logic/cubit/forms/factories/field_cubit_factory.dart'; @@ -15,16 +16,16 @@ import 'package:selfprivacy/ui/components/buttons/brand_button.dart'; import 'package:selfprivacy/ui/components/buttons/outlined_button.dart'; import 'package:selfprivacy/ui/components/cards/filled_card.dart'; import 'package:selfprivacy/ui/components/brand_header/brand_header.dart'; +import 'package:selfprivacy/ui/helpers/empty_page_placeholder.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart'; import 'package:selfprivacy/ui/components/info_box/info_box.dart'; import 'package:selfprivacy/ui/components/list_tiles/list_tile_on_surface_variant.dart'; -import 'package:selfprivacy/ui/components/not_ready_card/not_ready_card.dart'; import 'package:selfprivacy/ui/router/router.dart'; import 'package:selfprivacy/utils/breakpoints.dart'; +import 'package:selfprivacy/utils/platform_adapter.dart'; import 'package:selfprivacy/utils/ui_helpers.dart'; -part 'empty.dart'; part 'new_user.dart'; part 'user.dart'; part 'user_details.dart'; @@ -41,19 +42,16 @@ class UsersPage extends StatelessWidget { Widget child; if (!isReady) { - child = isNotReady(); + child = EmptyPagePlaceholder( + showReadyCard: true, + title: 'users.nobody_here'.tr(), + description: 'basis.please_connect'.tr(), + iconData: BrandIcons.users, + ); } else { child = BlocBuilder( builder: (final BuildContext context, final UsersState state) { - final List users = state.users - .where((final user) => user.type != UserType.root) - .toList(); - // final List users = []; - users.sort( - (final User a, final User b) => - a.login.toLowerCase().compareTo(b.login.toLowerCase()), - ); - + final users = state.orderedUsers; if (users.isEmpty) { if (state.isLoading) { return const Center( @@ -70,8 +68,10 @@ class UsersPage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - _CouldNotLoadUsers( - text: 'users.could_not_fetch_description'.tr(), + EmptyPagePlaceholder( + title: 'users.could_not_fetch_users'.tr(), + description: 'users.could_not_fetch_description'.tr(), + iconData: BrandIcons.users, ), const SizedBox(height: 18), BrandOutlinedButton( @@ -115,7 +115,7 @@ class UsersPage extends StatelessWidget { itemBuilder: (final BuildContext context, final int index) => _User( user: users[index], - isRootUser: users[index].type == UserType.primary, + isPrimaryUser: users[index].type == UserType.primary, ), ), ), @@ -138,24 +138,4 @@ class UsersPage extends StatelessWidget { body: child, ); } - - Widget isNotReady() => Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - const Padding( - padding: EdgeInsets.symmetric(horizontal: 15), - child: NotReadyCard(), - ), - Expanded( - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 15), - child: Center( - child: _NoUsers( - text: 'users.not_ready'.tr(), - ), - ), - ), - ) - ], - ); } diff --git a/lib/ui/router/router.gr.dart b/lib/ui/router/router.gr.dart index dfc41363..a9d401f3 100644 --- a/lib/ui/router/router.gr.dart +++ b/lib/ui/router/router.gr.dart @@ -15,18 +15,6 @@ abstract class _$RootRouter extends RootStackRouter { @override final Map pagesMap = { - OnboardingRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const OnboardingPage(), - ); - }, - BackupDetailsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const BackupDetailsPage(), - ); - }, BackupsListRoute.name: (routeData) { final args = routeData.argsAs(); return AutoRoutePage( @@ -37,10 +25,58 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - RecoveryKeyRoute.name: (routeData) { + BackupDetailsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, - child: const RecoveryKeyPage(), + child: const BackupDetailsPage(), + ); + }, + DevicesRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DevicesScreen(), + ); + }, + DnsDetailsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DnsDetailsPage(), + ); + }, + AboutApplicationRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const AboutApplicationPage(), + ); + }, + AppSettingsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const AppSettingsPage(), + ); + }, + DeveloperSettingsRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const DeveloperSettingsPage(), + ); + }, + ConsoleRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const ConsolePage(), + ); + }, + MoreRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const MorePage(), + ); + }, + OnboardingRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const OnboardingPage(), ); }, ProvidersRoute.name: (routeData) { @@ -49,6 +85,18 @@ abstract class _$RootRouter extends RootStackRouter { child: const ProvidersPage(), ); }, + RecoveryKeyRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const RecoveryKeyPage(), + ); + }, + RootRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: WrappedRoute(child: const RootPage()), + ); + }, ServerDetailsRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, @@ -67,17 +115,6 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - ExtendingVolumeRoute.name: (routeData) { - final args = routeData.argsAs(); - return AutoRoutePage( - routeData: routeData, - child: ExtendingVolumePage( - diskVolumeToResize: args.diskVolumeToResize, - diskStatus: args.diskStatus, - key: args.key, - ), - ); - }, ServerStorageRoute.name: (routeData) { final args = routeData.argsAs(); return AutoRoutePage( @@ -88,52 +125,15 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - DevicesRoute.name: (routeData) { + ExtendingVolumeRoute.name: (routeData) { + final args = routeData.argsAs(); return AutoRoutePage( routeData: routeData, - child: const DevicesScreen(), - ); - }, - RootRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: WrappedRoute(child: const RootPage()), - ); - }, - AboutApplicationRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AboutApplicationPage(), - ); - }, - ConsoleRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const ConsolePage(), - ); - }, - MoreRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const MorePage(), - ); - }, - AppSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const AppSettingsPage(), - ); - }, - DeveloperSettingsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DeveloperSettingsPage(), - ); - }, - DnsDetailsRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const DnsDetailsPage(), + child: ExtendingVolumePage( + diskVolumeToResize: args.diskVolumeToResize, + diskStatus: args.diskStatus, + key: args.key, + ), ); }, ServiceRoute.name: (routeData) { @@ -152,6 +152,18 @@ abstract class _$RootRouter extends RootStackRouter { child: const ServicesPage(), ); }, + InitializingRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const InitializingPage(), + ); + }, + RecoveryRoute.name: (routeData) { + return AutoRoutePage( + routeData: routeData, + child: const RecoveryRouting(), + ); + }, UsersRoute.name: (routeData) { return AutoRoutePage( routeData: routeData, @@ -174,49 +186,9 @@ abstract class _$RootRouter extends RootStackRouter { ), ); }, - InitializingRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const InitializingPage(), - ); - }, - RecoveryRoute.name: (routeData) { - return AutoRoutePage( - routeData: routeData, - child: const RecoveryRouting(), - ); - }, }; } -/// generated route for -/// [OnboardingPage] -class OnboardingRoute extends PageRouteInfo { - const OnboardingRoute({List? children}) - : super( - OnboardingRoute.name, - initialChildren: children, - ); - - static const String name = 'OnboardingRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [BackupDetailsPage] -class BackupDetailsRoute extends PageRouteInfo { - const BackupDetailsRoute({List? children}) - : super( - BackupDetailsRoute.name, - initialChildren: children, - ); - - static const String name = 'BackupDetailsRoute'; - - static const PageInfo page = PageInfo(name); -} - /// generated route for /// [BackupsListPage] class BackupsListRoute extends PageRouteInfo { @@ -256,15 +228,127 @@ class BackupsListRouteArgs { } /// generated route for -/// [RecoveryKeyPage] -class RecoveryKeyRoute extends PageRouteInfo { - const RecoveryKeyRoute({List? children}) +/// [BackupDetailsPage] +class BackupDetailsRoute extends PageRouteInfo { + const BackupDetailsRoute({List? children}) : super( - RecoveryKeyRoute.name, + BackupDetailsRoute.name, initialChildren: children, ); - static const String name = 'RecoveryKeyRoute'; + static const String name = 'BackupDetailsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [DevicesScreen] +class DevicesRoute extends PageRouteInfo { + const DevicesRoute({List? children}) + : super( + DevicesRoute.name, + initialChildren: children, + ); + + static const String name = 'DevicesRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [DnsDetailsPage] +class DnsDetailsRoute extends PageRouteInfo { + const DnsDetailsRoute({List? children}) + : super( + DnsDetailsRoute.name, + initialChildren: children, + ); + + static const String name = 'DnsDetailsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [AboutApplicationPage] +class AboutApplicationRoute extends PageRouteInfo { + const AboutApplicationRoute({List? children}) + : super( + AboutApplicationRoute.name, + initialChildren: children, + ); + + static const String name = 'AboutApplicationRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [AppSettingsPage] +class AppSettingsRoute extends PageRouteInfo { + const AppSettingsRoute({List? children}) + : super( + AppSettingsRoute.name, + initialChildren: children, + ); + + static const String name = 'AppSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [DeveloperSettingsPage] +class DeveloperSettingsRoute extends PageRouteInfo { + const DeveloperSettingsRoute({List? children}) + : super( + DeveloperSettingsRoute.name, + initialChildren: children, + ); + + static const String name = 'DeveloperSettingsRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [ConsolePage] +class ConsoleRoute extends PageRouteInfo { + const ConsoleRoute({List? children}) + : super( + ConsoleRoute.name, + initialChildren: children, + ); + + static const String name = 'ConsoleRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [MorePage] +class MoreRoute extends PageRouteInfo { + const MoreRoute({List? children}) + : super( + MoreRoute.name, + initialChildren: children, + ); + + static const String name = 'MoreRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [OnboardingPage] +class OnboardingRoute extends PageRouteInfo { + const OnboardingRoute({List? children}) + : super( + OnboardingRoute.name, + initialChildren: children, + ); + + static const String name = 'OnboardingRoute'; static const PageInfo page = PageInfo(name); } @@ -283,6 +367,34 @@ class ProvidersRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } +/// generated route for +/// [RecoveryKeyPage] +class RecoveryKeyRoute extends PageRouteInfo { + const RecoveryKeyRoute({List? children}) + : super( + RecoveryKeyRoute.name, + initialChildren: children, + ); + + static const String name = 'RecoveryKeyRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [RootPage] +class RootRoute extends PageRouteInfo { + const RootRoute({List? children}) + : super( + RootRoute.name, + initialChildren: children, + ); + + static const String name = 'RootRoute'; + + static const PageInfo page = PageInfo(name); +} + /// generated route for /// [ServerDetailsScreen] class ServerDetailsRoute extends PageRouteInfo { @@ -345,6 +457,44 @@ class ServicesMigrationRouteArgs { } } +/// generated route for +/// [ServerStoragePage] +class ServerStorageRoute extends PageRouteInfo { + ServerStorageRoute({ + required DiskStatus diskStatus, + Key? key, + List? children, + }) : super( + ServerStorageRoute.name, + args: ServerStorageRouteArgs( + diskStatus: diskStatus, + key: key, + ), + initialChildren: children, + ); + + static const String name = 'ServerStorageRoute'; + + static const PageInfo page = + PageInfo(name); +} + +class ServerStorageRouteArgs { + const ServerStorageRouteArgs({ + required this.diskStatus, + this.key, + }); + + final DiskStatus diskStatus; + + final Key? key; + + @override + String toString() { + return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; + } +} + /// generated route for /// [ExtendingVolumePage] class ExtendingVolumeRoute extends PageRouteInfo { @@ -388,156 +538,6 @@ class ExtendingVolumeRouteArgs { } } -/// generated route for -/// [ServerStoragePage] -class ServerStorageRoute extends PageRouteInfo { - ServerStorageRoute({ - required DiskStatus diskStatus, - Key? key, - List? children, - }) : super( - ServerStorageRoute.name, - args: ServerStorageRouteArgs( - diskStatus: diskStatus, - key: key, - ), - initialChildren: children, - ); - - static const String name = 'ServerStorageRoute'; - - static const PageInfo page = - PageInfo(name); -} - -class ServerStorageRouteArgs { - const ServerStorageRouteArgs({ - required this.diskStatus, - this.key, - }); - - final DiskStatus diskStatus; - - final Key? key; - - @override - String toString() { - return 'ServerStorageRouteArgs{diskStatus: $diskStatus, key: $key}'; - } -} - -/// generated route for -/// [DevicesScreen] -class DevicesRoute extends PageRouteInfo { - const DevicesRoute({List? children}) - : super( - DevicesRoute.name, - initialChildren: children, - ); - - static const String name = 'DevicesRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [RootPage] -class RootRoute extends PageRouteInfo { - const RootRoute({List? children}) - : super( - RootRoute.name, - initialChildren: children, - ); - - static const String name = 'RootRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [AboutApplicationPage] -class AboutApplicationRoute extends PageRouteInfo { - const AboutApplicationRoute({List? children}) - : super( - AboutApplicationRoute.name, - initialChildren: children, - ); - - static const String name = 'AboutApplicationRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [ConsolePage] -class ConsoleRoute extends PageRouteInfo { - const ConsoleRoute({List? children}) - : super( - ConsoleRoute.name, - initialChildren: children, - ); - - static const String name = 'ConsoleRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [MorePage] -class MoreRoute extends PageRouteInfo { - const MoreRoute({List? children}) - : super( - MoreRoute.name, - initialChildren: children, - ); - - static const String name = 'MoreRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [AppSettingsPage] -class AppSettingsRoute extends PageRouteInfo { - const AppSettingsRoute({List? children}) - : super( - AppSettingsRoute.name, - initialChildren: children, - ); - - static const String name = 'AppSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [DeveloperSettingsPage] -class DeveloperSettingsRoute extends PageRouteInfo { - const DeveloperSettingsRoute({List? children}) - : super( - DeveloperSettingsRoute.name, - initialChildren: children, - ); - - static const String name = 'DeveloperSettingsRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [DnsDetailsPage] -class DnsDetailsRoute extends PageRouteInfo { - const DnsDetailsRoute({List? children}) - : super( - DnsDetailsRoute.name, - initialChildren: children, - ); - - static const String name = 'DnsDetailsRoute'; - - static const PageInfo page = PageInfo(name); -} - /// generated route for /// [ServicePage] class ServiceRoute extends PageRouteInfo { @@ -590,6 +590,34 @@ class ServicesRoute extends PageRouteInfo { static const PageInfo page = PageInfo(name); } +/// generated route for +/// [InitializingPage] +class InitializingRoute extends PageRouteInfo { + const InitializingRoute({List? children}) + : super( + InitializingRoute.name, + initialChildren: children, + ); + + static const String name = 'InitializingRoute'; + + static const PageInfo page = PageInfo(name); +} + +/// generated route for +/// [RecoveryRouting] +class RecoveryRoute extends PageRouteInfo { + const RecoveryRoute({List? children}) + : super( + RecoveryRoute.name, + initialChildren: children, + ); + + static const String name = 'RecoveryRoute'; + + static const PageInfo page = PageInfo(name); +} + /// generated route for /// [UsersPage] class UsersRoute extends PageRouteInfo { @@ -655,31 +683,3 @@ class UserDetailsRouteArgs { return 'UserDetailsRouteArgs{login: $login, key: $key}'; } } - -/// generated route for -/// [InitializingPage] -class InitializingRoute extends PageRouteInfo { - const InitializingRoute({List? children}) - : super( - InitializingRoute.name, - initialChildren: children, - ); - - static const String name = 'InitializingRoute'; - - static const PageInfo page = PageInfo(name); -} - -/// generated route for -/// [RecoveryRouting] -class RecoveryRoute extends PageRouteInfo { - const RecoveryRoute({List? children}) - : super( - RecoveryRoute.name, - initialChildren: children, - ); - - static const String name = 'RecoveryRoute'; - - static const PageInfo page = PageInfo(name); -} diff --git a/lib/utils/platform_adapter.dart b/lib/utils/platform_adapter.dart index fa40d7d9..7e010dd4 100644 --- a/lib/utils/platform_adapter.dart +++ b/lib/utils/platform_adapter.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; /// SelfPrivacy wrapper for Platform information provider. class PlatformAdapter { @@ -56,4 +57,8 @@ class PlatformAdapter { return 'Unidentified'; } + + static void setClipboard(final String clipboardData) { + Clipboard.setData(ClipboardData(text: clipboardData)); + } } diff --git a/metadata/org.selfprivacy.app.nightly/en-US/full_description.txt b/metadata/org.selfprivacy.app.nightly/en-US/full_description.txt deleted file mode 100644 index 018c94ca..00000000 --- a/metadata/org.selfprivacy.app.nightly/en-US/full_description.txt +++ /dev/null @@ -1 +0,0 @@ -Nightly builds of SelfPrivacy app. diff --git a/metadata/org.selfprivacy.app.nightly/en-US/images/icon.png b/metadata/org.selfprivacy.app.nightly/en-US/images/icon.png deleted file mode 100644 index bceb0253..00000000 Binary files a/metadata/org.selfprivacy.app.nightly/en-US/images/icon.png and /dev/null differ diff --git a/metadata/org.selfprivacy.app.nightly/en-US/short_description.txt b/metadata/org.selfprivacy.app.nightly/en-US/short_description.txt deleted file mode 100644 index 18bbf5ab..00000000 --- a/metadata/org.selfprivacy.app.nightly/en-US/short_description.txt +++ /dev/null @@ -1 +0,0 @@ -Self-hosted services without pain diff --git a/metadata/org.selfprivacy.app.nightly/en-US/title.txt b/metadata/org.selfprivacy.app.nightly/en-US/title.txt deleted file mode 100644 index 7eb10ccc..00000000 --- a/metadata/org.selfprivacy.app.nightly/en-US/title.txt +++ /dev/null @@ -1 +0,0 @@ -SelfPrivacy (Nightly) diff --git a/metadata/org.selfprivacy.app/en-US/full_description.txt b/metadata/org.selfprivacy.app/en-US/full_description.txt deleted file mode 100644 index f5ba9142..00000000 --- a/metadata/org.selfprivacy.app/en-US/full_description.txt +++ /dev/null @@ -1,23 +0,0 @@ -

SelfPrivacy — is a platform on your cloud hosting, that allows to deploy your own private services and control them using mobile application.

- -

To use this application, you'll be required to create accounts of different service providers. Please reffer to this manual: https://selfprivacy.org/en/second

- -

Application will do the following things for you:

- -
    -
  1. Create your personal server
  2. -
  3. Setup NixOS
  4. -
  5. Bring all services to the ready-to-use state. Services include:
  6. -
- -
    -
  • E-mail, ready to use with DeltaChat
  • -
  • NextCloud — your personal cloud storage
  • -
  • Bitwarden — secure and private password manager
  • -
  • Pleroma — your private fediverse space for blogging
  • -
  • Jitsi — awesome Zoom alternative
  • -
  • Gitea — your own Git server
  • -
  • OpenConnect — Personal VPN server
  • -
- -

Project is currently in open beta state. Feel free to try it. It would be much appreciated if you would provide us with some feedback.

diff --git a/metadata/org.selfprivacy.app/en-US/images/icon.png b/metadata/org.selfprivacy.app/en-US/images/icon.png deleted file mode 100644 index fee217d6..00000000 Binary files a/metadata/org.selfprivacy.app/en-US/images/icon.png and /dev/null differ diff --git a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/1.png b/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/1.png deleted file mode 100644 index 3ffd726f..00000000 Binary files a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/1.png and /dev/null differ diff --git a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/2.png b/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/2.png deleted file mode 100644 index 6886e9b1..00000000 Binary files a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/2.png and /dev/null differ diff --git a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/3.png b/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/3.png deleted file mode 100644 index e2024cbd..00000000 Binary files a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/3.png and /dev/null differ diff --git a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/4.png b/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/4.png deleted file mode 100644 index 3d3b2b37..00000000 Binary files a/metadata/org.selfprivacy.app/en-US/images/phoneScreenshots/4.png and /dev/null differ diff --git a/metadata/org.selfprivacy.app/en-US/short_description.txt b/metadata/org.selfprivacy.app/en-US/short_description.txt deleted file mode 100644 index 18bbf5ab..00000000 --- a/metadata/org.selfprivacy.app/en-US/short_description.txt +++ /dev/null @@ -1 +0,0 @@ -Self-hosted services without pain diff --git a/metadata/org.selfprivacy.app/en-US/title.txt b/metadata/org.selfprivacy.app/en-US/title.txt deleted file mode 100644 index adc138c5..00000000 --- a/metadata/org.selfprivacy.app/en-US/title.txt +++ /dev/null @@ -1 +0,0 @@ -SelfPrivacy diff --git a/pubspec.yaml b/pubspec.yaml index 4fc007e8..1d58f581 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: selfprivacy description: selfprivacy.org publish_to: 'none' -version: 0.8.0+17 +version: 0.9.1+19 environment: sdk: '>=3.0.2 <4.0.0'