Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix reminders widget on android

Ammar Ahmede9a48ae02839
diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx
index 8646f3b92..1ee50a689 100644
--- a/apps/mobile/app/hooks/use-app-events.tsx
+++ b/apps/mobile/app/hooks/use-app-events.tsx
@@ -171,7 +171,7 @@ const onAppOpenedFromURL = async (event: { url: string }) => {
eSendEvent(eOnLoadNote, { newNote: true });
fluidTabsRef.current?.goToPage("editor", false);
return;
- } else if (url.startsWith("https://notesnook.com/open_note")) {
+ } else if (url.startsWith("https://app.notesnook.com/open_note")) {
const id = new URL(url).searchParams.get("id");
if (id) {
const note = await db.notes.note(id);
@@ -182,13 +182,13 @@ const onAppOpenedFromURL = async (event: { url: string }) => {
fluidTabsRef.current?.goToPage("editor", false);
}
}
- } else if (url.startsWith("https://notesnook.com/open_reminder")) {
+ } else if (url.startsWith("https://app.notesnook.com/open_reminder")) {
const id = new URL(url).searchParams.get("id");
if (id) {
const reminder = await db.reminders.reminder(id);
if (reminder) AddReminder.present(reminder);
}
- } else if (url.startsWith("https://notesnook.com/new_reminder")) {
+ } else if (url.startsWith("https://app.notesnook.com/new_reminder")) {
const reminderFeature = await isFeatureAvailable("activeReminders");
if (!reminderFeature.isAllowed) {
ToastManager.show({
@@ -780,13 +780,11 @@ export const useAppEvents = () => {
if (!isAppLoading && !appLocked) {
setTimeout(() => {
sub = AppState.addEventListener("change", onAppStateChanged);
- if (
- refValues.current.initialUrl &&
- !refValues.current.initialUrl?.includes("open_note")
- ) {
+ if (refValues.current.initialUrl) {
onAppOpenedFromURL({
url: refValues.current.initialUrl!
});
+ refValues.current.initialUrl = undefined;
}
}, 1000);
diff --git a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/NotePreviewWidget.java b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/NotePreviewWidget.java
index 9ebb4d993..341711fc3 100644
--- a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/NotePreviewWidget.java
+++ b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/NotePreviewWidget.java
@@ -33,7 +33,7 @@ public class NotePreviewWidget extends AppWidgetProvider {
intent.putExtra(OpenNoteId, note.getId());
intent.setAction(Intent.ACTION_VIEW);
intent.putExtra(RCTNNativeModule.IntentType, "OpenNote");
- intent.setData(Uri.parse("https://notesnook.com/open_note?id=" + note.getId()));
+ intent.setData(Uri.parse("https://app.notesnook.com/open_note?id=" + note.getId()));
PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE, getActivityOptionsBundle());
views.setOnClickPendingIntent(R.id.open_note, pendingIntent);
diff --git a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderViewsService.java b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderViewsService.java
index 126e372b1..5e9416e39 100644
--- a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderViewsService.java
+++ b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderViewsService.java
@@ -75,7 +75,7 @@ class ReminderRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactor
final Intent fillInIntent = new Intent();
final Bundle extras = new Bundle();
extras.putString(ReminderViewsService.OpenReminderId, reminder.getId());
- fillInIntent.setData(Uri.parse("https://notesnook.com/open_reminder?id=" + reminder.getId()));
+ fillInIntent.setData(Uri.parse("https://app.notesnook.com/open_reminder?id=" + reminder.getId()));
fillInIntent.putExtra(RCTNNativeModule.IntentType, "OpenReminder");
fillInIntent.putExtras(extras);
views.setOnClickFillInIntent(R.id.reminder_item_btn, fillInIntent);
diff --git a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderWidgetProvider.java b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderWidgetProvider.java
index 8c8300958..3ecd4daed 100644
--- a/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderWidgetProvider.java
+++ b/apps/mobile/native/android/app/src/main/java/com/streetwriters/notesnook/ReminderWidgetProvider.java
@@ -43,7 +43,7 @@ public class ReminderWidgetProvider extends AppWidgetProvider {
new_reminder_intent.putExtra(NewReminder, NewReminder);
new_reminder_intent.setAction(Intent.ACTION_VIEW);
new_reminder_intent.putExtra(RCTNNativeModule.IntentType, "NewReminder");
- new_reminder_intent.setData(Uri.parse("https://notesnook.com/new_reminder"));
+ new_reminder_intent.setData(Uri.parse("https://app.notesnook.com/new_reminder"));
PendingIntent pendingIntent2 = PendingIntent.getActivity(context, appWidgetId, new_reminder_intent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE, getActivityOptionsBundle());
views.setOnClickPendingIntent(R.id.add_button, pendingIntent2);
diff --git a/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout.xml b/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout.xml
index 242513009..a19296592 100644
--- a/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout.xml
+++ b/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout.xml
@@ -2,6 +2,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingVertical="10dp"
android:id="@+id/reminder_item_btn">
<TextView
diff --git a/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout_small.xml b/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout_small.xml
index 726feb47a..28ecb4c9e 100644
--- a/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout_small.xml
+++ b/apps/mobile/native/android/app/src/main/res/layout/widget_reminder_layout_small.xml
@@ -2,6 +2,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingVertical="10dp"
android:id="@+id/reminder_item_btn">
<TextView
diff --git a/apps/mobile/native/android/app/src/main/res/layout/widget_reminders.xml b/apps/mobile/native/android/app/src/main/res/layout/widget_reminders.xml
index 3dc921181..f7f25bf55 100644
--- a/apps/mobile/native/android/app/src/main/res/layout/widget_reminders.xml
+++ b/apps/mobile/native/android/app/src/main/res/layout/widget_reminders.xml
@@ -25,9 +25,9 @@
android:text="Upcoming Reminders"/>
<ImageButton
- android:layout_width="30dp"
+ android:layout_width="35dp"
android:id="@+id/add_button"
- android:layout_height="30dp"
+ android:layout_height="35dp"
android:layout_alignParentRight="true"
android:background="@drawable/ic_newnote" />
</RelativeLayout>