diff --git a/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteCreatedListener.java b/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteCreatedListener.java index bcc97c5f..3b0d12a1 100644 --- a/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteCreatedListener.java +++ b/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteCreatedListener.java @@ -2,6 +2,7 @@ import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; +import org.springframework.transaction.event.TransactionalEventListener; import com.jikgorae.api.articlefavoritecount.application.ArticleFavoriteCountService; import com.jikgorae.common.notification.domain.PushToken; @@ -24,6 +25,10 @@ public FavoriteCreatedListener(ArticleFavoriteCountService articleFavoriteCountS @Override public void onApplicationEvent(FavoriteCreatedEvent event) { articleFavoriteCountService.increase(event.getFavorite().getArticle()); + } + + @TransactionalEventListener + public void doAfterFavoriteCreatedEvent(FavoriteCreatedEvent event) { sendNotification(event); } diff --git a/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteNotificationService.java b/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteNotificationService.java index c55eb590..c2d5d7bf 100644 --- a/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteNotificationService.java +++ b/back/api/src/main/java/com/jikgorae/api/favorite/application/FavoriteNotificationService.java @@ -1,14 +1,10 @@ package com.jikgorae.api.favorite.application; -import java.util.NoSuchElementException; - import org.springframework.context.ApplicationEvent; import org.springframework.stereotype.Service; import com.jikgorae.api.article.application.ArticleViewService; import com.jikgorae.api.article.domain.Article; -import com.jikgorae.api.member.domain.Member; -import com.jikgorae.api.member.domain.MemberRepository; import com.jikgorae.common.notification.domain.NotificationService; import com.jikgorae.common.notification.domain.PushToken; @@ -17,27 +13,22 @@ public class FavoriteNotificationService implements NotificationService { private static final String MESSAGE = "님이 회원님의 게시글을 찜했습니다."; private final ArticleViewService articleViewService; - private final MemberRepository memberRepository; - public FavoriteNotificationService(ArticleViewService articleViewService, - MemberRepository memberRepository) { + public FavoriteNotificationService(ArticleViewService articleViewService) { this.articleViewService = articleViewService; - this.memberRepository = memberRepository; } @Override public String makeMessage(ApplicationEvent applicationEvent) { FavoriteCreatedEvent event = (FavoriteCreatedEvent)applicationEvent; - Article article = articleViewService.show(event.getFavorite().getArticle().getId()); - String author = article.getAuthor().getNickname(); - return author + MESSAGE; + String senderNickname = event.getFavorite().getMember().getNickname(); + return senderNickname + MESSAGE; } @Override public PushToken getToken(ApplicationEvent applicationEvent) { FavoriteCreatedEvent event = (FavoriteCreatedEvent)applicationEvent; - Member member = memberRepository.findById(event.getFavorite().getMember().getId()) - .orElseThrow(() -> new NoSuchElementException("존재하지 않는 회원입니다.")); - return new PushToken(member.getPushToken()); + Article article = articleViewService.show(event.getFavorite().getArticle().getId()); + return new PushToken(article.getAuthor().getPushToken()); } } diff --git a/back/chat/src/main/java/com/jikgorae/chat/message/application/MessageResponse.java b/back/chat/src/main/java/com/jikgorae/chat/message/application/MessageResponse.java index f2ce3432..8c92a3b1 100644 --- a/back/chat/src/main/java/com/jikgorae/chat/message/application/MessageResponse.java +++ b/back/chat/src/main/java/com/jikgorae/chat/message/application/MessageResponse.java @@ -8,6 +8,8 @@ import com.jikgorae.chat.message.domain.Message; public class MessageResponse { + private static final long GAP_OF_KST_AND_UTC = 9L; + private String id; private Long senderId; private String senderNickname; @@ -18,7 +20,8 @@ public class MessageResponse { public MessageResponse() { } - public MessageResponse(String id, Long senderId, String senderNickname, Long roomId, String content, LocalDateTime createdTime) { + public MessageResponse(String id, Long senderId, String senderNickname, Long roomId, + String content, LocalDateTime createdTime) { this.id = id; this.senderId = senderId; this.senderNickname = senderNickname; @@ -30,7 +33,7 @@ public MessageResponse(String id, Long senderId, String senderNickname, Long roo public static MessageResponse of(Message message) { return new MessageResponse(message.getId(), message.getSenderId(), message.getSenderNickname(), message.getRoomId(), message.getContent(), - message.getCreatedTime().minusHours(9L)); + message.getCreatedTime().minusHours(GAP_OF_KST_AND_UTC)); } public static List listOf(List messages) { @@ -39,8 +42,9 @@ public static List listOf(List messages) { .collect(toList()); } - public void adjustTime() { - this.createdTime = createdTime.plusHours(9L); + public MessageResponse adjustTime() { + return new MessageResponse(id, senderId, senderNickname, roomId, content, + createdTime.plusHours(GAP_OF_KST_AND_UTC)); } public String getId() { diff --git a/back/chat/src/main/java/com/jikgorae/chat/message/presentation/MessageController.java b/back/chat/src/main/java/com/jikgorae/chat/message/presentation/MessageController.java index 7c3cdecf..3801a346 100644 --- a/back/chat/src/main/java/com/jikgorae/chat/message/presentation/MessageController.java +++ b/back/chat/src/main/java/com/jikgorae/chat/message/presentation/MessageController.java @@ -35,8 +35,7 @@ public MessageController(SimpMessageSendingOperations messagingTemplate, @MessageMapping(MESSAGE_URI) public void message(MessageRequest request) { MessageResponse response = messageService.save(request); - response.adjustTime(); - messagingTemplate.convertAndSend(DESTINATION + request.getRoomId(), response); + messagingTemplate.convertAndSend(DESTINATION + request.getRoomId(), response.adjustTime()); } @GetMapping(MESSAGE_REST_URI) @@ -47,6 +46,7 @@ public ResponseEntity> showAll(@PathVariable Long roomId, @GetMapping(MESSAGE_REST_URI + NEW) public ResponseEntity showLast(@PathVariable Long roomId) { - return ResponseEntity.ok(messageService.showLast(roomId)); + MessageResponse response = messageService.showLast(roomId); + return ResponseEntity.ok(response.adjustTime()); } } \ No newline at end of file diff --git a/back/chat/src/main/java/com/jikgorae/chat/wholemessage/application/WholeMessageResponse.java b/back/chat/src/main/java/com/jikgorae/chat/wholemessage/application/WholeMessageResponse.java index 7a18eb56..67114fb0 100644 --- a/back/chat/src/main/java/com/jikgorae/chat/wholemessage/application/WholeMessageResponse.java +++ b/back/chat/src/main/java/com/jikgorae/chat/wholemessage/application/WholeMessageResponse.java @@ -8,6 +8,8 @@ import com.jikgorae.chat.wholemessage.domain.WholeMessage; public class WholeMessageResponse { + private static final long GAP_OF_KST_AND_UTC = 9L; + private String id; private Long senderId; private String senderNickname; @@ -30,21 +32,11 @@ public WholeMessageResponse(String id, Long senderId, String senderNickname, this.createdTime = createdTime; } - public WholeMessageResponse(String id, Long senderId, String senderNickname, Long roomId, - String content, LocalDateTime createdTime) { - this.id = id; - this.senderId = senderId; - this.senderNickname = senderNickname; - this.roomId = roomId; - this.content = content; - this.createdTime = createdTime; - } - public static WholeMessageResponse of(WholeMessage wholeMessage) { return new WholeMessageResponse(wholeMessage.getId(), wholeMessage.getSenderId(), wholeMessage.getSenderNickname(), wholeMessage.getSenderAvatar(), wholeMessage.getRoomId(), wholeMessage.getContent(), - wholeMessage.getCreatedTime().minusHours(9L)); + wholeMessage.getCreatedTime().minusHours(GAP_OF_KST_AND_UTC)); } public static List listOf(List messages) { @@ -53,8 +45,9 @@ public static List listOf(List messages) { .collect(toList()); } - public void adjustTime() { - this.createdTime = createdTime.plusHours(9L); + public WholeMessageResponse adjustTime() { + return new WholeMessageResponse(id, senderId, senderNickname, senderAvatar, roomId, content, + createdTime.plusHours(GAP_OF_KST_AND_UTC)); } public String getId() { diff --git a/back/chat/src/main/java/com/jikgorae/chat/wholemessage/presentation/WholeMessageController.java b/back/chat/src/main/java/com/jikgorae/chat/wholemessage/presentation/WholeMessageController.java index f302f9e8..d6bb66fc 100644 --- a/back/chat/src/main/java/com/jikgorae/chat/wholemessage/presentation/WholeMessageController.java +++ b/back/chat/src/main/java/com/jikgorae/chat/wholemessage/presentation/WholeMessageController.java @@ -32,15 +32,12 @@ public WholeMessageController(SimpMessageSendingOperations messagingTemplate, @MessageMapping(WHOLE_MESSAGE_URI) public void message(WholeMessageRequest request) { WholeMessageResponse response = wholeMessageService.save(request); - response.adjustTime(); - messagingTemplate.convertAndSend(DESTINATION_OF_ORGANIZATION + request.getRoomId(), - response); + messagingTemplate.convertAndSend(DESTINATION_OF_ORGANIZATION + request.getRoomId(), response.adjustTime()); } @GetMapping(WHOLE_MESSAGE_REST_URI) public ResponseEntity> showAll(@PathVariable Long organizationId, @RequestParam int size, @RequestParam String lastMessageDate) { - return ResponseEntity.ok( - wholeMessageService.showAll(organizationId, size, lastMessageDate)); + return ResponseEntity.ok(wholeMessageService.showAll(organizationId, size, lastMessageDate)); } } diff --git a/back/chat/src/test/java/com/jikgorae/chat/message/fixture/MessageFixture.java b/back/chat/src/test/java/com/jikgorae/chat/message/fixture/MessageFixture.java index b6109c71..67081b5c 100644 --- a/back/chat/src/test/java/com/jikgorae/chat/message/fixture/MessageFixture.java +++ b/back/chat/src/test/java/com/jikgorae/chat/message/fixture/MessageFixture.java @@ -4,6 +4,6 @@ public class MessageFixture { public static MessageRequest requestOf(Long roomId) { - return new MessageRequest(roomId, 99L, "NICKNAME", "MESSAGE", "ExponentPushToken[1234567-12345678901234]"); + return new MessageRequest(roomId, 99L, "NICKNAME", "MESSAGE", "PUSH_TOKEN"); } } diff --git a/front/app.json b/front/app.json index a523250e..8a934fe5 100644 --- a/front/app.json +++ b/front/app.json @@ -2,7 +2,7 @@ "expo": { "name": "직고래", "slug": "jikgorae", - "version": "2.0.0", + "version": "2.0.2", "orientation": "portrait", "icon": "./assets/app_icon.png", "splash": { @@ -18,12 +18,8 @@ "android": { "package": "com.sellerleecompany.jikgorae", "softwareKeyboardLayoutMode": "pan", - "versionCode": 4 - }, - "ios": { - "bundleIdentifier": "com.sellerleecompany.jikgorae", - "supportsTablet": true, - "buildNumber": "2.0.0" + "versionCode": 6, + "useNextNotificationsApi": true }, "web": { "favicon": "./assets/app_icon.png" diff --git a/front/assets/app_icon.png b/front/assets/app_icon.png index 6f5bfbca..e762c426 100644 Binary files a/front/assets/app_icon.png and b/front/assets/app_icon.png differ diff --git a/front/src/components/ArticleDetail/ArticleDetailBottomNav.tsx b/front/src/components/ArticleDetail/ArticleDetailBottomNav.tsx index 2104d931..455c8392 100644 --- a/front/src/components/ArticleDetail/ArticleDetailBottomNav.tsx +++ b/front/src/components/ArticleDetail/ArticleDetailBottomNav.tsx @@ -12,7 +12,7 @@ import { StackNavigationProp } from "@react-navigation/stack"; import { HomeStackParam } from "../../types/types"; import { useSetRecoilState } from "recoil/dist"; import { chatRoomState } from "../../states/chatRoomState"; -import { MaterialCommunityIcons } from "@expo/vector-icons"; +import { AntDesign } from "@expo/vector-icons"; export default function ArticleDetailBottomNav() { const navigation = useNavigation< @@ -58,18 +58,21 @@ export default function ArticleDetailBottomNav() { - - {`${insertComma(price.toString())}원`} - - - {memberNickname !== author.nickname ? ( - + createChat(author)} /> - ) : undefined} + + ) : ( + <> + )} + + {`${insertComma(price.toString())}원`} ); @@ -86,25 +89,24 @@ const styles = StyleSheet.create({ alignItems: "center", borderRightWidth: 1, borderRightColor: theme.border, - paddingRight: 30, + paddingRight: 20, }, chatContainer: { justifyContent: "center", alignItems: "flex-end", - borderLeftWidth: 1, - borderLeftColor: theme.border, - paddingLeft: 30, + borderRightWidth: 1, + borderRightColor: theme.border, + paddingHorizontal: 20, }, priceContainer: { flex: 1, justifyContent: "center", alignItems: "flex-end", - paddingRight: 20, }, price: { fontSize: 24, fontWeight: "bold", - textAlign: "center", + textAlign: "right", color: theme.others, }, }); diff --git a/front/src/components/Common/ArticleCommon/ArticleCardTradeDetails.tsx b/front/src/components/Common/ArticleCommon/ArticleCardTradeDetails.tsx index 018c1b60..56cee5d3 100644 --- a/front/src/components/Common/ArticleCommon/ArticleCardTradeDetails.tsx +++ b/front/src/components/Common/ArticleCommon/ArticleCardTradeDetails.tsx @@ -23,7 +23,8 @@ const styles = StyleSheet.create({ alignItems: "center", }, createTime: { - marginLeft: 5, - fontSize: 12, + marginLeft: 10, + fontSize: 13, + color: "gray", }, }); diff --git a/front/src/components/Common/ArticleCommon/ArticleCardTradeState.tsx b/front/src/components/Common/ArticleCommon/ArticleCardTradeState.tsx index c8ddbbe3..b9685aac 100644 --- a/front/src/components/Common/ArticleCommon/ArticleCardTradeState.tsx +++ b/front/src/components/Common/ArticleCommon/ArticleCardTradeState.tsx @@ -39,21 +39,21 @@ export default function ArticleCardTradeState({ const styles = StyleSheet.create({ tradeOnSaleContainer: { - paddingHorizontal: 5, + paddingHorizontal: 10, backgroundColor: theme.primary, borderRadius: 10, justifyContent: "center", alignItems: "center", }, tradeReservedContainer: { - paddingHorizontal: 5, + paddingHorizontal: 10, backgroundColor: theme.secondary, borderRadius: 10, justifyContent: "center", alignItems: "center", }, tradeCompletedContainer: { - paddingHorizontal: 5, + paddingHorizontal: 10, backgroundColor: "lightgrey", borderRadius: 10, justifyContent: "center", diff --git a/front/src/components/Navigation/HomeStack.tsx b/front/src/components/Navigation/HomeStack.tsx index 343e8e77..5eb81ea2 100644 --- a/front/src/components/Navigation/HomeStack.tsx +++ b/front/src/components/Navigation/HomeStack.tsx @@ -62,20 +62,8 @@ export default function HomeStack() { component={CategoryHomeScreen} /> - - + + - 조직 입장/생성 + 조직 관리 diff --git a/front/src/components/Profile/ProfileInfo.tsx b/front/src/components/Profile/ProfileInfo.tsx index ad185f15..c284b3f3 100644 --- a/front/src/components/Profile/ProfileInfo.tsx +++ b/front/src/components/Profile/ProfileInfo.tsx @@ -21,7 +21,7 @@ export default function ProfileInfo() { diff --git a/front/src/components/chat/ChatMenu.tsx b/front/src/components/chat/ChatMenu.tsx index f74eb27f..a7eac497 100644 --- a/front/src/components/chat/ChatMenu.tsx +++ b/front/src/components/chat/ChatMenu.tsx @@ -34,7 +34,7 @@ export default function ChatMenu() { }; return ( - + @@ -49,11 +49,8 @@ export default function ChatMenu() { } const styles = StyleSheet.create({ - container: { - paddingVertical: 5, - }, menuOptions: { - width: 100, + width: 80, }, menuCustomStyle: { textAlign: "center", diff --git a/front/src/components/chat/ChatRoomItem.tsx b/front/src/components/chat/ChatRoomItem.tsx index ce62dc60..e23da32a 100644 --- a/front/src/components/chat/ChatRoomItem.tsx +++ b/front/src/components/chat/ChatRoomItem.tsx @@ -101,36 +101,35 @@ const styles = StyleSheet.create({ aspectRatio: 1, flexDirection: "row", justifyContent: "flex-start", - paddingVertical: 20, - paddingHorizontal: 20, + padding: 15, }, opponentContainer: { flex: 5, alignItems: "flex-start", + justifyContent: "space-between", + paddingVertical: 15, }, opponentTopContainer: { flexDirection: "row", + alignItems: "center", }, opponentNickname: { - paddingVertical: 10, fontSize: 16, color: "black", fontWeight: "bold", }, diffTime: { - paddingVertical: 11, - paddingHorizontal: 10, + paddingLeft: 10, fontSize: 14, color: "rgb(80,80,80)", }, lastMessage: { - paddingVertical: 5, - fontSize: 16, + fontSize: 18, color: "rgb(80,80,80)", }, articleThumbnailContainer: { flex: 1, justifyContent: "center", - paddingHorizontal: 20, + padding: 20, }, }); diff --git a/front/src/components/chat/ChatTradeState.tsx b/front/src/components/chat/ChatTradeState.tsx index 1976df65..955b51d0 100644 --- a/front/src/components/chat/ChatTradeState.tsx +++ b/front/src/components/chat/ChatTradeState.tsx @@ -1,6 +1,7 @@ import React from "react"; import { StyleSheet, Text, View } from "react-native"; import theme from "../../colors"; +import colors from "../../colors"; export default function ChatTradeState({ tradeState }: { tradeState: string }) { const getContainerStyleByTradeState = () => { @@ -22,54 +23,43 @@ export default function ChatTradeState({ tradeState }: { tradeState: string }) { } return styles.tradeCompletedText; }; + return ( - - - {tradeState} - + + {tradeState} ); } const styles = StyleSheet.create({ - container: { - flex: 1, - justifyContent: "flex-start", - }, tradeOnSaleContainer: { - flex: 1, - marginTop: 5, - aspectRatio: 5 / 3, + paddingHorizontal: 10, backgroundColor: theme.primary, borderRadius: 10, justifyContent: "center", alignItems: "center", }, tradeReservedContainer: { - flex: 1, - marginTop: 5, - aspectRatio: 5 / 3, + paddingHorizontal: 10, backgroundColor: theme.secondary, borderRadius: 10, justifyContent: "center", alignItems: "center", }, tradeCompletedContainer: { - flex: 1, - marginTop: 5, - aspectRatio: 5 / 3, + paddingHorizontal: 10, backgroundColor: "lightgrey", borderRadius: 10, justifyContent: "center", alignItems: "center", }, tradeOnSaleText: { - fontSize: 14, + fontSize: 12, fontWeight: "bold", color: "white", }, tradeReservedText: { - fontSize: 14, + fontSize: 12, fontWeight: "bold", color: "white", }, @@ -78,4 +68,33 @@ const styles = StyleSheet.create({ fontWeight: "bold", color: "grey", }, + containerOfOnSale: { + flex: 1, + backgroundColor: colors.primary, + width: 45, + height: 25, + borderRadius: 5, + justifyContent: "center", + alignItems: "center", + marginBottom: 3, + }, + containerOfNotOnSale: { + flex: 1, + backgroundColor: "lightgrey", + width: 60, + height: 25, + borderRadius: 5, + justifyContent: "center", + alignItems: "center", + marginBottom: 3, + }, + tradeStateOfOnSale: { + color: "white", + fontSize: 13, + fontWeight: "500", + }, + tradeStateOfNotOnSale: { + fontSize: 13, + color: "rgb(110,110,110)", + }, }); diff --git a/front/src/components/chat/OrganizationChatList.tsx b/front/src/components/chat/OrganizationChatList.tsx index 1551d9fa..4d796798 100644 --- a/front/src/components/chat/OrganizationChatList.tsx +++ b/front/src/components/chat/OrganizationChatList.tsx @@ -1,29 +1,15 @@ -import React, { useEffect, useState } from "react"; - +import React from "react"; import { FlatList } from "react-native"; - import OrganizationItem from "./OrganizationItem"; -import { organizationAPI } from "../../api/api"; +import { useRecoilValue } from "recoil/dist"; +import { organizationListState } from "../../states/organizationState"; export default function OrganizationChatList() { - const [organizations, setOrganizations] = useState([ - { - id: 0, - name: "", - }, - ]); - - useEffect(() => { - const initOrganizations = async () => { - const { data } = await organizationAPI.showAll(); - setOrganizations(data); - }; - initOrganizations(); - }, []); + const organizationList = useRecoilValue(organizationListState); return ( ( // @ts-ignore diff --git a/front/src/screens/ArticleDetailScreen.tsx b/front/src/screens/ArticleDetailScreen.tsx index 344cd147..d75d6dbc 100644 --- a/front/src/screens/ArticleDetailScreen.tsx +++ b/front/src/screens/ArticleDetailScreen.tsx @@ -212,7 +212,7 @@ const styles = StyleSheet.create({ articleContentContainer: { backgroundColor: "white", marginTop: -30, - paddingHorizontal: 30, + paddingHorizontal: 20, borderTopLeftRadius: 30, borderTopRightRadius: 30, }, @@ -229,8 +229,8 @@ const styles = StyleSheet.create({ backgroundColor: "white", borderWidth: 1, borderColor: theme.border, - paddingHorizontal: 30, - paddingVertical: 10, + paddingHorizontal: 20, + paddingVertical: 5, }, chatButtonContainer: { flex: 1, diff --git a/front/src/screens/CategoryHomeScreen.tsx b/front/src/screens/CategoryHomeScreen.tsx index e523d90c..849173cc 100644 --- a/front/src/screens/CategoryHomeScreen.tsx +++ b/front/src/screens/CategoryHomeScreen.tsx @@ -131,9 +131,9 @@ export default function CategoryHomeScreen() { setVisibleMenu(true)}> diff --git a/front/src/screens/ChatScreen.tsx b/front/src/screens/ChatScreen.tsx index 68054737..0651aafd 100644 --- a/front/src/screens/ChatScreen.tsx +++ b/front/src/screens/ChatScreen.tsx @@ -1,12 +1,15 @@ -import React, { useCallback, useEffect, useState } from "react"; +import React, { + useCallback, + useEffect, + useLayoutEffect, + useState, +} from "react"; import { useRecoilValue, useSetRecoilState } from "recoil/dist"; import { chatRoomState } from "../states/chatRoomState"; import { ActivityIndicator, Image, - Platform, - SafeAreaView, - StatusBar, + KeyboardAvoidingView, StyleSheet, Text, TouchableOpacity, @@ -19,8 +22,8 @@ import theme from "../colors"; import { CHAT_BASE_URL, messageAPI } from "../api/api"; import { memberAvatarState, - memberNicknameState, memberIdState, + memberNicknameState, } from "../states/memberState"; import SockJS from "sockjs-client"; import ArticleCardImage from "../components/Common/ArticleCommon/ArticleCardImage"; @@ -57,6 +60,33 @@ export default function ChatScreen() { const [hasMoreMessage, setHasMoreMessage] = useState(true); const [isLoading, setIsLoading] = useState(false); + useLayoutEffect(() => { + navigation.setOptions({ + title: `${opponent.nickname}님과의 채팅`, + headerTitleAlign: "left", + headerLeft: () => ( + ( + + )} + /> + ), + headerLeftContainerStyle: { + alignItems: "center", + justifyContents: "center", + aspectRatio: 1, + }, + headerRight: () => , + headerRightContainerStyle: { + aspectRatio: 1, + justifyContents: "center", + alignItems: "center", + }, + }); + }, [navigation]); + const pushMessage = useCallback((message = []) => { const received = JSON.parse(message.body); const user = { @@ -118,10 +148,8 @@ export default function ChatScreen() { // @ts-ignore const renderSend = (props) => { return ( - - - - + + ); }; @@ -195,24 +223,15 @@ export default function ChatScreen() { }; return ( - - - } - /> - - {opponent.nickname}님과의 채팅 - - - + - {articleInfo.title} + + {articleInfo.title} + @@ -284,9 +303,10 @@ export default function ChatScreen() { )} parsePatterns={(linkStyle) => [{ type: "phone", style: linkStyle }]} + maxInputLength={150} /> - + ); } @@ -294,15 +314,6 @@ const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "white", - paddingTop: Platform.OS === "ios" ? 0 : StatusBar.currentHeight, - }, - navigationContainer: { - flex: 0.8, - flexDirection: "row", - backgroundColor: "white", - paddingHorizontal: 25, - borderBottomWidth: 1, - borderBottomColor: theme.border, }, opponentContainer: { flex: 1, @@ -310,14 +321,14 @@ const styles = StyleSheet.create({ alignItems: "center", }, opponent: { - fontSize: 18, + fontSize: 16, color: "black", }, articleContainer: { - flex: 1.8, + aspectRatio: 4, flexDirection: "row", backgroundColor: "rgb(250,250,250)", - paddingHorizontal: 30, + paddingHorizontal: 20, borderBottomWidth: 1, borderBottomColor: theme.border, }, @@ -325,30 +336,33 @@ const styles = StyleSheet.create({ aspectRatio: 1, flexDirection: "row", justifyContent: "center", - marginVertical: 15, + marginVertical: 10, }, articleInfoContainer: { flex: 1, - paddingHorizontal: 30, - paddingVertical: 20, + paddingHorizontal: 20, + paddingVertical: 10, + justifyContent: "space-between", + }, + articleTitleContainer: { + justifyContent: "flex-start", }, articleTitle: { - fontSize: 24, + fontSize: 22, fontWeight: "bold", color: "black", }, articlePriceAndTradeStateContainer: { - flex: 1, + aspectRatio: 8, flexDirection: "row", + justifyContent: "space-between", }, articlePriceContainer: { - flex: 1, - flexDirection: "row", alignItems: "flex-end", - justifyContent: "flex-end", + justifyContent: "center", }, articlePrice: { - fontSize: 18, + fontSize: 20, fontWeight: "bold", color: theme.others, }, @@ -360,12 +374,10 @@ const styles = StyleSheet.create({ chatContainer: { flex: 12, }, - sendingContainer: { + sendContainer: { aspectRatio: 1, justifyContent: "center", alignItems: "center", - padding: 5, - marginRight: 5, }, loadingContainer: { flex: 12, diff --git a/front/src/screens/FeedHomeScreen.tsx b/front/src/screens/FeedHomeScreen.tsx index 6a6fdd08..47c095eb 100644 --- a/front/src/screens/FeedHomeScreen.tsx +++ b/front/src/screens/FeedHomeScreen.tsx @@ -29,6 +29,7 @@ import { Menu, MenuOptions, MenuTrigger } from "react-native-popup-menu"; import { selectedOrganizationInFeedsState } from "../states/organizationState"; import { Feather } from "@expo/vector-icons"; import OrganizationList from "../components/organization/OrganizationList"; +import Constants from "expo-constants"; type FeedHomeScreenNavigationProp = CompositeNavigationProp< StackNavigationProp, @@ -78,15 +79,28 @@ export default function FeedHomeScreen() { ); const requestNotificationPermission = async () => { - const { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS); - if (status !== PermissionStatus.GRANTED) { - return; + let pushToken; + if (Constants.isDevice) { + const { status: existingStatus } = await Permissions.getAsync( + Permissions.NOTIFICATIONS, + ); + let finalStatus = existingStatus; + if (existingStatus !== PermissionStatus.GRANTED) { + const { status } = await Permissions.askAsync( + Permissions.NOTIFICATIONS, + ); + finalStatus = status; + } + if (finalStatus !== PermissionStatus.GRANTED) { + alert("Failed to get push token for push notification!"); + return; + } + pushToken = (await Notifications.getExpoPushTokenAsync()).data; + console.log(pushToken); } - const pushToken = (await Notifications.getExpoPushTokenAsync()).data; - if (Platform.OS === "android") { - await Notifications.setNotificationChannelAsync("default", { + Notifications.setNotificationChannelAsync("default", { name: "default", importance: Notifications.AndroidImportance.MAX, vibrationPattern: [0, 250, 250, 250], @@ -191,10 +205,12 @@ export default function FeedHomeScreen() { return ( - {setTitle()} setVisibleMenu(true)}> - + + {setTitle()} + + { getProfile(); }, []); diff --git a/front/src/screens/WholeChatScreen.tsx b/front/src/screens/WholeChatScreen.tsx index b59bc919..6b05aa5b 100644 --- a/front/src/screens/WholeChatScreen.tsx +++ b/front/src/screens/WholeChatScreen.tsx @@ -1,11 +1,14 @@ -import React, { useCallback, useEffect, useState } from "react"; +import React, { + useCallback, + useEffect, + useLayoutEffect, + useState, +} from "react"; import { useRecoilValue } from "recoil/dist"; import { wholeChatRoomState } from "../states/chatRoomState"; import { ActivityIndicator, - Platform, - SafeAreaView, - StatusBar, + KeyboardAvoidingView, StyleSheet, Text, View, @@ -49,6 +52,27 @@ export default function WholeChatScreen() { const [hasMoreMessage, setHasMoreMessage] = useState(true); const [isLoading, setIsLoading] = useState(false); + useLayoutEffect(() => { + navigation.setOptions({ + title: `${name}`, + headerTitleAlign: "left", + headerLeft: () => ( + ( + + )} + /> + ), + headerLeftContainerStyle: { + alignItems: "center", + justifyContents: "center", + aspectRatio: 1, + }, + }); + }, [navigation]); + const pushMessage = useCallback((message = []) => { const received = JSON.parse(message.body); const user = { @@ -115,10 +139,8 @@ export default function WholeChatScreen() { // @ts-ignore const renderSend = (props) => { return ( - - - - + + ); }; @@ -211,17 +233,7 @@ export default function WholeChatScreen() { }; return ( - - - } - /> - - {name} - - + [{ type: "phone", style: linkStyle }]} /> - + ); } @@ -262,7 +274,6 @@ const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "white", - paddingTop: Platform.OS === "ios" ? 0 : StatusBar.currentHeight, }, navigationContainer: { flex: 0.8, @@ -328,12 +339,10 @@ const styles = StyleSheet.create({ chatContainer: { flex: 12, }, - sendingContainer: { + sendContainer: { aspectRatio: 1, justifyContent: "center", alignItems: "center", - padding: 5, - marginRight: 5, }, loadingContainer: { flex: 12, diff --git a/seller-lee-secret b/seller-lee-secret index 1522c929..213b121b 160000 --- a/seller-lee-secret +++ b/seller-lee-secret @@ -1 +1 @@ -Subproject commit 1522c9290e11454d336ff589263a514c1a21ef27 +Subproject commit 213b121bbda449c882a89491a08ca3f2c20a0aff