mirror of
https://github.com/Qortal/qortal-mobile.git
synced 2025-03-31 01:35:54 +00:00
fixes
This commit is contained in:
parent
e22072db72
commit
03d0bf0177
@ -64,7 +64,7 @@ export function saveToLocalStorage(key, subKey, newValue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AppsNavBar = () => {
|
export const AppsNavBar = ({appsMode}) => {
|
||||||
const [tabs, setTabs] = useState([]);
|
const [tabs, setTabs] = useState([]);
|
||||||
const [selectedTab, setSelectedTab] = useState(null);
|
const [selectedTab, setSelectedTab] = useState(null);
|
||||||
const [isNewTabWindow, setIsNewTabWindow] = useState(false);
|
const [isNewTabWindow, setIsNewTabWindow] = useState(false);
|
||||||
@ -77,10 +77,11 @@ export const AppsNavBar = () => {
|
|||||||
const [navigationController, setNavigationController] = useRecoilState(navigationControllerAtom)
|
const [navigationController, setNavigationController] = useRecoilState(navigationControllerAtom)
|
||||||
|
|
||||||
const isDisableBackButton = useMemo(()=> {
|
const isDisableBackButton = useMemo(()=> {
|
||||||
|
if(isNewTabWindow && appsMode === 'viewer') return true
|
||||||
if(selectedTab && navigationController[selectedTab?.tabId]?.hasBack) return false
|
if(selectedTab && navigationController[selectedTab?.tabId]?.hasBack) return false
|
||||||
if(selectedTab && !navigationController[selectedTab?.tabId]?.hasBack) return true
|
if(selectedTab && !navigationController[selectedTab?.tabId]?.hasBack) return true
|
||||||
return false
|
return false
|
||||||
}, [navigationController, selectedTab])
|
}, [navigationController, selectedTab, isNewTabWindow, appsMode])
|
||||||
|
|
||||||
const setSettingsLocalLastUpdated = useSetRecoilState(
|
const setSettingsLocalLastUpdated = useSetRecoilState(
|
||||||
settingsLocalLastUpdatedAtom
|
settingsLocalLastUpdatedAtom
|
||||||
|
@ -479,7 +479,7 @@ isDOMContentLoaded: false
|
|||||||
} else if (
|
} else if (
|
||||||
event?.data?.action === 'PUBLISH_MULTIPLE_QDN_RESOURCES' ||
|
event?.data?.action === 'PUBLISH_MULTIPLE_QDN_RESOURCES' ||
|
||||||
event?.data?.action === 'PUBLISH_QDN_RESOURCE' ||
|
event?.data?.action === 'PUBLISH_QDN_RESOURCE' ||
|
||||||
event?.data?.action === 'ENCRYPT_DATA' || event?.data?.action === 'ENCRYPT_DATA_WITH_SHARING_KEY' || 'ENCRYPT_QORTAL_GROUP_DATA'
|
event?.data?.action === 'ENCRYPT_DATA' || event?.data?.action === 'ENCRYPT_DATA_WITH_SHARING_KEY' || event?.data?.action === 'ENCRYPT_QORTAL_GROUP_DATA'
|
||||||
|
|
||||||
) {
|
) {
|
||||||
let data;
|
let data;
|
||||||
|
@ -28,6 +28,7 @@ import DownloadIcon from "@mui/icons-material/Download";
|
|||||||
import SaveIcon from '@mui/icons-material/Save';
|
import SaveIcon from '@mui/icons-material/Save';
|
||||||
import { useSetRecoilState } from "recoil";
|
import { useSetRecoilState } from "recoil";
|
||||||
import { blobControllerAtom } from "../../atoms/global";
|
import { blobControllerAtom } from "../../atoms/global";
|
||||||
|
import { decodeIfEncoded } from "../../utils/decode";
|
||||||
|
|
||||||
|
|
||||||
export const AttachmentCard = ({
|
export const AttachmentCard = ({
|
||||||
@ -206,7 +207,7 @@ export const AttachmentCard = ({
|
|||||||
color: "white",
|
color: "white",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Created by {owner}
|
Created by {decodeIfEncoded(owner)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -17,6 +17,7 @@ import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|||||||
import { CustomLoader } from "../../common/CustomLoader";
|
import { CustomLoader } from "../../common/CustomLoader";
|
||||||
import ImageIcon from "@mui/icons-material/Image";
|
import ImageIcon from "@mui/icons-material/Image";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
|
import { decodeIfEncoded } from "../../utils/decode";
|
||||||
|
|
||||||
export const ImageCard = ({
|
export const ImageCard = ({
|
||||||
image,
|
image,
|
||||||
@ -37,11 +38,11 @@ export const ImageCard = ({
|
|||||||
}
|
}
|
||||||
}, [isOpen]);
|
}, [isOpen]);
|
||||||
|
|
||||||
useEffect(()=> {
|
// useEffect(()=> {
|
||||||
if(errorMsg){
|
// if(errorMsg){
|
||||||
setHeight('300px')
|
// setHeight('300px')
|
||||||
}
|
// }
|
||||||
}, [errorMsg])
|
// }, [errorMsg])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
@ -113,7 +114,7 @@ export const ImageCard = ({
|
|||||||
color: "white",
|
color: "white",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Created by {owner}
|
Created by {decodeIfEncoded(owner)}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -96,6 +96,7 @@ import { useHandleMobileNativeBack } from "../../hooks/useHandleMobileNativeBack
|
|||||||
import { AdminSpace } from "../Chat/AdminSpace";
|
import { AdminSpace } from "../Chat/AdminSpace";
|
||||||
import { useSetRecoilState } from "recoil";
|
import { useSetRecoilState } from "recoil";
|
||||||
import { selectedGroupIdAtom } from "../../atoms/global";
|
import { selectedGroupIdAtom } from "../../atoms/global";
|
||||||
|
import { sortArrayByTimestampAndGroupName } from "../../utils/time";
|
||||||
|
|
||||||
// let touchStartY = 0;
|
// let touchStartY = 0;
|
||||||
// let disablePullToRefresh = false;
|
// let disablePullToRefresh = false;
|
||||||
@ -910,7 +911,7 @@ export const Group = ({
|
|||||||
if (message?.action === "SET_GROUPS") {
|
if (message?.action === "SET_GROUPS") {
|
||||||
|
|
||||||
// Update the component state with the received 'sendqort' state
|
// Update the component state with the received 'sendqort' state
|
||||||
setGroups(message.payload);
|
setGroups(sortArrayByTimestampAndGroupName(message.payload));
|
||||||
getLatestRegularChat(message.payload);
|
getLatestRegularChat(message.payload);
|
||||||
setMemberGroups(message.payload);
|
setMemberGroups(message.payload);
|
||||||
|
|
||||||
@ -2673,7 +2674,7 @@ export const Group = ({
|
|||||||
)}
|
)}
|
||||||
{(isMobile && mobileViewMode === "apps" && appsMode !== 'home') && !mobileViewModeKeepOpen && (
|
{(isMobile && mobileViewMode === "apps" && appsMode !== 'home') && !mobileViewModeKeepOpen && (
|
||||||
<>
|
<>
|
||||||
<AppsNavBar />
|
<AppsNavBar appsMode={appsMode} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
16
src/utils/decode.ts
Normal file
16
src/utils/decode.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
export function decodeIfEncoded(input) {
|
||||||
|
try {
|
||||||
|
// Check if input is URI-encoded by encoding and decoding
|
||||||
|
const encoded = encodeURIComponent(decodeURIComponent(input));
|
||||||
|
if (encoded === input) {
|
||||||
|
// Input is URI-encoded, so decode it
|
||||||
|
return decodeURIComponent(input);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// decodeURIComponent throws an error if input is not encoded
|
||||||
|
console.error("Error decoding URI:", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return input as-is if not URI-encoded
|
||||||
|
return input;
|
||||||
|
}
|
@ -36,3 +36,21 @@ export function formatTimestamp(timestamp: number): string {
|
|||||||
|
|
||||||
return date
|
return date
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function sortArrayByTimestampAndGroupName(array) {
|
||||||
|
return array.sort((a, b) => {
|
||||||
|
if (a.timestamp && b.timestamp) {
|
||||||
|
// Both have timestamp, sort by timestamp descending
|
||||||
|
return b.timestamp - a.timestamp;
|
||||||
|
} else if (a.timestamp) {
|
||||||
|
// Only `a` has timestamp, it comes first
|
||||||
|
return -1;
|
||||||
|
} else if (b.timestamp) {
|
||||||
|
// Only `b` has timestamp, it comes first
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
// Neither has timestamp, sort alphabetically by groupName
|
||||||
|
return a.groupName.localeCompare(b.groupName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user