@zezosoft/zezo-ott-react-native-ui-kit 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/components/Content/Card/Sliders/Styles/Three.js +5 -4
- package/lib/module/components/Content/Card/Sliders/Styles/Three.js.map +1 -1
- package/lib/module/components/Headers/Four.js +1 -1
- package/lib/module/components/Headers/Three.js +2 -1
- package/lib/module/components/Headers/Three.js.map +1 -1
- package/lib/typescript/src/components/Content/Card/Sliders/Styles/Three.d.ts.map +1 -1
- package/package.json +2 -14
- package/src/Styles/globalStyles.ts +0 -70
- package/src/assets/animations/135037-payment-processing-error.json +0 -1347
- package/src/assets/animations/7227-vui-animation.json +0 -3377
- package/src/assets/animations/Failed.json +0 -2103
- package/src/assets/animations/Pending.json +0 -522
- package/src/assets/animations/Successful.json +0 -2289
- package/src/assets/animations/heart.json +0 -788
- package/src/assets/animations/succesfull-payment.json +0 -2379
- package/src/assets/animations/voice-icon.json +0 -542
- package/src/assets/img/back.png +0 -0
- package/src/assets/img/bottom-panel.png +0 -0
- package/src/assets/img/camera.png +0 -0
- package/src/assets/img/camera2.png +0 -0
- package/src/assets/img/home.png +0 -0
- package/src/assets/img/lock.png +0 -0
- package/src/assets/img/play.png +0 -0
- package/src/assets/img/profile.jpg +0 -0
- package/src/assets/img/qr-code.png +0 -0
- package/src/assets/img/shadow.png +0 -0
- package/src/assets/img/shadow2.png +0 -0
- package/src/assets/img/user.png +0 -0
- package/src/assets/svg/Account.svg +0 -4
- package/src/assets/svg/Favourite.svg +0 -14
- package/src/assets/svg/Upcoming.svg +0 -4
- package/src/assets/svg/content-error.svg +0 -28
- package/src/assets/svg/download.svg +0 -3
- package/src/assets/svg/eye-off.svg +0 -10
- package/src/assets/svg/favorites.svg +0 -3
- package/src/assets/svg/h.svg +0 -4
- package/src/assets/svg/home.svg +0 -5
- package/src/assets/svg/home1.svg +0 -3
- package/src/assets/svg/menu-bar.svg +0 -4
- package/src/assets/svg/my-space.svg +0 -14
- package/src/assets/svg/play-icon-with-bg.svg +0 -5
- package/src/assets/svg/profile.svg +0 -4
- package/src/assets/svg/search.svg +0 -5
- package/src/assets/svg/search1.svg +0 -4
- package/src/assets/svg/server-error.svg +0 -139
- package/src/components/Account/Account.tsx +0 -367
- package/src/components/Account/index.ts +0 -1
- package/src/components/Alert/AlertDialog.tsx +0 -247
- package/src/components/Alert/UAAlert.tsx +0 -170
- package/src/components/Alert/index.ts +0 -2
- package/src/components/Auth/AuthProvider/AuthProvider.tsx +0 -419
- package/src/components/Auth/One/ForgotPassword/ForgotPassword.tsx +0 -324
- package/src/components/Auth/One/Login/LoginWithEmail.tsx +0 -455
- package/src/components/Auth/One/Login/LoginWithPhone.tsx +0 -306
- package/src/components/Auth/One/OTP/OTP.tsx +0 -465
- package/src/components/Auth/One/QrLogin/QrLogin.tsx +0 -602
- package/src/components/Auth/One/QrLogin/components/QrViewArea.tsx +0 -423
- package/src/components/Auth/One/SignUp/SignUp.tsx +0 -479
- package/src/components/Auth/One/SplashScreen/SplashScreen.tsx +0 -249
- package/src/components/Auth/One/SplashScreen/components/SplashImage/SplashImage.tsx +0 -103
- package/src/components/Auth/One/SplashScreen/components/SplashLottie/SplashLottie.tsx +0 -77
- package/src/components/Auth/One/SplashScreen/components/SplashVideo/SplashVideo.tsx +0 -174
- package/src/components/Auth/One/index.ts +0 -24
- package/src/components/Auth/Two/AuthHeader/AuthHeader.tsx +0 -108
- package/src/components/Auth/Two/ForgotPassword/ForgotPassword.tsx +0 -335
- package/src/components/Auth/Two/Login/AuthLoginShell.tsx +0 -173
- package/src/components/Auth/Two/Login/LoginWithEmail.tsx +0 -279
- package/src/components/Auth/Two/Login/LoginWithPhone.tsx +0 -188
- package/src/components/Auth/Two/OTP/OTP.tsx +0 -465
- package/src/components/Auth/Two/QrLogin/QrLogin.tsx +0 -602
- package/src/components/Auth/Two/QrLogin/components/QrViewArea.tsx +0 -423
- package/src/components/Auth/Two/SignUp/SignUp.tsx +0 -472
- package/src/components/Auth/Two/SplashScreen/SplashScreen.tsx +0 -248
- package/src/components/Auth/Two/SplashScreen/components/SplashImage/SplashImage.tsx +0 -92
- package/src/components/Auth/Two/SplashScreen/components/SplashLottie/SplashLottie.tsx +0 -77
- package/src/components/Auth/Two/SplashScreen/components/SplashVideo/SplashVideo.tsx +0 -178
- package/src/components/Auth/Two/index.ts +0 -28
- package/src/components/Auth/index.ts +0 -11
- package/src/components/BackgroundLayout/BackgroundLayout.tsx +0 -174
- package/src/components/BackgroundLayout/BackgroundLayoutOne.tsx +0 -56
- package/src/components/BlogView/BlogView.tsx +0 -276
- package/src/components/BlogView/index.ts +0 -8
- package/src/components/BlurView/BlurView.tsx +0 -199
- package/src/components/BlurView/index.ts +0 -7
- package/src/components/BottomSheet/BottomSheet.tsx +0 -200
- package/src/components/BottomSheet/BottomSheetOne.tsx +0 -220
- package/src/components/BottomSheet/index.ts +0 -4
- package/src/components/Button/BackBtn.tsx +0 -168
- package/src/components/Button/MenuBtn.tsx +0 -229
- package/src/components/Button/PrimaryBtn.tsx +0 -134
- package/src/components/Button/SecondaryBtn.tsx +0 -132
- package/src/components/Button/TextButton.tsx +0 -145
- package/src/components/Button/index.ts +0 -18
- package/src/components/Content/Card/Category/Category.tsx +0 -436
- package/src/components/Content/Card/Category/CategroyTwo.tsx +0 -429
- package/src/components/Content/Card/NowWatching/NowWatching.tsx +0 -624
- package/src/components/Content/Card/Sliders/Styles/One.tsx +0 -490
- package/src/components/Content/Card/Sliders/Styles/Three.tsx +0 -935
- package/src/components/Content/Card/Sliders/Styles/Two.tsx +0 -391
- package/src/components/Content/Card/Sliders/index.ts +0 -17
- package/src/components/Content/Card/Styles/Five.tsx +0 -385
- package/src/components/Content/Card/Styles/Four.tsx +0 -379
- package/src/components/Content/Card/Styles/One.tsx +0 -386
- package/src/components/Content/Card/Styles/RotateInOut.tsx +0 -413
- package/src/components/Content/Card/Styles/Six.tsx +0 -392
- package/src/components/Content/Card/Styles/Three.tsx +0 -314
- package/src/components/Content/Card/Styles/TopTen.tsx +0 -412
- package/src/components/Content/Card/Styles/Two.tsx +0 -416
- package/src/components/Content/Card/components/AdsPoster.tsx +0 -202
- package/src/components/Content/Card/components/CardPoster.tsx +0 -377
- package/src/components/Content/Card/components/NavigateToMore.tsx +0 -97
- package/src/components/Content/Card/components/RentOrBuyIcon.tsx +0 -129
- package/src/components/Content/Card/components/ShowAllButton.tsx +0 -92
- package/src/components/Content/Card/components/ThumbnailCard.tsx +0 -234
- package/src/components/Content/Card/components/index.ts +0 -1
- package/src/components/Content/Card/index.ts +0 -30
- package/src/components/Content/Content.tsx +0 -315
- package/src/components/Content/Sections.tsx +0 -238
- package/src/components/Content/types.ts +0 -176
- package/src/components/ContentView/MoreContentList.tsx +0 -327
- package/src/components/ContentView/One/ContentViewOne.tsx +0 -243
- package/src/components/ContentView/One/components/AboutSection.tsx +0 -216
- package/src/components/ContentView/One/components/CastCard.tsx +0 -265
- package/src/components/ContentView/One/components/EpisodeCard.tsx +0 -535
- package/src/components/ContentView/One/components/GenreTags.tsx +0 -132
- package/src/components/ContentView/One/components/HeroBanner.tsx +0 -357
- package/src/components/ContentView/One/components/MiniInfo.tsx +0 -356
- package/src/components/ContentView/One/components/PlayButton.tsx +0 -56
- package/src/components/ContentView/One/components/Title.tsx +0 -149
- package/src/components/ContentView/One/components/TrailerButton.tsx +0 -76
- package/src/components/ContentView/Two/ContentViewTwo.tsx +0 -343
- package/src/components/ContentView/Two/components/AboutSection.tsx +0 -216
- package/src/components/ContentView/Two/components/Details.tsx +0 -193
- package/src/components/ContentView/Two/components/EpisodeCard.tsx +0 -602
- package/src/components/ContentView/Two/components/GenreTags.tsx +0 -123
- package/src/components/ContentView/Two/components/HeroBanner.tsx +0 -402
- package/src/components/ContentView/Two/components/LikeShareActions.tsx +0 -125
- package/src/components/ContentView/Two/components/MoreLikeThisContentList .tsx +0 -305
- package/src/components/ContentView/Two/components/PlayOrTrailer.tsx +0 -133
- package/src/components/ContentView/Two/components/SectionTabs.tsx +0 -177
- package/src/components/ContentView/Two/components/Title.tsx +0 -226
- package/src/components/ContentView/Two/components/index.ts +0 -15
- package/src/components/ContentView/index.ts +0 -13
- package/src/components/Fallbacks/NoContentFallback.tsx +0 -176
- package/src/components/Fallbacks/NotFoundFallback.tsx +0 -94
- package/src/components/Fallbacks/index.ts +0 -2
- package/src/components/Headers/AppHeader.tsx +0 -150
- package/src/components/Headers/Four.tsx +0 -83
- package/src/components/Headers/One.tsx +0 -115
- package/src/components/Headers/Three.tsx +0 -135
- package/src/components/Headers/Two.tsx +0 -100
- package/src/components/Headers/index.ts +0 -18
- package/src/components/Input/Input.ts +0 -20
- package/src/components/Input/InputOne.tsx +0 -259
- package/src/components/Input/InputThree.tsx +0 -212
- package/src/components/Input/InputTwo.tsx +0 -212
- package/src/components/Input/PhoneNumberInput.tsx +0 -431
- package/src/components/Input/PhoneNumberInputTwo.tsx +0 -418
- package/src/components/Keyboard/HideKeyboard.tsx +0 -88
- package/src/components/Loader/Loader.tsx +0 -44
- package/src/components/Logo/Logo.tsx +0 -145
- package/src/components/NewRelease/NewReleaseSheet.tsx +0 -250
- package/src/components/NewRelease/index.ts +0 -1
- package/src/components/Reels/ReelsSeries/MediaControls/BottomControls.tsx +0 -221
- package/src/components/Reels/ReelsSeries/MediaControls/MediaControlsProvider.tsx +0 -314
- package/src/components/Reels/ReelsSeries/MediaControls/MiddleControls.tsx +0 -196
- package/src/components/Reels/ReelsSeries/MediaControls/RightControls.tsx +0 -95
- package/src/components/Reels/ReelsSeries/MediaControls/TopControls.tsx +0 -163
- package/src/components/Reels/ReelsSeries/Model/DetailsModal.tsx +0 -210
- package/src/components/Reels/ReelsSeries/Model/SettingModal.tsx +0 -146
- package/src/components/Reels/ReelsSeries/Model/UnlockModal.tsx +0 -154
- package/src/components/Reels/ReelsSeries/ReelsSeries.tsx +0 -264
- package/src/components/Reels/ReelsSeries/ReelsSeriesItem.tsx +0 -494
- package/src/components/Reels/ReelsSeries/components/AnimatedThreeLines.tsx +0 -184
- package/src/components/Reels/ReelsSeries/components/Episodes.tsx +0 -154
- package/src/components/Reels/ReelsSeries/components/GradientOverlay.tsx +0 -41
- package/src/components/Reels/ReelsSeries/components/Like.tsx +0 -40
- package/src/components/Reels/ReelsSeries/components/RotatingLoader.tsx +0 -79
- package/src/components/Reels/ReelsSeries/components/Synopsis.tsx +0 -332
- package/src/components/Reels/ReelsSeries/components/VideoControls/QualityControl.tsx +0 -187
- package/src/components/Reels/ReelsSeries/components/VideoControls/SpeedControl.tsx +0 -80
- package/src/components/Reels/ReelsSeries/components/VideoControls/index.ts +0 -2
- package/src/components/Reels/ReelsSeries/types.ts +0 -54
- package/src/components/Reels/ReelsSeries/useReelsWatchProgress.ts +0 -85
- package/src/components/Reels/ReelsSeries/utils/quality.ts +0 -48
- package/src/components/Reels/index.ts +0 -9
- package/src/components/Reels/utils/Controls/gestureUtils.ts +0 -42
- package/src/components/Reels/utils/Controls/index.ts +0 -4
- package/src/components/Reels/utils/Controls/overlayUtils.ts +0 -35
- package/src/components/Reels/utils/Controls/videoControlsConstants.ts +0 -25
- package/src/components/Reels/utils/Controls/videoRef.ts +0 -4
- package/src/components/Reels/utils/index.ts +0 -1
- package/src/components/Reels/utils/timeoutUtils.ts +0 -29
- package/src/components/Search/One.tsx +0 -256
- package/src/components/Search/components/RecentSearchesSection.tsx +0 -181
- package/src/components/Search/components/SearchCard.tsx +0 -275
- package/src/components/Search/index.ts +0 -16
- package/src/components/Settings/AppSettings.tsx +0 -428
- package/src/components/Settings/index.ts +0 -1
- package/src/components/Subscription/SubOne.tsx +0 -874
- package/src/components/Subscription/index.ts +0 -12
- package/src/components/TabBar/One.tsx +0 -148
- package/src/components/TabBar/Three.tsx +0 -169
- package/src/components/TabBar/Two.tsx +0 -189
- package/src/components/TabBar/index.ts +0 -20
- package/src/components/Text/Text.tsx +0 -85
- package/src/components/Text/index.ts +0 -5
- package/src/components/User/DeviceSessions/DeviceSessions.tsx +0 -468
- package/src/components/User/ProfileUpdate/ProfileUpdate.tsx +0 -278
- package/src/components/User/PurchaseHistory/PurchaseHistory.tsx +0 -494
- package/src/components/User/WatchHistory/WatchHistory.tsx +0 -227
- package/src/components/User/WatchLater/WatchLater.tsx +0 -397
- package/src/components/User/components/UserAvatar.tsx +0 -120
- package/src/components/User/components/UserSection.tsx +0 -228
- package/src/components/User/index.ts +0 -18
- package/src/components/View/View.tsx +0 -37
- package/src/components/View/index.ts +0 -5
- package/src/components/common/AppStatusBar.tsx +0 -57
- package/src/components/index.ts +0 -29
- package/src/components/layout/SafeAreaWrapper.tsx +0 -45
- package/src/components/layout/index.ts +0 -1
- package/src/constants/dummySections.ts +0 -98
- package/src/hooks/Images/index.ts +0 -2
- package/src/hooks/Images/useImageLoader.ts +0 -206
- package/src/hooks/Images/useImageValidation.ts +0 -36
- package/src/hooks/index.ts +0 -17
- package/src/hooks/useAdTracking.ts +0 -349
- package/src/hooks/useCards.ts +0 -228
- package/src/hooks/useDebounce.ts +0 -35
- package/src/hooks/useKeyboard.ts +0 -43
- package/src/hooks/useNavigationMode.ts +0 -46
- package/src/hooks/usePaginatedSection.ts +0 -101
- package/src/hooks/usePrevious.ts +0 -28
- package/src/hooks/useSafeCallback.ts +0 -43
- package/src/hooks/useSkeletonItems.ts +0 -30
- package/src/hooks/useSplashCache.ts +0 -186
- package/src/hooks/useThemeColors.ts +0 -51
- package/src/index.tsx +0 -8
- package/src/store/RecentSearchesStore.ts +0 -78
- package/src/store/splashStore.ts +0 -91
- package/src/store/themeStore.ts +0 -43
- package/src/theme/ThemeProvider.tsx +0 -112
- package/src/theme/hook/index.ts +0 -1
- package/src/theme/hook/useInternalTheme.ts +0 -98
- package/src/theme/index.ts +0 -7
- package/src/theme/themes.ts +0 -336
- package/src/theme/utils/validateColor.ts +0 -127
- package/src/types/content/content-view.types.ts +0 -206
- package/src/types/hook/index.ts +0 -5
- package/src/types/hook/usePaginatedSetion.ts +0 -19
- package/src/types/index.ts +0 -7
- package/src/types/sections/index.ts +0 -84
- package/src/utils/Display.ts +0 -14
- package/src/utils/Formater.ts +0 -14
- package/src/utils/PlatformSelector.ts +0 -29
- package/src/utils/SizeMatters.ts +0 -7
- package/src/utils/Spacing.ts +0 -27
- package/src/utils/colorUtils.ts +0 -70
|
@@ -1,468 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Naresh Dhamu
|
|
3
|
-
* @lastModified Mon 30 Jun 2025 at 05:00 PM
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { memo, useMemo, useCallback } from 'react';
|
|
7
|
-
import {
|
|
8
|
-
View,
|
|
9
|
-
StyleSheet,
|
|
10
|
-
FlatList,
|
|
11
|
-
TouchableOpacity,
|
|
12
|
-
type StyleProp,
|
|
13
|
-
type ViewStyle,
|
|
14
|
-
Alert,
|
|
15
|
-
} from 'react-native';
|
|
16
|
-
import { scale, verticalScale } from 'react-native-size-matters';
|
|
17
|
-
import { Text } from '../../Text';
|
|
18
|
-
import { useInternalTheme } from '../../../theme/hook/useInternalTheme';
|
|
19
|
-
import AppHeader from '../../Headers/AppHeader';
|
|
20
|
-
import SkeletonPlaceholder from 'react-native-skeleton-placeholder';
|
|
21
|
-
import type { ThemeOverride } from '../../../theme/themes';
|
|
22
|
-
import { RFValue } from 'react-native-responsive-fontsize';
|
|
23
|
-
import { ScanLine } from 'lucide-react-native';
|
|
24
|
-
|
|
25
|
-
type IUserLocation = {
|
|
26
|
-
country: string | null;
|
|
27
|
-
state: string | null;
|
|
28
|
-
city: string | null;
|
|
29
|
-
};
|
|
30
|
-
type IDeviceInfo = {
|
|
31
|
-
name: string | null;
|
|
32
|
-
browser: string | null;
|
|
33
|
-
location: IUserLocation | null;
|
|
34
|
-
};
|
|
35
|
-
type ISessions = {
|
|
36
|
-
id: string;
|
|
37
|
-
token: string;
|
|
38
|
-
refreshToken: string | null;
|
|
39
|
-
fingerprint: string;
|
|
40
|
-
deviceId: string | null;
|
|
41
|
-
lastActivity?: Date;
|
|
42
|
-
deviceInfo: IDeviceInfo | null;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
type TextLabels = {
|
|
46
|
-
thisDevice?: string;
|
|
47
|
-
logOut?: string;
|
|
48
|
-
lastActivePrefix?: string;
|
|
49
|
-
noSessions?: string;
|
|
50
|
-
loadingLogoutText?: string;
|
|
51
|
-
cannotLogoutThisDeviceTitle?: string;
|
|
52
|
-
cannotLogoutThisDeviceMessage?: string;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
type IDeviceSessionsProps = {
|
|
56
|
-
sessions: ISessions[];
|
|
57
|
-
activeSessionId?: string;
|
|
58
|
-
error?: string;
|
|
59
|
-
onLogout: ({ session }: { session: ISessions }) => void;
|
|
60
|
-
onBackPress?: () => void;
|
|
61
|
-
onQrLoginPress?: () => void;
|
|
62
|
-
style?: StyleProp<ViewStyle>;
|
|
63
|
-
title?: string;
|
|
64
|
-
renderLogoutButton?: ({ session }: { session: ISessions }) => React.ReactNode;
|
|
65
|
-
renderContent?: ({
|
|
66
|
-
session,
|
|
67
|
-
isActive,
|
|
68
|
-
}: {
|
|
69
|
-
session: ISessions;
|
|
70
|
-
isActive: boolean;
|
|
71
|
-
}) => React.ReactNode | null;
|
|
72
|
-
textLabels?: TextLabels;
|
|
73
|
-
headerStyle?: StyleProp<ViewStyle>;
|
|
74
|
-
headerTitleAlign?: 'left' | 'center';
|
|
75
|
-
headerTitleStyle?: StyleProp<any>;
|
|
76
|
-
renderHeader?: () => React.ReactNode;
|
|
77
|
-
theme?: ThemeOverride;
|
|
78
|
-
isLoading?: boolean;
|
|
79
|
-
isLoadingLogout?: boolean;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const DeviceSessionsComponent: React.FC<IDeviceSessionsProps> = ({
|
|
83
|
-
sessions,
|
|
84
|
-
activeSessionId,
|
|
85
|
-
onLogout,
|
|
86
|
-
onBackPress = () => {},
|
|
87
|
-
onQrLoginPress,
|
|
88
|
-
title = 'Manage Devices',
|
|
89
|
-
style,
|
|
90
|
-
error,
|
|
91
|
-
renderLogoutButton,
|
|
92
|
-
renderContent,
|
|
93
|
-
textLabels,
|
|
94
|
-
headerStyle = {},
|
|
95
|
-
headerTitleAlign = 'center',
|
|
96
|
-
headerTitleStyle,
|
|
97
|
-
renderHeader,
|
|
98
|
-
theme,
|
|
99
|
-
isLoading,
|
|
100
|
-
isLoadingLogout,
|
|
101
|
-
}) => {
|
|
102
|
-
const { theme: appliedTheme } = useInternalTheme(theme);
|
|
103
|
-
const colors = appliedTheme.colors;
|
|
104
|
-
|
|
105
|
-
const [logoutSessionId, setLogoutSessionId] = React.useState<string | null>(
|
|
106
|
-
null
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const {
|
|
110
|
-
thisDevice = 'This Device',
|
|
111
|
-
logOut = 'LOG OUT',
|
|
112
|
-
lastActivePrefix = 'Last active:',
|
|
113
|
-
noSessions = 'No active sessions found.',
|
|
114
|
-
loadingLogoutText = 'Logging out...',
|
|
115
|
-
cannotLogoutThisDeviceTitle = '⚠️ Cannot Logout',
|
|
116
|
-
cannotLogoutThisDeviceMessage = 'You cannot log out of this device.',
|
|
117
|
-
} = textLabels || {};
|
|
118
|
-
|
|
119
|
-
const handleLogoutPress = useCallback(
|
|
120
|
-
(item: ISessions) => {
|
|
121
|
-
if (item.id === activeSessionId) {
|
|
122
|
-
Alert.alert(
|
|
123
|
-
cannotLogoutThisDeviceTitle,
|
|
124
|
-
cannotLogoutThisDeviceMessage,
|
|
125
|
-
[{ text: 'Cancel', style: 'cancel' }],
|
|
126
|
-
{
|
|
127
|
-
cancelable: true,
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
setLogoutSessionId(item.id);
|
|
133
|
-
onLogout({ session: item });
|
|
134
|
-
},
|
|
135
|
-
[
|
|
136
|
-
activeSessionId,
|
|
137
|
-
cannotLogoutThisDeviceTitle,
|
|
138
|
-
cannotLogoutThisDeviceMessage,
|
|
139
|
-
onLogout,
|
|
140
|
-
]
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
const renderItem = useCallback(
|
|
144
|
-
({ item }: { item: ISessions }): React.ReactElement | null => {
|
|
145
|
-
const isActive = item?.id === activeSessionId;
|
|
146
|
-
const isLoggingOut = isLoadingLogout && logoutSessionId === item.id;
|
|
147
|
-
if (renderContent) {
|
|
148
|
-
return (
|
|
149
|
-
(renderContent({
|
|
150
|
-
session: item,
|
|
151
|
-
isActive,
|
|
152
|
-
}) as React.ReactElement) ?? null
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const { name = 'Device', browser, location } = item.deviceInfo || {};
|
|
157
|
-
const hasLocation =
|
|
158
|
-
location?.city || location?.state || location?.country;
|
|
159
|
-
|
|
160
|
-
return (
|
|
161
|
-
<View
|
|
162
|
-
style={[
|
|
163
|
-
styles.deviceRow,
|
|
164
|
-
{
|
|
165
|
-
backgroundColor: colors.surfaceVariant,
|
|
166
|
-
borderColor: colors.outlineVariant ?? colors.outline,
|
|
167
|
-
shadowColor: colors.shadow ?? '#000',
|
|
168
|
-
},
|
|
169
|
-
]}
|
|
170
|
-
>
|
|
171
|
-
<View style={styles.deviceInfo}>
|
|
172
|
-
{(name || isActive) && (
|
|
173
|
-
<View style={styles.deviceRowHeader}>
|
|
174
|
-
{name && (
|
|
175
|
-
<Text
|
|
176
|
-
numberOfLines={1}
|
|
177
|
-
ellipsizeMode="tail"
|
|
178
|
-
style={[styles.deviceName, { color: colors.onSurface }]}
|
|
179
|
-
>
|
|
180
|
-
{name}
|
|
181
|
-
</Text>
|
|
182
|
-
)}
|
|
183
|
-
{isActive && (
|
|
184
|
-
<View
|
|
185
|
-
style={[styles.badge, { backgroundColor: colors.button }]}
|
|
186
|
-
>
|
|
187
|
-
<Text
|
|
188
|
-
numberOfLines={1}
|
|
189
|
-
style={[styles.badgeText, { color: colors.buttonText }]}
|
|
190
|
-
>
|
|
191
|
-
{thisDevice}
|
|
192
|
-
</Text>
|
|
193
|
-
</View>
|
|
194
|
-
)}
|
|
195
|
-
</View>
|
|
196
|
-
)}
|
|
197
|
-
|
|
198
|
-
{(browser || hasLocation) && (
|
|
199
|
-
<Text
|
|
200
|
-
numberOfLines={1}
|
|
201
|
-
ellipsizeMode="tail"
|
|
202
|
-
style={[styles.deviceMeta, { color: colors.onSurfaceVariant }]}
|
|
203
|
-
>
|
|
204
|
-
{browser}
|
|
205
|
-
{browser && hasLocation ? ' · ' : ''}
|
|
206
|
-
{hasLocation &&
|
|
207
|
-
[location?.city, location?.state, location?.country]
|
|
208
|
-
.filter(Boolean)
|
|
209
|
-
.join(', ')}
|
|
210
|
-
</Text>
|
|
211
|
-
)}
|
|
212
|
-
|
|
213
|
-
{item?.lastActivity && (
|
|
214
|
-
<Text
|
|
215
|
-
numberOfLines={1}
|
|
216
|
-
ellipsizeMode="tail"
|
|
217
|
-
style={[styles.deviceMeta, { color: colors.onSurfaceVariant }]}
|
|
218
|
-
>
|
|
219
|
-
{lastActivePrefix}{' '}
|
|
220
|
-
{new Date(item.lastActivity).toLocaleString()}
|
|
221
|
-
</Text>
|
|
222
|
-
)}
|
|
223
|
-
</View>
|
|
224
|
-
|
|
225
|
-
{renderLogoutButton ? (
|
|
226
|
-
renderLogoutButton({
|
|
227
|
-
session: item,
|
|
228
|
-
})
|
|
229
|
-
) : (
|
|
230
|
-
<TouchableOpacity
|
|
231
|
-
style={[styles.logoutButton, { borderColor: colors.border }]}
|
|
232
|
-
disabled={isLoggingOut}
|
|
233
|
-
activeOpacity={0.7}
|
|
234
|
-
onPress={() => handleLogoutPress(item)}
|
|
235
|
-
>
|
|
236
|
-
<Text
|
|
237
|
-
numberOfLines={1}
|
|
238
|
-
ellipsizeMode="tail"
|
|
239
|
-
style={[styles.logoutText, { color: colors.primary }]}
|
|
240
|
-
>
|
|
241
|
-
{isLoggingOut ? loadingLogoutText : logOut}
|
|
242
|
-
</Text>
|
|
243
|
-
</TouchableOpacity>
|
|
244
|
-
)}
|
|
245
|
-
</View>
|
|
246
|
-
);
|
|
247
|
-
},
|
|
248
|
-
[
|
|
249
|
-
activeSessionId,
|
|
250
|
-
isLoadingLogout,
|
|
251
|
-
logoutSessionId,
|
|
252
|
-
renderContent,
|
|
253
|
-
colors,
|
|
254
|
-
thisDevice,
|
|
255
|
-
lastActivePrefix,
|
|
256
|
-
renderLogoutButton,
|
|
257
|
-
loadingLogoutText,
|
|
258
|
-
logOut,
|
|
259
|
-
handleLogoutPress,
|
|
260
|
-
]
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
const keyExtractor = useCallback((item: ISessions) => item.id, []);
|
|
264
|
-
|
|
265
|
-
const renderSkeleton = () => {
|
|
266
|
-
return (
|
|
267
|
-
<View style={styles.listContent}>
|
|
268
|
-
{[...Array(4)].map((_, index) => (
|
|
269
|
-
<View
|
|
270
|
-
key={index}
|
|
271
|
-
style={{
|
|
272
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
273
|
-
borderColor: colors.outlineVariant ?? colors.outline,
|
|
274
|
-
borderRadius: scale(10),
|
|
275
|
-
padding: scale(12),
|
|
276
|
-
marginBottom: verticalScale(12),
|
|
277
|
-
backgroundColor: colors.surfaceVariant,
|
|
278
|
-
}}
|
|
279
|
-
>
|
|
280
|
-
<SkeletonPlaceholder
|
|
281
|
-
backgroundColor={colors.skeletonBaseColor || '#E1E9EE'}
|
|
282
|
-
highlightColor={colors.skeletonHighlightColor || '#F2F8FC'}
|
|
283
|
-
borderRadius={scale(8)}
|
|
284
|
-
>
|
|
285
|
-
<SkeletonPlaceholder.Item
|
|
286
|
-
flexDirection="row"
|
|
287
|
-
alignItems="center"
|
|
288
|
-
justifyContent="space-between"
|
|
289
|
-
>
|
|
290
|
-
<SkeletonPlaceholder.Item flex={1} paddingRight={scale(12)}>
|
|
291
|
-
<SkeletonPlaceholder.Item
|
|
292
|
-
width="60%"
|
|
293
|
-
height={scale(14)}
|
|
294
|
-
borderRadius={scale(4)}
|
|
295
|
-
marginBottom={scale(6)}
|
|
296
|
-
/>
|
|
297
|
-
<SkeletonPlaceholder.Item
|
|
298
|
-
width="80%"
|
|
299
|
-
height={scale(10)}
|
|
300
|
-
borderRadius={scale(4)}
|
|
301
|
-
marginBottom={scale(4)}
|
|
302
|
-
/>
|
|
303
|
-
<SkeletonPlaceholder.Item
|
|
304
|
-
width="50%"
|
|
305
|
-
height={scale(10)}
|
|
306
|
-
borderRadius={scale(4)}
|
|
307
|
-
/>
|
|
308
|
-
</SkeletonPlaceholder.Item>
|
|
309
|
-
|
|
310
|
-
<SkeletonPlaceholder.Item
|
|
311
|
-
width={scale(80)}
|
|
312
|
-
height={verticalScale(30)}
|
|
313
|
-
borderRadius={scale(6)}
|
|
314
|
-
/>
|
|
315
|
-
</SkeletonPlaceholder.Item>
|
|
316
|
-
</SkeletonPlaceholder>
|
|
317
|
-
</View>
|
|
318
|
-
))}
|
|
319
|
-
</View>
|
|
320
|
-
);
|
|
321
|
-
};
|
|
322
|
-
const sortedSessions = useMemo(() => {
|
|
323
|
-
if (!sessions?.length) return [];
|
|
324
|
-
return [...sessions].sort((a, b) => {
|
|
325
|
-
if (a.id === activeSessionId) return -1;
|
|
326
|
-
if (b.id === activeSessionId) return 1;
|
|
327
|
-
return 0;
|
|
328
|
-
});
|
|
329
|
-
}, [sessions, activeSessionId]);
|
|
330
|
-
return (
|
|
331
|
-
<View
|
|
332
|
-
style={[styles.container, { backgroundColor: colors.background }, style]}
|
|
333
|
-
>
|
|
334
|
-
{renderHeader ? (
|
|
335
|
-
renderHeader()
|
|
336
|
-
) : (
|
|
337
|
-
<AppHeader
|
|
338
|
-
title={title}
|
|
339
|
-
onBackPress={onBackPress}
|
|
340
|
-
onRightPress={onQrLoginPress}
|
|
341
|
-
rightIcon={
|
|
342
|
-
<ScanLine
|
|
343
|
-
size={22}
|
|
344
|
-
strokeWidth={2}
|
|
345
|
-
color={colors.onSurfaceVariant}
|
|
346
|
-
/>
|
|
347
|
-
}
|
|
348
|
-
theme={theme}
|
|
349
|
-
titleAlign={headerTitleAlign}
|
|
350
|
-
style={headerStyle}
|
|
351
|
-
titleStyle={headerTitleStyle}
|
|
352
|
-
/>
|
|
353
|
-
)}
|
|
354
|
-
|
|
355
|
-
{isLoading ? (
|
|
356
|
-
renderSkeleton()
|
|
357
|
-
) : (
|
|
358
|
-
<FlatList
|
|
359
|
-
data={sortedSessions}
|
|
360
|
-
keyExtractor={keyExtractor}
|
|
361
|
-
renderItem={renderItem}
|
|
362
|
-
contentContainerStyle={styles.listContent}
|
|
363
|
-
ListEmptyComponent={
|
|
364
|
-
<View style={styles.emptyWrapper}>
|
|
365
|
-
<Text
|
|
366
|
-
numberOfLines={2}
|
|
367
|
-
ellipsizeMode="tail"
|
|
368
|
-
style={[styles.emptyText, { color: colors.onSurfaceVariant }]}
|
|
369
|
-
>
|
|
370
|
-
{error || noSessions}
|
|
371
|
-
</Text>
|
|
372
|
-
</View>
|
|
373
|
-
}
|
|
374
|
-
/>
|
|
375
|
-
)}
|
|
376
|
-
</View>
|
|
377
|
-
);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
export const DeviceSessions = memo(DeviceSessionsComponent);
|
|
381
|
-
|
|
382
|
-
const styles = StyleSheet.create({
|
|
383
|
-
container: {
|
|
384
|
-
flex: 1,
|
|
385
|
-
},
|
|
386
|
-
listContent: {
|
|
387
|
-
paddingHorizontal: scale(16),
|
|
388
|
-
paddingVertical: verticalScale(12),
|
|
389
|
-
},
|
|
390
|
-
deviceRow: {
|
|
391
|
-
flexDirection: 'row',
|
|
392
|
-
alignItems: 'center',
|
|
393
|
-
justifyContent: 'space-between',
|
|
394
|
-
borderWidth: StyleSheet.hairlineWidth,
|
|
395
|
-
padding: scale(12),
|
|
396
|
-
borderRadius: scale(10),
|
|
397
|
-
marginBottom: verticalScale(12),
|
|
398
|
-
elevation: 2,
|
|
399
|
-
shadowOpacity: 0.1,
|
|
400
|
-
shadowOffset: { width: 0, height: 1 },
|
|
401
|
-
shadowRadius: 4,
|
|
402
|
-
},
|
|
403
|
-
deviceInfo: {
|
|
404
|
-
flex: 1,
|
|
405
|
-
paddingRight: scale(12),
|
|
406
|
-
},
|
|
407
|
-
deviceRowHeader: {
|
|
408
|
-
flexDirection: 'row',
|
|
409
|
-
alignItems: 'center',
|
|
410
|
-
columnGap: scale(8),
|
|
411
|
-
rowGap: verticalScale(2),
|
|
412
|
-
flexWrap: 'wrap',
|
|
413
|
-
marginBottom: scale(4),
|
|
414
|
-
},
|
|
415
|
-
deviceName: {
|
|
416
|
-
fontSize: RFValue(12),
|
|
417
|
-
fontWeight: '600',
|
|
418
|
-
flexShrink: 1,
|
|
419
|
-
maxWidth: '80%',
|
|
420
|
-
},
|
|
421
|
-
deviceMeta: {
|
|
422
|
-
fontSize: RFValue(9),
|
|
423
|
-
marginTop: scale(2),
|
|
424
|
-
flexShrink: 1,
|
|
425
|
-
},
|
|
426
|
-
logoutButton: {
|
|
427
|
-
paddingHorizontal: scale(12),
|
|
428
|
-
paddingVertical: verticalScale(6),
|
|
429
|
-
borderRadius: scale(6),
|
|
430
|
-
minWidth: scale(80),
|
|
431
|
-
borderWidth: scale(1.5),
|
|
432
|
-
alignItems: 'center',
|
|
433
|
-
},
|
|
434
|
-
logoutText: {
|
|
435
|
-
fontSize: RFValue(10),
|
|
436
|
-
fontWeight: '600',
|
|
437
|
-
},
|
|
438
|
-
badge: {
|
|
439
|
-
paddingHorizontal: scale(8),
|
|
440
|
-
paddingVertical: verticalScale(2),
|
|
441
|
-
borderRadius: scale(6),
|
|
442
|
-
},
|
|
443
|
-
badgeText: {
|
|
444
|
-
fontSize: RFValue(9),
|
|
445
|
-
fontWeight: '500',
|
|
446
|
-
maxWidth: scale(100),
|
|
447
|
-
flexShrink: 1,
|
|
448
|
-
},
|
|
449
|
-
emptyWrapper: {
|
|
450
|
-
paddingVertical: verticalScale(40),
|
|
451
|
-
alignItems: 'center',
|
|
452
|
-
justifyContent: 'center',
|
|
453
|
-
},
|
|
454
|
-
emptyText: {
|
|
455
|
-
fontSize: RFValue(11),
|
|
456
|
-
textAlign: 'center',
|
|
457
|
-
},
|
|
458
|
-
skeletonLine: {
|
|
459
|
-
borderRadius: scale(4),
|
|
460
|
-
backgroundColor: '#ccc',
|
|
461
|
-
},
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
export namespace DeviceSessions {
|
|
465
|
-
export type Props = IDeviceSessionsProps;
|
|
466
|
-
export type Data = Props['sessions'];
|
|
467
|
-
export type Item = Props['sessions'][number];
|
|
468
|
-
}
|