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

fix: added channel setting parse logic #1107

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

akp111
Copy link
Collaborator

@akp111 akp111 commented Feb 9, 2024

Fixes Issue

Changes proposed

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

Screenshots

Note to reviewers

Copy link

github-actions bot commented Feb 9, 2024

File: packages/restapi/src/lib/channels/getChannel.ts

  1. In the import statement, the "parseSettings" function is imported from the "../utils/parseSettings" module, but the file name is misspelled as "packages/restapi/src/lib/utils/parseSettigns". It should be corrected to "../utils/parseSettings".

  2. Inside the "getChannel" function, the "else" block of the "if(raw)" condition is missing a return statement. It should be added to return the modified "response.data" object.

  3. In the catch block of the "getChannel" function, instead of using console.error, the error should be thrown. The catch block should be modified as follows:

.catch((err) => {
  throw new Error(`[Push SDK] - API ${requestUrl}: ${err}`);
});

File: packages/restapi/src/lib/pushNotification/PushNotificationTypes.ts

  1. The last section of the file is missing closing braces for the "NotificationOptions", "CreateChannelOptions", "NotificationSetting", "NotificationSettings", and "ChannelOptions" types. They should be added as follows:
export type NotificationOptions = {
  notification: INotification;
  payload?: IPayload;
  config?: IConfig;
  advanced?: IAdvance;
  channel?: string;
};

export type CreateChannelOptions = {
  name: string;
  description: string;
  icon: string;
  url: string;
  alias?: string;
  progressHook?: (progress: ProgressHookType) => void;
};

export type NotificationSetting = {
  type: number;
  default: number | { upper: number; lower: number };
  data?: {
    upper: number;
    lower: number;
    enabled?: boolean;
    ticker?: number;
  };
};

export type NotificationSettings = NotificationSetting[];

export type ChannelOptions = {
  raw: boolean;
};

File: packages/restapi/src/lib/pushNotification/channel.ts

  1. There is a typo in the import statement. The module name is "viem" but it should be "wien". It should be corrected as follows:
import * as wien from 'wien';
  1. Inside the "Channel" class, the import statements for the "ChannelInfoOptions", "ChannelSearchOptions", "NotificationOptions", "CreateChannelOptions", "NotificationSettings", and "ChannelOptions" types are missing closing braces. They should be added as follows:
import {
  ChannelInfoOptions,
  ChannelSearchOptions,
  NotificationOptions,
  CreateChannelOptions,
  NotificationSettings,
  ChannelOptions,
} from './PushNotificationTypes';

File: packages/restapi/src/lib/types/index.ts

  1. The import statement for the "VideoNotificationRules" interface is missing the "./" prefix. It should be corrected as follows:
import { VideoNotificationRules } from './VideoNotificationRules';
  1. The import statement for the "ISendNotificationInputOptions" interface is missing the "./" prefix. It should be corrected as follows:
import { ISendNotificationInputOptions } from './ISendNotificationInputOptions';
  1. In the "ParsedResponseType" type, the spelling of "userPreferance" should be corrected to "userPreference".

  2. In the "NotificationSettingType" type, the spelling of "userPreferance" should be corrected to "userPreference".

  3. The "ApiSubscribersType" interface is missing a closing brace. It should be added as follows:

export interface ApiSubscribersType {
  itemcount: number;
  subscribers: {
    subscriber: string;
    settings: string | null;
  }[];
}
  1. The "VideoNotificationRules" interface is missing a closing brace. It should be added as follows:
export interface VideoNotificationRules {
  access: {
    type: VIDEO_NOTIFICATION_ACCESS_TYPE;
    data: {
      chatId?: string;
    };
  };
}
  1. The "SendNotificationRules" type is missing a closing brace. It should be added as follows:
export type SendNotificationRules = VideoNotificationRules;

File: packages/restapi/src/lib/utils/parseSettings.ts

  1. The import statement for the "NotificationSettingType" type is missing the "../types/index" module. It should be added as follows:
import { NotificationSettingType } from '../types/index';
  1. The "data" property in the "setting" object of the "if (setting.type == 2)" block is missing a closing brace. It should be added as follows:
data: {
  upper: setting.upperLimit,
  lower: setting.lowerLimit,
  ticker: setting.ticker ?? 1,
},
enabled: setting.enabled,
  1. The "parseSettings" function is missing a closing brace. It should be added at the end of the file.

File: packages/restapi/tests/lib/notification/channel.test.ts

  1. The import statement for the "ethers" module is missing a closing brace. It should be added as follows:
import { ethers } from 'ethers';
  1. The import statement for the "ethers" module is missing the "./" prefix. It should be corrected as follows:
import { ethers } from './ethers';
  1. The import statement for the "ProgressHookType" and "ProgressHookTypeFunction" types is missing the "../types" module. It should be corrected as follows:
