From 4499bb8bae3476aae99681a19d9cb0fffaf4f27d Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Sat, 15 May 2021 23:08:13 +0200 Subject: [PATCH] Updates --- Gemfile.lock | 39 +++++------ fastlane/Fastfile | 4 +- src/screens/Tabs/Me/Root/Collections.tsx | 78 +++++++++------------- src/screens/Tabs/Me/Settings/Analytics.tsx | 7 +- src/startup/sentry.ts | 4 +- src/utils/slices/versionSlice.ts | 8 +-- 6 files changed, 57 insertions(+), 83 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d11b8c6b..2fe8dde7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -15,7 +15,7 @@ GEM artifactory (3.0.15) atomos (0.1.3) aws-eventstream (1.1.1) - aws-partitions (1.445.0) + aws-partitions (1.455.0) aws-sdk-core (3.114.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) @@ -24,7 +24,7 @@ GEM aws-sdk-kms (1.43.0) aws-sdk-core (~> 3, >= 3.112.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.93.1) + aws-sdk-s3 (1.94.1) aws-sdk-core (~> 3, >= 3.112.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) @@ -71,10 +71,9 @@ GEM cocoapods-try (1.2.0) colored (1.2) colored2 (3.1.2) - commander-fastlane (4.4.6) - highline (~> 1.7.2) + commander (4.6.0) + highline (~> 2.0.0) concurrent-ruby (1.1.8) - connection_pool (2.2.5) declarative (0.0.20) digest-crc (0.6.3) rake (>= 12.0.0, < 14.0.0) @@ -85,25 +84,23 @@ GEM escape (0.0.4) ethon (0.12.0) ffi (>= 1.3.0) - excon (0.80.1) - faraday (1.4.0) - faraday-excon (~> 1.0) + excon (0.81.0) + faraday (1.4.1) + faraday-excon (~> 1.1) faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) + faraday-net_http_persistent (~> 1.1) multipart-post (>= 1.2, < 3) ruby2_keywords (>= 0.0.4) faraday-cookie_jar (0.0.7) faraday (>= 0.8.0) http-cookie (~> 1.0.0) - faraday-excon (1.0.0) - excon (>= 0.27.4) + faraday-excon (1.1.0) faraday-net_http (1.0.1) - faraday-net_http_persistent (1.0.3) - net-http-persistent (>= 3.1) + faraday-net_http_persistent (1.1.0) faraday_middleware (1.0.0) faraday (~> 1.0) fastimage (2.2.3) - fastlane (2.180.1) + fastlane (2.182.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) artifactory (~> 3.0) @@ -111,7 +108,7 @@ GEM babosa (>= 1.0.3, < 2.0.0) bundler (>= 1.12.0, < 3.0.0) colored - commander-fastlane (>= 4.4.6, < 5.0.0) + commander (~> 4.6) dotenv (>= 2.1.1, < 3.0.0) emoji_regex (>= 0.1, < 4.0) excon (>= 0.71.0, < 1.0.0) @@ -122,7 +119,7 @@ GEM gh_inspector (>= 1.1.2, < 2.0.0) google-api-client (>= 0.37.0, < 0.39.0) google-cloud-storage (>= 1.15.0, < 2.0.0) - highline (>= 1.7.2, < 2.0.0) + highline (~> 2.0) json (< 3.0.0) jwt (>= 2.1.0, < 3) mini_magick (>= 4.9.4, < 5.0.0) @@ -132,7 +129,6 @@ GEM rubyzip (>= 2.0.0, < 3.0.0) security (= 0.1.3) simctl (~> 1.6.3) - slack-notifier (>= 2.0.0, < 3.0.0) terminal-notifier (>= 2.0.0, < 3.0.0) terminal-table (>= 1.4.5, < 2.0.0) tty-screen (>= 0.6.3, < 1.0.0) @@ -185,14 +181,14 @@ GEM google-cloud-core (~> 1.2) googleauth (~> 0.9) mini_mime (~> 1.0) - googleauth (0.16.1) + googleauth (0.16.2) faraday (>= 0.17.3, < 2.0) jwt (>= 1.4, < 3.0) memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (~> 0.14) - highline (1.7.10) + highline (2.0.3) http-cookie (1.0.3) domain_name (~> 0.5) httpclient (2.8.3) @@ -200,7 +196,7 @@ GEM concurrent-ruby (~> 1.0) jmespath (1.4.0) json (2.5.1) - jwt (2.2.2) + jwt (2.2.3) memoist (0.16.2) mini_magick (4.11.0) mini_mime (1.1.0) @@ -211,8 +207,6 @@ GEM nanaimo (0.3.0) nap (1.1.0) naturally (2.2.1) - net-http-persistent (4.0.1) - connection_pool (~> 2.2) netrc (0.11.0) os (1.1.1) plist (3.6.0) @@ -237,7 +231,6 @@ GEM simctl (1.6.8) CFPropertyList naturally - slack-notifier (2.3.2) terminal-notifier (2.0.0) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index a2a11877..ba915952 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -109,8 +109,8 @@ private_lane :build_ios do upload_to_app_store( ipa: IPA_FILE, app_version: VERSION ) else if !is_ci - match( type: "development", readonly: true ) - build_ios_app( export_method: "development", output_directory: BUILD_DIRECTORY, silent: true ) + match( type: "adhoc", readonly: true ) + build_ios_app( export_method: "ad-hoc", output_directory: BUILD_DIRECTORY, silent: true ) install_on_device( skip_wifi: true ) end end diff --git a/src/screens/Tabs/Me/Root/Collections.tsx b/src/screens/Tabs/Me/Root/Collections.tsx index ecabbf7c..a528eb0e 100644 --- a/src/screens/Tabs/Me/Root/Collections.tsx +++ b/src/screens/Tabs/Me/Root/Collections.tsx @@ -2,65 +2,25 @@ import { MenuContainer, MenuRow } from '@components/Menu' import { useNavigation } from '@react-navigation/native' import { useAnnouncementQuery } from '@utils/queryHooks/announcement' import { useListsQuery } from '@utils/queryHooks/lists' -import React, { useMemo } from 'react' +import React from 'react' import { useTranslation } from 'react-i18next' const Collections: React.FC = () => { - const { t, i18n } = useTranslation('screenTabs') + const { t } = useTranslation('screenTabs') const navigation = useNavigation() const listsQuery = useListsQuery({ options: { - notifyOnChangeProps: [] + notifyOnChangeProps: ['data'] } }) - const rowLists = useMemo(() => { - if (listsQuery.isSuccess && listsQuery.data?.length) { - return ( - navigation.navigate('Tab-Me-Lists')} - /> - ) - } else { - return null - } - }, [listsQuery.isSuccess, listsQuery.data, i18n.language]) const announcementsQuery = useAnnouncementQuery({ showAll: true, options: { - notifyOnChangeProps: [] + notifyOnChangeProps: ['data'] } }) - const rowAnnouncements = useMemo(() => { - if (announcementsQuery.isSuccess && announcementsQuery.data?.length) { - const amount = announcementsQuery.data.filter( - announcement => !announcement.read - ).length - return ( - - navigation.navigate('Screen-Announcements', { showAll: true }) - } - /> - ) - } else { - return null - } - }, [announcementsQuery.isSuccess, announcementsQuery.data, i18n.language]) return ( @@ -82,8 +42,34 @@ const Collections: React.FC = () => { title={t('me.stacks.favourites.name')} onPress={() => navigation.navigate('Tab-Me-Favourites')} /> - {rowLists} - {rowAnnouncements} + {listsQuery.data?.length ? ( + navigation.navigate('Tab-Me-Lists')} + /> + ) : null} + {announcementsQuery.data?.length ? ( + !announcement.read) + .length + ? t('me.root.announcements.content.unread', { + amount: announcementsQuery.data.filter( + announcement => !announcement.read + ).length + }) + : t('me.root.announcements.content.read') + } + onPress={() => + navigation.navigate('Screen-Announcements', { showAll: true }) + } + /> + ) : null} ) } diff --git a/src/screens/Tabs/Me/Settings/Analytics.tsx b/src/screens/Tabs/Me/Settings/Analytics.tsx index 5910b257..3740d9bf 100644 --- a/src/screens/Tabs/Me/Settings/Analytics.tsx +++ b/src/screens/Tabs/Me/Settings/Analytics.tsx @@ -5,10 +5,10 @@ import { } from '@utils/slices/settingsSlice' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' -import * as Updates from 'expo-updates' import React from 'react' import { useTranslation } from 'react-i18next' import { StyleSheet, Text } from 'react-native' +import { Constants } from 'react-native-unimodules' import { useDispatch, useSelector } from 'react-redux' const SettingsAnalytics: React.FC = () => { @@ -29,10 +29,7 @@ const SettingsAnalytics: React.FC = () => { } /> - {t('me.settings.version', { - // @ts-ignore - version: Updates.manifest?.version - })} + {t('me.settings.version', { version: Constants.manifest.version })} ) diff --git a/src/startup/sentry.ts b/src/startup/sentry.ts index 54d33543..7f4ebf70 100644 --- a/src/startup/sentry.ts +++ b/src/startup/sentry.ts @@ -1,12 +1,12 @@ import * as Updates from 'expo-updates' +import { Constants } from 'react-native-unimodules' import * as Sentry from 'sentry-expo' import log from './log' const sentry = () => { log('log', 'Sentry', 'initializing') Sentry.init({ - // @ts-ignore - dsn: Updates.manifest?.extra?.sentryDSN, + dsn: Constants.manifest?.extra?.sentryDSN, enableInExpoDevelopment: false, debug: __DEV__ || diff --git a/src/utils/slices/versionSlice.ts b/src/utils/slices/versionSlice.ts index 276056db..4c62ba8c 100644 --- a/src/utils/slices/versionSlice.ts +++ b/src/utils/slices/versionSlice.ts @@ -1,7 +1,7 @@ import apiGeneral from '@api/general' import { createAsyncThunk, createSlice } from '@reduxjs/toolkit' import { RootState } from '@root/store' -import * as Updates from 'expo-updates' +import { Constants } from 'react-native-unimodules' export const retriveVersionLatest = createAsyncThunk( 'version/latest', @@ -29,10 +29,8 @@ const versionSlice = createSlice({ reducers: {}, extraReducers: builder => { builder.addCase(retriveVersionLatest.fulfilled, (state, action) => { - // @ts-ignore - if (action.payload && Updates.manifest?.version) { - // @ts-ignore - if (parseInt(action.payload) > parseInt(Updates.manifest.version)) { + if (action.payload && Constants.manifest.version) { + if (parseInt(action.payload) > parseInt(Constants.manifest.version)) { state.update = true } }