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

Alpha deployment #1121

Merged
merged 46 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6d61a4e
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.61
mohammeds1992 Jan 3, 2024
f07f84b
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jan 3, 2024
38c7539
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.62
mohammeds1992 Jan 3, 2024
25f6f4f
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jan 15, 2024
a1dfaa9
ci(restapi): 🎉 cut release to restapi-v0.9.0
mohammeds1992 Jan 15, 2024
f90e416
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.63
mohammeds1992 Jan 15, 2024
f93c645
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jan 18, 2024
6a91107
fix: fix errors
mohammeds1992 Jan 18, 2024
65d46c6
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.64
mohammeds1992 Jan 18, 2024
e597fe5
fix: changed stream type to any
mishramonalisha76 Jan 18, 2024
859341e
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.16
mohammeds1992 Jan 18, 2024
d75a862
fix: minor change
mohammeds1992 Jan 18, 2024
e57160a
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.17
mohammeds1992 Jan 18, 2024
3034c2c
fix: minor fix
mohammeds1992 Jan 18, 2024
2f7f04e
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.36
mohammeds1992 Jan 18, 2024
bb3bdf5
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jan 19, 2024
a05ba4a
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.37
mohammeds1992 Jan 19, 2024
6bac687
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jan 25, 2024
77896b6
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.38
mohammeds1992 Jan 25, 2024
12179ab
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jan 25, 2024
6054507
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.39
mohammeds1992 Jan 25, 2024
d4484dd
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.39
mohammeds1992 Jan 25, 2024
e7d53ca
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Jan 29, 2024
df6c7a7
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.40
mohammeds1992 Jan 29, 2024
e3d08bb
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Feb 1, 2024
e85d484
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.41
mohammeds1992 Feb 1, 2024
e80f2f8
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Feb 7, 2024
0d61b10
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Feb 8, 2024
f822908
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.65
mohammeds1992 Feb 8, 2024
bbf3ddf
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.42
mohammeds1992 Feb 8, 2024
feb77a9
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Feb 8, 2024
ff22863
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.66
mohammeds1992 Feb 8, 2024
2c0a4b9
fix: Merge branch 'alpha' into alpha-deployment
mohammeds1992 Feb 9, 2024
3edb0ed
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.43
mohammeds1992 Feb 9, 2024
be6cac0
fix: Merge alpha
mishramonalisha76 Feb 13, 2024
cdee5c6
fix: fixed build issues
mishramonalisha76 Feb 13, 2024
c6962ab
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.36
mishramonalisha76 Feb 13, 2024
2962c6c
ci(uiweb): 🎉 cut beta release to uiweb-v0.0.1-alpha.44
mishramonalisha76 Feb 13, 2024
9014a76
ci(restapi): 🎉 cut beta release to restapi-v0.0.1-alpha.67
mishramonalisha76 Feb 13, 2024
2b02a65
fix: fixed minor bugs
mishramonalisha76 Feb 13, 2024
c6ba60b
fix: fixed conflicts
mishramonalisha76 Feb 13, 2024
ff6b576
fix: fixed chatpreview and widget issues
mishramonalisha76 Feb 19, 2024
db2fd58
fix: fixed merge conflicts
mishramonalisha76 Feb 19, 2024
f4cdbda
fix: fixed chat bugs
mishramonalisha76 Feb 21, 2024
50b6fd3
fix: testing readMode
mishramonalisha76 Feb 21, 2024
7214d68
fix: fixed readmode
mishramonalisha76 Feb 21, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const ChatPreviewListTest = () => {
onPaging={(chats) => { console.log("paging chats are: ", chats) }}
onPreload={(chats) => { console.log("preload chats are: ", chats) }}
// listType='SEARCH'
// searchParamter='0x784546737C60d54946B3De932f2246187c7E1dD9'
// searchParamter='0x56A734ba4C7c7b117774C9aAcCEf521eBE66d65b'
/>
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ChatViewComponentTest = () => {
<ChatView
onVerificationFail={() => console.log("Verification Failed")}

chatId='0xc64444D6a076D6a8252390709A1270bfBBa32e2d'
chatId='0x56A734ba4C7c7b117774C9aAcCEf521eBE66d65b'
chatProfileLeftHelperComponent={<img src={Img} onClick={()=>console.debug('clicked')}/>}
chatProfileRightHelperComponent={<div>right component</div>}

Expand Down
6 changes: 3 additions & 3 deletions packages/restapi/src/lib/pushapi/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Chat {
page: options?.page,
limit: options?.limit,
env: this.env,
toDecrypt: !!this.signer, // Set to false if signer is undefined or null,
toDecrypt: !!this.decryptedPgpPvtKey, // Set to false if signer is undefined or null,
};

switch (type) {
Expand All @@ -96,7 +96,7 @@ export class Chat {

const latestMessages = await PUSH_CHAT.latest({
threadhash: threadHash,
toDecrypt: !!this.signer, // Set to false if signer is undefined or null,
toDecrypt: !!this.decryptedPgpPvtKey, // Set to false if signer is undefined or null,
pgpPrivateKey: this.decryptedPgpPvtKey,
account: this.account,
env: this.env,
Expand Down Expand Up @@ -131,7 +131,7 @@ export class Chat {
env: this.env,
threadhash: reference,
pgpPrivateKey: this.decryptedPgpPvtKey,
toDecrypt: !!this.signer, // Set to false if signer is undefined or null,
toDecrypt: !!this.decryptedPgpPvtKey, // Set to false if signer is undefined or null,
limit: options?.limit,
});
const listType = intent ? 'CHATS' : 'REQUESTS';
Expand Down
2 changes: 1 addition & 1 deletion packages/restapi/src/lib/pushapi/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export class Space {
page: options?.page,
limit: options?.limit,
env: this.env,
toDecrypt: !!this.signer, // Set to false if signer is undefined or null,
toDecrypt: !!this.decryptedPgpPvtKey, // Set to false if signer is undefined or null,
};

switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import useGetGroupByIDnew from '../../../hooks/chat/useGetGroupByIDnew';
import { Button, Section, Span, Spinner } from '../../reusables';
import { ChatPreview } from '../ChatPreview';

import { getAddress, pCAIP10ToWallet } from '../../../helpers';
import { getAddress, getNewChatUser, pCAIP10ToWallet, walletToPCAIP10 } from '../../../helpers';
import {
displayDefaultUser,
generateRandomNonce,
transformChatItems,
transformStreamToIChatPreviewPayload,
Expand Down Expand Up @@ -408,21 +409,21 @@ export const ChatPreviewList: React.FC<IChatPreviewListProps> = (
// Effects

// If account, env or signer changes
// useEffect(() => {
// setChatPreviewList({
// nonce: generateRandomNonce(),
// items: [],
// page: 1,
// preloading: true,
// loading: false,
// loaded: false,
// reset: false,
// resume: false,
// errored: false,
// error: null,
// });
// resetBadge();
// }, [account, env]);
useEffect(() => {
setChatPreviewList({
nonce: generateRandomNonce(),
items: [],
page: 1,
preloading: true,
loading: false,
loaded: false,
reset: false,
resume: false,
errored: false,
error: null,
});
resetBadge();
}, [account, env,signer]);

useEffect(() => {
if (options?.onLoading) {
Expand Down Expand Up @@ -506,7 +507,7 @@ export const ChatPreviewList: React.FC<IChatPreviewListProps> = (
}


}, [chatPreviewList.reset]);
}, [chatPreviewList.reset,user?.readmode()]);

// If loading becomes active
useEffect(() => {
Expand Down Expand Up @@ -579,7 +580,7 @@ export const ChatPreviewList: React.FC<IChatPreviewListProps> = (
try {
if (options?.searchParamter) {
let formattedChatId: string | null = options?.searchParamter;
let userProfile: IUser | null = null;
let userProfile: IUser | undefined = undefined;
let groupProfile: Group;

//check if ens then convert to address
Expand All @@ -596,9 +597,12 @@ export const ChatPreviewList: React.FC<IChatPreviewListProps> = (
if (!error) {
if (await ethers.utils.isAddress(formattedChatId)) {
//fetch profile
userProfile = await fetchUserProfile({
profileId: formattedChatId,
userProfile = await getNewChatUser({
searchText: formattedChatId,
env,
fetchChatProfile:fetchUserProfile,
user

});
} else {
//fetch group info
Expand Down
3 changes: 2 additions & 1 deletion packages/uiweb/src/lib/components/chat/helpers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { IFeeds, IUser, ParticipantStatus } from '@pushprotocol/restapi';
import { getAddress, walletToPCAIP10 } from '../../../helpers';
import { Env, } from '@pushprotocol/restapi';
import moment from 'moment';
import { ProfilePicture } from '../../../config';

export const profilePicture = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAvklEQVR4AcXBsW2FMBiF0Y8r3GQb6jeBxRauYRpo4yGQkMd4A7kg7Z/GUfSKe8703fKDkTATZsJsrr0RlZSJ9r4RLayMvLmJjnQS1d6IhJkwE2bT13U/DBzp5BN73xgRZsJMmM1HOolqb/yWiWpvjJSUiRZWopIykTATZsJs5g+1N6KSMiO1N/5DmAkzYTa9Lh6MhJkwE2ZzSZlo7xvRwson3txERzqJhJkwE2bT6+JhoKTMJ2pvjAgzYSbMfgDlXixqjH6gRgAAAABJRU5ErkJggg==`;

Expand All @@ -12,7 +13,7 @@ export const displayDefaultUser = ({ caip10 }: { caip10: string }): IUser => {
did: caip10,
wallets: caip10,
publicKey: 'temp',
profilePicture: profilePicture,
profilePicture: ProfilePicture,
encryptedPrivateKey: 'temp',
encryptionType: 'temp',
signature: 'temp',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const AddWallets = ({
const theme = useContext(ThemeContext);

const [filteredUserData, setFilteredUserData] = useState<any>(null);
const { env } = useChatData();
const { env,user } = useChatData();
const isMobile = useMediaQuery(device.mobileL);
const { fetchUserProfile } = useUserProfile();
const groupInfoToast = useToast();
Expand All @@ -76,6 +76,7 @@ export const AddWallets = ({
searchText: searchedText,
fetchChatProfile:fetchUserProfile,
env,
user
});
if (newChatUser) {
setFilteredUserData(newChatUser);
Expand Down
17 changes: 10 additions & 7 deletions packages/uiweb/src/lib/dataProviders/ChatDataProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,21 @@ export const ChatUIProvider = ({
useEffect(() => {
(async () => {
resetStates();
setEnvVal(env);


let address;
if (Object.keys(signer || {}).length && !user) {
const address = await getAddressFromSigner(signer!);
setAccountVal(address);
address = await getAddressFromSigner(signer!);
// setAccountVal(address);
} else if (!signer && user) {
const profile = await fetchUserProfile({user});
setAccountVal(pCAIP10ToWallet(profile?.wallets));
address = (pCAIP10ToWallet(profile?.wallets));
} else {
setAccountVal(GUEST_MODE_ACCOUNT);
address = GUEST_MODE_ACCOUNT;
}
setEnvVal(env);
setAccountVal(address);
setSignerVal(signer);

setUserVal(user);
setPgpPrivateKeyVal(pgpPrivateKey);
})();
Expand All @@ -84,7 +87,7 @@ export const ChatUIProvider = ({
useEffect(() => {
(async () => {

if ((accountVal && envVal && signerVal) ||(accountVal == GUEST_MODE_ACCOUNT && envVal && !userVal) ) {
if ((accountVal && envVal ) ) {
const pushUser = await initializeUser({
signer: signerVal,
account: accountVal!,
Expand Down
13 changes: 6 additions & 7 deletions packages/uiweb/src/lib/helpers/chat/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Env, IFeeds, IUser } from '@pushprotocol/restapi';
import type { Env, IFeeds, IUser, PushAPI } from '@pushprotocol/restapi';
import { add } from 'date-fns';
import { ethers } from 'ethers';
import {
Expand All @@ -7,7 +7,7 @@ import {
InfuraAPIKey,
ProfilePicture,
} from '../../config';
import type { GetProfileParams } from '../../hooks';
import type { FetchProfileParams, GetProfileParams } from '../../hooks';
import type {
ChatFeedsType,
NotificationFeedsType,
Expand Down Expand Up @@ -54,17 +54,16 @@ export const getObjectsWithMatchingKeys = (

type getNewChatUserParamType = {
searchText: string;
fetchChatProfile: ({
profileId,
env
}: GetProfileParams) => Promise<IUser | undefined>;
fetchChatProfile: any;
env: Env;
user?: PushAPI
};

export const getNewChatUser = async ({
searchText,
fetchChatProfile,
env,
user
}: getNewChatUserParamType): Promise<IUser | undefined> => {
let chatProfile: IUser | undefined;
let address: string | null = null;
Expand All @@ -75,7 +74,7 @@ export const getNewChatUser = async ({
// address = await getAddress(searchText, env);
// }
if (address) {
chatProfile = await fetchChatProfile({ profileId: address, env });
chatProfile = await fetchChatProfile({ profileId: address, env,user });
if (!chatProfile)
chatProfile = displayDefaultUser({ caip10: walletToPCAIP10(address) });
return chatProfile;
Expand Down
11 changes: 7 additions & 4 deletions packages/uiweb/src/lib/hooks/useGetChatProfile.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import * as PushAPI from '@pushprotocol/restapi';
import { useCallback, useContext } from 'react';
import { ChatAndNotificationPropsContext } from '../context';
import { GUEST_MODE_ACCOUNT } from '../config';

export interface GetProfileParams {
profileId: string;
profileId?: string | undefined;
env:PushAPI.Env
user?:PushAPI.PushAPI | undefined
}

const useGetChatProfile = () => {
const fetchChatProfile = useCallback(
async ({
profileId,
env
profileId = GUEST_MODE_ACCOUNT,
env,
user
}: GetProfileParams): Promise<PushAPI.IUser | undefined> => {
try {
const profile = await PushAPI.user.get({
env: env,
account: profileId,
account: profileId!,
});
return profile;
} catch (error) {
Expand Down
Loading