Skip to content

Commit

Permalink
Remove notification permission nag (#7489)
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteHamster authored Nov 10, 2024
1 parent 26c0dea commit ae58f21
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 150 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package de.danoeh.antennapod.ui.screen.home;

import android.Manifest;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
Expand All @@ -13,7 +10,6 @@
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentContainerView;
import de.danoeh.antennapod.R;
Expand All @@ -26,7 +22,6 @@
import de.danoeh.antennapod.storage.database.DBReader;
import de.danoeh.antennapod.ui.echo.EchoConfig;
import de.danoeh.antennapod.ui.screen.SearchFragment;
import de.danoeh.antennapod.ui.screen.home.sections.AllowNotificationsSection;
import de.danoeh.antennapod.ui.screen.home.sections.DownloadsSection;
import de.danoeh.antennapod.ui.screen.home.sections.EchoSection;
import de.danoeh.antennapod.ui.screen.home.sections.EpisodesSurpriseSection;
Expand Down Expand Up @@ -54,7 +49,6 @@ public class HomeFragment extends Fragment implements Toolbar.OnMenuItemClickLis

public static final String TAG = "HomeFragment";
public static final String PREF_NAME = "PrefHomeFragment";
public static final String PREF_DISABLE_NOTIFICATION_PERMISSION_NAG = "DisableNotificationPermissionNag";
public static final String PREF_HIDE_ECHO = "HideEcho";

private static final String KEY_UP_ARROW = "up_arrow";
Expand Down Expand Up @@ -88,12 +82,6 @@ private void populateSectionList() {
viewBinding.homeContainer.removeAllViews();

SharedPreferences prefs = getContext().getSharedPreferences(HomeFragment.PREF_NAME, Context.MODE_PRIVATE);
if (Build.VERSION.SDK_INT >= 33 && ContextCompat.checkSelfPermission(getContext(),
Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
if (!prefs.getBoolean(HomeFragment.PREF_DISABLE_NOTIFICATION_PERMISSION_NAG, false)) {
addSection(new AllowNotificationsSection());
}
}
if (Calendar.getInstance().get(Calendar.YEAR) == EchoConfig.RELEASE_YEAR
&& Calendar.getInstance().get(Calendar.MONTH) == Calendar.DECEMBER
&& Calendar.getInstance().get(Calendar.DAY_OF_MONTH) >= 10
Expand Down

This file was deleted.

66 changes: 0 additions & 66 deletions app/src/main/res/layout/home_section_notification.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,9 @@ private void displayStreamingNotAllowedNotification(Intent originalIntent) {
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.POST_NOTIFICATIONS)
== PackageManager.PERMISSION_GRANTED) {
notificationManager.notify(R.id.notification_streaming_confirmation, builder.build());
} else {
Toast.makeText(getApplicationContext(),
R.string.confirm_mobile_streaming_notification_message, Toast.LENGTH_LONG).show();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
Expand Down Expand Up @@ -122,6 +123,8 @@ private void showErrorNotification(Exception exception) {
if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.POST_NOTIFICATIONS)
== PackageManager.PERMISSION_GRANTED) {
nm.notify(R.id.notification_id_backup_error, notification);
} else {
Toast.makeText(getApplicationContext(), description, Toast.LENGTH_LONG).show();
}
}
}
4 changes: 0 additions & 4 deletions ui/i18n/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@
<string name="home_downloads_empty_text">You can download any episode to listen to it offline.</string>
<string name="home_welcome_title">Welcome to AntennaPod!</string>
<string name="home_welcome_text">You are not subscribed to any podcasts yet. Open the side menu to add a podcast.</string>
<string name="notification_permission_text">AntennaPod needs your permission to show notifications. By default, AntennaPod only shows notifications while something is being downloaded or when something goes wrong.</string>
<string name="notification_permission_denied">You denied the permission.</string>
<string name="notification_permission_deny_warning">If you disable notifications and something goes wrong, you might be unable to find out why it went wrong.</string>
<string name="deny_label">Deny</string>
<string name="open_settings">Open settings</string>
<string name="configure_home">Configure Home Screen</string>
<string name="section_hidden">Hidden</string>
<string name="section_shown">Shown</string>
Expand Down

0 comments on commit ae58f21

Please sign in to comment.