Skip to content

Commit

Permalink
Merge pull request #192 from yssk22/develop
Browse files Browse the repository at this point in the history
[expo] support purchase history check on HomeTabGoods feed
  • Loading branch information
yssk22 authored Dec 23, 2024
2 parents 35a1893 + 28bead2 commit be8c6c1
Show file tree
Hide file tree
Showing 26 changed files with 19,868 additions and 58 deletions.
18 changes: 15 additions & 3 deletions expo/assets/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,22 @@
"ja": "Tシャツ"
},
"Elineup Mall Settings": {
"ja": "イーラインナップモールの設定"
"ja": "Elineup!Mallの設定"
},
"Order End At": {
"ja": "販売終了日時"
"Fetch Elnieup Mall Purchase History": {
"ja": "Elineup!Mallの購入履歴を取得"
},
"Ordered On": {
"ja": "注文日"
},
"FC credentials will be used to fetch your purchase history from elineupmall.": {
"ja": "ファンクラブの認証情報を使用して、Elineup!Mallから購入履歴を取得します。"
},
"Following settings per a member per a category": {
"ja": "メンバーごとのカテゴリごとのフォロー設定"
},
"Order End On": {
"ja": "販売終了日"
},
"Price": {
"ja": "価格"
Expand Down
5 changes: 5 additions & 0 deletions expo/features/app/settings/internals/SettingsUserConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export type UserConfig = {
consentOnToS?: boolean;
consentOnUPFCDataPolicy?: boolean;

elineupmallFetchPurchaseHistory: boolean;

// deprecated
amebloOptimizedView: boolean;
feedUseMemberTaggings: boolean;

Expand All @@ -27,6 +30,8 @@ export const SettingsUserConfigDefault: UserConfig = {
consentOnToS: false,
consentOnUPFCDataPolicy: false,

elineupmallFetchPurchaseHistory: false,

amebloOptimizedView: false,
feedUseMemberTaggings: true,

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 36 additions & 2 deletions expo/features/elineupmall/ElineupMallSettingsScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
import { useUserConfig, useUserConfigUpdator } from '@hpapp/features/app/settings';
import { FontSize } from '@hpapp/features/common/constants';
import { ListItem, ListItemSwitch } from '@hpapp/features/common/list';
import { defineScreen, useScreenTitle } from '@hpapp/features/common/stack';
import { t } from '@hpapp/system/i18n';
import { Divider } from '@rneui/themed';
import { ScrollView, StyleSheet, Text } from 'react-native';

import ElineupMallSettingsFollowings from './internal/settings/ElineupMallSettingsFollowings';

export default defineScreen('/elineupmall/settings/', function ElineupMallSettingsScreen() {
useScreenTitle(t('Elineup Mall Settings'));
const config = useUserConfig();
const updator = useUserConfigUpdator();
return (
<>
<ScrollView>
<ListItemSwitch
label={
<>
<Text>{t('Fetch Elnieup Mall Purchase History')}</Text>
<Text style={styles.sublabel}>
{t('FC credentials will be used to fetch your purchase history from elineupmall.')}
</Text>
</>
}
value={config?.elineupmallFetchPurchaseHistory ?? false}
onValueChange={(value) => {
updator({
...config!,
elineupmallFetchPurchaseHistory: value
});
}}
/>
<Divider />
<ListItem>
<Text>{t('Following settings per a member per a category')}</Text>
</ListItem>
<ElineupMallSettingsFollowings />
</>
</ScrollView>
);
});

const styles = StyleSheet.create({
sublabel: {
fontSize: FontSize.Small
}
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ListItemLoadMore } from '@hpapp/features/common/list';
import { ElineupMallPurchaseHistoryItem } from '@hpapp/features/elineupmall/scraper';
import { useLazyReloadableQuery } from '@hpapp/system/graphql/hooks';
import { FlatList, RefreshControl } from 'react-native';
import { graphql, usePaginationFragment } from 'react-relay';
Expand Down Expand Up @@ -26,6 +27,7 @@ const ElineupMallLimitedTimeItemListQueryFragmentGraphQL = graphql`
edges {
node {
id
permalink
...ElineupMallLimitedTimeItemListItemFragment
}
}
Expand All @@ -44,12 +46,14 @@ export type ElineupMallLimitedTimeItemListProps = {
}[];
memberIds: string[];
categories: ElineupMallItemCategory[];
historyMap?: Map<string, ElineupMallPurchaseHistoryItem>;
};

export default function ElineupMallLimitedTimeItemList({
memberCategories,
memberIds,
categories
categories,
historyMap
}: ElineupMallLimitedTimeItemListProps) {
const { data, isReloading, reload } = useLazyReloadableQuery<ElineupMallLimitedTimeItemListQuery>(
ElineupMallLimitedTimeItemListQueryGraphQL,
Expand All @@ -72,7 +76,8 @@ export default function ElineupMallLimitedTimeItemList({
keyExtractor={(item) => item!.node!.id}
data={histories.data.elineupMallItems!.edges}
renderItem={({ item, index }) => {
return <ElineupMallLimitedTimeItemListItem data={item!.node!} />;
const historyItem = historyMap?.get(item?.node?.permalink ?? '');
return <ElineupMallLimitedTimeItemListItem data={item!.node!} purchaseHistoryItem={historyItem} />;
}}
onEndReachedThreshold={0.01}
onEndReached={() => {
Expand Down
Loading

0 comments on commit be8c6c1

Please sign in to comment.