Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: JS Android Notifications #1214

Merged
merged 14 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import { privySecureStorage } from "./utils/keychain/helpers";
import { initSentry } from "./utils/sentry";
import "./utils/splash/splash";
import "./features/notifications/utils";

LogBox.ignoreLogs([
"Privy: Expected status code 200, received 400", // Privy
Expand Down Expand Up @@ -79,10 +80,10 @@
}, []);

const showDebugMenu = useCallback(() => {
if (!debugRef.current || !(debugRef.current as any).showDebugMenu) {

Check warning on line 83 in App.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return;
}
(debugRef.current as any).showDebugMenu();

Check warning on line 86 in App.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
}, []);

useEffect(() => {
Expand Down Expand Up @@ -140,7 +141,7 @@
const AppKeyboardProvider =
Platform.OS === "ios" ? KeyboardProvider : React.Fragment;

export default function AppWithProviders() {

Check warning on line 144 in App.tsx

View workflow job for this annotation

GitHub Actions / lint

Prefer named exports
const colorScheme = useColorScheme();

const paperTheme = useMemo(() => {
Expand All @@ -158,7 +159,7 @@
<ActionSheetProvider>
<ThemeProvider value={{ themeScheme, setThemeContextOverride }}>
<PaperProvider theme={paperTheme}>
<GestureHandlerRootView style={{ flex: 1 }}>

Check warning on line 162 in App.tsx

View workflow job for this annotation

GitHub Actions / lint

Inline style: { flex: 1 }
<BottomSheetModalProvider>
<PortalProvider>
<App />
Expand Down
8 changes: 4 additions & 4 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/49a65fae-3895-4487-8e8a-5bd8bee3a401"/>
<meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/ic_default_expo_notifications"/>
<meta-data android:name="expo.modules.notifications.default_notification_color" android:resource="@color/notification_icon_color"/>
<!-- <meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/ic_default_expo_notifications"/>-->
<!-- <meta-data android:name="expo.modules.notifications.default_notification_color" android:resource="@color/notification_icon_color"/>-->
Comment on lines +64 to +65
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Missing notification styling configuration after migration to Notifee

The codebase shows a transition from Expo notifications to Notifee, but the notification styling (icon and color) configurations are missing in the new implementation. While the default Expo notification resources exist (ic_default_expo_notifications.png), they are not being utilized in the Notifee setup. This needs to be addressed to ensure proper notification appearance:

  • features/notifications/utils/setupAndroidNotificationChannel.ts: Channel creation lacks icon and color configurations
  • features/notifications/utils/background/groupMessageNotification.ts: Notification display lacks smallIcon and color settings in the android configuration

Required actions:

  1. Add smallIcon configuration in the android options when displaying notifications
  2. Configure notification color using color property in android options
  3. Either reuse existing notification icons or add new ones for Notifee
🔗 Analysis chain

Verify notification appearance after removing default settings

The default notification icon and color settings are being removed. Please ensure that:

  1. A replacement mechanism is in place for setting notification icons and colors
  2. All notifications still appear with appropriate styling across different Android versions

Run the following to check for alternative notification styling implementations:


Let me check the content of the notification channel setup files to verify if there's proper configuration for notification styling.


Let me check how notifications are being displayed with Notifee since the code shows a transition from Expo notifications to Notifee.


Let me check if there are any Notifee-specific icon and color configurations in the notification display code.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for alternative notification styling implementations
echo "Checking for Notifee configuration..."
rg -l "notifee.*icon|notifee.*color" --type js --type ts

echo "Checking for direct notification channel configurations..."
rg -l "createChannel|NotificationChannel" --type js --type ts

echo "Checking for notification-related resources..."
fd -e xml -e png -e jpg "ic_notification|notification" android/app/src/main/res/

Length of output: 1228


Script:

#!/bin/bash
# Check notification channel setup implementation
echo "Content of setupAndroidNotificationChannel.ts:"
cat features/notifications/utils/setupAndroidNotificationChannel.ts

echo -e "\nChecking for icon/color configurations in notification handling:"
rg -A 5 "createNotificationChannel|NotificationChannel" features/notifications/utils/

Length of output: 6210


Script:

#!/bin/bash
# Check notification display implementation
echo "Checking Notifee notification display configurations:"
rg -A 10 "notifee\.display" features/notifications/

echo -e "\nChecking background notification handling:"
rg -A 10 "displayNotification" features/notifications/utils/background/

Length of output: 2399


Script:

#!/bin/bash
# Search for Notifee icon and color configurations
echo "Checking for Notifee icon and color settings in notification display:"
rg -A 15 "android: \{" features/notifications/utils/background/

echo -e "\nChecking for any Notifee default settings:"
rg -A 5 "notifee\.setDefaultSettings" features/notifications/

Length of output: 1155

<meta-data android:name="io.sentry.dsn" android:value="https://fb7c7cbf876644b68a05db08623c8369@o4504757119680512.ingest.sentry.io/4504757120729088"/>
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="false"/>
<meta-data android:name="io.sentry.attach-screenshot" android:value="false"/>
Expand Down Expand Up @@ -96,10 +96,10 @@
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
<service android:name=".PushNotificationsService" android:enabled="true" android:exported="false">
<!-- <service android:name=".PushNotificationsService" android:enabled="true" android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
</service> -->
</application>
</manifest>
55 changes: 0 additions & 55 deletions android/app/src/main/java/com/converse/AsyncStorage.kt

This file was deleted.

71 changes: 0 additions & 71 deletions android/app/src/main/java/com/converse/BackendApi.kt

This file was deleted.

23 changes: 0 additions & 23 deletions android/app/src/main/java/com/converse/Datatypes.kt

This file was deleted.

25 changes: 0 additions & 25 deletions android/app/src/main/java/com/converse/Keychain.kt

This file was deleted.

140 changes: 0 additions & 140 deletions android/app/src/main/java/com/converse/MessageNotification.kt

This file was deleted.

Loading
Loading