diff --git a/README.md b/README.md index 16749ff82..6053674b2 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,9 @@        -Lead developer: [framapiaf.org/@fedilab](https://framapiaf.org/@fedilab) +Lead developer: [toot.fedilab.app/@fedilab](https://toot.fedilab.app/@fedilab)
-Developer: [mastodon.social/@kasun](https://mastodon.social/@kasun) +Developer: [toot.fedilab.app/@kasun](https://toot.fedilab.app/@kasun) ## Backers diff --git a/app/src/main/assets/changelogs/337.txt b/app/src/main/assets/changelogs/337.txt new file mode 100644 index 000000000..858f61ec7 --- /dev/null +++ b/app/src/main/assets/changelogs/337.txt @@ -0,0 +1,10 @@ +Changed +- Text color for notifications with custom themes +- Polls: use the number of voters instead of votes +- News timeline targets the new account + +Fixed +- Friendica: Login/Quick replies/follow notifications +- Fix crash when resetting custom colors +- Crash on device reboot when no accounts +- Some crashes \ No newline at end of file diff --git a/app/src/main/java/app/fedilab/android/activities/TootActivity.java b/app/src/main/java/app/fedilab/android/activities/TootActivity.java index 05bb078b2..3a3554ec4 100644 --- a/app/src/main/java/app/fedilab/android/activities/TootActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/TootActivity.java @@ -340,6 +340,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate, @Override public void afterTextChanged(Editable s) { + if (status != null) { status.setQuickReplyContent(s.toString()); } diff --git a/app/src/main/java/app/fedilab/android/client/API.java b/app/src/main/java/app/fedilab/android/client/API.java index 643445cb6..8ae574cae 100644 --- a/app/src/main/java/app/fedilab/android/client/API.java +++ b/app/src/main/java/app/fedilab/android/client/API.java @@ -3355,7 +3355,7 @@ public class API { apiResponse = new APIResponse(); try { HttpsConnection httpsConnection = new HttpsConnection(context, this.instance); - String response = httpsConnection.get("https://framapiaf.org/api/v1/timelines/tag/fedilab", 10, params, prefKeyOauthTokenT); + String response = httpsConnection.get("https://toot.fedilab.app/api/v1/timelines/tag/fedilab", 10, params, prefKeyOauthTokenT); apiResponse.setSince_id(httpsConnection.getSince_id()); apiResponse.setMax_id(httpsConnection.getMax_id()); List tmp_status = parseStatuses(context, new JSONArray(response)); diff --git a/app/src/main/java/app/fedilab/android/client/GNUAPI.java b/app/src/main/java/app/fedilab/android/client/GNUAPI.java index eb3388059..d22535d52 100644 --- a/app/src/main/java/app/fedilab/android/client/GNUAPI.java +++ b/app/src/main/java/app/fedilab/android/client/GNUAPI.java @@ -396,16 +396,24 @@ public class GNUAPI { Account account = new Account(); try { - account.setId(resobj.get("id").toString()); - if (resobj.has("ostatus_uri")) + if( resobj.has("id_str")){ + account.setId(resobj.getString("id_str")); + }else{ + account.setId(resobj.get("id").toString()); + } + if (resobj.has("ostatus_uri")) { account.setUuid(resobj.get("ostatus_uri").toString()); - else - account.setUuid(resobj.get("id").toString()); - account.setUsername(resobj.get("screen_name").toString()); - account.setAcct(resobj.get("screen_name").toString()); - account.setDisplay_name(resobj.get("name").toString()); + }else { + if( resobj.has("id_str")){ + account.setUuid(resobj.getString("id_str")); + }else{ + account.setUuid(resobj.get("id").toString()); + } + } + account.setUsername(resobj.getString("screen_name")); + account.setAcct(resobj.getString("screen_name")); + account.setDisplay_name(resobj.getString("name")); account.setLocked(Boolean.parseBoolean(resobj.get("protected").toString())); - account.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString())); account.setFollowers_count(Integer.valueOf(resobj.get("followers_count").toString())); account.setFollowing_count(Integer.valueOf(resobj.get("friends_count").toString())); account.setStatuses_count(Integer.valueOf(resobj.get("statuses_count").toString())); @@ -428,8 +436,8 @@ public class GNUAPI { else account.setSocial("GNU"); account.setEmojis(new ArrayList<>()); - } catch (JSONException ignored) { - } catch (ParseException e) { + account.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString())); + } catch (JSONException | ParseException e) { e.printStackTrace(); } return account; @@ -1386,13 +1394,7 @@ public class GNUAPI { } } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (JSONException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { e.printStackTrace(); } apiResponse.setStatuses(statuses); @@ -1632,13 +1634,7 @@ public class GNUAPI { } } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (JSONException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { e.printStackTrace(); } apiResponse.setAccounts(accounts); @@ -1954,11 +1950,7 @@ public class GNUAPI { } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException e) { e.printStackTrace(); } return actionCode; @@ -2025,13 +2017,7 @@ public class GNUAPI { } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (JSONException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { e.printStackTrace(); } apiResponse.setStatuses(statuses); @@ -2121,15 +2107,16 @@ public class GNUAPI { apiResponse.setMax_id(httpsConnection.getMax_id()); if (type == DisplayNotificationsFragment.Type.FOLLOW) { List accounts = parseAccountResponse(new JSONArray(response)); - if (accounts != null) + if (accounts != null) { for (Account st : accounts) { Notification notification = new Notification(); notification.setType(stringType); notification.setId(st.getId()); notification.setStatus(null); - notification.setAccount(account); + notification.setAccount(st); notifications.add(notification); } + } } else { List statuses = parseStatuses(context, new JSONArray(response)); if (statuses != null) @@ -2146,13 +2133,7 @@ public class GNUAPI { } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (JSONException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { e.printStackTrace(); } apiResponse.setNotifications(notifications); @@ -2257,13 +2238,7 @@ public class GNUAPI { } catch (HttpsConnection.HttpsConnectionException e) { setError(e.getStatusCode(), e); e.printStackTrace(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } catch (JSONException e) { + } catch (NoSuchAlgorithmException | IOException | KeyManagementException | JSONException e) { e.printStackTrace(); } return apiResponse; diff --git a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java index 0064c8bb0..59e255cdc 100644 --- a/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java +++ b/app/src/main/java/app/fedilab/android/drawers/StatusListAdapter.java @@ -2525,8 +2525,8 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct break; } } - if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) - holder.quick_reply_text.addTextChangedListener(textWatcher); + holder.quick_reply_text.addTextChangedListener(textWatcher); + } else { status.setShortReply(false); @@ -3836,19 +3836,17 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); String instance = Helper.getLiveInstance(context); + int split_toot_size = sharedpreferences.getInt(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS_SIZE + userId + instance, Helper.SPLIT_TOOT_SIZE); boolean split_toot = sharedpreferences.getBoolean(Helper.SET_AUTOMATICALLY_SPLIT_TOOTS + userId + instance, false); - String tootContent; if (toot_cw_content.getText() != null && toot_cw_content.getText().toString().trim().length() > 0) split_toot_size -= toot_cw_content.getText().toString().trim().length(); if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA || !split_toot || (TootActivity.countLength(social, toot_content, toot_cw_content) < split_toot_size)) { - tootContent = toot_content.getText().toString().trim(); createAndSendToot(status, content_type, userId, instance); } else { splitToot = Helper.splitToots(toot_content.getText().toString().trim(), split_toot_size, true); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - tootContent = splitToot.get(0); stepSpliToot = 1; int style; if (theme == Helper.THEME_DARK) { diff --git a/app/src/main/java/app/fedilab/android/sqlite/AccountDAO.java b/app/src/main/java/app/fedilab/android/sqlite/AccountDAO.java index ab6321289..1a18c2c30 100644 --- a/app/src/main/java/app/fedilab/android/sqlite/AccountDAO.java +++ b/app/src/main/java/app/fedilab/android/sqlite/AccountDAO.java @@ -255,7 +255,7 @@ public class AccountDAO { public List getAllAccountCrossAction() { try { - Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, Sqlite.COL_SOCIAL + " != 'PEERTUBE' AND " + Sqlite.COL_OAUTHTOKEN + " != 'null'", null, null, null, Sqlite.COL_INSTANCE + " ASC", null); + Cursor c = db.query(Sqlite.TABLE_USER_ACCOUNT, null, Sqlite.COL_SOCIAL + " != 'PEERTUBE' AND " + Sqlite.COL_SOCIAL + " != 'FRIENDICA' AND " + Sqlite.COL_SOCIAL + " != 'GNU' AND " +Sqlite.COL_OAUTHTOKEN + " != 'null'", null, null, null, Sqlite.COL_INSTANCE + " ASC", null); return cursorToListUser(c); } catch (Exception e) { return null;