Fix issue for stopping delayed/live notifications
This commit is contained in:
parent
59bc06c77c
commit
c7a7b8cc82
|
@ -6,5 +6,7 @@ Added
|
||||||
|
|
||||||
Fixed
|
Fixed
|
||||||
- Issue with polls not displayed
|
- Issue with polls not displayed
|
||||||
|
- Notifications not stopped
|
||||||
- Pleroma wysiwyg
|
- Pleroma wysiwyg
|
||||||
|
- Login issue
|
||||||
- Some crashes
|
- Some crashes
|
|
@ -1408,43 +1408,34 @@ public class ContentSettingsFragment extends Fragment implements OnRetrieveRemot
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
if (liveNotificationCount > 0) {
|
if (liveNotificationCount > 0) {
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
|
||||||
|
context.sendBroadcast(new Intent(context, StopLiveNotificationReceiver.class));
|
||||||
|
context.sendBroadcast(new Intent(context, StopDelayedNotificationReceiver.class));
|
||||||
|
ApplicationJob.cancelAllJob(NotificationsSyncJob.NOTIFICATION_REFRESH);
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case Helper.NOTIF_LIVE:
|
case Helper.NOTIF_LIVE:
|
||||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
|
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, true);
|
||||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false);
|
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false);
|
||||||
live_notif_per_account.setVisibility(View.VISIBLE);
|
live_notif_per_account.setVisibility(View.VISIBLE);
|
||||||
editor.apply();
|
editor.commit();
|
||||||
context.sendBroadcast(new Intent(context, StopDelayedNotificationReceiver.class));
|
set_live_type_indication.setText(R.string.live_notif_indication);
|
||||||
ApplicationJob.cancelAllJob(NotificationsSyncJob.NOTIFICATION_REFRESH);
|
Helper.startStreaming(context);
|
||||||
break;
|
break;
|
||||||
case Helper.NOTIF_DELAYED:
|
case Helper.NOTIF_DELAYED:
|
||||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, true);
|
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, true);
|
||||||
live_notif_per_account.setVisibility(View.VISIBLE);
|
live_notif_per_account.setVisibility(View.VISIBLE);
|
||||||
context.sendBroadcast(new Intent(context, StopLiveNotificationReceiver.class));
|
set_live_type_indication.setText(R.string.set_live_type_indication);
|
||||||
editor.apply();
|
editor.commit();
|
||||||
ApplicationJob.cancelAllJob(NotificationsSyncJob.NOTIFICATION_REFRESH);
|
Helper.startStreaming(context);
|
||||||
break;
|
break;
|
||||||
case Helper.NOTIF_NONE:
|
case Helper.NOTIF_NONE:
|
||||||
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
editor.putBoolean(Helper.SET_LIVE_NOTIFICATIONS, false);
|
||||||
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false);
|
editor.putBoolean(Helper.SET_DELAYED_NOTIFICATIONS, false);
|
||||||
live_notif_per_account.setVisibility(View.GONE);
|
editor.commit();
|
||||||
context.sendBroadcast(new Intent(context, StopLiveNotificationReceiver.class));
|
|
||||||
context.sendBroadcast(new Intent(context, StopDelayedNotificationReceiver.class));
|
|
||||||
NotificationsSyncJob.schedule(false);
|
|
||||||
editor.apply();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Helper.startStreaming(context);
|
|
||||||
switch (Helper.liveNotifType(context)) {
|
|
||||||
case Helper.NOTIF_LIVE:
|
|
||||||
set_live_type_indication.setText(R.string.live_notif_indication);
|
|
||||||
break;
|
|
||||||
case Helper.NOTIF_DELAYED:
|
|
||||||
set_live_type_indication.setText(R.string.set_live_type_indication);
|
|
||||||
break;
|
|
||||||
case Helper.NOTIF_NONE:
|
|
||||||
set_live_type_indication.setText(R.string.no_live_indication);
|
set_live_type_indication.setText(R.string.no_live_indication);
|
||||||
|
live_notif_per_account.setVisibility(View.GONE);
|
||||||
|
NotificationsSyncJob.schedule(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -4696,9 +4696,7 @@ public class Helper {
|
||||||
} else {
|
} else {
|
||||||
context.startService(streamingIntent);
|
context.startService(streamingIntent);
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {}
|
||||||
ignored.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,9 @@ public class LiveNotificationDelayedService extends Service {
|
||||||
assert notificationManager != null;
|
assert notificationManager != null;
|
||||||
notificationManager.deleteNotificationChannel(CHANNEL_ID);
|
notificationManager.deleteNotificationChannel(CHANNEL_ID);
|
||||||
}
|
}
|
||||||
|
if (intent != null) {
|
||||||
|
intent.replaceExtras(new Bundle());
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
if (totalAccount > 0) {
|
if (totalAccount > 0) {
|
||||||
|
|
|
@ -185,6 +185,9 @@ public class LiveNotificationService extends Service implements NetworkStateRece
|
||||||
assert notificationManager != null;
|
assert notificationManager != null;
|
||||||
notificationManager.deleteNotificationChannel(CHANNEL_ID);
|
notificationManager.deleteNotificationChannel(CHANNEL_ID);
|
||||||
}
|
}
|
||||||
|
if (intent != null) {
|
||||||
|
intent.replaceExtras(new Bundle());
|
||||||
|
}
|
||||||
stopSelf();
|
stopSelf();
|
||||||
}
|
}
|
||||||
if (totalAccount > 0) {
|
if (totalAccount > 0) {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Thomas on 18/10/2019.
|
* Created by Thomas on 18/10/2019.
|
||||||
* BroadcastReceiver for restarting delayed notification service
|
* BroadcastReceiver for restarting delayed notification service
|
||||||
|
|
Loading…
Reference in New Issue