From f8d2723c1deee4fa9199c4f86d448d3770b7f9ea Mon Sep 17 00:00:00 2001 From: Vitalik Date: Sat, 27 Apr 2024 21:49:31 +0300 Subject: [PATCH] RELEASE | 2.3 --- android/app/build.gradle | 2 +- ios/taskme2.xcodeproj/project.pbxproj | 28 +++++---------- src/shared/hooks/use-flat-list.hook.ts | 47 +++++++++++++++++++------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index f4b88ec..41bbfca 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ android { applicationId "com.app.task_me" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 229 + versionCode 230 versionName "2.3" resValue "string", "build_config_package", "com.app.task_me" } diff --git a/ios/taskme2.xcodeproj/project.pbxproj b/ios/taskme2.xcodeproj/project.pbxproj index 2ac31f7..49ff0f1 100644 --- a/ios/taskme2.xcodeproj/project.pbxproj +++ b/ios/taskme2.xcodeproj/project.pbxproj @@ -753,10 +753,7 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; @@ -771,7 +768,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = taskme2/taskme2Stage.Debug.entitlements; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 33; DEVELOPMENT_TEAM = HQ3J3TDPR2; ENABLE_BITCODE = NO; HEADER_SEARCH_PATHS = ( @@ -1039,10 +1036,7 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; @@ -1058,7 +1052,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = taskme2/taskme2Stage.Release.entitlements; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 33; DEVELOPMENT_TEAM = HQ3J3TDPR2; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1338,7 +1332,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = taskme2/taskme2.entitlements; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 33; DEVELOPMENT_TEAM = HQ3J3TDPR2; ENABLE_BITCODE = NO; HEADER_SEARCH_PATHS = ( @@ -1476,7 +1470,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = taskme2/taskme2.entitlements; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 33; DEVELOPMENT_TEAM = HQ3J3TDPR2; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -1680,10 +1674,7 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; @@ -1761,10 +1752,7 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); - OTHER_LDFLAGS = ( - "$(inherited)", - " ", - ); + OTHER_LDFLAGS = "$(inherited) "; REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/src/shared/hooks/use-flat-list.hook.ts b/src/shared/hooks/use-flat-list.hook.ts index a4280fe..1583e6d 100644 --- a/src/shared/hooks/use-flat-list.hook.ts +++ b/src/shared/hooks/use-flat-list.hook.ts @@ -35,8 +35,9 @@ const getDefaultProps = () => { } export const useFlatList = (props: IProps) => { - if (!props.fetchItems) + if (!props.fetchItems) { throw new Error('Use flat list need a fetchItems function') + } props = Object.assign(getDefaultProps(), props) @@ -58,8 +59,11 @@ export const useFlatList = (props: IProps) => { useEffect(() => { if (props.skeletonDataKey) { const items = skeletonDataService.get(props.skeletonDataKey) - if (items) setItems(_.defaultTo(items, [])) - else setLoading(true) + if (items) { + setItems(_.defaultTo(items, [])) + } else { + setLoading(true) + } } }, []) @@ -67,23 +71,31 @@ export const useFlatList = (props: IProps) => { const { count, page, limit } = loadParams.current if (firstFetch) { - if (isInit || !props.skeletonDataKey) setLoading(true) + if (isInit || !props.skeletonDataKey) { + setLoading(true) + } loadParams.current.page = defaultProps.page loadParams.current.count = undefined - } else if (blockLoadingRef.current) return - else if ((count && page > Math.ceil(count / limit)) || count === 0) + } else if (blockLoadingRef.current) { return + } else if ((count && page > Math.ceil(count / limit)) || count === 0) { + return + } setIsLoadingNext(true) blockLoadingRef.current = true try { - if (props.clearWhenReload) setItems([]) + if (props.clearWhenReload) { + setItems([]) + } const response = props.serrializatorResponse( await props.fetchItems({ params: loadParams.current }), ) - if (!response) throw {} + if (!response) { + throw {} + } loadParams.current = { ...props.loadParams, @@ -94,19 +106,24 @@ export const useFlatList = (props: IProps) => { } const fetchedItems = props.serrializatorItems(response.data.items) - if (firstFetch) setItems(fetchedItems) - else setItems([...items, ...fetchedItems]) + if (firstFetch) { + setItems(fetchedItems) + } else { + setItems([...items, ...fetchedItems]) + } setTotalCount(response.data.count) if (!isInit) { - if (props.skeletonDataKey) + if (props.skeletonDataKey) { skeletonDataService.set(props.skeletonDataKey, fetchedItems) + } setIsInit(true) } } catch (e) { console.log(e) setItems([]) + loadParams.current.count = 0 } blockLoadingRef.current = false @@ -131,11 +148,15 @@ export const useFlatList = (props: IProps) => { } useEffect(() => { - if (props.needInit) fetchItems(true) + if (props.needInit) { + fetchItems(true) + } }, []) const loadAll = () => { - if (!loadParams.current.count) return + if (!loadParams.current.count) { + return + } setLoadParams({ limit: loadParams.current.count }) }