Skip to content

Commit

Permalink
Warning shawn when pinning a note with no notification permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed Mar 10, 2024
1 parent 47c1f6e commit 018c585
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import static java.lang.Long.parseLong;

import android.Manifest;
import android.Manifest.permission;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.PendingIntent;
Expand Down Expand Up @@ -109,6 +110,7 @@
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.activity.result.contract.ActivityResultContracts.RequestPermission;
import androidx.core.util.Pair;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentTransaction;
Expand All @@ -126,6 +128,7 @@
import it.feio.android.checklistview.models.ChecklistManager;
import it.feio.android.omninotes.async.AttachmentTask;
import it.feio.android.omninotes.async.bus.NotesUpdatedEvent;
import it.feio.android.omninotes.async.bus.NotificationsGrantedEvent;
import it.feio.android.omninotes.async.bus.PushbulletReplyEvent;
import it.feio.android.omninotes.async.bus.SwitchFragmentEvent;
import it.feio.android.omninotes.async.notes.NoteProcessorDelete;
Expand Down Expand Up @@ -1864,6 +1867,11 @@ public void onAnimationEnd(Animation animation) {
* Pin note as ongoing notifications
*/
private void pinNote() {
if (!new NotificationsHelper(getAppContext()).checkNotificationsEnabled(getAppContext())) {
mainActivity.showToast(getText(R.string.denied_notifications_permission), Toast.LENGTH_LONG);
return;
}

PendingIntent notifyIntent = IntentHelper
.getNotePendingIntent(getContext(), SnoozeActivity.class, ACTION_PINNED, note);

Expand Down
2 changes: 2 additions & 0 deletions omniNotes/src/main/res/raw/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
changeDate="Mar 8, 2024"
versionName="6.3.2">
<changelogtext>[b]Happy Women Day!![/b]</changelogtext>
<changelogtext>[i]Improved![/i] When trying to pin a note without notifications permissions enabled a message will be shown</changelogtext>
<changelogtext>[i]Improved![/i] Updated Gradle build tools to 8.3.0</changelogtext>
<changelogtext>[u]Fix[/u] Protected notes are no more searchable nor their tags (from content) will appear anywhere content's secrecy (thanks to [a href='https://github.com/XYIheng']Yiheng Xiong[/a])</changelogtext>
</changelogversion>

Expand Down

0 comments on commit 018c585

Please sign in to comment.