diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java b/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java index 5fb60003..8dca0705 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/api/mastodon/Mastodon.java @@ -1120,6 +1120,7 @@ public class Mastodon implements Connection { @Override public WebPush updatePush(PushUpdate pushUpdate) throws ConnectionException { try { + // initialize encryption as required by Mastodon API (but not used yet) KeyPairGenerator generator = KeyPairGenerator.getInstance("EC"); ECGenParameterSpec spec = new ECGenParameterSpec("prime256v1"); generator.initialize(spec); @@ -1131,27 +1132,19 @@ public class Mastodon implements Connection { String pushPrivateKey = Base64.encodeToString(privKeyData, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING); String pushPublicKey = Base64.encodeToString(pubKeyData, Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING); String randomString = StringUtils.getRandomString(); - + // List params = new ArrayList<>(); params.add("subscription[endpoint]=" + StringUtils.encode(pushUpdate.getHost())); params.add("subscription[keys][p256dh]=" + encodedPublicKey); params.add("subscription[keys][auth]=" + randomString); - if (pushUpdate.mentionsEnabled()) - params.add("data[alerts][mention]=true"); - if (pushUpdate.favoriteEnabled()) - params.add("data[alerts][favourite]=true"); - if (pushUpdate.repostEnabled()) - params.add("data[alerts][reblog]=true"); - if (pushUpdate.followEnabled()) - params.add("data[alerts][follow]=true"); - if (pushUpdate.followRequestEnabled()) - params.add("data[alerts][follow_request]=true"); - if (pushUpdate.pollEnabled()) - params.add("data[alerts][poll]=true"); - if (pushUpdate.statusPostEnabled()) - params.add("data[alerts][status]=true"); - if (pushUpdate.statusEditEnabled()) - params.add("data[alerts][update]=true"); + params.add("data[alerts][mention]=" + pushUpdate.mentionsEnabled()); + params.add("data[alerts][favourite]=" + pushUpdate.favoriteEnabled()); + params.add("data[alerts][reblog]=" + pushUpdate.repostEnabled()); + params.add("data[alerts][follow]=" + pushUpdate.followEnabled()); + params.add("data[alerts][follow_request]=" + pushUpdate.followRequestEnabled()); + params.add("data[alerts][poll]=" + pushUpdate.pollEnabled()); + params.add("data[alerts][status]=" + pushUpdate.statusPostEnabled()); + params.add("data[alerts][update]=" + pushUpdate.statusEditEnabled()); if (pushUpdate.getPolicy() == WebPush.POLICY_ALL) params.add("data[policy]=all"); else if (pushUpdate.getPolicy() == WebPush.POLICY_FOLLOWER) diff --git a/app/src/main/java/org/nuclearfog/twidda/backend/utils/AppStyles.java b/app/src/main/java/org/nuclearfog/twidda/backend/utils/AppStyles.java index 4226411d..f394940c 100644 --- a/app/src/main/java/org/nuclearfog/twidda/backend/utils/AppStyles.java +++ b/app/src/main/java/org/nuclearfog/twidda/backend/utils/AppStyles.java @@ -366,7 +366,7 @@ public class AppStyles { sw.setThumbColor(new ColorStateList(SWITCH_STATES, thumbColor)); } else if (child instanceof FloatingActionButton) { FloatingActionButton floatingButton = (FloatingActionButton) child; - floatingButton.setBackgroundTintList(ColorStateList.valueOf(settings.getHighlightColor())); + floatingButton.setBackgroundTintList(ColorStateList.valueOf(settings.getPopupColor())); setDrawableColor(floatingButton, settings.getIconColor()); } else if (child instanceof SeekBar) { SeekBar seekBar = (SeekBar) child; diff --git a/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java b/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java index d1e6cab1..86826c32 100644 --- a/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java +++ b/app/src/main/java/org/nuclearfog/twidda/config/GlobalSettings.java @@ -68,7 +68,7 @@ public class GlobalSettings { private static final String INDEX_SCALE = "index_scale"; private static final String LIST_SIZE = "preload"; private static final String IMAGE_LOAD = "image_load"; - private static final String TWEET_INDICATOR = "tweet_indicator"; + private static final String STATUS_ICONS = "tweet_indicator"; private static final String PROFILE_OVERLAP = "profile_toolbar_overlap"; private static final String PROXY_SET = "proxy_enabled"; private static final String AUTH_SET = "proxy_auth_set"; @@ -143,7 +143,7 @@ public class GlobalSettings { private boolean isProxyAuthSet; private boolean proxyWarning; private boolean toolbarOverlap; - private boolean tweetIndicators; + private boolean showStatusIcons; private boolean filterResults; private boolean enableLike; private boolean localOnly; @@ -155,7 +155,7 @@ public class GlobalSettings { private int card_color; private int icon_color; private int popup_color; - private int retweet_color; + private int repost_color; private int favorite_color; private int request_color; private int follow_color; @@ -341,21 +341,21 @@ public class GlobalSettings { } /** - * get retweet icon color + * get repost icon color * * @return icon color */ public int getRepostIconColor() { - return retweet_color; + return repost_color; } /** - * set retweet icon color (enabled) + * set repost icon color (enabled) * * @param color icon color */ public void setRepostIconColor(int color) { - retweet_color = color; + repost_color = color; Editor edit = settings.edit(); edit.putInt(RT_COLOR, color); @@ -416,7 +416,7 @@ public class GlobalSettings { background_color, font_color, popup_color, highlight_color, card_color, icon_color, - retweet_color, favorite_color, + repost_color, favorite_color, request_color, follow_color }; } @@ -488,22 +488,22 @@ public class GlobalSettings { } /** - * @return true if status indicators enabled + * @return true if status attachment icons enabled */ public boolean statusIndicatorsEnabled() { - return tweetIndicators; + return showStatusIcons; } /** - * enable/disable status indicators + * enable/disable status attachment icons * - * @param enable true to enable tweet indicators + * @param enable true to enable icons */ public void enableStatusIndicators(boolean enable) { - tweetIndicators = enable; + showStatusIcons = enable; Editor edit = settings.edit(); - edit.putBoolean(TWEET_INDICATOR, enable); + edit.putBoolean(STATUS_ICONS, enable); edit.apply(); } @@ -608,18 +608,18 @@ public class GlobalSettings { /** - * get loading limit of tweets/users + * get max list size to load online/offline * - * @return max numbers of tweets/users should be loaded + * @return max list size to load */ public int getListSize() { return listSize; } /** - * set limit of tweets/users + * set max list size to load online/offline * - * @param listSize max numbers of tweets/users + * @param listSize max list size to load */ public void setListSize(int listSize) { this.listSize = listSize; @@ -1005,7 +1005,7 @@ public class GlobalSettings { popup_color = settings.getInt(POPUP_COLOR, DEFAULT_POPUP_COLOR); card_color = settings.getInt(CARD_COLOR, DEFAULT_CARD_COLOR); icon_color = settings.getInt(ICON_COLOR, DEFAULT_ICON_COLOR); - retweet_color = settings.getInt(RT_COLOR, DEFAULT_RT_ICON_COLOR); + repost_color = settings.getInt(RT_COLOR, DEFAULT_RT_ICON_COLOR); favorite_color = settings.getInt(FV_COLOR, DEFAULT_FV_ICON_COLOR); request_color = settings.getInt(F_REQ_COLOR, DEFAULT_FR_ICON_COLOR); follow_color = settings.getInt(FOLLOW_COLOR, DEFAULT_FW_ICON_COLOR); @@ -1017,7 +1017,7 @@ public class GlobalSettings { loggedIn = settings.getBoolean(LOGIN_ENABLED, false); push_enabled = settings.getBoolean(PUSH_ENABLED, false); loadImage = settings.getBoolean(IMAGE_LOAD, true); - tweetIndicators = settings.getBoolean(TWEET_INDICATOR, true); + showStatusIcons = settings.getBoolean(STATUS_ICONS, true); toolbarOverlap = settings.getBoolean(PROFILE_OVERLAP, true); filterResults = settings.getBoolean(FILTER_RESULTS, true); enableLike = settings.getBoolean(ENABLE_LIKE, false);