Skip to content

Commit

Permalink
change ios folder colors to match ios design
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed Oct 25, 2022
1 parent c546697 commit 4abb70d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
6 changes: 5 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ export const App = memo(() => {
storage.set("cameraUploadFetchRemoteAssetsTimeout:" + userId, (new Date().getTime() - 5000))

return () => {
setSetupDone(false)

global.nodeThread.ready = false

dimensionsListener.remove()
shareMenuListener.remove()
navigationRef.removeListener("state", navigationRefListener)
Expand All @@ -360,7 +364,7 @@ export const App = memo(() => {

netInfoListener()
}
}, [])
}, [isLoggedIn])

return (
<>
Expand Down
12 changes: 10 additions & 2 deletions src/components/ActionSheets/ActionSheets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2130,7 +2130,7 @@ export const FolderColorActionSheet = memo(() => {
const [lang, setLang] = useMMKVString("lang", storage)
const currentActionSheetItem = useStore(state => state.currentActionSheetItem)
const [buttonsDisabled, setButtonsDisabled] = useState<boolean>(false)
const availableFolderColors: any = getAvailableFolderColors()
const availableFolderColors = getAvailableFolderColors()

useEffect(() => {
setButtonsDisabled(false)
Expand Down Expand Up @@ -2159,6 +2159,14 @@ export const FolderColorActionSheet = memo(() => {
<ItemActionSheetItemHeader />
{
Object.keys(availableFolderColors).map((prop) => {
if(prop == "default_ios"){
return null
}

if(Platform.OS == "ios" && prop == "blue"){
return null
}

return (
<ActionButton
key={prop}
Expand Down Expand Up @@ -2200,7 +2208,7 @@ export const FolderColorActionSheet = memo(() => {
showToast({ message: err.toString() })
})
}}
color={availableFolderColors[prop] as string}
color={Platform.OS == "ios" && prop == "default" ? availableFolderColors['default_ios'] as string : availableFolderColors[prop] as string}
text={i18n(lang, "color_" + prop)}
/>
)
Expand Down
21 changes: 13 additions & 8 deletions src/lib/helpers/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,35 @@ export const calcTimeLeft = (loadedBytes: number, totalBytes: number, started: n
return remaining > 0 ? remaining : 0
}

export const getFolderColor = memoize((color: string | null | undefined): string => {
export const getFolderColor = (color: string | null | undefined): string => {
const colors = getAvailableFolderColors()

if(!color){
return colors['default']
return Platform.OS == "ios" ? colors['default_ios'] : colors['default']
}

if(typeof colors[color] !== "undefined"){
if(color == "default"){
return Platform.OS == "ios" ? colors['default_ios'] : colors['default']
}

return colors[color]
}

return colors['default']
})
return Platform.OS == "ios" ? colors['default_ios'] : colors['default']
}

export const getAvailableFolderColors = memoize((): { [key: string]: string } => {
export const getAvailableFolderColors = (): { [key: string]: string } => {
return {
"default": "#F6C358",
"default": "#ffd04c",
"blue": "#2992E5",
"green": "#57A15B",
"purple": "#8E3A9D",
"red": "#CB2E35",
"gray": "gray"
"gray": "gray",
"default_ios": "#3ea0d5"
}
})
}

export const fileAndFolderNameValidation = (name: string): boolean => {
const regex = /[<>:"\/\\|?*\x00-\x1F]|^(?:aux|con|clock\$|nul|prn|com[1-9]|lpt[1-9])$/i
Expand Down
2 changes: 1 addition & 1 deletion src/lib/node/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ global.nodeThread = {
}

nodejs.channel.addListener("message", (message) => {
if(message == "ready" && !global.nodeThread.ready){
if(message == "ready"){
return global.nodeThread.ready = true
}

Expand Down

0 comments on commit 4abb70d

Please sign in to comment.