Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

Commit b190480

Browse files
committed
add push post notifications
closes #93
1 parent 9a085be commit b190480

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java

+2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ public void onCreate(Bundle savedInstanceState){
144144
items.add(new SwitchItem(R.string.notify_follow, R.drawable.ic_fluent_person_add_24_regular, pushSubscription.alerts.follow, i->onNotificationsChanged(PushNotification.Type.FOLLOW, i.checked)));
145145
items.add(new SwitchItem(R.string.notify_reblog, R.drawable.ic_fluent_arrow_repeat_all_24_regular, pushSubscription.alerts.reblog, i->onNotificationsChanged(PushNotification.Type.REBLOG, i.checked)));
146146
items.add(new SwitchItem(R.string.notify_mention, R.drawable.ic_at_symbol, pushSubscription.alerts.mention, i->onNotificationsChanged(PushNotification.Type.MENTION, i.checked)));
147+
items.add(new SwitchItem(R.string.sk_notify_posts, R.drawable.ic_fluent_alert_24_regular, pushSubscription.alerts.status, i->onNotificationsChanged(PushNotification.Type.STATUS, i.checked)));
147148

148149
items.add(new HeaderItem(R.string.settings_boring));
149150
items.add(new TextItem(R.string.settings_account, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/auth/edit")));
@@ -293,6 +294,7 @@ private void onNotificationsChanged(PushNotification.Type type, boolean enabled)
293294
case FOLLOW -> subscription.alerts.follow=enabled;
294295
case REBLOG -> subscription.alerts.reblog=enabled;
295296
case MENTION -> subscription.alerts.mention=subscription.alerts.poll=enabled;
297+
case STATUS -> subscription.alerts.status=enabled;
296298
}
297299
needUpdateNotificationSettings=true;
298300
}

mastodon/src/main/java/org/joinmastodon/android/model/PushNotification.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public enum Type{
4343
@SerializedName("follow")
4444
FOLLOW(R.string.notification_type_follow),
4545
@SerializedName("poll")
46-
POLL(R.string.notification_type_poll);
46+
POLL(R.string.notification_type_poll),
47+
@SerializedName("status")
48+
STATUS(R.string.sk_notification_type_status);
4749

4850
@StringRes
4951
public final int localizedName;

mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ public static class Alerts implements Cloneable{
4343
public boolean reblog;
4444
public boolean mention;
4545
public boolean poll;
46+
public boolean status;
4647

4748
public static Alerts ofAll(){
4849
Alerts alerts=new Alerts();
49-
alerts.follow=alerts.favourite=alerts.reblog=alerts.mention=alerts.poll=true;
50+
alerts.follow=alerts.favourite=alerts.reblog=alerts.mention=alerts.poll=alerts.status=true;
5051
return alerts;
5152
}
5253

@@ -58,6 +59,7 @@ public String toString(){
5859
", reblog="+reblog+
5960
", mention="+mention+
6061
", poll="+poll+
62+
", status="+status+
6163
'}';
6264
}
6365

mastodon/src/main/res/values/strings_sk.xml

+2
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@
3838
<string name="sk_disable_marquee">Disable scrolling text in title bars</string>
3939
<string name="sk_settings_contribute">Contribute to Megalodon</string>
4040
<string name="sk_settings_show_federated_timeline">Show federated timeline</string>
41+
<string name="sk_notification_type_status">Posts</string>
42+
<string name="sk_notify_posts">Post notifications</string>
4143
</resources>

0 commit comments

Comments
 (0)