Skip to content

Commit

Permalink
Merge branch 'dev' into cw-2380-support-group-message
Browse files Browse the repository at this point in the history
  • Loading branch information
roienatan committed Dec 13, 2023
2 parents 71464e6 + c111c2b commit a78d9b0
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 127 deletions.
18 changes: 0 additions & 18 deletions .github/labeler.yml

This file was deleted.

69 changes: 0 additions & 69 deletions .github/labels.json

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/label-labeler.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/label-sync.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ import { history } from "@/shared/appConfig";
import { WebviewActions } from "@/shared/constants";
import { FirebaseCredentials } from "@/shared/interfaces/FirebaseCredentials";
import { getInboxPagePath } from "@/shared/utils";
import firebase from "@/shared/utils/firebase";
import { parseJson } from "@/shared/utils/json";

const WebViewLoginHandler: FC = () => {
const dispatch = useDispatch();

const handleWebviewLogin = React.useCallback((event) => {
const handleWebviewLogin = React.useCallback(async (event) => {
const data = parseJson(event.data) as FirebaseCredentials;
const user = await firebase.auth().currentUser;

if (data?.redirectUrl) {
history.push(data?.redirectUrl);
}
if (!data?.providerId) {
if (!data?.providerId || !!user) {
return;
}

Expand Down
10 changes: 5 additions & 5 deletions src/services/Discussion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class DiscussionService {
const fromCache = snapshot.metadata.fromCache ? "local cache" : "server";
const discussion = snapshot?.data() || null;

// console.log(
// `getDiscussionById [${fromCache}]`,
// discussionId,
// snapshot?.data() || null,
// );
console.log(
`getDiscussionById [${fromCache}]`,
discussionId,
snapshot?.data() || null,
);
if (!discussion && source === FirestoreDataSource.Cache) {
return this.getDiscussionById(discussionId, FirestoreDataSource.Server);
}
Expand Down
35 changes: 24 additions & 11 deletions src/shared/utils/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { BaseProposal } from "@/shared/models/governance/proposals";
import { transformFirebaseDataList } from "@/shared/utils/transformFirebaseDataToModel";
import { BASE_URL } from "../constants";
import { Common, DateFormat, Time, User } from "../models";
import { ElementType } from "../ui-kit/TextEditor/constants";

export const getPrefix = (currency: Currency): string => {
switch (currency) {
Expand Down Expand Up @@ -201,22 +202,34 @@ export const isRTL = (text = ""): boolean => {
};

export const isRtlText = (text = ""): boolean => {
for (let i = 0; i < text.length; i++) {
const charCode = text.charCodeAt(i);
try {
const parsedText = JSON.parse(text);
const textWithNoMentions = JSON.stringify(
parsedText[0].children?.filter(
(item) => item.type !== ElementType.Mention,
),
);

for (let i = 0; i < textWithNoMentions.length; i++) {
const charCode = textWithNoMentions.charCodeAt(i);

// Hebrew Block
if (charCode >= 0x0590 && charCode <= 0x05ff) return true;
// Hebrew Block
if (charCode >= 0x0590 && charCode <= 0x05ff) return true;

// Arabic Block
if (charCode >= 0x0600 && charCode <= 0x06ff) return true;
// Arabic Block
if (charCode >= 0x0600 && charCode <= 0x06ff) return true;

// Arabic Supplement Block
if (charCode >= 0x0750 && charCode <= 0x077f) return true;
// Arabic Supplement Block
if (charCode >= 0x0750 && charCode <= 0x077f) return true;

// Arabic Extended-A Block
if (charCode >= 0x08a0 && charCode <= 0x08ff) return true;
// Arabic Extended-A Block
if (charCode >= 0x08a0 && charCode <= 0x08ff) return true;
}
return false;
} catch (error) {
console.error(error);
return false;
}
return false;
};

/**
Expand Down

0 comments on commit a78d9b0

Please sign in to comment.