@oxyhq/services 5.4.1 → 5.4.2
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/package.json +2 -2
- package/src/core/index.ts +68 -0
- package/src/ui/components/OxyProvider.tsx +5 -5
- package/src/ui/context/OxyContext.tsx +61 -41
- package/src/ui/screens/AccountOverviewScreen.tsx +44 -26
- package/src/ui/screens/AccountSettingsScreen.tsx +24 -18
- package/src/ui/screens/FileManagementScreen.tsx +246 -211
- package/src/ui/screens/SignInScreen.tsx +382 -326
- package/src/ui/screens/SignUpScreen.tsx +443 -273
- package/src/ui/screens/karma/KarmaFAQScreen.tsx +50 -29
- package/lib/commonjs/assets/OxyLogo.svg +0 -1
- package/lib/commonjs/assets/assets/OxyLogo.svg +0 -1
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/assets/assets/icons/OxyServices.tsx +0 -67
- package/lib/commonjs/assets/assets/icons/logo_OxyServices.svg +0 -1
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/commonjs/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/commonjs/assets/icons/OxyServices.js +0 -53
- package/lib/commonjs/assets/icons/OxyServices.js.map +0 -1
- package/lib/commonjs/assets/icons/logo_OxyServices.svg +0 -1
- package/lib/commonjs/constants/version.js +0 -28
- package/lib/commonjs/constants/version.js.map +0 -1
- package/lib/commonjs/core/index.js +0 -1578
- package/lib/commonjs/core/index.js.map +0 -1
- package/lib/commonjs/index.js +0 -160
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/lib/sonner.js +0 -21
- package/lib/commonjs/lib/sonner.js.map +0 -1
- package/lib/commonjs/models/interfaces.js +0 -2
- package/lib/commonjs/models/interfaces.js.map +0 -1
- package/lib/commonjs/models/secureSession.js +0 -2
- package/lib/commonjs/models/secureSession.js.map +0 -1
- package/lib/commonjs/node/index.js +0 -54
- package/lib/commonjs/node/index.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/ui/components/Avatar.js +0 -98
- package/lib/commonjs/ui/components/Avatar.js.map +0 -1
- package/lib/commonjs/ui/components/FollowButton.js +0 -246
- package/lib/commonjs/ui/components/FollowButton.js.map +0 -1
- package/lib/commonjs/ui/components/FontLoader.js +0 -181
- package/lib/commonjs/ui/components/FontLoader.js.map +0 -1
- package/lib/commonjs/ui/components/GroupedItem.js +0 -109
- package/lib/commonjs/ui/components/GroupedItem.js.map +0 -1
- package/lib/commonjs/ui/components/GroupedSection.js +0 -33
- package/lib/commonjs/ui/components/GroupedSection.js.map +0 -1
- package/lib/commonjs/ui/components/OxyLogo.js +0 -56
- package/lib/commonjs/ui/components/OxyLogo.js.map +0 -1
- package/lib/commonjs/ui/components/OxyProvider.js +0 -517
- package/lib/commonjs/ui/components/OxyProvider.js.map +0 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +0 -178
- package/lib/commonjs/ui/components/OxySignInButton.js.map +0 -1
- package/lib/commonjs/ui/components/ProfileCard.js +0 -124
- package/lib/commonjs/ui/components/ProfileCard.js.map +0 -1
- package/lib/commonjs/ui/components/QuickActions.js +0 -87
- package/lib/commonjs/ui/components/QuickActions.js.map +0 -1
- package/lib/commonjs/ui/components/Section.js +0 -36
- package/lib/commonjs/ui/components/Section.js.map +0 -1
- package/lib/commonjs/ui/components/SectionTitle.js +0 -35
- package/lib/commonjs/ui/components/SectionTitle.js.map +0 -1
- package/lib/commonjs/ui/components/bottomSheet/index.js +0 -37
- package/lib/commonjs/ui/components/bottomSheet/index.js.map +0 -1
- package/lib/commonjs/ui/components/icon/OxyIcon.js +0 -27
- package/lib/commonjs/ui/components/icon/OxyIcon.js.map +0 -1
- package/lib/commonjs/ui/components/icon/index.js +0 -14
- package/lib/commonjs/ui/components/icon/index.js.map +0 -1
- package/lib/commonjs/ui/components/index.js +0 -97
- package/lib/commonjs/ui/components/index.js.map +0 -1
- package/lib/commonjs/ui/context/OxyContext.js +0 -568
- package/lib/commonjs/ui/context/OxyContext.js.map +0 -1
- package/lib/commonjs/ui/index.js +0 -128
- package/lib/commonjs/ui/index.js.map +0 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js +0 -264
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +0 -1
- package/lib/commonjs/ui/navigation/types.js +0 -6
- package/lib/commonjs/ui/navigation/types.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +0 -313
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountManagementDemo.js +0 -299
- package/lib/commonjs/ui/screens/AccountManagementDemo.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js +0 -837
- package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +0 -836
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +0 -788
- package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +0 -664
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/BillingManagementScreen.js +0 -636
- package/lib/commonjs/ui/screens/BillingManagementScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +0 -2497
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +0 -1620
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +0 -450
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/SessionManagementScreen.js +0 -449
- package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/SignInScreen.js +0 -956
- package/lib/commonjs/ui/screens/SignInScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/SignUpScreen.js +0 -762
- package/lib/commonjs/ui/screens/SignUpScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js +0 -88
- package/lib/commonjs/ui/screens/karma/KarmaAboutScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js +0 -364
- package/lib/commonjs/ui/screens/karma/KarmaCenterScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js +0 -202
- package/lib/commonjs/ui/screens/karma/KarmaFAQScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js +0 -148
- package/lib/commonjs/ui/screens/karma/KarmaLeaderboardScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +0 -127
- package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +0 -1
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js +0 -105
- package/lib/commonjs/ui/screens/karma/KarmaRulesScreen.js.map +0 -1
- package/lib/commonjs/ui/styles/FONTS.md +0 -126
- package/lib/commonjs/ui/styles/fonts.js +0 -84
- package/lib/commonjs/ui/styles/fonts.js.map +0 -1
- package/lib/commonjs/ui/styles/index.js +0 -28
- package/lib/commonjs/ui/styles/index.js.map +0 -1
- package/lib/commonjs/ui/styles/theme.js +0 -121
- package/lib/commonjs/ui/styles/theme.js.map +0 -1
- package/lib/commonjs/utils/deviceManager.js +0 -173
- package/lib/commonjs/utils/deviceManager.js.map +0 -1
- package/lib/commonjs/utils/index.js +0 -13
- package/lib/commonjs/utils/index.js.map +0 -1
- package/lib/commonjs/utils/polyfills.js +0 -42
- package/lib/commonjs/utils/polyfills.js.map +0 -1
- package/lib/module/assets/OxyLogo.svg +0 -1
- package/lib/module/assets/assets/OxyLogo.svg +0 -1
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/assets/assets/icons/OxyServices.tsx +0 -67
- package/lib/module/assets/assets/icons/logo_OxyServices.svg +0 -1
- package/lib/module/assets/fonts/Phudu/Phudu-Black.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Bold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-ExtraBold.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Light.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Medium.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-Regular.ttf +0 -0
- package/lib/module/assets/fonts/Phudu/Phudu-SemiBold.ttf +0 -0
- package/lib/module/assets/icons/OxyServices.js +0 -46
- package/lib/module/assets/icons/OxyServices.js.map +0 -1
- package/lib/module/assets/icons/logo_OxyServices.svg +0 -1
- package/lib/module/constants/version.js +0 -21
- package/lib/module/constants/version.js.map +0 -1
- package/lib/module/core/index.js +0 -1552
- package/lib/module/core/index.js.map +0 -1
- package/lib/module/index.js +0 -48
- package/lib/module/index.js.map +0 -1
- package/lib/module/lib/sonner.js +0 -16
- package/lib/module/lib/sonner.js.map +0 -1
- package/lib/module/models/interfaces.js +0 -2
- package/lib/module/models/interfaces.js.map +0 -1
- package/lib/module/models/secureSession.js +0 -2
- package/lib/module/models/secureSession.js.map +0 -1
- package/lib/module/node/index.js +0 -23
- package/lib/module/node/index.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/module/ui/components/Avatar.js +0 -93
- package/lib/module/ui/components/Avatar.js.map +0 -1
- package/lib/module/ui/components/FollowButton.js +0 -241
- package/lib/module/ui/components/FollowButton.js.map +0 -1
- package/lib/module/ui/components/FontLoader.js +0 -176
- package/lib/module/ui/components/FontLoader.js.map +0 -1
- package/lib/module/ui/components/GroupedItem.js +0 -104
- package/lib/module/ui/components/GroupedItem.js.map +0 -1
- package/lib/module/ui/components/GroupedSection.js +0 -28
- package/lib/module/ui/components/GroupedSection.js.map +0 -1
- package/lib/module/ui/components/OxyLogo.js +0 -49
- package/lib/module/ui/components/OxyLogo.js.map +0 -1
- package/lib/module/ui/components/OxyProvider.js +0 -511
- package/lib/module/ui/components/OxyProvider.js.map +0 -1
- package/lib/module/ui/components/OxySignInButton.js +0 -172
- package/lib/module/ui/components/OxySignInButton.js.map +0 -1
- package/lib/module/ui/components/ProfileCard.js +0 -119
- package/lib/module/ui/components/ProfileCard.js.map +0 -1
- package/lib/module/ui/components/QuickActions.js +0 -82
- package/lib/module/ui/components/QuickActions.js.map +0 -1
- package/lib/module/ui/components/Section.js +0 -31
- package/lib/module/ui/components/Section.js.map +0 -1
- package/lib/module/ui/components/SectionTitle.js +0 -30
- package/lib/module/ui/components/SectionTitle.js.map +0 -1
- package/lib/module/ui/components/bottomSheet/index.js +0 -5
- package/lib/module/ui/components/bottomSheet/index.js.map +0 -1
- package/lib/module/ui/components/icon/OxyIcon.js +0 -22
- package/lib/module/ui/components/icon/OxyIcon.js.map +0 -1
- package/lib/module/ui/components/icon/index.js +0 -4
- package/lib/module/ui/components/icon/index.js.map +0 -1
- package/lib/module/ui/components/index.js +0 -18
- package/lib/module/ui/components/index.js.map +0 -1
- package/lib/module/ui/context/OxyContext.js +0 -563
- package/lib/module/ui/context/OxyContext.js.map +0 -1
- package/lib/module/ui/index.js +0 -24
- package/lib/module/ui/index.js.map +0 -1
- package/lib/module/ui/navigation/OxyRouter.js +0 -257
- package/lib/module/ui/navigation/OxyRouter.js.map +0 -1
- package/lib/module/ui/navigation/types.js +0 -4
- package/lib/module/ui/navigation/types.js.map +0 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +0 -308
- package/lib/module/ui/screens/AccountCenterScreen.js.map +0 -1
- package/lib/module/ui/screens/AccountManagementDemo.js +0 -296
- package/lib/module/ui/screens/AccountManagementDemo.js.map +0 -1
- package/lib/module/ui/screens/AccountOverviewScreen.js +0 -831
- package/lib/module/ui/screens/AccountOverviewScreen.js.map +0 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +0 -830
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +0 -1
- package/lib/module/ui/screens/AccountSwitcherScreen.js +0 -782
- package/lib/module/ui/screens/AccountSwitcherScreen.js.map +0 -1
- package/lib/module/ui/screens/AppInfoScreen.js +0 -658
- package/lib/module/ui/screens/AppInfoScreen.js.map +0 -1
- package/lib/module/ui/screens/BillingManagementScreen.js +0 -631
- package/lib/module/ui/screens/BillingManagementScreen.js.map +0 -1
- package/lib/module/ui/screens/FileManagementScreen.js +0 -2492
- package/lib/module/ui/screens/FileManagementScreen.js.map +0 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +0 -1615
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +0 -1
- package/lib/module/ui/screens/ProfileScreen.js +0 -444
- package/lib/module/ui/screens/ProfileScreen.js.map +0 -1
- package/lib/module/ui/screens/SessionManagementScreen.js +0 -444
- package/lib/module/ui/screens/SessionManagementScreen.js.map +0 -1
- package/lib/module/ui/screens/SignInScreen.js +0 -950
- package/lib/module/ui/screens/SignInScreen.js.map +0 -1
- package/lib/module/ui/screens/SignUpScreen.js +0 -755
- package/lib/module/ui/screens/SignUpScreen.js.map +0 -1
- package/lib/module/ui/screens/karma/KarmaAboutScreen.js +0 -83
- package/lib/module/ui/screens/karma/KarmaAboutScreen.js.map +0 -1
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js +0 -358
- package/lib/module/ui/screens/karma/KarmaCenterScreen.js.map +0 -1
- package/lib/module/ui/screens/karma/KarmaFAQScreen.js +0 -197
- package/lib/module/ui/screens/karma/KarmaFAQScreen.js.map +0 -1
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js +0 -142
- package/lib/module/ui/screens/karma/KarmaLeaderboardScreen.js.map +0 -1
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +0 -122
- package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +0 -1
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js +0 -100
- package/lib/module/ui/screens/karma/KarmaRulesScreen.js.map +0 -1
- package/lib/module/ui/styles/FONTS.md +0 -126
- package/lib/module/ui/styles/fonts.js +0 -81
- package/lib/module/ui/styles/fonts.js.map +0 -1
- package/lib/module/ui/styles/index.js +0 -5
- package/lib/module/ui/styles/index.js.map +0 -1
- package/lib/module/ui/styles/theme.js +0 -114
- package/lib/module/ui/styles/theme.js.map +0 -1
- package/lib/module/utils/deviceManager.js +0 -167
- package/lib/module/utils/deviceManager.js.map +0 -1
- package/lib/module/utils/index.js +0 -4
- package/lib/module/utils/index.js.map +0 -1
- package/lib/module/utils/polyfills.js +0 -36
- package/lib/module/utils/polyfills.js.map +0 -1
- package/lib/typescript/assets/icons/OxyServices.d.ts +0 -29
- package/lib/typescript/assets/icons/OxyServices.d.ts.map +0 -1
- package/lib/typescript/constants/version.d.ts +0 -14
- package/lib/typescript/constants/version.d.ts.map +0 -1
- package/lib/typescript/core/index.d.ts +0 -579
- package/lib/typescript/core/index.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -20
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/lib/sonner.d.ts +0 -6
- package/lib/typescript/lib/sonner.d.ts.map +0 -1
- package/lib/typescript/models/interfaces.d.ts +0 -179
- package/lib/typescript/models/interfaces.d.ts.map +0 -1
- package/lib/typescript/models/secureSession.d.ts +0 -27
- package/lib/typescript/models/secureSession.d.ts.map +0 -1
- package/lib/typescript/node/index.d.ts +0 -11
- package/lib/typescript/node/index.d.ts.map +0 -1
- package/lib/typescript/ui/components/Avatar.d.ts +0 -62
- package/lib/typescript/ui/components/Avatar.d.ts.map +0 -1
- package/lib/typescript/ui/components/FollowButton.d.ts +0 -92
- package/lib/typescript/ui/components/FollowButton.d.ts.map +0 -1
- package/lib/typescript/ui/components/FontLoader.d.ts +0 -15
- package/lib/typescript/ui/components/FontLoader.d.ts.map +0 -1
- package/lib/typescript/ui/components/GroupedItem.d.ts +0 -17
- package/lib/typescript/ui/components/GroupedItem.d.ts.map +0 -1
- package/lib/typescript/ui/components/GroupedSection.d.ts +0 -19
- package/lib/typescript/ui/components/GroupedSection.d.ts.map +0 -1
- package/lib/typescript/ui/components/OxyLogo.d.ts +0 -29
- package/lib/typescript/ui/components/OxyLogo.d.ts.map +0 -1
- package/lib/typescript/ui/components/OxyProvider.d.ts +0 -12
- package/lib/typescript/ui/components/OxyProvider.d.ts.map +0 -1
- package/lib/typescript/ui/components/OxySignInButton.d.ts +0 -70
- package/lib/typescript/ui/components/OxySignInButton.d.ts.map +0 -1
- package/lib/typescript/ui/components/ProfileCard.d.ts +0 -20
- package/lib/typescript/ui/components/ProfileCard.d.ts.map +0 -1
- package/lib/typescript/ui/components/QuickActions.d.ts +0 -15
- package/lib/typescript/ui/components/QuickActions.d.ts.map +0 -1
- package/lib/typescript/ui/components/Section.d.ts +0 -11
- package/lib/typescript/ui/components/Section.d.ts.map +0 -1
- package/lib/typescript/ui/components/SectionTitle.d.ts +0 -9
- package/lib/typescript/ui/components/SectionTitle.d.ts.map +0 -1
- package/lib/typescript/ui/components/bottomSheet/index.d.ts +0 -4
- package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +0 -1
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts +0 -10
- package/lib/typescript/ui/components/icon/OxyIcon.d.ts.map +0 -1
- package/lib/typescript/ui/components/icon/index.d.ts +0 -3
- package/lib/typescript/ui/components/icon/index.d.ts.map +0 -1
- package/lib/typescript/ui/components/index.d.ts +0 -13
- package/lib/typescript/ui/components/index.d.ts.map +0 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +0 -42
- package/lib/typescript/ui/context/OxyContext.d.ts.map +0 -1
- package/lib/typescript/ui/index.d.ts +0 -15
- package/lib/typescript/ui/index.d.ts.map +0 -1
- package/lib/typescript/ui/navigation/OxyRouter.d.ts +0 -5
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +0 -1
- package/lib/typescript/ui/navigation/types.d.ts +0 -116
- package/lib/typescript/ui/navigation/types.d.ts.map +0 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/AccountManagementDemo.d.ts +0 -8
- package/lib/typescript/ui/screens/AccountManagementDemo.d.ts.map +0 -1
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/BillingManagementScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/BillingManagementScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts +0 -8
- package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/ProfileScreen.d.ts +0 -9
- package/lib/typescript/ui/screens/ProfileScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/SignInScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/SignInScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/SignUpScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/karma/KarmaAboutScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/karma/KarmaCenterScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/karma/KarmaFAQScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/karma/KarmaLeaderboardScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +0 -1
- package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts +0 -5
- package/lib/typescript/ui/screens/karma/KarmaRulesScreen.d.ts.map +0 -1
- package/lib/typescript/ui/styles/fonts.d.ts +0 -21
- package/lib/typescript/ui/styles/fonts.d.ts.map +0 -1
- package/lib/typescript/ui/styles/index.d.ts +0 -3
- package/lib/typescript/ui/styles/index.d.ts.map +0 -1
- package/lib/typescript/ui/styles/theme.d.ts +0 -68
- package/lib/typescript/ui/styles/theme.d.ts.map +0 -1
- package/lib/typescript/utils/deviceManager.d.ts +0 -66
- package/lib/typescript/utils/deviceManager.d.ts.map +0 -1
- package/lib/typescript/utils/index.d.ts +0 -3
- package/lib/typescript/utils/index.d.ts.map +0 -1
- package/lib/typescript/utils/polyfills.d.ts +0 -6
- package/lib/typescript/utils/polyfills.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀",
|
|
5
5
|
"main": "lib/commonjs/node/index.js",
|
|
6
6
|
"module": "lib/module/node/index.js",
|
|
@@ -149,4 +149,4 @@
|
|
|
149
149
|
"react-native-gesture-handler": "^2.20.2",
|
|
150
150
|
"react-native-reanimated": "^3.16.1"
|
|
151
151
|
}
|
|
152
|
-
}
|
|
152
|
+
}
|
package/src/core/index.ts
CHANGED
|
@@ -1589,6 +1589,74 @@ export class OxyServices {
|
|
|
1589
1589
|
|
|
1590
1590
|
return apiError;
|
|
1591
1591
|
}
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* Check if a username is available
|
|
1595
|
+
* @param username - The username to check
|
|
1596
|
+
* @returns Promise with availability status
|
|
1597
|
+
*/
|
|
1598
|
+
async checkUsernameAvailability(username: string): Promise<{ available: boolean; message: string }> {
|
|
1599
|
+
try {
|
|
1600
|
+
const res = await this.client.get(`/auth/check-username/${username}`);
|
|
1601
|
+
return res.data;
|
|
1602
|
+
} catch (error: any) {
|
|
1603
|
+
// If the endpoint doesn't exist, fall back to basic validation
|
|
1604
|
+
if (error.response?.status === 404) {
|
|
1605
|
+
console.warn('Username validation endpoint not found, using fallback validation');
|
|
1606
|
+
return { available: true, message: 'Username validation not available' };
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
// If it's a validation error (400), return the error message
|
|
1610
|
+
if (error.response?.status === 400) {
|
|
1611
|
+
return error.response.data;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
// For other errors, log and return a fallback
|
|
1615
|
+
console.error('Username validation error:', error);
|
|
1616
|
+
return { available: true, message: 'Unable to validate username' };
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Check if an email is available
|
|
1622
|
+
* @param email - The email to check
|
|
1623
|
+
* @returns Promise with availability status
|
|
1624
|
+
*/
|
|
1625
|
+
async checkEmailAvailability(email: string): Promise<{ available: boolean; message: string }> {
|
|
1626
|
+
try {
|
|
1627
|
+
const res = await this.client.post('/auth/check-email', { email });
|
|
1628
|
+
return res.data;
|
|
1629
|
+
} catch (error: any) {
|
|
1630
|
+
// If the endpoint doesn't exist, fall back to basic validation
|
|
1631
|
+
if (error.response?.status === 404) {
|
|
1632
|
+
console.warn('Email validation endpoint not found, using fallback validation');
|
|
1633
|
+
return { available: true, message: 'Email validation not available' };
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
// If it's a validation error (400), return the error message
|
|
1637
|
+
if (error.response?.status === 400) {
|
|
1638
|
+
return error.response.data;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// For other errors, log and return a fallback
|
|
1642
|
+
console.error('Email validation error:', error);
|
|
1643
|
+
return { available: true, message: 'Unable to validate email' };
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* Get user profile by username
|
|
1649
|
+
* @param username - The username to look up
|
|
1650
|
+
* @returns Promise with user profile
|
|
1651
|
+
*/
|
|
1652
|
+
async getUserProfileByUsername(username: string): Promise<User> {
|
|
1653
|
+
try {
|
|
1654
|
+
const res = await this.client.get(`/profiles/username/${username}`);
|
|
1655
|
+
return res.data;
|
|
1656
|
+
} catch (error) {
|
|
1657
|
+
throw this.handleError(error);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1592
1660
|
}
|
|
1593
1661
|
|
|
1594
1662
|
export default OxyServices;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState, useEffect } from 'react';
|
|
1
|
+
import React, { useCallback, useRef, useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import { View, Text, StyleSheet, Dimensions, Platform, Animated, StatusBar, Keyboard, KeyboardEvent } from 'react-native';
|
|
3
3
|
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
@@ -303,8 +303,8 @@ const OxyBottomSheet: React.FC<OxyProviderProps> = ({
|
|
|
303
303
|
[]
|
|
304
304
|
);
|
|
305
305
|
|
|
306
|
-
//
|
|
307
|
-
const
|
|
306
|
+
// Memoize background style based on theme to prevent recalculation on every render
|
|
307
|
+
const backgroundStyle = useMemo(() => {
|
|
308
308
|
const baseColor = customStyles.backgroundColor || (theme === 'light' ? '#FFFFFF' : '#121212');
|
|
309
309
|
return {
|
|
310
310
|
backgroundColor: baseColor,
|
|
@@ -317,7 +317,7 @@ const OxyBottomSheet: React.FC<OxyProviderProps> = ({
|
|
|
317
317
|
}
|
|
318
318
|
})
|
|
319
319
|
};
|
|
320
|
-
};
|
|
320
|
+
}, [customStyles.backgroundColor, theme]);
|
|
321
321
|
|
|
322
322
|
// Method to adjust snap points from Router
|
|
323
323
|
const adjustSnapPoints = useCallback((points: string[]) => {
|
|
@@ -398,7 +398,7 @@ const OxyBottomSheet: React.FC<OxyProviderProps> = ({
|
|
|
398
398
|
enablePanDownToClose
|
|
399
399
|
backdropComponent={renderBackdrop}
|
|
400
400
|
backgroundStyle={[
|
|
401
|
-
|
|
401
|
+
backgroundStyle,
|
|
402
402
|
{
|
|
403
403
|
borderTopLeftRadius: 35,
|
|
404
404
|
borderTopRightRadius: 35,
|
|
@@ -161,11 +161,11 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
161
161
|
|
|
162
162
|
if (sessionsData) {
|
|
163
163
|
const parsedSessions: SecureClientSession[] = JSON.parse(sessionsData);
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
// Migrate old session format to include user info
|
|
166
166
|
const migratedSessions: SecureClientSession[] = [];
|
|
167
167
|
let shouldUpdateStorage = false;
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
for (const session of parsedSessions) {
|
|
170
170
|
if (!session.userId || !session.username) {
|
|
171
171
|
// Session is missing user info, try to fetch it
|
|
@@ -188,31 +188,31 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
188
188
|
migratedSessions.push(session);
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
// Update storage if we made changes
|
|
193
193
|
if (shouldUpdateStorage) {
|
|
194
194
|
await saveSessionsToStorage(migratedSessions);
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
|
|
197
197
|
setSessions(migratedSessions);
|
|
198
198
|
|
|
199
199
|
if (storedActiveSessionId && migratedSessions.length > 0) {
|
|
200
200
|
const activeSession = migratedSessions.find(s => s.sessionId === storedActiveSessionId);
|
|
201
|
-
|
|
201
|
+
|
|
202
202
|
if (activeSession) {
|
|
203
203
|
console.log('SecureAuth - activeSession found:', activeSession);
|
|
204
|
-
|
|
204
|
+
|
|
205
205
|
// Validate session
|
|
206
206
|
try {
|
|
207
207
|
const validation = await oxyServices.validateSession(activeSession.sessionId);
|
|
208
|
-
|
|
208
|
+
|
|
209
209
|
if (validation.valid) {
|
|
210
210
|
console.log('SecureAuth - session validated successfully');
|
|
211
211
|
setActiveSessionId(activeSession.sessionId);
|
|
212
|
-
|
|
212
|
+
|
|
213
213
|
// Get access token for API calls
|
|
214
214
|
await oxyServices.getTokenBySession(activeSession.sessionId);
|
|
215
|
-
|
|
215
|
+
|
|
216
216
|
// Load full user data
|
|
217
217
|
const fullUser = await oxyServices.getUserBySession(activeSession.sessionId);
|
|
218
218
|
setUser(fullUser);
|
|
@@ -221,7 +221,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
221
221
|
username: fullUser.username,
|
|
222
222
|
avatar: fullUser.avatar
|
|
223
223
|
});
|
|
224
|
-
|
|
224
|
+
|
|
225
225
|
if (onAuthStateChange) {
|
|
226
226
|
onAuthStateChange(fullUser);
|
|
227
227
|
}
|
|
@@ -254,7 +254,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
254
254
|
const filteredSessions = sessions.filter(s => s.sessionId !== sessionId);
|
|
255
255
|
setSessions(filteredSessions);
|
|
256
256
|
await saveSessionsToStorage(filteredSessions);
|
|
257
|
-
|
|
257
|
+
|
|
258
258
|
// If there are other sessions, switch to the first one
|
|
259
259
|
if (filteredSessions.length > 0) {
|
|
260
260
|
await switchToSession(filteredSessions[0].sessionId);
|
|
@@ -264,7 +264,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
264
264
|
setUser(null);
|
|
265
265
|
setMinimalUser(null);
|
|
266
266
|
await storage?.removeItem(keys.activeSessionId);
|
|
267
|
-
|
|
267
|
+
|
|
268
268
|
if (onAuthStateChange) {
|
|
269
269
|
onAuthStateChange(null);
|
|
270
270
|
}
|
|
@@ -298,13 +298,13 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
298
298
|
const switchToSession = useCallback(async (sessionId: string): Promise<void> => {
|
|
299
299
|
try {
|
|
300
300
|
setIsLoading(true);
|
|
301
|
-
|
|
301
|
+
|
|
302
302
|
// Get access token for this session
|
|
303
303
|
await oxyServices.getTokenBySession(sessionId);
|
|
304
|
-
|
|
304
|
+
|
|
305
305
|
// Load full user data
|
|
306
306
|
const fullUser = await oxyServices.getUserBySession(sessionId);
|
|
307
|
-
|
|
307
|
+
|
|
308
308
|
setActiveSessionId(sessionId);
|
|
309
309
|
setUser(fullUser);
|
|
310
310
|
setMinimalUser({
|
|
@@ -312,9 +312,9 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
312
312
|
username: fullUser.username,
|
|
313
313
|
avatar: fullUser.avatar
|
|
314
314
|
});
|
|
315
|
-
|
|
315
|
+
|
|
316
316
|
await saveActiveSessionId(sessionId);
|
|
317
|
-
|
|
317
|
+
|
|
318
318
|
if (onAuthStateChange) {
|
|
319
319
|
onAuthStateChange(fullUser);
|
|
320
320
|
}
|
|
@@ -336,20 +336,20 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
336
336
|
try {
|
|
337
337
|
// Get device fingerprint for enhanced device identification
|
|
338
338
|
const deviceFingerprint = DeviceManager.getDeviceFingerprint();
|
|
339
|
-
|
|
339
|
+
|
|
340
340
|
// Get or generate persistent device info
|
|
341
341
|
const deviceInfo = await DeviceManager.getDeviceInfo();
|
|
342
|
-
|
|
342
|
+
|
|
343
343
|
console.log('SecureAuth - Using device fingerprint:', deviceFingerprint);
|
|
344
344
|
console.log('SecureAuth - Using device ID:', deviceInfo.deviceId);
|
|
345
345
|
|
|
346
346
|
const response: SecureLoginResponse = await oxyServices.secureLogin(
|
|
347
|
-
username,
|
|
348
|
-
password,
|
|
347
|
+
username,
|
|
348
|
+
password,
|
|
349
349
|
deviceName || deviceInfo.deviceName || DeviceManager.getDefaultDeviceName(),
|
|
350
350
|
deviceFingerprint
|
|
351
351
|
);
|
|
352
|
-
|
|
352
|
+
|
|
353
353
|
// Create client session object with user info for duplicate detection
|
|
354
354
|
const clientSession: SecureClientSession = {
|
|
355
355
|
sessionId: response.sessionId,
|
|
@@ -361,20 +361,20 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
361
361
|
};
|
|
362
362
|
|
|
363
363
|
// Check if this user already has a session (prevent duplicate accounts)
|
|
364
|
-
const existingUserSessionIndex = sessions.findIndex(s =>
|
|
364
|
+
const existingUserSessionIndex = sessions.findIndex(s =>
|
|
365
365
|
s.userId === response.user.id || s.username === response.user.username
|
|
366
366
|
);
|
|
367
367
|
|
|
368
368
|
let updatedSessions: SecureClientSession[];
|
|
369
|
-
|
|
369
|
+
|
|
370
370
|
if (existingUserSessionIndex !== -1) {
|
|
371
371
|
// User already has a session - replace it with the new one (reused session scenario)
|
|
372
372
|
const existingSession = sessions[existingUserSessionIndex];
|
|
373
373
|
updatedSessions = [...sessions];
|
|
374
374
|
updatedSessions[existingUserSessionIndex] = clientSession;
|
|
375
|
-
|
|
375
|
+
|
|
376
376
|
console.log(`Reusing/updating existing session for user ${response.user.username}. Previous session: ${existingSession.sessionId}, New session: ${response.sessionId}`);
|
|
377
|
-
|
|
377
|
+
|
|
378
378
|
// If the replaced session was the active one, update active session
|
|
379
379
|
if (activeSessionId === existingSession.sessionId) {
|
|
380
380
|
setActiveSessionId(response.sessionId);
|
|
@@ -438,7 +438,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
438
438
|
setUser(null);
|
|
439
439
|
setMinimalUser(null);
|
|
440
440
|
await storage?.removeItem(keys.activeSessionId);
|
|
441
|
-
|
|
441
|
+
|
|
442
442
|
if (onAuthStateChange) {
|
|
443
443
|
onAuthStateChange(null);
|
|
444
444
|
}
|
|
@@ -453,7 +453,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
453
453
|
// Logout all sessions
|
|
454
454
|
const logoutAll = async (): Promise<void> => {
|
|
455
455
|
console.log('logoutAll called with activeSessionId:', activeSessionId);
|
|
456
|
-
|
|
456
|
+
|
|
457
457
|
if (!activeSessionId) {
|
|
458
458
|
console.error('No active session ID found, cannot logout all');
|
|
459
459
|
setError('No active session found');
|
|
@@ -470,7 +470,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
470
470
|
console.log('Calling oxyServices.logoutAllSecureSessions with sessionId:', activeSessionId);
|
|
471
471
|
await oxyServices.logoutAllSecureSessions(activeSessionId);
|
|
472
472
|
console.log('logoutAllSecureSessions completed successfully');
|
|
473
|
-
|
|
473
|
+
|
|
474
474
|
// Clear all local data
|
|
475
475
|
setSessions([]);
|
|
476
476
|
setActiveSessionId(null);
|
|
@@ -478,7 +478,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
478
478
|
setMinimalUser(null);
|
|
479
479
|
await clearAllStorage();
|
|
480
480
|
console.log('Local storage cleared');
|
|
481
|
-
|
|
481
|
+
|
|
482
482
|
if (onAuthStateChange) {
|
|
483
483
|
onAuthStateChange(null);
|
|
484
484
|
console.log('Auth state change callback called');
|
|
@@ -490,10 +490,30 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
490
490
|
}
|
|
491
491
|
};
|
|
492
492
|
|
|
493
|
-
// Sign up method
|
|
493
|
+
// Sign up method
|
|
494
494
|
const signUp = async (username: string, email: string, password: string): Promise<User> => {
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
if (!storage) throw new Error('Storage not initialized');
|
|
496
|
+
|
|
497
|
+
setIsLoading(true);
|
|
498
|
+
setError(null);
|
|
499
|
+
|
|
500
|
+
try {
|
|
501
|
+
// Create new account using the OxyServices signUp method
|
|
502
|
+
const response = await oxyServices.signUp(username, email, password);
|
|
503
|
+
|
|
504
|
+
console.log('SignUp successful:', response);
|
|
505
|
+
|
|
506
|
+
// Now log the user in securely to create a session
|
|
507
|
+
// This will handle the session creation and device registration
|
|
508
|
+
const user = await login(username, password);
|
|
509
|
+
|
|
510
|
+
return user;
|
|
511
|
+
} catch (error: any) {
|
|
512
|
+
setError(error.message || 'Sign up failed');
|
|
513
|
+
throw error;
|
|
514
|
+
} finally {
|
|
515
|
+
setIsLoading(false);
|
|
516
|
+
}
|
|
497
517
|
};
|
|
498
518
|
|
|
499
519
|
// Switch session method
|
|
@@ -512,7 +532,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
512
532
|
|
|
513
533
|
try {
|
|
514
534
|
const serverSessions = await oxyServices.getSessionsBySessionId(activeSessionId);
|
|
515
|
-
|
|
535
|
+
|
|
516
536
|
// Update local sessions with server data
|
|
517
537
|
const updatedSessions: SecureClientSession[] = serverSessions.map(serverSession => ({
|
|
518
538
|
sessionId: serverSession.sessionId,
|
|
@@ -520,7 +540,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
520
540
|
expiresAt: new Date().toISOString(), // You might want to get this from server
|
|
521
541
|
lastActive: new Date().toISOString()
|
|
522
542
|
}));
|
|
523
|
-
|
|
543
|
+
|
|
524
544
|
setSessions(updatedSessions);
|
|
525
545
|
await saveSessionsToStorage(updatedSessions);
|
|
526
546
|
} catch (error) {
|
|
@@ -545,14 +565,14 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
545
565
|
|
|
546
566
|
try {
|
|
547
567
|
await oxyServices.logoutAllDeviceSessions(activeSessionId);
|
|
548
|
-
|
|
568
|
+
|
|
549
569
|
// Clear all local sessions since we logged out from all devices
|
|
550
570
|
setSessions([]);
|
|
551
571
|
setActiveSessionId(null);
|
|
552
572
|
setUser(null);
|
|
553
573
|
setMinimalUser(null);
|
|
554
574
|
await clearAllStorage();
|
|
555
|
-
|
|
575
|
+
|
|
556
576
|
if (onAuthStateChange) {
|
|
557
577
|
onAuthStateChange(null);
|
|
558
578
|
}
|
|
@@ -567,7 +587,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
567
587
|
|
|
568
588
|
try {
|
|
569
589
|
await oxyServices.updateDeviceName(activeSessionId, deviceName);
|
|
570
|
-
|
|
590
|
+
|
|
571
591
|
// Update local device info
|
|
572
592
|
await DeviceManager.updateDeviceName(deviceName);
|
|
573
593
|
} catch (error) {
|
|
@@ -579,10 +599,10 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
579
599
|
// Bottom sheet control methods
|
|
580
600
|
const showBottomSheet = useCallback((screenOrConfig?: string | { screen: string; props?: Record<string, any> }) => {
|
|
581
601
|
console.log('showBottomSheet called with:', screenOrConfig);
|
|
582
|
-
|
|
602
|
+
|
|
583
603
|
if (bottomSheetRef?.current) {
|
|
584
604
|
console.log('bottomSheetRef is available');
|
|
585
|
-
|
|
605
|
+
|
|
586
606
|
// First, show the bottom sheet
|
|
587
607
|
if (bottomSheetRef.current.expand) {
|
|
588
608
|
console.log('Expanding bottom sheet');
|
|
@@ -593,7 +613,7 @@ export const OxyContextProvider: React.FC<OxyContextProviderProps> = ({
|
|
|
593
613
|
} else {
|
|
594
614
|
console.warn('No expand or present method available on bottomSheetRef');
|
|
595
615
|
}
|
|
596
|
-
|
|
616
|
+
|
|
597
617
|
// Then navigate to the specified screen if provided
|
|
598
618
|
if (screenOrConfig) {
|
|
599
619
|
// Add a small delay to ensure the bottom sheet is opened first
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, useMemo, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -20,6 +20,15 @@ import { fontFamilies } from '../styles/fonts';
|
|
|
20
20
|
import { toast } from '../../lib/sonner';
|
|
21
21
|
import { Ionicons } from '@expo/vector-icons';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* AccountOverviewScreen - Optimized for performance
|
|
25
|
+
*
|
|
26
|
+
* Performance optimizations implemented:
|
|
27
|
+
* - useMemo for theme calculations (only recalculates when theme changes)
|
|
28
|
+
* - useMemo for additional accounts filtering (only recalculates when dependencies change)
|
|
29
|
+
* - useCallback for event handlers to prevent unnecessary re-renders
|
|
30
|
+
* - React.memo wrapper to prevent re-renders when props haven't changed
|
|
31
|
+
*/
|
|
23
32
|
const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
24
33
|
onClose,
|
|
25
34
|
theme,
|
|
@@ -30,18 +39,26 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
30
39
|
const [additionalAccountsData, setAdditionalAccountsData] = useState<any[]>([]);
|
|
31
40
|
const [loadingAdditionalAccounts, setLoadingAdditionalAccounts] = useState(false);
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
// Memoize theme-related calculations to prevent unnecessary recalculations
|
|
43
|
+
const themeStyles = useMemo(() => {
|
|
44
|
+
const isDarkTheme = theme === 'dark';
|
|
45
|
+
return {
|
|
46
|
+
isDarkTheme,
|
|
47
|
+
textColor: isDarkTheme ? '#FFFFFF' : '#000000',
|
|
48
|
+
backgroundColor: isDarkTheme ? '#121212' : '#FFFFFF',
|
|
49
|
+
secondaryBackgroundColor: isDarkTheme ? '#222222' : '#F5F5F5',
|
|
50
|
+
borderColor: isDarkTheme ? '#444444' : '#E0E0E0',
|
|
51
|
+
primaryColor: '#d169e5',
|
|
52
|
+
dangerColor: '#D32F2F',
|
|
53
|
+
iconColor: isDarkTheme ? '#BBBBBB' : '#666666',
|
|
54
|
+
};
|
|
55
|
+
}, [theme]);
|
|
56
|
+
|
|
57
|
+
// Memoize additional accounts filtering to prevent recalculation on every render
|
|
58
|
+
const additionalAccounts = useMemo(() =>
|
|
59
|
+
sessions.filter(session =>
|
|
60
|
+
session.sessionId !== activeSessionId && session.userId !== user?.id
|
|
61
|
+
), [sessions, activeSessionId, user?.id]
|
|
45
62
|
);
|
|
46
63
|
|
|
47
64
|
// Load user profiles for additional accounts
|
|
@@ -98,7 +115,8 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
98
115
|
language: 'English',
|
|
99
116
|
};
|
|
100
117
|
|
|
101
|
-
|
|
118
|
+
// Memoize event handlers to prevent recreation on every render
|
|
119
|
+
const handleLogout = useCallback(async () => {
|
|
102
120
|
try {
|
|
103
121
|
await logout();
|
|
104
122
|
if (onClose) {
|
|
@@ -108,9 +126,9 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
108
126
|
console.error('Logout failed:', error);
|
|
109
127
|
toast.error('There was a problem signing you out. Please try again.');
|
|
110
128
|
}
|
|
111
|
-
};
|
|
129
|
+
}, [logout, onClose]);
|
|
112
130
|
|
|
113
|
-
const confirmLogout = () => {
|
|
131
|
+
const confirmLogout = useCallback(() => {
|
|
114
132
|
Alert.alert(
|
|
115
133
|
'Sign Out',
|
|
116
134
|
'Are you sure you want to sign out?',
|
|
@@ -127,13 +145,13 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
127
145
|
],
|
|
128
146
|
{ cancelable: true }
|
|
129
147
|
);
|
|
130
|
-
};
|
|
148
|
+
}, [handleLogout]);
|
|
131
149
|
|
|
132
|
-
const handleAddAccount = () => {
|
|
150
|
+
const handleAddAccount = useCallback(() => {
|
|
133
151
|
toast.info('Add another account feature coming soon!');
|
|
134
|
-
};
|
|
152
|
+
}, []);
|
|
135
153
|
|
|
136
|
-
const handleSignOutAll = () => {
|
|
154
|
+
const handleSignOutAll = useCallback(() => {
|
|
137
155
|
Alert.alert(
|
|
138
156
|
'Sign Out of All Accounts',
|
|
139
157
|
'Are you sure you want to sign out of all accounts?',
|
|
@@ -150,20 +168,20 @@ const AccountOverviewScreen: React.FC<BaseScreenProps> = ({
|
|
|
150
168
|
],
|
|
151
169
|
{ cancelable: true }
|
|
152
170
|
);
|
|
153
|
-
};
|
|
171
|
+
}, [handleLogout]);
|
|
154
172
|
|
|
155
173
|
if (!user) {
|
|
156
174
|
return (
|
|
157
|
-
<View style={[styles.container, { backgroundColor }]}>
|
|
158
|
-
<Text style={[styles.message, { color: textColor }]}>Not signed in</Text>
|
|
175
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor }]}>
|
|
176
|
+
<Text style={[styles.message, { color: themeStyles.textColor }]}>Not signed in</Text>
|
|
159
177
|
</View>
|
|
160
178
|
);
|
|
161
179
|
}
|
|
162
180
|
|
|
163
181
|
if (isLoading) {
|
|
164
182
|
return (
|
|
165
|
-
<View style={[styles.container, { backgroundColor, justifyContent: 'center' }]}>
|
|
166
|
-
<ActivityIndicator size="large" color={primaryColor} />
|
|
183
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor, justifyContent: 'center' }]}>
|
|
184
|
+
<ActivityIndicator size="large" color={themeStyles.primaryColor} />
|
|
167
185
|
</View>
|
|
168
186
|
);
|
|
169
187
|
}
|
|
@@ -676,4 +694,4 @@ const styles = StyleSheet.create({
|
|
|
676
694
|
},
|
|
677
695
|
});
|
|
678
696
|
|
|
679
|
-
export default AccountOverviewScreen;
|
|
697
|
+
export default React.memo(AccountOverviewScreen);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
@@ -51,19 +51,25 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
51
51
|
const [tempLocation, setTempLocation] = useState('');
|
|
52
52
|
const [tempWebsite, setTempWebsite] = useState('');
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
// Memoize theme-related calculations to prevent unnecessary recalculations
|
|
55
|
+
const themeStyles = useMemo(() => {
|
|
56
|
+
const isDarkTheme = theme === 'dark';
|
|
57
|
+
return {
|
|
58
|
+
isDarkTheme,
|
|
59
|
+
backgroundColor: isDarkTheme ? '#121212' : '#f2f2f2',
|
|
60
|
+
primaryColor: '#007AFF',
|
|
61
|
+
};
|
|
62
|
+
}, [theme]);
|
|
57
63
|
|
|
58
|
-
//
|
|
59
|
-
const animateSaveButton = (toValue: number) => {
|
|
64
|
+
// Memoize animation function to prevent recreation on every render
|
|
65
|
+
const animateSaveButton = useCallback((toValue: number) => {
|
|
60
66
|
Animated.spring(saveButtonScale, {
|
|
61
67
|
toValue,
|
|
62
68
|
useNativeDriver: true,
|
|
63
69
|
tension: 150,
|
|
64
70
|
friction: 8,
|
|
65
71
|
}).start();
|
|
66
|
-
};
|
|
72
|
+
}, [saveButtonScale]);
|
|
67
73
|
|
|
68
74
|
// Load user data
|
|
69
75
|
useEffect(() => {
|
|
@@ -280,20 +286,20 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
280
286
|
style={[
|
|
281
287
|
config.multiline ? styles.editingFieldTextArea : styles.editingFieldInput,
|
|
282
288
|
{
|
|
283
|
-
backgroundColor: isDarkTheme ? '#333' : '#fff',
|
|
284
|
-
color: isDarkTheme ? '#fff' : '#000',
|
|
285
|
-
borderColor: primaryColor
|
|
289
|
+
backgroundColor: themeStyles.isDarkTheme ? '#333' : '#fff',
|
|
290
|
+
color: themeStyles.isDarkTheme ? '#fff' : '#000',
|
|
291
|
+
borderColor: themeStyles.primaryColor
|
|
286
292
|
}
|
|
287
293
|
]}
|
|
288
294
|
value={tempValue}
|
|
289
295
|
onChangeText={setTempValue}
|
|
290
296
|
placeholder={config.placeholder}
|
|
291
|
-
placeholderTextColor={isDarkTheme ? '#aaa' : '#999'}
|
|
297
|
+
placeholderTextColor={themeStyles.isDarkTheme ? '#aaa' : '#999'}
|
|
292
298
|
multiline={config.multiline}
|
|
293
299
|
numberOfLines={config.multiline ? 6 : 1}
|
|
294
300
|
keyboardType={config.keyboardType}
|
|
295
301
|
autoFocus
|
|
296
|
-
selectionColor={primaryColor}
|
|
302
|
+
selectionColor={themeStyles.primaryColor}
|
|
297
303
|
/>
|
|
298
304
|
</View>
|
|
299
305
|
</View>
|
|
@@ -340,14 +346,14 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
340
346
|
|
|
341
347
|
if (authLoading || !user) {
|
|
342
348
|
return (
|
|
343
|
-
<View style={[styles.container, { backgroundColor, justifyContent: 'center' }]}>
|
|
344
|
-
<ActivityIndicator size="large" color={primaryColor} />
|
|
349
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor, justifyContent: 'center' }]}>
|
|
350
|
+
<ActivityIndicator size="large" color={themeStyles.primaryColor} />
|
|
345
351
|
</View>
|
|
346
352
|
);
|
|
347
353
|
}
|
|
348
354
|
|
|
349
355
|
return (
|
|
350
|
-
<View style={[styles.container, { backgroundColor }]}>
|
|
356
|
+
<View style={[styles.container, { backgroundColor: themeStyles.backgroundColor }]}>
|
|
351
357
|
{/* Header */}
|
|
352
358
|
<View style={styles.header}>
|
|
353
359
|
{editingField ? (
|
|
@@ -401,9 +407,9 @@ const AccountSettingsScreen: React.FC<BaseScreenProps> = ({
|
|
|
401
407
|
disabled={isSaving}
|
|
402
408
|
>
|
|
403
409
|
{isSaving ? (
|
|
404
|
-
<ActivityIndicator size="small" color={primaryColor} />
|
|
410
|
+
<ActivityIndicator size="small" color={themeStyles.primaryColor} />
|
|
405
411
|
) : (
|
|
406
|
-
<Ionicons name="checkmark" size={24} color={primaryColor} />
|
|
412
|
+
<Ionicons name="checkmark" size={24} color={themeStyles.primaryColor} />
|
|
407
413
|
)}
|
|
408
414
|
</TouchableOpacity>
|
|
409
415
|
</Animated.View>
|
|
@@ -799,4 +805,4 @@ const styles = StyleSheet.create({
|
|
|
799
805
|
},
|
|
800
806
|
});
|
|
801
807
|
|
|
802
|
-
export default AccountSettingsScreen;
|
|
808
|
+
export default React.memo(AccountSettingsScreen);
|