From 77cc29d85ce36cefe684adf013fa3499f576a014 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Sat, 24 Oct 2020 14:50:52 -0400 Subject: [PATCH 1/5] New Crowdin updates (#240) * New translations strings.xml (Hindi) * New translations strings.xml (Hindi) * New translations strings.xml (Hindi) * New translations strings.xml (Hindi) * New translations strings.xml (Hindi) --- app/src/main/res/values-hi/strings.xml | 42 +++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 7a9af317..57756ccf 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -213,27 +213,27 @@ अनुयायी फ़ॉलो कर रहे हैं फलोअर्स & फलोइंग के तुलना - Both following each other - not following %s - %s is not following - Error loading cookies - Successfully loaded cookies!\nIf you still can\'t open private pages/posts, re-login! - Write a new comment... - Write a new message... - Liked your post - Commented on your post: - Started following you - Mentioned you: - Requested following you - Approve request - Reject request - Share this public post to... - This is a private post! Share to those who can view them! - This category is somehow empty... - An update is available! (%s) - Reminder: If you downloaded from F-Droid, you must update from it! Same applies for GitHub. - Thank you for updating Barinsta! - App crashed + एक दुसरे को फोलो कर रहें हैं + फोलो नहीं कर रहा %s + %s फोलो नहीं कर रहा है + कुकीज लोड करने में त्रुटि + कुकीज सफलतापूर्बक लोड हुआ!\nअगर आप अभी तक गोपन पेज या पोस्ट खुल नहीं पा रहे हैं, फिर से लग इन करें! + नया कमेंट करें... + एक नया संदेश लिखो... + आपकी पोस्ट को पसंद किया + आपके पोस्ट पर कमेंट किया है: + आपको फॉलो करना शुरू किया + आपका उल्लेख किया: + आपको फॉलो करने का निवेदन किया + निवेदन को ग्रहण करें + अनुरोध प्रत्याख्यान करें + इसी सार्वजनिक पोस्ट को भेजें... + यह एक गुप्त पोस्ट है! उन लोगों को बांटना जो उन्हें देख सकते हैं! + यह वर्ग रिक्त है... + नया अद्यतन उपलब्ध! (%s) + याद रखें: अगर आप f-droid से डाउनलोड किया है तो उसी से ही अपडेट करें! Github के लिये भी बही। + बारइनष्टा को अद्दतन करने के लिए धन्यबाद! + एप में त्रुटि हुयी। Oops.. the app crashed, but don\'t worry you can send error report to the developer to help him fix the issue. (: Use AMOLED mode for Dark theme Activity From 044db1827e0001ed052b21d0057de136e7284b23 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 2 Nov 2020 11:47:41 -0500 Subject: [PATCH 2/5] Update CONTRIBUTING.md --- .github/CONTRIBUTING.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7c462f88..e79bfef8 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,7 +1,8 @@ ## WARNING * All forks must respect [GPLv3](https://www.gnu.org/licenses/gpl-3.0.html). Please report violations in Issues or [confidentially](https://austinhuang.me/#hey-you-look-cool). -* Although publishing a fork is allowed by license, it is strongly discouraged to do so as it divides the effort and creates confusion. It is, therefore, recommended to send a pull request back to us, so that the larger community can enjoy your improvement. (This does not apply if you're adapting this app for a different platform other than Instagram.) + * Some people have asked me about publishing a "commercial" fork that serves ads. However, if you do properly comply with GPLv3, users would realize that the original non-commercial version exists and, in turn, abandon your fork. And if you don't comply, you get copystriked. +* Although publishing a fork is allowed by license, it is strongly discouraged to do so as it divides the effort and creates confusion (as well as for the reason above). It is, therefore, recommended to send a pull request back to us, so that the larger community can enjoy your improvement. (This does not apply if you're adapting this app for a different platform other than Instagram.) ## Contributing @@ -35,11 +36,11 @@ If you have questions, don't be afraid to ask for help from any current maintain ## I found a bug! -**Please read [FAQ](https://instagrabber.austinhuang.me/faq) first.** +**Please read [FAQ](https://barinsta.austinhuang.me/en/latest/faq/) first.** Bugs are inevitable during active development, as nobody can cover all the possible test cases. -You can either email your crash dump to `instagrabber@austinhuang.me` (The crash reporter will fill in this address for you) or create a GitHub issue. If you're on GitHub, please follow the template. If you're reporting by email, your email address will be published in the GitHub issue. You can contact me [privately](https://austinhuang.me/#hey-you-look-cool) or [through support channels](https://instagrabber.austinhuang.me/#what-can-i-do) to remove it. +You can either email your crash dump to `barinsta@austinhuang.me` (The crash reporter will fill in this address for you) or create a GitHub issue. If you're on GitHub, please follow the template. If you're reporting by email, your email address will be published in the GitHub issue. You can contact me [privately](https://austinhuang.me/#hey-you-look-cool) or [through support channels](https://barinsta.austinhuang.me/en/latest/#contact-us) to remove it. Generally, reporting bugs directly in support channels is not recommended, as they can be difficult to find. From 439c3009d5feb433cea56980cd8fe11a7fa979ac Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 2 Nov 2020 11:59:36 -0500 Subject: [PATCH 3/5] New Crowdin updates (#248) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Portuguese, Brazilian) * New translations strings.xml (Portuguese, Brazilian) * New translations arrays.xml (Persian) --- app/src/main/res/values-fa/arrays.xml | 4 +- app/src/main/res/values-pt/strings.xml | 68 +++++++++++++------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/app/src/main/res/values-fa/arrays.xml b/app/src/main/res/values-fa/arrays.xml index 39446032..a2704ef4 100644 --- a/app/src/main/res/values-fa/arrays.xml +++ b/app/src/main/res/values-fa/arrays.xml @@ -1,7 +1,7 @@ - پیش فرض سیستم + پیشگزیده سامانه انگلیسی فرانسوی [ با سپاس از kernoeb@ ] اسپانیایی [ با سپاس از sguinetti@ ] @@ -32,7 +32,7 @@ خودکار / پیروی از سیستم خودکار / پیروی از باتری - تاریک + تیره روشن diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 1230a744..4869eb54 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -6,9 +6,9 @@ Baixar Pesquisar nome de usuário… Comparar - like - likes - Erro ao copiar texto + curtida + curtidas + Falha ao copiar texto Copiado para a área de transferência! Reportar Senha (máx. 32 caracteres) @@ -31,15 +31,15 @@ Histórico de atualizações Mostrar barra de ferramentas na parte inferior Verificar se há atualizações ao iniciar - Baixar postagens para pastas com o nome de usuário - Carregar automaticamente todas as postagens do usuário + Baixar publicações para pastas com o nome de usuário + Carregar automaticamente todas as publicações do usuário Marcar stories como vistos após a visualização O autor do story saberá que você viu Marcar DM como vista após a visualização Outros membros saberão que você viu Ativar notificações de atividade - Erro ao carregar o perfil!\nTente fazer login e pesquise novamente. - Erro ao criar pasta(s) de download. + Falha ao carregar o perfil!\nTente fazer login e pesquisar novamente. + Falha ao criar pasta(s) de download. Mostrar feed do usuário (funciona apenas quando o usuário está logado) Salvar em pasta personalizada Selecione uma pasta @@ -53,25 +53,25 @@ Importar/Exportar Idioma O que fazer? - %s\n Postagens - %s Postagens + %s\nPublicações + %s Publicações %s\nSeguidores %s\nSeguindo - Postagem de vídeo - Postagem de imagem + Publicação de vídeo + Publicação de imagem Reprodução automática de vídeos Sempre silenciar vídeos %s - %s - Nota: A [Sessão] atual não mostrará esta caixa de diálogo até que você esteja aqui e sempre fará o download do slide de postagem mostrado. + Obs: A [Sessão] atual não mostrará esta mensagem até que você esteja aqui e sempre baixará o slide de publicação mostrado. Selecione o que baixar [Sessão] Atual Atual Álbum inteiro Mostrar stories Sem mais stories! - Seja paciente! - Ver postagem - Ver postagem + Tenha paciência! + Ver Publicação + Ver Publicação Spotify Não é possível interagir se você não estiver logado! Votar @@ -79,7 +79,7 @@ Você já votou! Responder Responder... - Resposta bem-sucedida! + Resposta enviada! Responder o story Responder... Quiz @@ -89,8 +89,8 @@ Você não será capaz de acessar as publicações após deixar de seguir! Tem certeza? Você pode fazer login em Mais -> Conta no canto inferior direito ou você pode ver as contas públicas sem fazer login! Você pode deslizar para a esquerda/direita para explorar/feed ou pesquisar algo abaixo! - Esta conta não tem postagens - Não há essas postagens! + Esta conta não tem publicações + Não há publicações! Versão atual: v%s ler mais… Logar @@ -167,7 +167,7 @@ Descurtir mensagem Cancelar envio Ver perfil do autor - Postagem compartilhada de %s + Publicação compartilhada de %s Tipo de mídia desconhecido Mídia expirada! Entregue @@ -185,19 +185,19 @@ Expulsar Usuários que saíram Baixar diretamente - Baixar as postagens diretamente no telefone! - Buscando postagem(s) + Baixar as publicações diretamente no telefone! + Buscando publicação(ões) Por favor, conceda as permissões e tente baixar novamente! Download iniciado Download concluído - Baixando postagem + Baixando publicação Baixando mídia Baixando foto do perfil Arquivo baixado na pasta Downloads! Ocorreu um erro desconhecido!!! - Erro ao criar pasta! - Erro ao baixar o arquivo - Você só pode baixar 100 postagens por vez. Não seja tão ganancioso! + Falha ao criar pasta! + Falha ao baixar arquivo + Você só pode baixar 100 publicações por vez. Não seja tão ganancioso! Copiar nome de usuário Copiar comentário Responder comentário @@ -214,19 +214,19 @@ Ambos se seguem não segue %s %s não segue - Erro ao carregar cookies - Cookies carregados com sucesso!\nSe você ainda não consegue abrir páginas/postagens privadas, faça o login novamente! + Falha ao carregar cookies + Cookies carregados com sucesso!\nSe você ainda não consegue abrir páginas/publicações privadas, faça o login novamente! Escrever um novo comentário... Escrever uma nova mensagem... - Curtiu sua postagem - Comentou em sua postagem: + Curtiu sua publicação + Comentou em sua publicação: Começou a seguir você Mencionou você: Pediu para seguir você Aprovar pedido Rejeitar pedido - Compartilhar esta postagem pública com... - Esta é uma postagem privada! Compartilhe com quem pode visualizá-la! + Compartilhar esta publicação pública com... + Esta é uma publicação privada! Compartilhe com quem pode visualizá-la! Esta categoria está vazia... Uma atualização está disponível! (%s) Lembrete: se você baixou do F-Droid, você deve atualizar a partir dele! O mesmo se aplica ao GitHub. @@ -242,7 +242,7 @@ %d comentários %d comentários curtidos %d marcações - %d likes + %d curtidas Você deslogou antes de clicar nessa notificação?! Feed Perfil @@ -287,10 +287,10 @@ Localizações Desconhecido Removido dos Favoritos - Backup & Restauração + Becape & Restauração Criar Restaurar Arquivo: Digite a senha - Selecione um arquivo de backup (.zaai/.backup) + Selecione um arquivo de becape (.zaai/.backup) From 92f7e04757747bc0c6f7602904bc26adcf2282b5 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 2 Nov 2020 17:09:35 -0500 Subject: [PATCH 4/5] more general maintenance --- app/build.gradle | 4 ++++ .../java/awais/instagrabber/utils/LocaleUtils.java | 1 + .../webservices/AddCookiesInterceptor.java | 5 +++++ app/src/main/res/values-de/strings.xml | 2 -- app/src/main/res/values-es/strings.xml | 2 -- app/src/main/res/values-fa/strings.xml | 2 -- app/src/main/res/values-fr/strings.xml | 2 -- app/src/main/res/values-hi/strings.xml | 2 -- app/src/main/res/values-in/strings.xml | 2 -- app/src/main/res/values-it/strings.xml | 2 -- app/src/main/res/values-mk/strings.xml | 2 -- app/src/main/res/values-pl/strings.xml | 2 -- app/src/main/res/values-pt/strings.xml | 2 -- app/src/main/res/values-tr/strings.xml | 2 -- app/src/main/res/values-vi/strings.xml | 2 -- app/src/main/res/values-zh/strings.xml | 2 -- app/src/main/res/values/strings.xml | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 8 +++++--- 18 files changed, 20 insertions(+), 34 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2d862706..d72cf3c2 100755 --- a/app/build.gradle +++ b/app/build.gradle @@ -82,4 +82,8 @@ dependencies { debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5' testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0' + + // temporary + implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.10' + implementation 'org.jetbrains:annotations:13.0' } diff --git a/app/src/main/java/awais/instagrabber/utils/LocaleUtils.java b/app/src/main/java/awais/instagrabber/utils/LocaleUtils.java index 5ddd7bdc..01b52bd3 100755 --- a/app/src/main/java/awais/instagrabber/utils/LocaleUtils.java +++ b/app/src/main/java/awais/instagrabber/utils/LocaleUtils.java @@ -72,6 +72,7 @@ public final class LocaleUtils { if (appLanguageIndex == 11) return "fa"; if (appLanguageIndex == 12) return "mk"; if (appLanguageIndex == 13) return "vi"; + if (appLanguageIndex == 14) return "hi"; return null; } diff --git a/app/src/main/java/awais/instagrabber/webservices/AddCookiesInterceptor.java b/app/src/main/java/awais/instagrabber/webservices/AddCookiesInterceptor.java index fa9a8a39..70920088 100644 --- a/app/src/main/java/awais/instagrabber/webservices/AddCookiesInterceptor.java +++ b/app/src/main/java/awais/instagrabber/webservices/AddCookiesInterceptor.java @@ -5,6 +5,7 @@ import androidx.annotation.NonNull; import java.io.IOException; import awais.instagrabber.utils.Constants; +import awais.instagrabber.utils.LocaleUtils; import awais.instagrabber.utils.Utils; import okhttp3.Interceptor; import okhttp3.Request; @@ -22,6 +23,10 @@ public class AddCookiesInterceptor implements Interceptor { if (request.header(userAgentHeader) == null) { builder.addHeader(userAgentHeader, Constants.I_USER_AGENT); } + final String languageHeader = "Accept-Language"; + if (request.header(languageHeader) == null) { + builder.addHeader(languageHeader, LocaleUtils.getCurrentLocale().getLanguage() + ",en-US;q=0.8"); + } final Request updatedRequest = builder.build(); return chain.proceed(updatedRequest); } diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 5554af0b..53c5bdf9 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -6,8 +6,6 @@ Herunterladen Benutzernamen suchen… Vergleichen - Like - Likes Fehler beim Kopieren des Textes In die Zwischenablage kopiert! Melden diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index a393a524..7f94f255 100755 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -6,8 +6,6 @@ Descarga Buscar usuario… Comparar - me gusta - me gustas Error al copiar texto ¡Copiar al portapapeles! Reportar diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index a95ae2dd..08ab7054 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -6,8 +6,6 @@ دانلود جستجوی نام کاربری… مقایسه - پسندیدن - پسند خطا هنگام کپی متن به کلیپ بورد کپی شد! گزارش diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 5da5c7af..b16978f8 100755 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -6,8 +6,6 @@ Téléchargement Rechercher par nom d\'utilisateur… Comparer - j\'aime - j\'aimes Erreur lors de la copie des éléments Copié dans le presse-papier ! Reporter diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 7a9af317..bfbfbd07 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -6,8 +6,6 @@ डाउनलोड करें ब्यबहारकारीयों के ब्यबहृत नाम ढुंढे... तुलना करें - पसंद करें - पसन्दित लेखा उतारने में त्रुटि क्लिपबोर्ड पर नक़ल किया रिपोर्ट करें diff --git a/app/src/main/res/values-in/strings.xml b/app/src/main/res/values-in/strings.xml index 422e968d..56b4edd1 100644 --- a/app/src/main/res/values-in/strings.xml +++ b/app/src/main/res/values-in/strings.xml @@ -6,8 +6,6 @@ Unduh Cari Pengguna… Bandingkan - suka - suka Galat menyalin tulisan Tersalin! Laporkan diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 17c89650..8a1434a6 100755 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -6,8 +6,6 @@ Scarica Cerca utente… Compara - hai messo un Like - likes Errore durante la copia del testo Copiato negli appunti! Segnala diff --git a/app/src/main/res/values-mk/strings.xml b/app/src/main/res/values-mk/strings.xml index 89368cb0..84df240b 100644 --- a/app/src/main/res/values-mk/strings.xml +++ b/app/src/main/res/values-mk/strings.xml @@ -6,8 +6,6 @@ Превземи Пребарај username… Спореди - лајкни - лајкови Грешка при копрање текст Копрано во clipboard! Пријави diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 5e4be0fb..b1fb1730 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -6,8 +6,6 @@ Pobierz Szukaj użytkownika… Porównaj - polubienie - polubienia Wystąpił błąd podczas kopiowania tekstu Skopiowano do schowka! Zgłoś diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index 1230a744..41fc6648 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -6,8 +6,6 @@ Baixar Pesquisar nome de usuário… Comparar - like - likes Erro ao copiar texto Copiado para a área de transferência! Reportar diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 862bd109..b99d529a 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -6,8 +6,6 @@ İndir Kullanıcı adı ara… Karşılaştır - beğeni - beğeni Metin kopyalanamadı Panoya kopyalandı! Bildir diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 11a2f1f9..309b22f3 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -6,8 +6,6 @@ Tải xuống Tìm tên người dùng… So sánh - thích - thích Lỗi khi sao chép Đã sao chép vào clipboard! Báo cáo diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 0ea5e170..f15de58e 100755 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -6,8 +6,6 @@ 下载 搜索用户名… 比较 - 次赞 - 次赞 复制文字时出错 已复制到剪贴板! 报告 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index cb30dfa2..64d5fa61 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -306,11 +306,11 @@ Video player timeline 1x 2x - 0.25x - 0.5x - 0.75x - 1.25x - 1.5x + 0.25x + 0.5x + 0.75x + 1.25x + 1.5x Liking… Like unsuccessful Unlike unsuccessful diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d35bba05..aa54c83c 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=5252d2f1a984e5518e604678b3964bb0227c4573fcc880b92548bc687c851704 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-rc-5-all.zip +distributionSha256Sum=0080de8491f0918e4f529a6db6820fa0b9e818ee2386117f4394f95feb1d5583 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +# https://gradle.org/releases/ +# https://gradle.org/release-checksums/ zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file From c19ff317fd5a71881641f476d0445009cca8f666 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Mon, 2 Nov 2020 21:12:18 -0500 Subject: [PATCH 5/5] comments and verified * fix comments count on profile posts * all comments should be visible now * add verified badge to comments and post title --- .../adapters/CommentsAdapter.java | 10 +- .../comments/ChildCommentViewHolder.java | 3 + .../comments/ParentCommentViewHolder.java | 3 + .../instagrabber/asyncs/CommentsFetcher.java | 2 +- .../fragments/PostViewFragment.java | 340 ------------------ .../fragments/PostViewV2Fragment.java | 1 + .../webservices/ProfileService.java | 2 +- app/src/main/res/layout/dialog_post_view.xml | 19 +- app/src/main/res/layout/item_comment.xml | 16 +- .../main/res/layout/item_comment_small.xml | 14 +- 10 files changed, 58 insertions(+), 352 deletions(-) delete mode 100644 app/src/main/java/awais/instagrabber/fragments/PostViewFragment.java diff --git a/app/src/main/java/awais/instagrabber/adapters/CommentsAdapter.java b/app/src/main/java/awais/instagrabber/adapters/CommentsAdapter.java index fb59c71b..e0ccb44e 100755 --- a/app/src/main/java/awais/instagrabber/adapters/CommentsAdapter.java +++ b/app/src/main/java/awais/instagrabber/adapters/CommentsAdapter.java @@ -142,10 +142,12 @@ public final class CommentsAdapter extends ListAdapter children = parent.getChildCommentModels(); - for (final CommentModel child : children) { - lastCommentIndex++; - flatList.add(child); - positionTypeMap.put(lastCommentIndex, TYPE_CHILD); + if (children != null) { + for (final CommentModel child : children) { + lastCommentIndex++; + flatList.add(child); + positionTypeMap.put(lastCommentIndex, TYPE_CHILD); + } } } return flatList; diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ChildCommentViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ChildCommentViewHolder.java index 27c82580..bc5aecd8 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ChildCommentViewHolder.java +++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ChildCommentViewHolder.java @@ -1,5 +1,7 @@ package awais.instagrabber.adapters.viewholder.comments; +import android.view.View; + import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; @@ -77,6 +79,7 @@ public final class ChildCommentViewHolder extends RecyclerView.ViewHolder { if (profileModel == null) return; binding.tvUsername.setText(profileModel.getUsername()); binding.ivProfilePic.setImageURI(profileModel.getSdProfilePic()); + binding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE); } private void setLikes(final int likes) { diff --git a/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ParentCommentViewHolder.java b/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ParentCommentViewHolder.java index 71ae48c2..2b595d9e 100644 --- a/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ParentCommentViewHolder.java +++ b/app/src/main/java/awais/instagrabber/adapters/viewholder/comments/ParentCommentViewHolder.java @@ -1,5 +1,7 @@ package awais.instagrabber.adapters.viewholder.comments; +import android.view.View; + import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; @@ -77,6 +79,7 @@ public final class ParentCommentViewHolder extends RecyclerView.ViewHolder { if (profileModel == null) return; binding.tvUsername.setText(profileModel.getUsername()); binding.ivProfilePic.setImageURI(profileModel.getSdProfilePic()); + binding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE); } private void setLikes(final int likes) { diff --git a/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java b/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java index d1736b49..7c1a5c43 100755 --- a/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java +++ b/app/src/main/java/awais/instagrabber/asyncs/CommentsFetcher.java @@ -269,8 +269,8 @@ public final class CommentsFetcher extends AsyncTask idOrCodeList; -// private boolean hasInitialResult = false; -// private PostViewAdapter adapter; -// private boolean session; -// private MediaService mediaService; -// -// private FetchListener pfl = result -> { -// if (result == null) return; -// final List viewerPostModels = viewerPostViewModel.getList().getValue(); -// final List temp = viewerPostModels == null ? new ArrayList<>(idOrCodeList.size()) -// : new ArrayList<>(viewerPostModels); -// String idOrCode = isId ? result.getPostId() : result.getShortCode(); -// if (idOrCode == null) return; -// if (isId) { -// // the post id is appended with `_` in the result -// idOrCode = idOrCode.substring(0, idOrCode.indexOf('_')); -// } -// final int index = idOrCodeList.indexOf(idOrCode); -// if (index < 0) return; -// final ViewerPostModelWrapper viewerPostModelWrapper = temp.get(index); -// viewerPostModelWrapper.setViewerPostModels(result.getSliderItems() == null ? Collections.emptyList() : result.getSliderItems()); -// temp.set(index, viewerPostModelWrapper); -// viewerPostViewModel.getList().setValue(temp); -// adapter.notifyItemChanged(index); -// if (!hasInitialResult) { -// Log.d(TAG, "setting delayed position to: " + currentPostIndex); -// binding.getRoot() -// .postDelayed(() -> binding.getRoot().setCurrentItem(currentPostIndex), 200); -// } -// hasInitialResult = true; -// }; -// private MentionClickListener mentionListener = (view, text, isHashtag, isLocation) -> { -// if (isHashtag) { -// final NavDirections action = PostViewFragmentDirections -// .actionGlobalHashTagFragment(text); -// NavHostFragment.findNavController(this).navigate(action); -// return; -// } -// if (isLocation) { -// final NavDirections action = PostViewFragmentDirections -// .actionGlobalLocationFragment(text); -// NavHostFragment.findNavController(this).navigate(action); -// return; -// } -// final NavDirections action = PostViewFragmentDirections -// .actionGlobalProfileFragment("@" + text); -// NavHostFragment.findNavController(this).navigate(action); -// }; -// private OnPostViewChildViewClickListener clickListener = (v, wrapper, postPosition, childPosition) -> { -// final ViewerPostModel postModel = wrapper.getViewerPostModels().get(0); -// final String username = postModel.getProfileModel().getUsername(); -// final int id = v.getId(); -// switch (id) { -// case R.id.viewerCaption: -// break; -// case R.id.btnComments: -// String postId = postModel.getPostId(); -// if (postId.contains("_")) postId = postId.substring(0, postId.indexOf("_")); -// final NavDirections commentsAction = PostViewFragmentDirections.actionGlobalCommentsViewerFragment( -// postModel.getShortCode(), -// postId, -// postModel.getProfileModel().getId() -// ); -// NavHostFragment.findNavController(this).navigate(commentsAction); -// break; -// case R.id.btnDownload: -// final Context context = getContext(); -// if (context == null) return; -// if (checkSelfPermission(context, -// DownloadUtils.PERMS[0]) == PackageManager.PERMISSION_GRANTED) { -// showDownloadDialog(wrapper.getViewerPostModels(), -// childPosition, -// username); -// return; -// } -// requestPermissions(DownloadUtils.PERMS, 8020); -// break; -// case R.id.ivProfilePic: -// case R.id.title: -// mentionListener.onClick(null, username, false, false); -// break; -// case R.id.btnLike: -// if (mediaService != null) { -// final String userId = CookieUtils.getUserIdFromCookie(COOKIE); -// final String csrfToken = CookieUtils.getCsrfTokenFromCookie(COOKIE); -// v.setEnabled(false); -// final ServiceCallback likeCallback = new ServiceCallback() { -// @Override -// public void onSuccess(final Boolean result) { -// v.setEnabled(true); -// if (result) { -// postModel.setManualLike(!postModel.getLike()); -// adapter.notifyItemChanged(postPosition); -// return; -// } -// Log.e(TAG, "like/unlike unsuccessful!"); -// } -// -// @Override -// public void onFailure(final Throwable t) { -// v.setEnabled(true); -// Log.e(TAG, "Error during like/unlike", t); -// } -// }; -// if (!postModel.getLike()) { -// mediaService.like(postModel.getPostId(), userId, csrfToken, likeCallback); -// } else { -// mediaService.unlike(postModel.getPostId(), userId, csrfToken, likeCallback); -// } -// } -// break; -// case R.id.btnBookmark: -// if (mediaService != null) { -// final String userId = CookieUtils.getUserIdFromCookie(COOKIE); -// final String csrfToken = CookieUtils.getCsrfTokenFromCookie(COOKIE); -// v.setEnabled(false); -// final ServiceCallback saveCallback = new ServiceCallback() { -// @Override -// public void onSuccess(final Boolean result) { -// v.setEnabled(true); -// if (result) { -// // postModel.setBookmarked(!postModel.isSaved()); -// adapter.notifyItemChanged(postPosition); -// return; -// } -// Log.e(TAG, "save/unsave unsuccessful!"); -// } -// -// @Override -// public void onFailure(final Throwable t) { -// v.setEnabled(true); -// Log.e(TAG, "Error during save/unsave", t); -// } -// }; -// if (!postModel.isSaved()) { -// mediaService.save(postModel.getPostId(), userId, csrfToken, saveCallback); -// } else { -// mediaService.unsave(postModel.getPostId(), userId, csrfToken, saveCallback); -// } -// } -// break; -// } -// }; -// private PostViewAdapter.OnPostCaptionLongClickListener captionLongClickListener = text -> { -// final Context context = getContext(); -// if (context == null) return; -// Utils.copyText(context, text); -// }; -// -// @Override -// public void onCreate(@Nullable final Bundle savedInstanceState) { -// super.onCreate(savedInstanceState); -// fragmentActivity = getActivity(); -// mediaService = MediaService.getInstance(); -// } -// -// @Nullable -// @Override -// public View onCreateView(@NonNull final LayoutInflater inflater, -// @Nullable final ViewGroup container, -// @Nullable final Bundle savedInstanceState) { -// if (root != null) { -// shouldRefresh = false; -// return root; -// } -// binding = FragmentPostViewBinding.inflate(inflater, container, false); -// root = binding.getRoot(); -// setupViewPager(); -// return root; -// } -// -// @Override -// public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) { -// if (!shouldRefresh) return; -// init(); -// shouldRefresh = false; -// } -// -// private void setupViewPager() { -// viewerPostViewModel = new ViewModelProvider(fragmentActivity) -// .get(ViewerPostViewModel.class); -// adapter = new PostViewAdapter(clickListener, captionLongClickListener, mentionListener); -// root.setAdapter(adapter); -// root.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { -// -// @Override -// public void onPageSelected(final int position) { -// // Log.d(TAG, "onPageSelected: " + position + ", hasInitialResult: " + hasInitialResult); -// if (!hasInitialResult) { -// return; -// } -// currentPostIndex = position; -// fetchPost(); -// } -// }); -// viewerPostViewModel.getList().observe(fragmentActivity, list -> adapter.submitList(list)); -// } -// -// private void init() { -// if (getArguments() == null) return; -// final PostViewFragmentArgs fragmentArgs = PostViewFragmentArgs.fromBundle(getArguments()); -// final String[] idOrCodeArray = fragmentArgs.getIdOrCodeArray(); -// if (idOrCodeArray.length == 0) return; -// currentPostIndex = fragmentArgs.getIndex(); -// if (currentPostIndex < 0) return; -// if (currentPostIndex >= idOrCodeArray.length) return; -// idOrCodeList = Arrays.asList(idOrCodeArray); -// viewerPostViewModel.getList().setValue(createPlaceholderModels(idOrCodeArray.length)); -// isId = fragmentArgs.getIsId(); -// fetchPost(); -// } -// -// private List createPlaceholderModels(final int size) { -// final List viewerPostModels = new ArrayList<>(size); -// for (int i = 0; i < size; i++) { -// // viewerPostModels.add(new ViewerPostModel[]{ViewerPostModel.getDefaultModel(-i, "")}); -// viewerPostModels.add(new ViewerPostModelWrapper(i, null)); -// } -// return viewerPostModels; -// } -// -// private void fetchPost() { -// // Log.d(TAG, "fetchPost, currentPostIndex: " + currentPostIndex); -// final List list = viewerPostViewModel.getList().getValue(); -// if (list != null) { -// final ViewerPostModelWrapper viewerPostModels = list.get(currentPostIndex); -// if (viewerPostModels != null && viewerPostModels -// .getViewerPostModels() != null && viewerPostModels -// .getViewerPostModels().size() > 0) { -// Log.d(TAG, "returning without fetching"); -// return; -// } -// } -// if (currentPostIndex >= idOrCodeList.size() || currentPostIndex < 0) return; -// final String idOrShortCode = idOrCodeList.get(currentPostIndex); -// if (isId) { -// new iPostFetcher(idOrShortCode, pfl).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); -// return; -// } -// new PostFetcher(idOrShortCode, pfl).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); -// } -// -// private void showDownloadDialog(final List postModels, -// final int childPosition, -// final String username) { -// final List postModelsToDownload = new ArrayList<>(); -// final Context context = getContext(); -// if (context == null) return; -// if (!session && postModels.size() > 1) { -// final DialogInterface.OnClickListener clickListener = (dialog, which) -> { -// if (which == DialogInterface.BUTTON_NEGATIVE) { -// postModelsToDownload.addAll(postModels); -// } else if (which == DialogInterface.BUTTON_POSITIVE) { -// postModelsToDownload.add(postModels.get(childPosition)); -// } else { -// session = true; -// postModelsToDownload.add(postModels.get(childPosition)); -// } -// if (postModelsToDownload.size() > 0) { -// DownloadUtils.batchDownload(context, -// username, -// DownloadMethod.DOWNLOAD_POST_VIEWER, -// postModelsToDownload); -// } -// }; -// new AlertDialog.Builder(context) -// .setTitle(R.string.post_viewer_download_dialog_title) -// .setMessage(R.string.post_viewer_download_message) -// .setNeutralButton(R.string.post_viewer_download_session, clickListener) -// .setPositiveButton(R.string.post_viewer_download_current, clickListener) -// .setNegativeButton(R.string.post_viewer_download_album, clickListener).show(); -// } else { -// DownloadUtils.batchDownload(context, -// username, -// DownloadMethod.DOWNLOAD_POST_VIEWER, -// Collections.singletonList(postModels.get(childPosition))); -// } -// } -// } \ No newline at end of file diff --git a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java index 2145e770..f811d1e6 100644 --- a/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java @@ -764,6 +764,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { private void setupTitles() { binding.title.setText(feedModel.getProfileModel().getUsername()); binding.righttitle.setText(feedModel.getProfileModel().getName()); + binding.isVerified.setVisibility(feedModel.getProfileModel().isVerified() ? View.VISIBLE : View.GONE); binding.title.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername())); binding.righttitle.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername())); final String locationName = feedModel.getLocationName(); diff --git a/app/src/main/java/awais/instagrabber/webservices/ProfileService.java b/app/src/main/java/awais/instagrabber/webservices/ProfileService.java index 34567d58..a221f3fb 100644 --- a/app/src/main/java/awais/instagrabber/webservices/ProfileService.java +++ b/app/src/main/java/awais/instagrabber/webservices/ProfileService.java @@ -172,7 +172,7 @@ public class ProfileService extends BaseService { } else { resourceUrl = mediaNode.has("display_resources") ? ResponseBodyUtils.getHighQualityImage(mediaNode) : displayUrl; } - JSONObject tempJsonObject = mediaNode.optJSONObject("edge_media_preview_comment"); + JSONObject tempJsonObject = mediaNode.optJSONObject("edge_media_to_comment"); final long commentsCount = tempJsonObject != null ? tempJsonObject.optLong("count") : 0; tempJsonObject = mediaNode.optJSONObject("edge_media_preview_like"); final long likesCount = tempJsonObject != null ? tempJsonObject.optLong("count") : 0; diff --git a/app/src/main/res/layout/dialog_post_view.xml b/app/src/main/res/layout/dialog_post_view.xml index 77d924a9..3ef6c076 100644 --- a/app/src/main/res/layout/dialog_post_view.xml +++ b/app/src/main/res/layout/dialog_post_view.xml @@ -65,29 +65,42 @@ android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_marginEnd="4dp" android:ellipsize="marquee" android:singleLine="true" android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1" android:textColor="@color/white" android:textStyle="bold" app:layout_constraintBottom_toTopOf="@id/subtitle" - app:layout_constraintEnd_toEndOf="@id/righttitle" + app:layout_constraintEnd_toStartOf="@id/isVerified" app:layout_constraintStart_toEndOf="@id/profile_pic" app:layout_constraintTop_toTopOf="@id/profile_pic" tools:text="Username Username Username" /> + + diff --git a/app/src/main/res/layout/item_comment.xml b/app/src/main/res/layout/item_comment.xml index cb119a13..6e222821 100755 --- a/app/src/main/res/layout/item_comment.xml +++ b/app/src/main/res/layout/item_comment.xml @@ -24,7 +24,7 @@ + + + +