Update party invite notification and party invite strings

This commit is contained in:
Hafiz 2023-03-14 15:54:53 -04:00 committed by Phillip Thelen
parent 170c583076
commit 546a765cb1
23 changed files with 68 additions and 60 deletions

View file

@ -773,7 +773,7 @@
<string name="new_msg_party">Tu grupo, <b>%1$s</b>, tiene nuevos mensajes</string>
<string name="unallocated_stats_points">Tienes <b>%1$s puntos de atributo sin asignar</b></string>
<string name="new_subscriber_item">Tienes un nuevo <b>Objeto Misterioso</b></string>
<string name="invited_to_party_notification">Fuiste invitado a unirte al grupo <b>%1$s</b></string>
<string name="invited_to_party_notification">%1$s fuiste invitado a unirte al grupo <b>%2$s</b></string>
<string name="invited_to_private_guild">Fuiste invitado a ser parte del gremio privado <b>%1$s</b></string>
<string name="invited_to_public_guild">Fuiste invitado a ser parte del gremio <b>%1$s</b></string>
<string name="invited_to_quest">Fuiste invitado a participar de la misión <b>%1$s</b></string>

View file

@ -643,7 +643,7 @@
<string name="new_msg_party"><![CDATA[Има нови публикации в групата Ви — <b>%1$s</b>]]></string>
<string name="unallocated_stats_points"><![CDATA[Имате <b>%1$s неразпределени показателни точки</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Имате нов <b>тайнствен предмет</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[Получихте покана за присъединяване към групата <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> Получихте покана за присъединяване към групата <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Получихте покана за присъединяване към частната гилдия <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Получихте покана за присъединяване към гилдията <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Получихте покана за присъединяване в мисията <b>%1$s</b>]]></string>

View file

@ -654,7 +654,7 @@ Die Quest-Schriftrolle wird an den Quest-Besitzer zurückgegeben.</string>
<string name="new_msg_party"><![CDATA[Deine Gruppe, <b>%1$s</b>, hat neue Beiträge]]></string>
<string name="unallocated_stats_points"><![CDATA[Du kannst <b>%1$s Attributpunkt(e)</b> verteilen]]></string>
<string name="new_subscriber_item"><![CDATA[Du hast einen neuen <b>Überraschungsgegenstand</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[Du wurdest zu der Gruppe <b>%1$s</b> eingeladen]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> du wurdest zu der Gruppe <b>%2$s</b> eingeladen]]></string>
<string name="invited_to_private_guild">Du wurdest eingeladen, der privaten Gilde <b>%1$s</b> beizutreten</string>
<string name="invited_to_public_guild">Du wurdest eingeladen, der Gilde <b>%1$s</b> beizutreten</string>
<string name="invited_to_quest"><![CDATA[Du wurdest zur Quest <b>%1$s</b> eingeladen]]></string>

View file

@ -653,7 +653,7 @@
<string name="new_msg_party"><![CDATA[Your Party, <b>%1$s</b>, has new posts]]></string>
<string name="unallocated_stats_points"><![CDATA[You have <b>%1$s unallocated Stat Points</b>]]></string>
<string name="new_subscriber_item"><![CDATA[You have new <b>Mystery Items</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[You were invited to join the Party <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> has invited you to join the party <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[You were invited to join the private Guild <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[You were invited to join the Guild <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[You were invited to the Quest <b>%1$s</b>]]></string>

View file

@ -653,7 +653,7 @@
<string name="new_msg_party"><![CDATA[Tu Equipo, <b>%1$s</b>, tiene nuevos mensajes]]></string>
<string name="unallocated_stats_points"><![CDATA[Tienes <b>%1$s Puntos de Estadísticas sin asignar</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Tienes <b>Objetos Misteriosos</b> nuevos]]></string>
<string name="invited_to_party_notification"><![CDATA[Has sido invitado a unirte al Equipo <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<![CDATA[<font color=#925CF3>%1$s</font> has sido invitado a unirte al Equipo <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Has sido invitado a unirte al Gremio privado <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Has sido invitado a unirte al Gremio <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Has sido invitado a la misión <b>%1$s</b>]]></string>

View file

@ -652,7 +652,7 @@
<string name="new_msg_party"><![CDATA[Votre équipe, <b>%1$s</b>, a de nouveaux messages]]></string>
<string name="unallocated_stats_points"><![CDATA[Vous avez <b>%1$s points d\'attribut non alloués</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Vous avez de nouveaux <b>objets mystère</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[Vous avez reçu une invitation à rejoindre l\'équipe <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<![CDATA[<font color=#925CF3>%1$s</font> vous avez reçu une invitation à rejoindre l\'équipe <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Vous avez reçu une invitation à rejoindre la guilde privée <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Vous avez reçu une invitation à rejoindre la guilde <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[On vous invite à rejoindre la quête <b>%1$s</b>]]></string>

View file

@ -677,7 +677,7 @@
<string name="years">Godina</string>
<string name="x_class">%s Klasa</string>
<string name="discard_changes_to_task_message">Jesi li siguran/la da želiš odbaciti promjene ovom zadatku\?</string>
<string name="invited_to_party_notification">Pozvan/a si da se pridružiš Družini <b>%1$s</b></string>
<string name="invited_to_party_notification">%1$s Pozvan/a si da se pridružiš Družini <b>%2$s</b></string>
<string name="month_reminder_title">Trebaš li promjenu svakodnevnice\?</string>
<string name="become_x">Postani %s</string>
<string name="no_notifications_text">Vile obavijesti ti daju prodornu rundu pljeska! Svaka čast!</string>

View file

@ -733,7 +733,7 @@
<string name="invited_to_quest">Kamu telah diundang untuk melaksanakan Misi <b>%1$s</b></string>
<string name="invited_to_public_guild">Kamu telah diundang untuk bergabung dengan Guild <b>%1$s</b></string>
<string name="invited_to_private_guild">Kamu telah diundang untuk bergabung dengan Guild pribadi <b>%1$s</b></string>
<string name="invited_to_party_notification">Kamu telah diundang untuk bergabung dengan Party <b>%1$s</b></string>
<string name="invited_to_party_notification">%1$s Kamu telah diundang untuk bergabung dengan Party <b>%2$s</b></string>
<string name="new_subscriber_item">Kamu memiliki <b>Item Misteri</b> baru</string>
<string name="unallocated_stats_points">Kamu memiliki <b>%1$s Poin Stat yang belum dialokasikan</b></string>
<string name="new_msg_party">Party-mu, <b>%1$s</b>, ada postingan baru</string>

View file

@ -643,7 +643,7 @@
<string name="new_msg_party"><![CDATA[La tua squadra, <b>%1$s</b>, ha nuovi messaggi]]></string>
<string name="unallocated_stats_points"><![CDATA[Hai <b>%1$s Punti Statistica non allocati</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Hai dei nuovi <b>Oggetti Misteriosi</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[Hai ricevuto un invito per unirti alla Squadra <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> hai ricevuto un invito per unirti alla Squadra <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Hai ricevuto un invito per unirti alla Gilda privata <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Hai ricevuto un invito per unirti alla Gilda <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Hai ricevuto un invito per la missione <b>%1$s</b>]]></string>

View file

@ -652,7 +652,7 @@
<string name="new_msg_party">あなたのパーティー、<b>%1$s</b>に新しい投稿があります</string>
<string name="unallocated_stats_points"><![CDATA[<b>%1$sポイントが割り当てできます。</b>]]></string>
<string name="new_subscriber_item">新しい<b>ミステリーアイテム</b></string>
<string name="invited_to_party_notification">パーティー「<b>%1$s</b>」に招待されました</string>
<string name="invited_to_party_notification">パーティー「<b>%1$s</b>」に招待されました %2$s</string>
<string name="invited_to_private_guild">プライベートギルド「<b>%1$s</b>」に招待されました</string>
<string name="invited_to_public_guild"><b>%1$s</b>」ギルドに招待されました</string>
<string name="invited_to_quest"><b>%1$s</b>クエストに招待されました</string>

View file

@ -715,7 +715,7 @@
<string name="invited_to_quest"><b>%1$s</b> 퀘스트에 초대되었습니다</string>
<string name="invited_to_public_guild"><b>%1$s</b> 길드에 초대되었습니다</string>
<string name="invited_to_private_guild"><b>%1$s</b> 비공개 길드에 초대되었습니다</string>
<string name="invited_to_party_notification"><b>%1$s</b> 파티에 초대되었습니다</string>
<string name="invited_to_party_notification"><b>%1$s</b> 파티에 초대되었습니다 %2$s</string>
<string name="new_subscriber_item">"새로운 "<b>미스터리 아이템</b>이 있습니다</string>
<string name="unallocated_stats_points"><b>%1$s 개의 배분되지 않은 능력치 포인트</b>가 있습니다</string>
<string name="new_msg_party"><b>%1$s</b> 파티창에 새로운 글이 올라왔습니다</string>

View file

@ -628,7 +628,7 @@
<string name="new_msg_party"><![CDATA[Je Gezelschap, <b>%1$s</b>, heeft nieuwe berichten]]></string>
<string name="unallocated_stats_points"><![CDATA[Je hebt <b>%1$s niet toegekende statuspunten</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Je hebt nieuwe <b>Mysterieuze items</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[Je werd uitgenodigd om je aan te sluiten bij de Groep <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> je werd uitgenodigd om je aan te sluiten bij de Groep <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Je werd uitgenodigd om je aan te sluiten bij het Gilde <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Je werd uitgenodigd om je aan te sluiten bij de Gilde <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Je bent uitgenodigd voor de Queeste <b>%1$s</b>]]></string>

View file

@ -585,7 +585,7 @@
<string name="new_msg_party"><![CDATA[Twoja drużyna <b>%1$s</b> ma nowe posty]]></string>
<string name="unallocated_stats_points"><![CDATA[Masz <b>nieprzydzielone Punkty Atrybutów: %1$s</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Masz nowy <b>Tajemniczy Przedmiot</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[Zostałeś/aś zaproszony/a do Dryżyny <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> zostałeś/aś zaproszony/a do Dryżyny <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Zostałeś/aś zaproszony/a do prywatnej Gildii <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Zostałeś/aś zaproszony/a do Gildii <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Zostałeś/aś zaproszony/a do Misji <b>%1$s</b>]]></string>

View file

@ -651,7 +651,7 @@
<string name="new_msg_party">Seu Grupo, <b>%1$s</b>, tem novas publicações</string>
<string name="unallocated_stats_points"><![CDATA[Você tem <b>%1$s</b> Pontos de Atributos não distribuidos]]></string>
<string name="new_subscriber_item">Você possui novos <b>Itens Misteriosos</b></string>
<string name="invited_to_party_notification"><![CDATA[Você foi convidado para entrar em um Grupo <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> Você foi convidado para entrar em um Grupo <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Você foi convidado para entrar em uma Guilda privada <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Você foi convidado para entrar em uma Guilda <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Você foi convidado para a Missão <b>%1$s</b>]]></string>

View file

@ -375,7 +375,7 @@
<string name="new_msg_party"><![CDATA[A sua Equipa, <b>%1$s</b>, tem novas mensagens]]></string>
<string name="unallocated_stats_points"><![CDATA[Tens <b>%1$s Ponto(s) de Atributo por alocar</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Você tem <b>Items Mistério</b> novos]]></string>
<string name="invited_to_party_notification"><![CDATA[Foi convidado a juntar-se à Equipa <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> foi convidado a juntar-se à Equipa <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Foi convidado a juntar-se à Guilda privada <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Foi convidado a juntar-se à Guilda <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Foste convidado para a Missão <b>%1$s</b>]]></string>

View file

@ -651,7 +651,7 @@
<string name="new_msg_party"><![CDATA[В команде <b>%1$s</b> есть новые сообщения]]></string>
<string name="unallocated_stats_points"><![CDATA[Вы не распределили <b>%1$s очков</b>]]></string>
<string name="new_subscriber_item"><![CDATA[У вас новый <b>Таинственный предмет</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[Вас пригласили в команду <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> Вас пригласили в команду <b>%2$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[Вас пригласили присоединиться к частной гильдии <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[Вас пригласили в гильдию <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[Вас пригласили на квест <b>%1$s</b>]]></string>

View file

@ -652,7 +652,7 @@
<string name="new_msg_party"><![CDATA[<b>%1$s</b> adlı Takımında yeni mesajlar var]]></string>
<string name="unallocated_stats_points"><![CDATA[<b>%1$s adet dağıtılmamış Nitelik Puanın var.</b>]]></string>
<string name="new_subscriber_item"><![CDATA[Yeni <b>Gizemli Eşyaların</b> var]]></string>
<string name="invited_to_party_notification"><![CDATA[<b>%1$s</b> Takımına davet edildin]]></string>
<string name="invited_to_party_notification"><![CDATA[<b>%2$s</b> Takımına davet edildin <font color=#925CF3>%1$s</font>]]></string>
<string name="invited_to_private_guild"><![CDATA[<b>%1$s</b> adlı özel Loncaya davet edildin]]></string>
<string name="invited_to_public_guild"><![CDATA[<b>%1$s</b> adlı Loncaya davet edildin]]></string>
<string name="invited_to_quest"><![CDATA[<b>%1$s</b> Görevine davet edildin]]></string>

View file

@ -1007,7 +1007,7 @@
<string name="invited_to_public_guild">Вас запросили в гільдію <b>%1$s</b></string>
<string name="invited_to_quest">Вас запросили на квест <b>%1$s</b></string>
<string name="invited_to_private_guild">Вас запросили приєднатися до приватної гільдії <b>%1$s</b></string>
<string name="invited_to_party_notification">Вас запросили до команди <b>%1$s</b></string>
<string name="invited_to_party_notification">%1$s Вас запросили до команди <b>%2$s</b></string>
<string name="gift_confirmation_text_sub_g1g1">Ви відправили %s %s-місячну підписку Habitica. Ця ж підписка була застосована до вашого облікового запису, завдяки участі в акції «Подаруйте підписку, отримайте підписку»!</string>
<string name="gift_subscription_subtitle">Виберіть підписку, яку хочете подарувати внизу! Ця покупка не буде продовжена автоматично.</string>
<string name="gift_one_get_one_detailed_description">Допоки ця акція активна, ви отримуєте відповідну підписку автоматично після відправки подарунка.</string>

View file

@ -682,7 +682,7 @@
<string name="invited_to_quest">Bạn đã được mời tham gia vào Nhiệm vụ <b>%1$s</b></string>
<string name="invited_to_public_guild">Bạn đã được mời tham gia vào Bang hội <b>%1$s</b></string>
<string name="invited_to_private_guild">Bạn đã được mời tham gia vào Bang hội kín <b>%1$s</b></string>
<string name="invited_to_party_notification">Bạn đã được mời tham gia vào Tổ đội <b>%1$s</b></string>
<string name="invited_to_party_notification">%1$s bạn đã được mời tham gia vào Tổ đội <b>%2$s</b></string>
<string name="new_subscriber_item">Bạn có <b>Vật phẩm Bí ẩn</b> mới</string>
<string name="unallocated_stats_points">Bạn có <b>%1$s Điểm Chỉ số chưa phân bổ</b></string>
<string name="new_msg_party">Tổ đội của bạn, <b>%1$s</b>, có bài viết mới</string>

View file

@ -651,7 +651,7 @@
<string name="new_msg_party"><![CDATA[您的隊伍<b>%1$s</b>有新的貼文]]></string>
<string name="unallocated_stats_points"><![CDATA[你有<b>%1$s點未分配屬性點</b>]]></string>
<string name="new_subscriber_item"><![CDATA[您有新的<b>神秘裝備</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[您受邀加入<b>%1$s</b>隊伍]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> 您受邀加入<b>%2$s</b>隊伍]]></string>
<string name="invited_to_private_guild"><![CDATA[您受邀加入<b>%1$s</b>私人公會]]></string>
<string name="invited_to_public_guild"><![CDATA[您受邀加入<b>%1$s</b>您受邀加入]]></string>
<string name="invited_to_quest"><![CDATA[您受邀加入<b>%1$s</b>副本]]></string>

View file

@ -652,7 +652,7 @@
<string name="new_msg_party"><![CDATA[您的队伍 <b>%1$s</b> 有新消息]]></string>
<string name="unallocated_stats_points"><![CDATA[你有<b>%1$s没分配的属性点</b>]]></string>
<string name="new_subscriber_item"><![CDATA[你有新的<b>神秘物品</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[你被邀请加入队伍<b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%1$s</font> 你被邀请加入队伍<b>%2$s</b>]]></string>
<string name="invited_to_private_guild">您收到邀请加入一个私人公会<b>%1$s</b></string>
<string name="invited_to_public_guild">您收到了加入公会的邀请<b>%1$s</b></string>
<string name="invited_to_quest">你被邀请加入副本<b>%1$s</b></string>

View file

@ -764,7 +764,7 @@
<string name="new_msg_party"><![CDATA[Your Party, <b>%1$s</b>, has new posts]]></string>
<string name="unallocated_stats_points"><![CDATA[You have <b>%1$s unallocated Stat Points</b>]]></string>
<string name="new_subscriber_item"><![CDATA[You have new <b>Mystery Items</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[You were invited to join the Party <b>%1$s</b>]]></string>
<string name="invited_to_party_notification"><![CDATA[<font color=#925CF3>%2$s</font> has invited you to join the party <b>%1$s</b>]]></string>
<string name="invited_to_private_guild"><![CDATA[You were invited to join the private Guild <b>%1$s</b>]]></string>
<string name="invited_to_public_guild"><![CDATA[You were invited to join the Guild <b>%1$s</b>]]></string>
<string name="invited_to_quest"><![CDATA[You were invited to the Quest <b>%1$s</b>]]></string>

View file

@ -15,6 +15,7 @@ import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import com.habitrpg.android.habitica.R
import com.habitrpg.android.habitica.components.UserComponent
import com.habitrpg.android.habitica.data.InventoryRepository
import com.habitrpg.android.habitica.data.SocialRepository
import com.habitrpg.android.habitica.databinding.ActivityNotificationsBinding
@ -39,6 +40,7 @@ import com.habitrpg.common.habitica.views.PixelArtView
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import javax.inject.Inject
@AndroidEntryPoint
@ -80,6 +82,10 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
binding.notificationsRefreshLayout.setOnRefreshListener(this)
}
override fun injectActivity(component: UserComponent?) {
component?.inject(this)
}
override fun onSupportNavigateUp(): Boolean {
if (supportFragmentManager.backStackEntryCount > 0) {
onBackPressed()
@ -122,39 +128,29 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
createNotificationsHeaderView(notifications.count())
)
//Currently retrieving the inviters username by user's id
lifecycleScope.launch(ExceptionHandler.coroutine()) {
notifications.filter { it.type == Notification.Type.PARTY_INVITATION.type }.forEach {
val item = createPartyInvitationNotification(it)
val inviteView = binding.notificationItems.findViewWithTag<View>(it.id)
if (item != null && inviteView == null) {
item.tag = it.id
notifications.map {
val item: View? = when (it.type) {
Notification.Type.NEW_CHAT_MESSAGE.type -> createNewChatMessageNotification(it)
Notification.Type.NEW_STUFF.type -> createNewStuffNotification(it)
Notification.Type.UNALLOCATED_STATS_POINTS.type -> createUnallocatedStatsNotification(it)
Notification.Type.NEW_MYSTERY_ITEMS.type -> createMysteryItemsNotification(it)
Notification.Type.GROUP_TASK_NEEDS_WORK.type -> createGroupTaskNeedsWorkNotification(it)
Notification.Type.GROUP_TASK_APPROVED.type -> createGroupTaskApprovedNotification(it)
Notification.Type.GROUP_TASK_REQUIRES_APPROVAL.type -> createGroupTaskNeedsApprovalNotification(it)
Notification.Type.PARTY_INVITATION.type -> createPartyInvitationNotification(it)
Notification.Type.GUILD_INVITATION.type -> createGuildInvitationNotification(it)
Notification.Type.QUEST_INVITATION.type -> createQuestInvitationNotification(it)
Notification.Type.ITEM_RECEIVED.type -> createItemReceivedNotification(it)
else -> null
}
if (item != null) {
binding.notificationItems.addView(item)
}
}
}
notifications.map {
val item: View? = when (it.type) {
Notification.Type.NEW_CHAT_MESSAGE.type -> createNewChatMessageNotification(it)
Notification.Type.NEW_STUFF.type -> createNewStuffNotification(it)
Notification.Type.UNALLOCATED_STATS_POINTS.type -> createUnallocatedStatsNotification(it)
Notification.Type.NEW_MYSTERY_ITEMS.type -> createMysteryItemsNotification(it)
Notification.Type.GROUP_TASK_NEEDS_WORK.type -> createGroupTaskNeedsWorkNotification(it)
Notification.Type.GROUP_TASK_APPROVED.type -> createGroupTaskApprovedNotification(it)
Notification.Type.GROUP_TASK_REQUIRES_APPROVAL.type -> createGroupTaskNeedsApprovalNotification(it)
Notification.Type.GUILD_INVITATION.type -> createGuildInvitationNotification(it)
Notification.Type.QUEST_INVITATION.type -> createQuestInvitationNotification(it)
Notification.Type.ITEM_RECEIVED.type -> createItemReceivedNotification(it)
else -> null
}
if (item != null) {
binding.notificationItems.addView(item)
}
}
}
private fun createNotificationsHeaderView(notificationCount: Int): View? {
@ -312,14 +308,21 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
return item
}
private suspend fun createPartyInvitationNotification(notification: Notification): View? = withContext(ExceptionHandler.coroutine()) {
val data = notification.data as? PartyInvitationData
return createActionableNotificationItem(
notification,
fromHtml(getString(R.string.invited_to_party_notification, data?.invitation?.name))
)
val inviterId = data?.invitation?.inviter
if (inviterId != null) {
val inviter = socialRepository.retrieveMember(inviterId, fromHall = false)
return@withContext createActionableNotificationItem(
notification,
fromHtml(getString(R.string.invited_to_party_notification, data.invitation?.name, inviter?.formattedUsername)),
openable = true,
inviterId
)
} else {
return@withContext null
}
}
private fun createGuildInvitationNotification(notification: Notification): View? {
@ -384,17 +387,22 @@ class NotificationsActivity : BaseActivity(), androidx.swiperefreshlayout.widget
private fun createActionableNotificationItem(
notification: Notification,
messageText: CharSequence,
openable: Boolean = false
openable: Boolean = false,
inviterId: String? = null
): View? {
val item = inflater?.inflate(R.layout.notification_item_actionable, binding.notificationItems, false)
if (openable) {
val container = item?.findViewById(R.id.notification_item) as? View
container?.setOnClickListener {
val resultIntent = Intent()
resultIntent.putExtra("notificationId", notification.id)
setResult(Activity.RESULT_OK, resultIntent)
finish()
if (inviterId != null) {
FullProfileActivity.open(inviterId)
} else {
val resultIntent = Intent()
resultIntent.putExtra("notificationId", notification.id)
setResult(Activity.RESULT_OK, resultIntent)
finish()
}
}
}