Some changes

This commit is contained in:
tom79 2019-11-23 11:00:23 +01:00
parent d529a77995
commit 857d5e4fbe
7 changed files with 45 additions and 61 deletions

View File

@ -40,9 +40,9 @@
<img src="./images/device-2019-02-02-114910.png" width="250">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Lead developer: [framapiaf.org/@fedilab](https://framapiaf.org/@fedilab)
Lead developer: [toot.fedilab.app/@fedilab](https://toot.fedilab.app/@fedilab)
<br>
Developer: [mastodon.social/@kasun](https://mastodon.social/@kasun)
Developer: [toot.fedilab.app/@kasun](https://toot.fedilab.app/@kasun)
## Backers

View File

@ -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

View File

@ -340,6 +340,7 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
@Override
public void afterTextChanged(Editable s) {
if (status != null) {
status.setQuickReplyContent(s.toString());
}

View File

@ -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<Status> tmp_status = parseStatuses(context, new JSONArray(response));

View File

@ -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<Account> 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<Status> 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;

View File

@ -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) {

View File

@ -255,7 +255,7 @@ public class AccountDAO {
public List<Account> 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;