diff --git a/Riot/Assets/Images.xcassets/Common/error_icon.imageset/Contents.json b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/Contents.json new file mode 100644 index 000000000..3979fbfbd --- /dev/null +++ b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "error_icon.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "error_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "error_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon.png b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon.png new file mode 100644 index 000000000..7be4fcb2b Binary files /dev/null and b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon.png differ diff --git a/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon@2x.png b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon@2x.png new file mode 100644 index 000000000..fcddaea56 Binary files /dev/null and b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon@2x.png differ diff --git a/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon@3x.png b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon@3x.png new file mode 100644 index 000000000..90dc3cf32 Binary files /dev/null and b/Riot/Assets/Images.xcassets/Common/error_icon.imageset/error_icon@3x.png differ diff --git a/Riot/Assets/Images.xcassets/Room/Activities/Contents.json b/Riot/Assets/Images.xcassets/Room/Activities/Contents.json index da4a164c9..73c00596a 100644 --- a/Riot/Assets/Images.xcassets/Room/Activities/Contents.json +++ b/Riot/Assets/Images.xcassets/Room/Activities/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/Contents.json b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/Contents.json new file mode 100644 index 000000000..13c5ca50a --- /dev/null +++ b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "room_activities_retry.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_activities_retry@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_activities_retry@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry.png b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry.png new file mode 100644 index 000000000..c23a356ee Binary files /dev/null and b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry.png differ diff --git a/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry@2x.png b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry@2x.png new file mode 100644 index 000000000..c40b768f7 Binary files /dev/null and b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry@2x.png differ diff --git a/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry@3x.png b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry@3x.png new file mode 100644 index 000000000..2adf43e33 Binary files /dev/null and b/Riot/Assets/Images.xcassets/Room/Activities/room_activities_retry.imageset/room_activities_retry@3x.png differ diff --git a/Riot/Assets/bg.lproj/Vector.strings b/Riot/Assets/bg.lproj/Vector.strings index a1bb6c3f7..186c3ef67 100644 --- a/Riot/Assets/bg.lproj/Vector.strings +++ b/Riot/Assets/bg.lproj/Vector.strings @@ -209,8 +209,8 @@ "encrypted_room_message_placeholder" = "Изпрати шифровано съобщение…"; "room_message_short_placeholder" = "Изпрати съобщение…"; "room_offline_notification" = "Връзката със сървъра е изгубена."; -"room_unsent_messages_notification" = "Съобщенията не са изпратени. %@ или %@?"; -"room_unsent_messages_unknown_devices_notification" = "Съобщението не е изпратено поради наличието на непознати сесии. %@ или %@?"; +"room_unsent_messages_notification" = "Съобщенията не са изпратени."; +"room_unsent_messages_unknown_devices_notification" = "Съобщението не е изпратено поради наличието на непознати сесии."; "room_ongoing_conference_call" = "Текущ групов разговор. Присъедини се с %@ или %@."; "room_ongoing_conference_call_with_close" = "Текущ групов разговор. Присъедини се с %@ или %@. %@ го."; "room_ongoing_conference_call_close" = "Затвори"; diff --git a/Riot/Assets/ca.lproj/Vector.strings b/Riot/Assets/ca.lproj/Vector.strings index 699284b81..f11645924 100644 --- a/Riot/Assets/ca.lproj/Vector.strings +++ b/Riot/Assets/ca.lproj/Vector.strings @@ -204,8 +204,8 @@ "encrypted_room_message_placeholder" = "Envia un missatge encriptat…"; "room_message_short_placeholder" = "Envia un missatge…"; "room_offline_notification" = "S'ha perdut la connexió amb el servidor."; -"room_unsent_messages_notification" = "Missatges no enviats. %@ o %@ ara?"; -"room_unsent_messages_unknown_devices_notification" = "El missatge no s'ha enviat perquè hi ha presents dispositius desconeguts. %@ o %@ ara?"; +"room_unsent_messages_notification" = "Missatges no enviats."; +"room_unsent_messages_unknown_devices_notification" = "El missatge no s'ha enviat perquè hi ha presents dispositius desconeguts."; "room_ongoing_conference_call" = "Conferència en curs. Unir-te com a %@ o %@."; "room_ongoing_conference_call_with_close" = "Conferència en curs. Unir-te com a %@ o %@. %@."; "room_ongoing_conference_call_close" = "Tancar"; diff --git a/Riot/Assets/cy.lproj/Vector.strings b/Riot/Assets/cy.lproj/Vector.strings index 01258fa76..e1524bbc8 100644 --- a/Riot/Assets/cy.lproj/Vector.strings +++ b/Riot/Assets/cy.lproj/Vector.strings @@ -237,8 +237,8 @@ "room_message_short_placeholder" = "Anfon neges…"; "room_message_reply_to_short_placeholder" = "Anfon ateb…"; "room_offline_notification" = "Collwyd cysylltedd â'r gweinydd."; -"room_unsent_messages_notification" = "Negeseuon heb eu hanfon. %@ neu %@ rwan?"; -"room_unsent_messages_unknown_devices_notification" = "Ni anfonwyd neges oherwydd bod sesiynau anhysbys yn bresennol. %@ neu %@ rwan?"; +"room_unsent_messages_notification" = "Negeseuon heb eu hanfon."; +"room_unsent_messages_unknown_devices_notification" = "Ni anfonwyd neges oherwydd bod sesiynau anhysbys yn bresennol."; "room_ongoing_conference_call" = "Galwad gynhadledd ar y gweill. Ymunwch fel %@ neu %@."; "room_ongoing_conference_call_with_close" = "Galwad gynhadledd ar y gweill. Ymunwch fel %@ neu %@. %@ o."; "room_ongoing_conference_call_close" = "Cau"; diff --git a/Riot/Assets/de.lproj/Vector.strings b/Riot/Assets/de.lproj/Vector.strings index 35921b1e6..a4f929dcd 100644 --- a/Riot/Assets/de.lproj/Vector.strings +++ b/Riot/Assets/de.lproj/Vector.strings @@ -157,8 +157,8 @@ "encrypted_room_message_placeholder" = "Verschlüsselte Nachricht…"; "room_message_short_placeholder" = "Sende eine Nachricht…"; "room_offline_notification" = "Verbindung zum Server wurde unterbrochen."; -"room_unsent_messages_notification" = "Nachrichten wurden nicht gesendet. Jetzt %@ oder %@?"; -"room_unsent_messages_unknown_devices_notification" = "Nachrichten wurden nicht gesendet, da unbekannte Sitzungen vorhanden waren. Jetzt %@ oder %@?"; +"room_unsent_messages_notification" = "Nachrichten wurden nicht gesendet."; +"room_unsent_messages_unknown_devices_notification" = "Nachrichten wurden nicht gesendet, da unbekannte Sitzungen vorhanden waren."; "room_prompt_resend" = "alle erneut senden"; "room_prompt_cancel" = "alles abbrechen"; "room_resend_unsent_messages" = "Ungesendete Nachrichten erneut senden"; diff --git a/Riot/Assets/en.lproj/Vector.strings b/Riot/Assets/en.lproj/Vector.strings index e66cdab70..14603673b 100644 --- a/Riot/Assets/en.lproj/Vector.strings +++ b/Riot/Assets/en.lproj/Vector.strings @@ -328,8 +328,10 @@ Tap the + to start adding people."; "room_message_short_placeholder" = "Send a message…"; "room_message_reply_to_short_placeholder" = "Send a reply…"; "room_offline_notification" = "Connectivity to the server has been lost."; -"room_unsent_messages_notification" = "Messages not sent. %@ or %@ now?"; -"room_unsent_messages_unknown_devices_notification" = "Message not sent due to unknown sessions being present. %@ or %@ now?"; +"room_unsent_messages_notification" = "Messages failed to send."; +"room_unsent_messages_unknown_devices_notification" = "Message failed to send due to unknown sessions being present."; +"room_unsent_messages_cancel_title" = "Delete unsent messages"; +"room_unsent_messages_cancel_message" = "Are you sure you want to delete all unsent messages in this room?"; "room_ongoing_conference_call" = "Ongoing conference call. Join as %@ or %@."; "room_ongoing_conference_call_with_close" = "Ongoing conference call. Join as %@ or %@. %@ it."; "room_ongoing_conference_call_close" = "Close"; diff --git a/Riot/Assets/es.lproj/Vector.strings b/Riot/Assets/es.lproj/Vector.strings index bd78b6061..de769fa05 100644 --- a/Riot/Assets/es.lproj/Vector.strings +++ b/Riot/Assets/es.lproj/Vector.strings @@ -216,8 +216,8 @@ "room_message_short_placeholder" = "Enviar un mensaje…"; "room_message_reply_to_short_placeholder" = "Enviar una respuesta…"; "room_offline_notification" = "Se perdió la conexión con el servidor."; -"room_unsent_messages_notification" = "Los mensajes no se enviaron. ¿%@ o %@ ahora?"; -"room_unsent_messages_unknown_devices_notification" = "No se envió el mensaje debido a dispositivos desconocidos presentes. ¿%@ o %@ ahora?"; +"room_unsent_messages_notification" = "Los mensajes no se enviaron."; +"room_unsent_messages_unknown_devices_notification" = "No se envió el mensaje debido a dispositivos desconocidos presentes."; "room_recents_server_notice_section" = "ALERTAS DE SISTEMA"; "room_ongoing_conference_call" = "Llamada de conferencia en curso. Unirse con %@ o %@."; "room_ongoing_conference_call_with_close" = "Llamada de conferencia en curso. Unirse con %@ o %@. %@ la."; diff --git a/Riot/Assets/et.lproj/Vector.strings b/Riot/Assets/et.lproj/Vector.strings index d898f4a65..522656a5a 100644 --- a/Riot/Assets/et.lproj/Vector.strings +++ b/Riot/Assets/et.lproj/Vector.strings @@ -242,8 +242,8 @@ "room_message_short_placeholder" = "Saada sõnum…"; "room_message_reply_to_short_placeholder" = "Saada vastus…"; "room_offline_notification" = "Ühendus sinu serveriga on katkenud."; -"room_unsent_messages_notification" = "Sõnumid pole saadetud. %@ või %@ nüüd?"; -"room_unsent_messages_unknown_devices_notification" = "Kuna leidub tundmatuid sessioone, siis sõnumid pole saadetud. %@ või %@ nüüd?"; +"room_unsent_messages_notification" = "Sõnumid pole saadetud."; +"room_unsent_messages_unknown_devices_notification" = "Kuna leidub tundmatuid sessioone, siis sõnumid pole saadetud."; "room_ongoing_conference_call" = "Konverentsikõne on käsil. Liitu kas %@ või %@."; "room_ongoing_conference_call_with_close" = "Konverentsikõne on käsil. Liitu kas %@ või %@. %@ seda."; "room_ongoing_conference_call_close" = "Sulge"; diff --git a/Riot/Assets/eu.lproj/Vector.strings b/Riot/Assets/eu.lproj/Vector.strings index ef60098fd..38a6e4d34 100644 --- a/Riot/Assets/eu.lproj/Vector.strings +++ b/Riot/Assets/eu.lproj/Vector.strings @@ -286,8 +286,8 @@ "room_two_users_are_typing" = "%@ eta %@ idazten ari dira…"; "room_many_users_are_typing" = "%@, %@, eta beste batzuk idazten ari dira…"; "room_message_short_placeholder" = "Bidali mezu bat…"; -"room_unsent_messages_notification" = "Bidali gabeko mezuak daude. %@ edo %@ orain?"; -"room_unsent_messages_unknown_devices_notification" = "Mezua ez da bidali saio ezezagunak daudelako. %@ edo %@ orain?"; +"room_unsent_messages_notification" = "Bidali gabeko mezuak daude."; +"room_unsent_messages_unknown_devices_notification" = "Mezua ez da bidali saio ezezagunak daudelako."; "room_ongoing_conference_call" = "Konferentzia deia abioan. Elkartu %@ edo %@ erabiliz."; "room_event_action_more" = "Gehiago"; "room_event_action_save" = "Gorde"; diff --git a/Riot/Assets/fr.lproj/Vector.strings b/Riot/Assets/fr.lproj/Vector.strings index 1d129967c..c53844af1 100644 --- a/Riot/Assets/fr.lproj/Vector.strings +++ b/Riot/Assets/fr.lproj/Vector.strings @@ -195,8 +195,8 @@ "encrypted_room_message_placeholder" = "Envoyer un message chiffré…"; "room_message_short_placeholder" = "Envoyer un message…"; "room_offline_notification" = "La connexion au serveur a été perdue."; -"room_unsent_messages_notification" = "Messages non envoyés. %@ ou %@ maintenant ?"; -"room_unsent_messages_unknown_devices_notification" = "Message non envoyé car des sessions inconnues sont présentes. %@ ou %@ maintenant ?"; +"room_unsent_messages_notification" = "Messages non envoyés."; +"room_unsent_messages_unknown_devices_notification" = "Message non envoyé car des sessions inconnues sont présentes."; "room_ongoing_conference_call" = "Téléconférence en cours. Rejoindre en %@ ou %@."; "room_prompt_resend" = "Tout renvoyer"; "room_prompt_cancel" = "tout annuler"; diff --git a/Riot/Assets/hu.lproj/Vector.strings b/Riot/Assets/hu.lproj/Vector.strings index 22903436c..cb403d9af 100644 --- a/Riot/Assets/hu.lproj/Vector.strings +++ b/Riot/Assets/hu.lproj/Vector.strings @@ -210,8 +210,8 @@ "room_message_short_placeholder" = "Üzenet küldése…"; "room_message_reply_to_short_placeholder" = "Válasz küldése…"; "room_offline_notification" = "A szerverrel megszakadt a kapcsolat."; -"room_unsent_messages_notification" = "Üzenet nincs elküldve. Most %@ vagy %@?"; -"room_unsent_messages_unknown_devices_notification" = "Az üzenet nincs elküldve, mert ismeretlen munkamenet van jelen. Most %@ vagy %@?"; +"room_unsent_messages_notification" = "Üzenet nincs elküldve."; +"room_unsent_messages_unknown_devices_notification" = "Az üzenet nincs elküldve, mert ismeretlen munkamenet van jelen."; "room_ongoing_conference_call" = "Konferencia hívás van folyamatban. Csatlakozol mint %@ vagy %@."; "room_ongoing_conference_call_with_close" = "Konferencia hívás van folyamatban. Csatlakozol mint %@ vagy %@. %@."; "room_ongoing_conference_call_close" = "Bezár"; diff --git a/Riot/Assets/is.lproj/Vector.strings b/Riot/Assets/is.lproj/Vector.strings index 841930c74..f6fcd78c3 100644 --- a/Riot/Assets/is.lproj/Vector.strings +++ b/Riot/Assets/is.lproj/Vector.strings @@ -401,8 +401,8 @@ "room_participants_remove_prompt_msg" = "Ertu viss um að þú viljir fjarlægja %@ úr þessu spjalli?"; "room_participants_invite_prompt_msg" = "Ertu viss um að þú viljir bjóða %@ á þetta spjall?"; "room_participants_invite_malformed_id" = "Rangt formað auðkenni. Ætti að vera tölvupóstfang eða Matrix-auðkenni á borð við'@sérheiti:lén'"; -"room_unsent_messages_notification" = "Skilaboð ekki send. %@ eða %@ núna?"; -"room_unsent_messages_unknown_devices_notification" = "Skilaboð ekki send vegna þess að vart var við óþekkt tæki. %@ eða %@ núna?"; +"room_unsent_messages_notification" = "Skilaboð ekki send."; +"room_unsent_messages_unknown_devices_notification" = "Skilaboð ekki send vegna þess að vart var við óþekkt tæki."; "room_ongoing_conference_call" = "Símafundur í gangi. Taka þátt með %@ eða %@."; "room_ongoing_conference_call_with_close" = "Símafundur í gangi. Taka þátt með %@ eða %@. %@ því."; "room_conference_call_no_power" = "Þú þarft aðgangsheimildir til að sýsla með símafundi á þessari spjallrás"; diff --git a/Riot/Assets/it.lproj/Vector.strings b/Riot/Assets/it.lproj/Vector.strings index 0afba28e8..aa6b12724 100644 --- a/Riot/Assets/it.lproj/Vector.strings +++ b/Riot/Assets/it.lproj/Vector.strings @@ -216,8 +216,8 @@ "room_message_short_placeholder" = "Invia un messaggio…"; "room_message_reply_to_short_placeholder" = "Invia una risposta…"; "room_offline_notification" = "La connessione al server è stata persa."; -"room_unsent_messages_notification" = "Messaggi non inviati. %1$s o %2$s ora?"; -"room_unsent_messages_unknown_devices_notification" = "Messaggi non inviati a causa della presenza di sessioni sconosciute. %1$s o %2$s ora?"; +"room_unsent_messages_notification" = "Messaggi non inviati."; +"room_unsent_messages_unknown_devices_notification" = "Messaggi non inviati a causa della presenza di sessioni sconosciute."; "room_ongoing_conference_call" = "Avvio conferenza. Unisciti come %@ o %@."; "room_ongoing_conference_call_with_close" = "Avvio conferenza. Unisciti come %@ o %@. %@."; "room_ongoing_conference_call_close" = "Chiudi"; diff --git a/Riot/Assets/ja.lproj/Vector.strings b/Riot/Assets/ja.lproj/Vector.strings index e977a6d7b..7c9dd284b 100644 --- a/Riot/Assets/ja.lproj/Vector.strings +++ b/Riot/Assets/ja.lproj/Vector.strings @@ -200,8 +200,8 @@ "encrypted_room_message_placeholder" = "暗号文を送信…"; "room_message_short_placeholder" = "ここに送信文を入力…"; "room_offline_notification" = "サーバとの接続が失われました."; -"room_unsent_messages_notification" = "文章が送信できませんでした。現在 %@ または %@ ?"; -"room_unsent_messages_unknown_devices_notification" = "未知のセッションが存在するために文章が送信されませんでした。現在%@ or %@ ?"; +"room_unsent_messages_notification" = "文章が送信できませんでした."; +"room_unsent_messages_unknown_devices_notification" = "未知のセッションが存在するために文章が送信されませんでした."; "room_ongoing_conference_call" = "会議通話実施中。 %@ または %@で参加してください。"; "room_ongoing_conference_call_with_close" = "会議通話実施中。%@または%@で参加してください。 %@。"; "room_ongoing_conference_call_close" = "閉じる"; diff --git a/Riot/Assets/nl.lproj/Vector.strings b/Riot/Assets/nl.lproj/Vector.strings index ce589eb60..d193952d4 100644 --- a/Riot/Assets/nl.lproj/Vector.strings +++ b/Riot/Assets/nl.lproj/Vector.strings @@ -204,8 +204,8 @@ "encrypted_room_message_placeholder" = "Stuur een versleuteld bericht…"; "room_message_short_placeholder" = "Stuur een bericht…"; "room_offline_notification" = "De verbinding met de server is verbroken."; -"room_unsent_messages_notification" = "Berichten niet verstuurd. Nu %@ of %@?"; -"room_unsent_messages_unknown_devices_notification" = "Bericht is niet verstuurd doordat er onbekende apparaten aanwezig zijn. Nu %@ of %@?"; +"room_unsent_messages_notification" = "Berichten niet verstuurd."; +"room_unsent_messages_unknown_devices_notification" = "Bericht is niet verstuurd doordat er onbekende apparaten aanwezig zijn."; "room_ongoing_conference_call" = "Er is een vergadergesprek gaande. Neem deel met %@ of %@."; "room_prompt_resend" = "alles opnieuw versturen"; "room_prompt_cancel" = "alles annuleren"; diff --git a/Riot/Assets/pl.lproj/Vector.strings b/Riot/Assets/pl.lproj/Vector.strings index 70058ef7a..9d4cb8526 100644 --- a/Riot/Assets/pl.lproj/Vector.strings +++ b/Riot/Assets/pl.lproj/Vector.strings @@ -392,7 +392,7 @@ "contacts_address_book_no_contact" = "Brak lokalnych kontaktów"; "auth_msisdn_validation_error" = "Nie można zweryfikować numeru telefonu."; "room_participants_invite_malformed_id" = "Uszkodzony ID. Powinien być adres e-mail lub Matrix ID podobny do '@localpart:domain'"; -"room_unsent_messages_notification" = "Wiadomość nie została wysłana. Czy %@ lub %@ teraz?"; +"room_unsent_messages_notification" = "Wiadomość nie została wysłana."; "room_ongoing_conference_call_with_close" = "Przychodzące połączenie grupowe. Dołącz z %@ lub z %@. %@ to."; "directory_search_results_title" = "Przeglądaj wyniki katalogów"; "room_event_action_kick_prompt_reason" = "Powód wyrzucenia użytkownika"; diff --git a/Riot/Assets/ru.lproj/Vector.strings b/Riot/Assets/ru.lproj/Vector.strings index 3ad1ec882..b9f7a1582 100644 --- a/Riot/Assets/ru.lproj/Vector.strings +++ b/Riot/Assets/ru.lproj/Vector.strings @@ -185,8 +185,8 @@ "encrypted_room_message_placeholder" = "Отправить зашифрованное сообщение…"; "room_message_short_placeholder" = "Отправить сообщение…"; "room_offline_notification" = "Связь с сервером потеряна."; -"room_unsent_messages_notification" = "Сообщения не отправлены. %@ или %@ сейчас?"; -"room_unsent_messages_unknown_devices_notification" = "Сообщение не отправлено из-за присутствия неизвестных сеансов. %@ или %@ сейчас?"; +"room_unsent_messages_notification" = "Сообщения не отправлены."; +"room_unsent_messages_unknown_devices_notification" = "Сообщение не отправлено из-за присутствия неизвестных сеансов."; "room_ongoing_conference_call" = "Текущий групповой вызов. Войти как %@ или %@."; "room_prompt_resend" = "Отправить все"; "room_prompt_cancel" = "отменить все"; diff --git a/Riot/Assets/sq.lproj/Vector.strings b/Riot/Assets/sq.lproj/Vector.strings index 112644270..e6057953a 100644 --- a/Riot/Assets/sq.lproj/Vector.strings +++ b/Riot/Assets/sq.lproj/Vector.strings @@ -173,7 +173,7 @@ "encrypted_room_message_placeholder" = "Dërgoni një mesazhi të fshehtëzuar…"; "room_message_short_placeholder" = "Dërgoni një mesazh…"; "room_offline_notification" = "Humbi lidhja me shërbyesin."; -"room_unsent_messages_notification" = "Mesazhet s’u dërguan. %@ apo %@ tani?"; +"room_unsent_messages_notification" = "Mesazhet s’u dërguan."; "room_ongoing_conference_call_close" = "Mbylle"; "room_prompt_resend" = "Ridërgoji krejt"; "room_prompt_cancel" = "anuloji krejt"; diff --git a/Riot/Assets/vi.lproj/Vector.strings b/Riot/Assets/vi.lproj/Vector.strings index 601be0bdc..9b2d328c4 100644 --- a/Riot/Assets/vi.lproj/Vector.strings +++ b/Riot/Assets/vi.lproj/Vector.strings @@ -200,8 +200,8 @@ "encrypted_room_message_placeholder" = "Gửi tin nhắn đã mã hoá…"; "room_message_short_placeholder" = "Gửi tin nhắn…"; "room_offline_notification" = "Kết nối tới máy chủ thất bại."; -"room_unsent_messages_notification" = "Các tin nhắn chưa được gửi. %@ hoặc %@ ngay bây giờ?"; -"room_unsent_messages_unknown_devices_notification" = "Các tin nhắn chưa được gửi tới các thiết bị không xác định hiện hành. %@ hoặc %@ ngay bây giờ?"; +"room_unsent_messages_notification" = "Các tin nhắn chưa được gửi."; +"room_unsent_messages_unknown_devices_notification" = "Các tin nhắn chưa được gửi tới các thiết bị không xác định hiện hành."; "room_ongoing_conference_call" = "Cuộc gọi hội nghị đang diễn ra. Tham gia như %@ hoặc %@."; "room_ongoing_conference_call_with_close" = "Cuộc gọi hội nghị đang diễn ra. Tham gia như %@ hoặc %@. %@ nó."; "room_ongoing_conference_call_close" = "Đóng"; diff --git a/Riot/Assets/zh_Hans.lproj/Vector.strings b/Riot/Assets/zh_Hans.lproj/Vector.strings index 2dcf813a0..46cf235d1 100644 --- a/Riot/Assets/zh_Hans.lproj/Vector.strings +++ b/Riot/Assets/zh_Hans.lproj/Vector.strings @@ -189,8 +189,8 @@ "encrypted_room_message_placeholder" = "发送加密消息…"; "room_message_short_placeholder" = "发送消息…"; "room_offline_notification" = "到服务器的连接已经丢失。"; -"room_unsent_messages_notification" = "消息没有发送。现在 %@ 或 %@ ?"; -"room_unsent_messages_unknown_devices_notification" = "由于未知会话在线所以消息没有发送。现在 %@ 或 %@?"; +"room_unsent_messages_notification" = "消息没有发送。"; +"room_unsent_messages_unknown_devices_notification" = "由于未知会话在线所以消息没有发送。"; "room_ongoing_conference_call" = "收到会议通话。以 %@ 或 %@ 加入。"; "room_prompt_resend" = "全部重新发送"; "room_prompt_cancel" = "全部取消"; diff --git a/Riot/Assets/zh_Hant.lproj/Vector.strings b/Riot/Assets/zh_Hant.lproj/Vector.strings index 3092bb226..685722293 100644 --- a/Riot/Assets/zh_Hant.lproj/Vector.strings +++ b/Riot/Assets/zh_Hant.lproj/Vector.strings @@ -266,8 +266,8 @@ "room_two_users_are_typing" = "%@ 和 %@ 正在輸入…"; "room_many_users_are_typing" = "%@、%@ 和 %@ 正在輸入…"; "room_message_short_placeholder" = "傳送訊息…"; -"room_unsent_messages_notification" = "訊息未被傳送。現在 %@ 或 %@ 嗎?"; -"room_unsent_messages_unknown_devices_notification" = "由於存在未知的工作階段導致訊息未被傳送。現在 %@ 或 %@ 嗎?"; +"room_unsent_messages_notification" = "訊息未被傳送。"; +"room_unsent_messages_unknown_devices_notification" = "由於存在未知的工作階段導致訊息未被傳送。"; "room_conference_call_no_power" = "您需要管理此聊天室群組通話的權限"; "room_prompt_resend" = "全部重新傳送"; "room_prompt_cancel" = "全部取消"; diff --git a/Riot/Categories/MXRoom+Riot.h b/Riot/Categories/MXRoom+Riot.h index 42a6a6c01..e69227b09 100644 --- a/Riot/Categories/MXRoom+Riot.h +++ b/Riot/Categories/MXRoom+Riot.h @@ -19,6 +19,13 @@ #import "UserEncryptionTrustLevel.h" +typedef NS_ENUM(NSUInteger, MXRoomSentStatus) +{ + MXRoomSentStatusOk, + MXRoomSentStatusSentFailed, + MXRoomSentStatusSentFailedDueToUnknownDevices +}; + /** Define a `MXRoom` category at Riot level. */ @@ -44,6 +51,9 @@ */ @property (nonatomic) id notificationCenterDidUpdateObserver; +/// Check if all messages have been sent. +@property (nonatomic, readonly) MXRoomSentStatus sentStatus; + /** Update the room tag. diff --git a/Riot/Categories/MXRoom+Riot.m b/Riot/Categories/MXRoom+Riot.m index 449bcbc84..35deee44e 100644 --- a/Riot/Categories/MXRoom+Riot.m +++ b/Riot/Categories/MXRoom+Riot.m @@ -656,4 +656,30 @@ return objc_getAssociatedObject(self, @selector(notificationCenterDidUpdateObserver)); } +#pragma mark - Unread messages + +- (MXRoomSentStatus)sentStatus +{ + MXRoomSentStatus status = MXRoomSentStatusOk; + NSArray *outgoingMsgs = self.outgoingMessages; + + for (MXEvent *event in outgoingMsgs) + { + if (event.sentState == MXEventSentStateFailed) + { + status = MXRoomSentStatusSentFailed; + + // Check if the error is due to unknown devices + if ([event.sentError.domain isEqualToString:MXEncryptingErrorDomain] + && event.sentError.code == MXEncryptingErrorUnknownDeviceCode) + { + status = MXRoomSentStatusSentFailedDueToUnknownDevices; + break; + } + } + } + + return status; +} + @end diff --git a/Riot/Generated/Images.swift b/Riot/Generated/Images.swift index 76ce088a2..f7463a89b 100644 --- a/Riot/Generated/Images.swift +++ b/Riot/Generated/Images.swift @@ -50,6 +50,7 @@ internal enum Asset { internal static let chevron = ImageAsset(name: "chevron") internal static let closeButton = ImageAsset(name: "close_button") internal static let disclosureIcon = ImageAsset(name: "disclosure_icon") + internal static let errorIcon = ImageAsset(name: "error_icon") internal static let faceidIcon = ImageAsset(name: "faceid_icon") internal static let group = ImageAsset(name: "group") internal static let monitor = ImageAsset(name: "monitor") @@ -98,8 +99,8 @@ internal enum Asset { internal static let peopleEmptyScreenArtworkDark = ImageAsset(name: "people_empty_screen_artwork_dark") internal static let peopleFloatingAction = ImageAsset(name: "people_floating_action") internal static let error = ImageAsset(name: "error") + internal static let roomActivitiesRetry = ImageAsset(name: "room_activities_retry") internal static let scrolldown = ImageAsset(name: "scrolldown") - internal static let sendingMessageTick = ImageAsset(name: "sending_message_tick") internal static let sentMessageTick = ImageAsset(name: "sent_message_tick") internal static let typing = ImageAsset(name: "typing") internal static let roomContextMenuCopy = ImageAsset(name: "room_context_menu_copy") diff --git a/Riot/Generated/Strings.swift b/Riot/Generated/Strings.swift index f0e5d2ac4..c3d8154f2 100644 --- a/Riot/Generated/Strings.swift +++ b/Riot/Generated/Strings.swift @@ -3334,13 +3334,21 @@ internal enum VectorL10n { internal static func roomTwoUsersAreTyping(_ p1: String, _ p2: String) -> String { return VectorL10n.tr("Vector", "room_two_users_are_typing", p1, p2) } - /// Messages not sent. %@ or %@ now? - internal static func roomUnsentMessagesNotification(_ p1: String, _ p2: String) -> String { - return VectorL10n.tr("Vector", "room_unsent_messages_notification", p1, p2) + /// Are you sure you want to delete all unsent messages in this room? + internal static var roomUnsentMessagesCancelMessage: String { + return VectorL10n.tr("Vector", "room_unsent_messages_cancel_message") } - /// Message not sent due to unknown sessions being present. %@ or %@ now? - internal static func roomUnsentMessagesUnknownDevicesNotification(_ p1: String, _ p2: String) -> String { - return VectorL10n.tr("Vector", "room_unsent_messages_unknown_devices_notification", p1, p2) + /// Delete unsent messages + internal static var roomUnsentMessagesCancelTitle: String { + return VectorL10n.tr("Vector", "room_unsent_messages_cancel_title") + } + /// Messages failed to send. + internal static var roomUnsentMessagesNotification: String { + return VectorL10n.tr("Vector", "room_unsent_messages_notification") + } + /// Message failed to send due to unknown sessions being present. + internal static var roomUnsentMessagesUnknownDevicesNotification: String { + return VectorL10n.tr("Vector", "room_unsent_messages_unknown_devices_notification") } /// End-to-end encryption is in beta and may not be reliable.\n\nYou should not yet trust it to secure data.\n\nDevices will not yet be able to decrypt history from before they joined the room.\n\nEncrypted messages will not be visible on clients that do not yet implement encryption. internal static var roomWarningAboutEncryption: String { diff --git a/Riot/Modules/BadgeLabel/BadgeLabel.h b/Riot/Modules/BadgeLabel/BadgeLabel.h new file mode 100644 index 000000000..ccebf2f67 --- /dev/null +++ b/Riot/Modules/BadgeLabel/BadgeLabel.h @@ -0,0 +1,31 @@ +// +// Copyright 2021 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +IB_DESIGNABLE +@interface BadgeLabel : UILabel + +@property IBInspectable (nonatomic, weak) UIColor *badgeColor; +@property IBInspectable (nonatomic) CGFloat borderWidth; +@property IBInspectable (nonatomic, weak) UIColor *borderColor; +@property IBInspectable (nonatomic) CGSize padding; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Riot/Modules/BadgeLabel/BadgeLabel.m b/Riot/Modules/BadgeLabel/BadgeLabel.m new file mode 100644 index 000000000..bb4932a76 --- /dev/null +++ b/Riot/Modules/BadgeLabel/BadgeLabel.m @@ -0,0 +1,96 @@ +// +// Copyright 2021 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#import "BadgeLabel.h" + +@implementation BadgeLabel + +- (instancetype)initWithCoder:(NSCoder *)coder +{ + self = [super initWithCoder:coder]; + if (self) { + [self setupView]; + } + return self; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self setupView]; + } + return self; +} + +- (void)layoutSubviews +{ + [super layoutSubviews]; + self.layer.cornerRadius = self.bounds.size.height / 2; +} + +- (CGSize)intrinsicContentSize +{ + CGSize intrinsicSize = [super intrinsicContentSize]; + intrinsicSize.height = MAX(intrinsicSize.height + self.padding.height, intrinsicSize.height) + self.borderWidth / 2; + intrinsicSize.width = MAX(intrinsicSize.width + self.padding.width, intrinsicSize.height); + return intrinsicSize; +} + +- (void)drawRect:(CGRect)rect +{ + CGContextRef context = UIGraphicsGetCurrentContext(); + CGContextSaveGState(context); + + CGRect backgroundRect = CGRectInset(self.bounds, self.borderWidth / 2, self.borderWidth / 2); + CGFloat cornerRadius = backgroundRect.size.height / 2; + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:backgroundRect cornerRadius:cornerRadius]; + CGContextAddPath(context, [path CGPath]); + CGContextSetLineWidth(context, self.borderWidth); + CGContextSetStrokeColorWithColor(context, [self.borderColor CGColor]); + CGContextSetFillColorWithColor(context, [self.badgeColor CGColor]); + + if (self.borderWidth > 0) + { + CGContextDrawPath(context, kCGPathFillStroke); + } + else + { + CGContextDrawPath(context, kCGPathFill); + } + + CGContextRestoreGState(context); + + [super drawRect:rect]; +} + +- (void)prepareForInterfaceBuilder +{ + [super prepareForInterfaceBuilder]; + [self setupView]; +} + +- (void)setupView +{ + self.badgeColor = UIColor.redColor; + self.borderWidth = 0; + self.borderColor = UIColor.whiteColor; + self.padding = CGSizeMake(10, 2); + self.textAlignment = NSTextAlignmentCenter; + self.textColor = UIColor.whiteColor; +} + +@end diff --git a/Riot/Modules/BadgeLabel/BadgeLabel.swift b/Riot/Modules/BadgeLabel/BadgeLabel.swift new file mode 100644 index 000000000..1abb9dbb4 --- /dev/null +++ b/Riot/Modules/BadgeLabel/BadgeLabel.swift @@ -0,0 +1,111 @@ +// +// Copyright 2021 New Vector Ltd +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import UIKit + +@IBDesignable +@objcMembers +class BadgeLabel: UILabel { + + // MARK: - Public properties + + @IBInspectable var badgeColor: UIColor = .red { + didSet { + setNeedsDisplay() + } + } + + @IBInspectable var borderWidth: CGFloat = 0 { + didSet { + invalidateIntrinsicContentSize() + } + } + + @IBInspectable var borderColor: UIColor = .white { + didSet { + invalidateIntrinsicContentSize() + } + } + + @IBInspectable var padding: CGSize = CGSize(width: 5, height: 2) { + didSet { + invalidateIntrinsicContentSize() + } + } + + // MARK: - Lifecycle + + required init?(coder: NSCoder) { + super.init(coder: coder) + setupView() + } + + override init(frame: CGRect) { + super.init(frame: frame) + setupView() + } + + override func layoutSubviews() { + super.layoutSubviews() + + self.layer.cornerRadius = self.bounds.size.height / 2 + } + + override var intrinsicContentSize: CGSize { + var intrinsicSize = super.intrinsicContentSize + intrinsicSize.height = max(intrinsicSize.height + padding.height, intrinsicSize.height) + borderWidth / 2 + intrinsicSize.width = max(intrinsicSize.width + padding.width, intrinsicSize.height) + return intrinsicSize + } + + override func draw(_ rect: CGRect) { + if let context = UIGraphicsGetCurrentContext() { + context.saveGState() + + let rect = self.bounds.insetBy(dx: borderWidth / 2, dy: borderWidth / 2) + let cornerRadius = rect.height / 2 + let path = UIBezierPath(roundedRect: rect, cornerRadius: cornerRadius) + + context.addPath(path.cgPath) + context.setLineWidth(borderWidth) + context.setStrokeColor(borderColor.cgColor) + context.setFillColor(badgeColor.cgColor) + + if borderWidth > 0 { + context.drawPath(using: .fillStroke) + } else { + context.drawPath(using: .fill) + } + + context.restoreGState() + } + + super.draw(rect) + } + + // MARK: - Interface Builder + + override func prepareForInterfaceBuilder() { + super.prepareForInterfaceBuilder() + setupView() + } + + // MARK: - Private methods + + private func setupView() { + self.textAlignment = .center + } +} diff --git a/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m b/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m index 84301fdb6..e337ae3dc 100644 --- a/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m +++ b/Riot/Modules/Common/Recents/DataSources/RecentsDataSource.m @@ -1294,6 +1294,18 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou // Sort each rooms collection by considering first the rooms with some missed notifs, the rooms with unread, then the others. comparator = ^NSComparisonResult(id recentCellData1, id recentCellData2) { + if (recentCellData1.roomSummary.room.sentStatus != MXRoomSentStatusOk + && recentCellData2.roomSummary.room.sentStatus == MXRoomSentStatusOk) + { + return NSOrderedAscending; + } + + if (recentCellData2.roomSummary.room.sentStatus != MXRoomSentStatusOk + && recentCellData1.roomSummary.room.sentStatus == MXRoomSentStatusOk) + { + return NSOrderedDescending; + } + if (recentCellData1.highlightCount) { if (recentCellData2.highlightCount) @@ -1351,6 +1363,18 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou // Sort each rooms collection by considering first the rooms with some unread messages then the others. comparator = ^NSComparisonResult(id recentCellData1, id recentCellData2) { + if (recentCellData1.roomSummary.room.sentStatus != MXRoomSentStatusOk + && recentCellData2.roomSummary.room.sentStatus == MXRoomSentStatusOk) + { + return NSOrderedAscending; + } + + if (recentCellData2.roomSummary.room.sentStatus != MXRoomSentStatusOk + && recentCellData1.roomSummary.room.sentStatus == MXRoomSentStatusOk) + { + return NSOrderedDescending; + } + if (recentCellData1.hasUnread) { if (recentCellData2.hasUnread) @@ -1389,6 +1413,24 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou return [session compareRoomsByTag:kMXRoomTagFavourite room1:recentCellData1.roomSummary.room room2:recentCellData2.roomSummary.room]; }]; + } else if (conversationCellDataArray.count > 0 && (_recentsDataSourceMode == RecentsDataSourceModeRooms || _recentsDataSourceMode == RecentsDataSourceModePeople)) + { + [conversationCellDataArray sortUsingComparator:^NSComparisonResult(id recentCellData1, id recentCellData2) { + + if (recentCellData1.roomSummary.room.sentStatus != MXRoomSentStatusOk + && recentCellData2.roomSummary.room.sentStatus == MXRoomSentStatusOk) + { + return NSOrderedAscending; + } + + if (recentCellData2.roomSummary.room.sentStatus != MXRoomSentStatusOk + && recentCellData1.roomSummary.room.sentStatus == MXRoomSentStatusOk) + { + return NSOrderedDescending; + } + + return NSOrderedAscending; + }]; } } diff --git a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.h b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.h index 7e8d85a08..04475a1e1 100644 --- a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.h +++ b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.h @@ -15,6 +15,7 @@ */ #import +#import "BadgeLabel.h" /** `RecentTableViewCell` instances display a room in the context of the recents list. @@ -30,4 +31,7 @@ @property (weak, nonatomic) IBOutlet UIView *missedNotifAndUnreadBadgeBgView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *missedNotifAndUnreadBadgeBgViewWidthConstraint; +@property (weak, nonatomic) IBOutlet NSLayoutConstraint *lastEventDecriptionLabelTrailingConstraint; +@property (weak, nonatomic) IBOutlet UIImageView *unsentImageView; + @end diff --git a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m index a33e0e5e0..a3449343c 100644 --- a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m +++ b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.m @@ -20,6 +20,7 @@ #import "AvatarGenerator.h" #import "MXEvent.h" +#import "MXRoom+Riot.h" #import "ThemeService.h" #import "Riot-Swift.h" @@ -102,6 +103,9 @@ static const CGFloat kDirectRoomBorderWidth = 3.0; self.lastEventDescription.text = roomCellData.lastEventTextMessage; } + self.unsentImageView.hidden = roomCellData.roomSummary.room.sentStatus == MXRoomSentStatusOk; + self.lastEventDecriptionLabelTrailingConstraint.constant = self.unsentImageView.hidden ? 10 : 30; + // Notify unreads and bing if (roomCellData.hasUnread) { diff --git a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.xib b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.xib index 8fd41d271..8765ab55e 100644 --- a/Riot/Modules/Common/Recents/Views/RecentTableViewCell.xib +++ b/Riot/Modules/Common/Recents/Views/RecentTableViewCell.xib @@ -1,11 +1,9 @@ - - - - + + - + @@ -15,7 +13,7 @@ - + + @@ -114,10 +120,11 @@ + - + @@ -129,6 +136,7 @@ + @@ -136,10 +144,13 @@ + + + diff --git a/Riot/Modules/Home/Views/RoomCollectionViewCell.h b/Riot/Modules/Home/Views/RoomCollectionViewCell.h index e28aa6642..c415ba579 100644 --- a/Riot/Modules/Home/Views/RoomCollectionViewCell.h +++ b/Riot/Modules/Home/Views/RoomCollectionViewCell.h @@ -15,6 +15,7 @@ */ #import +#import "BadgeLabel.h" /** 'RoomCollectionViewCell' class is used to display a room in a collection view. @@ -38,9 +39,7 @@ @property (weak, nonatomic) IBOutlet MXKImageView *roomAvatar; @property (weak, nonatomic) IBOutlet UIImageView *encryptedRoomIcon; -@property (weak, nonatomic) IBOutlet UILabel *missedNotifAndUnreadBadgeLabel; -@property (weak, nonatomic) IBOutlet UIView *missedNotifAndUnreadBadgeBgView; -@property (weak, nonatomic) IBOutlet NSLayoutConstraint *missedNotifAndUnreadBadgeBgViewWidthConstraint; +@property (weak, nonatomic) IBOutlet BadgeLabel *badgeLabel; @property (nonatomic, readonly) NSString *roomId; diff --git a/Riot/Modules/Home/Views/RoomCollectionViewCell.m b/Riot/Modules/Home/Views/RoomCollectionViewCell.m index 34ccbb861..042cca014 100644 --- a/Riot/Modules/Home/Views/RoomCollectionViewCell.m +++ b/Riot/Modules/Home/Views/RoomCollectionViewCell.m @@ -22,6 +22,7 @@ #import "Riot-Swift.h" #import "MXRoomSummary+Riot.h" +#import "MXRoom+Riot.h" #import "MXTools.h" @@ -42,10 +43,6 @@ static const CGFloat kDirectRoomBorderWidth = 3.0; [_roomAvatar.layer setCornerRadius:_roomAvatar.frame.size.width / 2]; _roomAvatar.clipsToBounds = YES; - // Initialize unread count badge - [_missedNotifAndUnreadBadgeBgView.layer setCornerRadius:10]; - _missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 0; - // Disable the user interaction on the room avatar. self.roomAvatar.userInteractionEnabled = NO; @@ -69,7 +66,6 @@ static const CGFloat kDirectRoomBorderWidth = 3.0; self.roomTitle.textColor = ThemeService.shared.theme.textPrimaryColor; self.roomTitle1.textColor = ThemeService.shared.theme.textPrimaryColor; self.roomTitle2.textColor = ThemeService.shared.theme.textPrimaryColor; - self.missedNotifAndUnreadBadgeLabel.textColor = ThemeService.shared.theme.baseTextPrimaryColor; // Prepare direct room border CGColorRef directRoomBorderColor = CGColorCreateCopyWithAlpha(ThemeService.shared.theme.tintColor.CGColor, kDirectRoomBorderColorAlpha); @@ -94,8 +90,7 @@ static const CGFloat kDirectRoomBorderWidth = 3.0; - (void)render:(MXKCellData *)cellData { // Hide by default missed notifications and unread widgets - self.missedNotifAndUnreadBadgeBgView.hidden = YES; - self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 0; + self.badgeLabel.hidden = YES; roomCellData = (id)cellData; if (roomCellData) @@ -125,28 +120,21 @@ static const CGFloat kDirectRoomBorderWidth = 3.0; { if (0 < roomCellData.notificationCount) { - self.missedNotifAndUnreadBadgeBgView.hidden = NO; - self.missedNotifAndUnreadBadgeBgView.backgroundColor = roomCellData.highlightCount ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor; - - self.missedNotifAndUnreadBadgeLabel.text = roomCellData.notificationCountStringValue; - [self.missedNotifAndUnreadBadgeLabel sizeToFit]; - - self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = self.missedNotifAndUnreadBadgeLabel.frame.size.width + 18; + self.badgeLabel.hidden = NO; + self.badgeLabel.badgeColor = roomCellData.highlightCount ? ThemeService.shared.theme.noticeColor : ThemeService.shared.theme.noticeSecondaryColor; + self.badgeLabel.text = roomCellData.notificationCountStringValue; } // Use bold font for the room title self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; } - else if (roomCellData.roomSummary.room.summary.membership == MXMembershipInvite) + else if (roomCellData.roomSummary.room.summary.membership == MXMembershipInvite + || roomCellData.roomSummary.room.sentStatus != MXRoomSentStatusOk) { - self.missedNotifAndUnreadBadgeBgView.hidden = NO; - self.missedNotifAndUnreadBadgeBgView.backgroundColor = ThemeService.shared.theme.noticeColor; - - self.missedNotifAndUnreadBadgeLabel.text = @"!"; - [self.missedNotifAndUnreadBadgeLabel sizeToFit]; - - self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = self.missedNotifAndUnreadBadgeLabel.frame.size.width + 18; - + self.badgeLabel.hidden = NO; + self.badgeLabel.badgeColor = ThemeService.shared.theme.noticeColor; + self.badgeLabel.text = @"!"; + // Use bold font for the room title self.roomTitle.font = self.roomTitle1.font = self.roomTitle2.font = [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; } diff --git a/Riot/Modules/Home/Views/RoomCollectionViewCell.xib b/Riot/Modules/Home/Views/RoomCollectionViewCell.xib index 45366f0ff..55bf49818 100644 --- a/Riot/Modules/Home/Views/RoomCollectionViewCell.xib +++ b/Riot/Modules/Home/Views/RoomCollectionViewCell.xib @@ -1,11 +1,9 @@ - - - - + + - + @@ -34,25 +32,12 @@ - + + + + + + + + + diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 48f7b5cd7..630552dff 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -4618,32 +4618,14 @@ NSNotificationName const RoomCallTileTappedNotification = @"RoomCallTileTappedNo -(BOOL)checkUnsentMessages { - BOOL hasUnsent = NO; - BOOL hasUnsentDueToUnknownDevices = NO; - + MXRoomSentStatus sentStatus = MXRoomSentStatusOk; if ([self.activitiesView isKindOfClass:RoomActivitiesView.class]) { - NSArray *outgoingMsgs = self.roomDataSource.room.outgoingMessages; - - for (MXEvent *event in outgoingMsgs) + sentStatus = self.roomDataSource.room.sentStatus; + + if (sentStatus != MXRoomSentStatusOk) { - if (event.sentState == MXEventSentStateFailed) - { - hasUnsent = YES; - - // Check if the error is due to unknown devices - if ([event.sentError.domain isEqualToString:MXEncryptingErrorDomain] - && event.sentError.code == MXEncryptingErrorUnknownDeviceCode) - { - hasUnsentDueToUnknownDevices = YES; - break; - } - } - } - - if (hasUnsent) - { - NSString *notification = hasUnsentDueToUnknownDevices ? + NSString *notification = sentStatus == MXRoomSentStatusSentFailedDueToUnknownDevices ? NSLocalizedStringFromTable(@"room_unsent_messages_unknown_devices_notification", @"Vector", nil) : NSLocalizedStringFromTable(@"room_unsent_messages_notification", @"Vector", nil); @@ -4713,7 +4695,7 @@ NSNotificationName const RoomCallTileTappedNotification = @"RoomCallTileTappedNo } } - return hasUnsent; + return sentStatus != MXRoomSentStatusOk; } - (void)eventDidChangeSentState:(NSNotification *)notif @@ -4851,19 +4833,32 @@ NSNotificationName const RoomCallTileTappedNotification = @"RoomCallTileTappedNo - (void)cancelAllUnsentMessages { - // Remove unsent event ids - for (NSUInteger index = 0; index < self.roomDataSource.room.outgoingMessages.count;) - { - MXEvent *event = self.roomDataSource.room.outgoingMessages[index]; - if (event.sentState == MXEventSentStateFailed) + currentAlert = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"room_unsent_messages_cancel_title", @"Vector", nil) message:NSLocalizedStringFromTable(@"room_unsent_messages_cancel_message", @"Vector", nil) preferredStyle:UIAlertControllerStyleAlert]; + + MXWeakify(self); + [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"] style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { + MXStrongifyAndReturnIfNil(self); + self->currentAlert = nil; + }]]; + + [currentAlert addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"delete"] style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) { + MXStrongifyAndReturnIfNil(self); + // Remove unsent event ids + for (NSUInteger index = 0; index < self.roomDataSource.room.outgoingMessages.count;) { - [self.roomDataSource removeEventWithEventId:event.eventId]; + MXEvent *event = self.roomDataSource.room.outgoingMessages[index]; + if (event.sentState == MXEventSentStateFailed) + { + [self.roomDataSource removeEventWithEventId:event.eventId]; + } + else + { + index ++; + } } - else - { - index ++; - } - } + }]]; + + [self presentViewController:currentAlert animated:YES completion:nil]; } # pragma mark - Encryption Information view diff --git a/Riot/Modules/Room/Views/Activities/RoomActivitiesView.h b/Riot/Modules/Room/Views/Activities/RoomActivitiesView.h index f28e47c44..54eb3feb7 100644 --- a/Riot/Modules/Room/Views/Activities/RoomActivitiesView.h +++ b/Riot/Modules/Room/Views/Activities/RoomActivitiesView.h @@ -30,6 +30,11 @@ @property (weak, nonatomic) IBOutlet NSLayoutConstraint *mainHeightConstraint; +@property (weak, nonatomic) IBOutlet UIView *unsentMessagesContentView; +@property (weak, nonatomic) IBOutlet UIButton *resendButton; +@property (weak, nonatomic) IBOutlet UIButton *deleteButton; +@property (weak, nonatomic) IBOutlet UILabel *unsentMessageLabel; + /** Notify that some messages are not sent. Replace the current notification if any. diff --git a/Riot/Modules/Room/Views/Activities/RoomActivitiesView.m b/Riot/Modules/Room/Views/Activities/RoomActivitiesView.m index b29435bb4..cacef67d6 100644 --- a/Riot/Modules/Room/Views/Activities/RoomActivitiesView.m +++ b/Riot/Modules/Room/Views/Activities/RoomActivitiesView.m @@ -118,64 +118,50 @@ { self.messageLabel.textColor = ThemeService.shared.theme.textSecondaryColor; } + + [self.resendButton.layer setCornerRadius:5]; + self.resendButton.clipsToBounds = YES; + [self.resendButton setTitle:NSLocalizedStringFromTable(@"room_event_action_resend", @"Vector", nil) forState:UIControlStateNormal]; + self.resendButton.backgroundColor = ThemeService.shared.theme.tintColor; + + UIImage *image = [[UIImage imageNamed:@"room_context_menu_delete"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + [self.deleteButton setImage:image forState:UIControlStateNormal]; + self.deleteButton.tintColor = ThemeService.shared.theme.warningColor; + + self.unsentMessageLabel.textColor = ThemeService.shared.theme.textPrimaryColor; } #pragma mark - +- (IBAction)onCancelSendingPressed:(id)sender +{ + void (^onCancelLinkPressed)(void) = objc_getAssociatedObject(self.deleteButton, "onCancelLinkPressed"); + if (onCancelLinkPressed) + { + onCancelLinkPressed (); + } +} + +- (IBAction)onResendMessagesPressed:(id)sender +{ + void (^onResendLinkPressed)(void) = objc_getAssociatedObject(self.resendButton, "onResendLinkPressed"); + if (onResendLinkPressed) + { + onResendLinkPressed(); + } +} + - (void)displayUnsentMessagesNotification:(NSString*)notification withResendLink:(void (^)(void))onResendLinkPressed andCancelLink:(void (^)(void))onCancelLinkPressed andIconTapGesture:(void (^)(void))onIconTapGesture { [self reset]; - + if (onResendLinkPressed && onCancelLinkPressed) { - NSString *resendLink = NSLocalizedStringFromTable(@"room_prompt_resend", @"Vector", nil); - NSString *cancelLink = NSLocalizedStringFromTable(@"room_prompt_cancel", @"Vector", nil); - - NSString *notif = [NSString stringWithFormat:notification, resendLink, cancelLink]; - NSMutableAttributedString *tappableNotif = [[NSMutableAttributedString alloc] initWithString:notif]; + self.unsentMessagesContentView.hidden = NO; + self.unsentMessageLabel.text = notification; - objc_setAssociatedObject(self.messageTextView, "onResendLinkPressed", [onResendLinkPressed copy], OBJC_ASSOCIATION_RETAIN_NONATOMIC); - objc_setAssociatedObject(self.messageTextView, "onCancelLinkPressed", [onCancelLinkPressed copy], OBJC_ASSOCIATION_RETAIN_NONATOMIC); - - NSRange range = [notif rangeOfString:resendLink]; - [tappableNotif addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:range]; - [tappableNotif addAttribute:NSLinkAttributeName value:@"onResendLink" range:range]; - - range = [notif rangeOfString:cancelLink]; - [tappableNotif addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:range]; - [tappableNotif addAttribute:NSLinkAttributeName value:@"onCancelLink" range:range]; - - NSRange wholeString = NSMakeRange(0, tappableNotif.length); - [tappableNotif addAttribute:NSForegroundColorAttributeName value:ThemeService.shared.theme.warningColor range:wholeString]; - [tappableNotif addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:wholeString]; - - self.messageTextView.attributedText = tappableNotif; - self.messageTextView.tintColor = ThemeService.shared.theme.warningColor; - self.messageTextView.hidden = NO; - self.messageTextView.backgroundColor = [UIColor clearColor]; - } - else - { - self.messageLabel.text = notification; - self.messageLabel.textColor = ThemeService.shared.theme.warningColor; - self.messageLabel.hidden = NO; - } - - self.iconImageView.image = [UIImage imageNamed:@"error"]; - self.iconImageView.tintColor = ThemeService.shared.theme.tintColor; - self.iconImageView.hidden = NO; - - if (onIconTapGesture) - { - objc_setAssociatedObject(self.iconImageView, "onIconTapGesture", [onIconTapGesture copy], OBJC_ASSOCIATION_RETAIN_NONATOMIC); - - // Listen to icon tap - UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onIconTap:)]; - [tapGesture setNumberOfTouchesRequired:1]; - [tapGesture setNumberOfTapsRequired:1]; - [tapGesture setDelegate:self]; - [self.iconImageView addGestureRecognizer:tapGesture]; - self.iconImageView.userInteractionEnabled = YES; + objc_setAssociatedObject(self.resendButton, "onResendLinkPressed", [onResendLinkPressed copy], OBJC_ASSOCIATION_RETAIN_NONATOMIC); + objc_setAssociatedObject(self.deleteButton, "onCancelLinkPressed", [onCancelLinkPressed copy], OBJC_ASSOCIATION_RETAIN_NONATOMIC); } [self checkHeight:YES]; @@ -517,6 +503,7 @@ - (void)reset { self.separatorView.hidden = NO; + self.unsentMessagesContentView.hidden = YES; self.backgroundColor = UIColor.clearColor; diff --git a/Riot/Modules/Room/Views/Activities/RoomActivitiesView.xib b/Riot/Modules/Room/Views/Activities/RoomActivitiesView.xib index b7286bd60..3d4afd9be 100644 --- a/Riot/Modules/Room/Views/Activities/RoomActivitiesView.xib +++ b/Riot/Modules/Room/Views/Activities/RoomActivitiesView.xib @@ -1,11 +1,10 @@ - - - - + + - + + @@ -56,16 +55,71 @@ + + + + + @@ -87,15 +141,26 @@ + + + + + - + + + + + + +