import {
  SignerType,
  ProgressHookType,
  ProgressHookTypeFunction,
} from '../types';
  1. There is a typo in the import statement. The "ChannelInfoOptions" type is imported from the wrong module. It should be corrected as follows:
import {
  ChannelInfoOptions,
  ChannelSearchOptions,
  Notification

@mohammeds1992 mohammeds1992 self-requested a review February 9, 2024 10:32
@mohammeds1992 mohammeds1992 merged commit 6d0d6d5 into main Feb 9, 2024
1 check passed
mishramonalisha76 added a commit that referenced this pull request Feb 13, 2024
* feat(video-v2): add highlevel video class

* feat(video): add video stream

* fix(sendnotification): modify rules.access.data to be an object & code cleanup

* fix(video): remove signer from input, throw err if signer, decrypted pgp key  not found

* feat(video): add sendNotification calls in connect, disconnect methods

* fix(videonotificationrules): typo in VideoNotificationRules interface

* add: useStream.ts video-v2-example-app

* add: videoV2.tsx in video-v2-example-app

* feat(video stream): handle connect, retry internally from the SDK

* feat(video connect): remove the connect method from the videov2 SDK

* fix(videov2): create push signer instance to get chain id in initialize()

* fix(videov2-example): refactor react example component & remove useStream hook

* fix(video stream): add backwards compatibilty to rules object for older SDK versions

* fix(video stream): fix bug in rules object creation

* fix(video stream): call connect() for ApproveVideo event

* feat(example-video-1.5): video v2  example app  implementation

* feat(sdk-frontend): few ui changes

* fix(video-v2-example-app): initialisevdeo call after a call ends

* feat(video stream): add request, deny evennt handlers

* feat(sdk-frontend and sdk-frontend-react): added video-v2 example implementation

* fix: few fixes

* refactor: refator and remove console logs

* fix: fix import error

* feat(video): update param names for video.initialize()

* fix: param name changes

* chore: added few comments

* chore: ui toast added

* fix(video example): remove pushprotocol sdk direct dir reference for initVideoCallData

* fix(video example): import React in examples & update SDK version in sdk-frontend

* feat(video example): replace video events from CONSTANTS obj

* Edited video example to make it more versatile

* Update index.js

* fix: fixed message parsing (#1051)

* Minor fixes and improvements in video v2 (#1062)

* feat(video v2): add VIDEO constants and types

* feat(video v2): modify approve, deny to use internally stored peerInfo

* fix(video constants): rename DEFAULT_DATA to INITIAL_DATA

* 1050 update video example implementation in sdk-frontend (#1070)

* fix: use latest imports in example app

* feat: use  latest rainbowkit library

* chore: use latest restapi package

* chore: remove unnecessary libs

* fix: fixed signer bug (#1073)

* fix: send intent in history and latest. (#1069)

* fix: send intent in history and latest.

* fix: get chat info API sdk changes

* fix: stream helper functions

* fix: caching implementation on user profile API (#1053)

* fix: caching implementation on user profile API

* fix: cache code review comments

* fix: fix public key in read mode (#1074)

* fix: added notification widget layout

* fix: fixed naming convention

* fix: added layout for hyperlink

* Pub key cache to speed up chat messages verification (#1081)

* fix: minor fixes

* fix: cache implementation for public keys

* fix: fix encV1 key decryption (#1088)

* fix: add benchamark tests, fix reference msgs' (#1089)

* fix: added resuables

* bolierplate examples

* bolierplate examples

* bolierplate examples

* fix: added connect button

* fix: fixed lint

* fix: v2 user creation / upgrades / downgrades (#1099)

* fix: fix v2 user

* test: remove only

* Add filter for subscription (#1102)

* fix: added parsing for settings

* fix: minor fixes

* fix: added manage notifiction

* fix: added channel setting parse logic (#1107)

* fix: fixed css

* added user downgrade example

* fix: fixed lint

* fix: fixed connect modal

* fix: added readmode

* fix: fixed readMode

---------

Co-authored-by: Madhur Gupta <madhur@push.org>
Co-authored-by: Siddesh Sankhya <79219618+Siddesh7@users.noreply.github.com>
Co-authored-by: Siddesh <siddeshsankhya@gmail.com>
Co-authored-by: harshrajat <harsh@epns.io>
Co-authored-by: Harsh | Push <harsh@push.org>
Co-authored-by: Aman Gupta <guptaaman200115@gmail.com>
Co-authored-by: Mohammed S <shoaib@push.org>
Co-authored-by: Ashis Kumar Pradhan <38760485+akp111@users.noreply.github.com>
Co-authored-by: Mohammed S <shoaibmohammed92@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants