Compare commits

...

6 Commits

Author SHA1 Message Date
Grishka
ad2f4791c2 Merge branch 'l10n_master' 2024-11-16 15:14:33 +03:00
Grishka
c468e9958f Crash fixes 2024-11-16 15:13:48 +03:00
Grishka
a217167667 Increase robustness of instance data loading 2024-11-16 15:04:46 +03:00
Eugen Rochko
af1ae2fa01 New translations strings.xml (Japanese) 2024-11-15 19:08:14 +01:00
Eugen Rochko
5be9ae7cce New translations strings.xml (Japanese) 2024-11-15 17:52:47 +01:00
Eugen Rochko
548abe8d90 New translations strings.xml (Vietnamese) 2024-11-15 07:29:19 +01:00
6 changed files with 116 additions and 16 deletions

View File

@@ -13,8 +13,8 @@ android {
applicationId "org.joinmastodon.android"
minSdk 23
targetSdk 34
versionCode 128
versionName "2.9.0"
versionCode 129
versionName "2.9.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@@ -395,8 +395,14 @@ public class AccountSessionManager{
case 2 -> InstanceV2.class;
default -> throw new IllegalStateException("Unexpected value: "+version);
});
instances.put(domain, instance);
StringBuilder emojiSB=new StringBuilder();
emojiSB.append(values.getAsString("emojis"));
String emojiPart=values.getAsString("emojis");
if(emojiPart==null){
// not putting anything into instancesLastUpdated to force a reload
continue;
}
emojiSB.append(emojiPart);
//get emoji in chunks of 1MB if it didn't fit in the first query
int emojiStringLength=values.getAsInteger("emoji_length");
if(emojiStringLength>maxEmojiLength){
@@ -409,13 +415,12 @@ public class AccountSessionManager{
}
}
List<Emoji> emojis=MastodonAPIController.gson.fromJson(emojiSB.toString(), new TypeToken<List<Emoji>>(){}.getType());
instances.put(domain, instance);
customEmojis.put(domain, groupCustomEmojis(emojis));
instancesLastUpdated.put(domain, values.getAsLong("last_updated"));
}
}catch(Exception ex){
Log.d(TAG, "readInstanceInfo failed", ex);
return;
// instancesLastUpdated will not contain that domain, so instance data will be forced to be reloaded
}
}
if(!loadedInstances){

View File

@@ -50,6 +50,7 @@ import android.widget.Toolbar;
import org.joinmastodon.android.GlobalUserPreferences;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.api.requests.accounts.GetAccountByID;
import org.joinmastodon.android.api.requests.accounts.GetAccountFamiliarFollowers;
import org.joinmastodon.android.api.requests.accounts.GetAccountRelationships;
@@ -95,6 +96,7 @@ import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@@ -104,6 +106,7 @@ import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager2.widget.ViewPager2;
import me.grishka.appkit.Nav;
import me.grishka.appkit.api.APIRequest;
import me.grishka.appkit.api.Callback;
import me.grishka.appkit.api.ErrorResponse;
import me.grishka.appkit.api.SimpleCallback;
@@ -172,6 +175,7 @@ public class ProfileFragment extends LoaderFragment implements ScrollableToTop,
private MenuItem editSaveMenuItem;
private boolean savingEdits;
private Runnable editModeBackCallback=this::onEditModeBackCallback;
private HashSet<APIRequest<?>> relationshipRequests=new HashSet<>();
@Override
public void onCreate(Bundle savedInstanceState){
@@ -200,6 +204,14 @@ public class ProfileFragment extends LoaderFragment implements ScrollableToTop,
setHasOptionsMenu(true);
}
@Override
public void onDestroy(){
super.onDestroy();
for(APIRequest<?> req:relationshipRequests)
req.cancel();
relationshipRequests.clear();
}
@Override
public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View content=inflater.inflate(R.layout.fragment_profile, container, false);
@@ -801,10 +813,13 @@ public class ProfileFragment extends LoaderFragment implements ScrollableToTop,
}
private void loadRelationship(){
new GetAccountRelationships(Collections.singletonList(account.id))
.setCallback(new Callback<>(){
MastodonAPIRequest<List<Relationship>> relReq=new GetAccountRelationships(Collections.singletonList(account.id));
relReq.setCallback(new Callback<>(){
@Override
public void onSuccess(List<Relationship> result){
relationshipRequests.remove(relReq);
if(getActivity()==null)
return;
if(!result.isEmpty()){
relationship=result.get(0);
updateRelationship();
@@ -813,14 +828,17 @@ public class ProfileFragment extends LoaderFragment implements ScrollableToTop,
@Override
public void onError(ErrorResponse error){
relationshipRequests.remove(relReq);
}
})
.exec(accountID);
new GetAccountFamiliarFollowers(Set.of(account.id))
.setCallback(new Callback<>(){
MastodonAPIRequest<List<FamiliarFollowers>> followersReq=new GetAccountFamiliarFollowers(Set.of(account.id));
followersReq.setCallback(new Callback<>(){
@Override
public void onSuccess(List<FamiliarFollowers> result){
relationshipRequests.remove(followersReq);
if(getActivity()==null)
return;
for(FamiliarFollowers ff:result){
if(ff.id.equals(account.id)){
familiarFollowers=ff.accounts;
@@ -832,10 +850,12 @@ public class ProfileFragment extends LoaderFragment implements ScrollableToTop,
@Override
public void onError(ErrorResponse error){
relationshipRequests.remove(followersReq);
}
})
.exec(accountID);
relationshipRequests.add(relReq);
relationshipRequests.add(followersReq);
}
private void updateRelationship(){

View File

@@ -90,8 +90,8 @@ public class HtmlParser{
Map<String, String> idsByUrl=mentions.stream().distinct().collect(Collectors.toMap(m->m.url, m->m.id));
// Hashtags in remote posts have remote URLs, these have local URLs so they don't match.
// Map<String, String> tagsByUrl=tags.stream().collect(Collectors.toMap(t->t.url, t->t.name));
Map<String, Hashtag> tagsByTag=tags.stream().distinct().collect(Collectors.toMap(t->t.name.toLowerCase(), Function.identity()));
Map<String, Mention> mentionsByID=mentions.stream().distinct().collect(Collectors.toMap(m->m.id, Function.identity()));
Map<String, Hashtag> tagsByTag=tags.stream().distinct().collect(Collectors.toMap(t->t.name.toLowerCase(), Function.identity(), (a, b)->a));
Map<String, Mention> mentionsByID=mentions.stream().distinct().collect(Collectors.toMap(m->m.id, Function.identity(), (a, b)->a));
source=source.replaceAll("[\u2028\u2029]", "<br>");
final SpannableStringBuilder ssb=new SpannableStringBuilder();

View File

@@ -166,7 +166,7 @@
<string name="media_attachment_unsupported_type">ファイル %s は対応していないファイル形式です</string>
<string name="media_attachment_too_big">ファイル %1$s が上限の %2$s MB を超えています</string>
<string name="settings_theme">テーマ</string>
<string name="theme_auto">デバイスのテーマ</string>
<string name="theme_auto">端末のテーマ</string>
<string name="theme_light">ライト</string>
<string name="theme_dark">ダーク</string>
<string name="settings_behavior">動作</string>
@@ -183,7 +183,7 @@
<string name="sensitive_content_explain">投稿者が閲覧注意に設定しました。</string>
<string name="avatar_description">%s さんのプロフィールを見る</string>
<string name="more_options">その他のオプション</string>
<string name="new_post">しい投稿</string>
<string name="new_post">投稿</string>
<string name="button_reply">返信</string>
<string name="button_reblog">ブースト</string>
<string name="button_favorite">お気に入り</string>
@@ -221,7 +221,7 @@
<!-- %s is the server domain -->
<string name="local_timeline_info_banner">あなたのサーバー (%s) の全ユーザーの全投稿です。</string>
<string name="recommended_accounts_info_banner">こちらは、あなたがフォローしている人に基づいた、おすすめのアカウントです。</string>
<string name="see_new_posts">しい投稿</string>
<string name="see_new_posts">投稿</string>
<string name="follow_back">フォローバック</string>
<string name="button_follow_pending">保留</string>
<string name="follows_you">フォローされています</string>
@@ -284,6 +284,7 @@
<string name="add_bookmark">ブックマーク</string>
<string name="remove_bookmark">ブックマークから削除</string>
<string name="bookmarks">ブックマーク</string>
<string name="your_favorites">お気に入り</string>
<string name="login_title">お帰りなさい</string>
<string name="login_subtitle">アカウントがあるサーバーの URL を入力してください。</string>
<string name="server_url">サーバーの URL</string>
@@ -758,7 +759,47 @@
<string name="moderation_warning_action_silence">あなたのアカウントは制限されています。</string>
<string name="moderation_warning_action_suspend">あなたのアカウントは停止されています。</string>
<string name="moderation_warning_learn_more">詳細</string>
<string name="text_show_more">もっと見る</string>
<string name="avatar_move_and_scale">移動と拡大/縮小</string>
<string name="confirm_avatar_crop">選択</string>
<string name="settings_use_dynamic_colors">Dynamic color を使用する</string>
<string name="settings_accounts">アカウント</string>
<string name="settings_add_account">アカウントを追加...</string>
<string name="settings_app_settings">アプリ設定</string>
<string name="account_settings">アカウント設定</string>
<string name="settings_about_this_server">このサーバーについて</string>
<string name="manage_account">アカウント管理</string>
<string name="switch_to_this_account">このアカウントに切り替える</string>
<string name="delete_account">アカウントを削除する</string>
<string name="notification_type_status">新着投稿</string>
<plurals name="user_and_x_more_followed">
<item quantity="other">%1$s さん他 %2$,d 人にフォローされています</item>
</plurals>
<string name="familiar_followers_one">%s さんにフォローされています</string>
<string name="familiar_followers_two">%s さんと %s さんにフォローされています</string>
<string name="profile_saved_posts">保存した投稿</string>
<string name="profile_saved_posts_explanation">保存した投稿はあなたのみ閲覧できます。</string>
<string name="search_people">人々</string>
<plurals name="familiar_followers_many">
<item quantity="other">%1$s さん、%2$s さん他 %3$,d 人にフォローされています</item>
</plurals>
<plurals name="x_followers_you_know">
<item quantity="other">あなたの知り合い %,d 人のフォロワー</item>
</plurals>
<!-- appears when you're about to block a server -->
<plurals name="server_x_followers_will_be_removed">
<item quantity="other">このサーバーの %,d 人のフォロワーが削除されます。</item>
</plurals>
<!-- The complete string will look like "You will lose X followers and Y people you follow". See will_lose_x_followers and will_lose_x_following -->
<string name="server_x_followers_and_following_will_be_removed">%1$sと%2$sがいなくなります。</string>
<plurals name="will_lose_x_followers">
<item quantity="other">フォロワー %,d 人</item>
</plurals>
<plurals name="will_lose_x_following">
<item quantity="other">フォローしている %,d 人</item>
</plurals>
<!-- The complete string will look like "You will lose X people you follow". See will_lose_x_following -->
<string name="server_x_following_will_be_removed">%sがいなくなります。</string>
<string name="load_missing_posts_above">上の不足している投稿を読み込む</string>
<string name="load_missing_posts_below">下の不足している投稿を読み込む</string>
</resources>

View File

@@ -284,6 +284,7 @@
<string name="add_bookmark">Lưu</string>
<string name="remove_bookmark">Bỏ lưu</string>
<string name="bookmarks">Những tút đã lưu</string>
<string name="your_favorites">Những tút đã thích</string>
<string name="login_title">Chào mừng trở lại</string>
<string name="login_subtitle">Đăng nhập với máy chủ nơi bạn tạo tài khoản.</string>
<string name="server_url">URL Máy chủ</string>
@@ -762,10 +763,43 @@ Bạn càng theo dõi nhiều người thì nó sẽ càng sôi động và thú
<string name="avatar_move_and_scale">Kéo và thu phóng</string>
<string name="confirm_avatar_crop">Chọn</string>
<string name="settings_use_dynamic_colors">Giống hệ thống</string>
<string name="settings_accounts">Tài khoản</string>
<string name="settings_add_account">Thêm tài khoản...</string>
<string name="settings_app_settings">Cài đặt ứng dụng</string>
<string name="account_settings">Cài đặt tài khoản</string>
<string name="settings_about_this_server">Về máy chủ này</string>
<string name="manage_account">Quản lý tài khoản</string>
<string name="switch_to_this_account">Chuyển sang tài khoản này</string>
<string name="delete_account">Xóa tài khoản</string>
<string name="notification_type_status">Những tút mới</string>
<plurals name="user_and_x_more_followed">
<item quantity="other">%1$s và %2$,d người khác đã theo dõi bạn</item>
</plurals>
<string name="familiar_followers_one">Theo dõi bởi %s</string>
<string name="familiar_followers_two">Theo dõi bởi %s và %s</string>
<string name="profile_saved_posts">Những tút đã lưu</string>
<string name="profile_saved_posts_explanation">Những tút bạn lưu chỉ hiển thị với bạn.</string>
<string name="search_people">Người</string>
<plurals name="familiar_followers_many">
<item quantity="other">Theo dõi bởi %1$s, %2$s, và %3$,d người khác</item>
</plurals>
<plurals name="x_followers_you_know">
<item quantity="other">%,d người theo dõi bạn biết</item>
</plurals>
<!-- appears when you're about to block a server -->
<plurals name="server_x_followers_will_be_removed">
<item quantity="other">%,d người theo dõi bạn ở máy chủ này sẽ bị xóa.</item>
</plurals>
<!-- The complete string will look like "You will lose X followers and Y people you follow". See will_lose_x_followers and will_lose_x_following -->
<string name="server_x_followers_and_following_will_be_removed">Bạn sẽ mất %1$s và %2$s.</string>
<plurals name="will_lose_x_followers">
<item quantity="other">%,d người theo dõi</item>
</plurals>
<plurals name="will_lose_x_following">
<item quantity="other">%,d người bạn theo dõi</item>
</plurals>
<!-- The complete string will look like "You will lose X people you follow". See will_lose_x_following -->
<string name="server_x_following_will_be_removed">Bạn sẽ mất %s.</string>
<string name="load_missing_posts_above">Tải tút chưa đọc ở trên</string>
<string name="load_missing_posts_below">Tải tút chưa đọc ở dưới</string>
</resources>