Skip to content

Commit

Permalink
Fixed the Send Notification issue and updated Navigation file
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek-01k committed Jul 31, 2024
1 parent 59a670c commit e13cd9e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/components/channel/NotificationSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import useModalBlur, { MODAL_POSITION } from 'hooks/useModalBlur';
import { ChannelSetting } from 'helpers/channel/types';
import { updateChannelSetting } from 'redux/slices/channelSlice';
import { NotificationSetting } from '@pushprotocol/restapi/src/lib/pushNotification/PushNotificationTypes';
import { useGetChannelDetails } from 'queries';

// Constants
const CORE_CHAIN_ID = appConfig.coreContractChain;
Expand All @@ -49,6 +50,8 @@ function NotificationSettings() {
const [isLoadingSettings, setIsLoadingSettings] = useState(true);
const { handleConnectWalletAndEnableProfile } = useContext(AppContext);

const { refetch: refetchChannelDetails } = useGetChannelDetails(account);

const { userPushSDKInstance } = useSelector((state: any) => {
return state.user;
});
Expand Down Expand Up @@ -216,7 +219,7 @@ function NotificationSettings() {
/>
),
});

refetchChannelDetails();
// Go back to channel dashboard
setTimeout(() => goBack(), 2000);
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const SendNotificationForm: FC<SendNotificationFormProps> = ({ channelDetails })
handleSendNotification(values);
},
});
const selectedChannel = delegatees?.find(
(delegatee: ChannelDetails) => delegatee.channel === formik.values.channelAddress
);
const selectedChannel =
delegatees?.find((delegatee: ChannelDetails) => delegatee.channel === formik.values.channelAddress) ||
channelDetails;
const alaisChainOptions = getSelectChains(getChannelChainList(selectedChannel));

const showPreview = formik.values.body || formik.values.title || formik.values.ctaLink || formik.values.mediaUrl;
Expand Down
3 changes: 2 additions & 1 deletion src/structure/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ function Navigation() {
}, [canSend, channelDetails, navigationSetup, processingState, account]);

useEffect(() => {
console.debug(channelDetails, 'channelDetials');
if (processingState !== 0) {
dispatch(setCanSend(SEND_NOTIFICATION_STATES.LOADING));
} else {
if (isAliasVerified || (delegatees && delegatees.length > 0)) {
if (isAliasVerified || (delegatees && delegatees.length > 0) || channelDetails) {
dispatch(setCanSend(SEND_NOTIFICATION_STATES.SEND));
} else {
dispatch(setCanSend(SEND_NOTIFICATION_STATES.HIDE));
Expand Down

0 comments on commit e13cd9e

Please sign in to comment.