diff --git a/packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Bold.otf b/packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Bold.otf new file mode 100644 index 0000000000..5e7d34d56b Binary files /dev/null and b/packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Bold.otf differ diff --git a/packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Medium.otf b/packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Medium.otf new file mode 100644 index 0000000000..33a47f15f5 Binary files /dev/null and b/packages/core-mobile/android/app/src/main/assets/fonts/Aeonik-Medium.otf differ diff --git a/packages/core-mobile/android/app/src/main/assets/fonts/DejaVuSansMono.ttf b/packages/core-mobile/android/app/src/main/assets/fonts/DejaVuSansMono.ttf new file mode 100644 index 0000000000..8b7bb2a4e1 Binary files /dev/null and b/packages/core-mobile/android/app/src/main/assets/fonts/DejaVuSansMono.ttf differ diff --git a/packages/core-mobile/app/ContextApp.tsx b/packages/core-mobile/app/ContextApp.tsx index b85b087495..89a351b3c2 100644 --- a/packages/core-mobile/app/ContextApp.tsx +++ b/packages/core-mobile/app/ContextApp.tsx @@ -10,6 +10,7 @@ import Toast from 'react-native-toast-notifications' import JailMonkey from 'jail-monkey' import { RootSiblingParent } from 'react-native-root-siblings' import { K2ThemeProvider } from '@avalabs/k2-mobile' +import { K2AlpineThemeProvider } from '@avalabs/k2-alpine' import JailbrokenWarning from 'screens/onboarding/JailbrokenWarning' import { PosthogContextProvider } from 'contexts/PosthogContext' import { StatusBar, View } from 'react-native' @@ -37,11 +38,13 @@ const ContextProviders: FC = ({ children }) => ( - - - {children} - - + + + + {children} + + + diff --git a/packages/core-mobile/app/assets/fonts/Aeonik-Bold.otf b/packages/core-mobile/app/assets/fonts/Aeonik-Bold.otf new file mode 100644 index 0000000000..5e7d34d56b Binary files /dev/null and b/packages/core-mobile/app/assets/fonts/Aeonik-Bold.otf differ diff --git a/packages/core-mobile/app/assets/fonts/Aeonik-Medium.otf b/packages/core-mobile/app/assets/fonts/Aeonik-Medium.otf new file mode 100644 index 0000000000..33a47f15f5 Binary files /dev/null and b/packages/core-mobile/app/assets/fonts/Aeonik-Medium.otf differ diff --git a/packages/core-mobile/app/assets/fonts/DejaVuSansMono.ttf b/packages/core-mobile/app/assets/fonts/DejaVuSansMono.ttf new file mode 100644 index 0000000000..8b7bb2a4e1 Binary files /dev/null and b/packages/core-mobile/app/assets/fonts/DejaVuSansMono.ttf differ diff --git a/packages/core-mobile/app/navigation/WalletScreenStack/WalletScreenStack.tsx b/packages/core-mobile/app/navigation/WalletScreenStack/WalletScreenStack.tsx index 5337068e5d..ca9aaf5e5f 100644 --- a/packages/core-mobile/app/navigation/WalletScreenStack/WalletScreenStack.tsx +++ b/packages/core-mobile/app/navigation/WalletScreenStack/WalletScreenStack.tsx @@ -102,7 +102,6 @@ import AdvancedStackScreen, { } from '../wallet/AdvancedStackScreen' import { createModals } from './createModals' -// @ts-expect-error lazy import is fine but typescript doesn't like it const PolyfillCrypto = React.lazy(() => import('react-native-webview-crypto')) type Props = { diff --git a/packages/core-mobile/app/navigation/wallet/TabNavigator.tsx b/packages/core-mobile/app/navigation/wallet/TabNavigator.tsx index 70ed1ccfbb..168b40a724 100644 --- a/packages/core-mobile/app/navigation/wallet/TabNavigator.tsx +++ b/packages/core-mobile/app/navigation/wallet/TabNavigator.tsx @@ -1,4 +1,5 @@ /* eslint-disable react/no-unstable-nested-components */ +import { lazy } from 'react' import AppNavigation, { Tabs } from 'navigation/AppNavigation' import HomeSVG from 'components/svg/HomeSVG' import WatchlistSVG from 'components/svg/WatchlistSVG' @@ -6,7 +7,6 @@ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' import { useApplicationContext } from 'contexts/ApplicationContext' import PortfolioStackScreen from 'navigation/wallet/PortfolioScreenStack' import React, { useState } from 'react' -import WatchlistTab from 'screens/watchlist/WatchlistTabView' import TopNavigationHeader from 'navigation/TopNavigationHeader' import { getCommonBottomTabOptions, TabButton } from 'navigation/NavUtils' import EarnSVG from 'components/svg/EarnSVG' @@ -18,8 +18,14 @@ import { Fab } from 'components/Fab' import { addTab, selectActiveTab, selectAllTabs } from 'store/browser' import { useDispatch, useSelector } from 'react-redux' import AnalyticsService from 'services/analytics/AnalyticsService' +import { withK2Alpine } from 'utils/withK2Alpine' import EarnScreenStack from './EarnScreenStack/EarnScreenStack' +const WatchlistTab = withK2Alpine( + lazy(() => import('screens/watchlist/WatchlistTabView')), + lazy(() => import('screens/watchlist/WatchlistTabViewK2Alpine')) +) + export type TabNavigatorParamList = { [AppNavigation.Tabs.Portfolio]: { showBackButton?: boolean } [AppNavigation.Tabs.Watchlist]: undefined @@ -43,6 +49,7 @@ const TabNavigator: () => JSX.Element = () => { const renderEarnTab: () => null | JSX.Element = () => { if (earnBlocked) return null + return ( { + return ( + + + Hello from K2 Alpine + + + ) +} + +export default WatchlistTabK2Alpine diff --git a/packages/core-mobile/app/services/posthog/PostHogService.ts b/packages/core-mobile/app/services/posthog/PostHogService.ts index 36b9455ada..fd1398b83d 100644 --- a/packages/core-mobile/app/services/posthog/PostHogService.ts +++ b/packages/core-mobile/app/services/posthog/PostHogService.ts @@ -14,13 +14,15 @@ import { import { getPosthogDeviceInfo } from './utils' class PostHogService implements PostHogServiceInterface { + #posthogCaptureUrl: string + constructor( private posthogAnalyticsKey: string, private posthogUrl: string, private posthogFeatureFlagsKey: string - ) {} - - #posthogCaptureUrl = `${this.posthogUrl}/capture/` + ) { + this.#posthogCaptureUrl = `${posthogUrl}/capture/` + } distinctId: string | undefined userId: string | undefined diff --git a/packages/core-mobile/app/services/posthog/types.ts b/packages/core-mobile/app/services/posthog/types.ts index 4fd063bae8..a201c5374f 100644 --- a/packages/core-mobile/app/services/posthog/types.ts +++ b/packages/core-mobile/app/services/posthog/types.ts @@ -27,7 +27,8 @@ export enum FeatureGates { LOG_ERRORS_TO_SENTRY = 'log-errors-to-sentry', BLOCKAID_TRANSACTION_VALIDATION = 'blockaid-transaction-validation', BLOCKAID_DAPP_SCAN = 'blockaid-dapp-scan', - BALANCE_CHANGE_NOTIFICATIONS = 'balance-change-notifications' + BALANCE_CHANGE_NOTIFICATIONS = 'balance-change-notifications', + K2_ALPINE = 'k2-alpine' } export enum FeatureVars { diff --git a/packages/core-mobile/app/store/posthog/slice.ts b/packages/core-mobile/app/store/posthog/slice.ts index 92824e19b4..5c59d8c20e 100644 --- a/packages/core-mobile/app/store/posthog/slice.ts +++ b/packages/core-mobile/app/store/posthog/slice.ts @@ -331,6 +331,14 @@ export const selectIsBalanceChangeNotificationsBlocked = ( ) } +export const selectIsK2AlpineBlocked = (state: RootState): boolean => { + const { featureFlags } = state.posthog + return ( + !featureFlags[FeatureGates.K2_ALPINE] || + !featureFlags[FeatureGates.EVERYTHING] + ) +} + // actions export const { regenerateUserId, toggleAnalytics, setFeatureFlags } = posthogSlice.actions diff --git a/packages/core-mobile/app/store/posthog/types.ts b/packages/core-mobile/app/store/posthog/types.ts index 1fb7c33990..6c336342f1 100644 --- a/packages/core-mobile/app/store/posthog/types.ts +++ b/packages/core-mobile/app/store/posthog/types.ts @@ -27,7 +27,8 @@ export const DefaultFeatureFlagConfig = { [FeatureGates.SEEDLESS_SIGNING]: true, [FeatureGates.BLOCKAID_TRANSACTION_VALIDATION]: true, [FeatureGates.BLOCKAID_DAPP_SCAN]: true, - [FeatureGates.BALANCE_CHANGE_NOTIFICATIONS]: false + [FeatureGates.BALANCE_CHANGE_NOTIFICATIONS]: false, + [FeatureGates.K2_ALPINE]: false } export const initialState = { diff --git a/packages/core-mobile/app/utils/withK2Alpine.tsx b/packages/core-mobile/app/utils/withK2Alpine.tsx new file mode 100644 index 0000000000..5dfd941361 --- /dev/null +++ b/packages/core-mobile/app/utils/withK2Alpine.tsx @@ -0,0 +1,29 @@ +import React from 'react' +import { useSelector } from 'react-redux' +import { selectIsK2AlpineBlocked } from 'store/posthog/slice' + +/** + * This HoC is used to implement a gradual rollout of the new K2 Alpine design. + * + * It does the following: + * - conditionally renders either the old or the new version of a component based on K2 ALPINE feature flag. + * - ensures both the old and new components are interchangeable by enforcing that they accept the same props. + * - ensures that both old and new components are lazily loaded via React.lazy. + * + * Example usage: + * const WatchlistTab = withK2Alpine( + * lazy(() => import('screens/watchlist/WatchlistTabView')), + * lazy(() => import('screens/watchlist/WatchlistTabViewK2Alpine')) + * ) + */ +export const withK2Alpine =

( + OldComponent: React.LazyExoticComponent>, + NewComponent: React.LazyExoticComponent> +): React.ComponentType

=> { + return (props: P) => { + const isK2AlpineBlocked = useSelector(selectIsK2AlpineBlocked) + const Component = isK2AlpineBlocked ? OldComponent : NewComponent + // @ts-ignore react lazy doesn't work well with generic typing + return + } +} diff --git a/packages/core-mobile/ios/AvaxWallet.xcodeproj/project.pbxproj b/packages/core-mobile/ios/AvaxWallet.xcodeproj/project.pbxproj index 071abd43ed..fdeeed4ab7 100644 --- a/packages/core-mobile/ios/AvaxWallet.xcodeproj/project.pbxproj +++ b/packages/core-mobile/ios/AvaxWallet.xcodeproj/project.pbxproj @@ -7,14 +7,10 @@ objects = { /* Begin PBXBuildFile section */ - 0B1C89B127E4D7EF00C19912 /* Inter-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0B1C89B027E4D7EF00C19912 /* Inter-ExtraBold.ttf */; }; 0B66CE2B2C91C7D70059E353 /* core_receive.wav in Resources */ = {isa = PBXBuildFile; fileRef = 0B66CE2A2C91C7D70059E353 /* core_receive.wav */; }; 0B66CE2C2C91C7D70059E353 /* core_receive.wav in Resources */ = {isa = PBXBuildFile; fileRef = 0B66CE2A2C91C7D70059E353 /* core_receive.wav */; }; - 0B66D74B270B75C3006530A8 /* Inter-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0B66D74A270B75C3006530A8 /* Inter-SemiBold.ttf */; }; 0B73DE0B2C80D72900DED1DF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0B73DE0A2C80D72900DED1DF /* GoogleService-Info.plist */; }; 0B73DE0C2C80D72900DED1DF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 0B73DE0A2C80D72900DED1DF /* GoogleService-Info.plist */; }; - 0BAAA734269F480900722C85 /* Inter-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BAAA732269F480900722C85 /* Inter-Regular.ttf */; }; - 0BAAA735269F480900722C85 /* Inter-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BAAA733269F480900722C85 /* Inter-Bold.ttf */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 501C50832C35C63800DAFF77 /* core_send.wav in Resources */ = {isa = PBXBuildFile; fileRef = 501C50822C35C63800DAFF77 /* core_send.wav */; }; 5084807F2C3C3E78008762B2 /* core_send.wav in Resources */ = {isa = PBXBuildFile; fileRef = 501C50822C35C63800DAFF77 /* core_send.wav */; }; @@ -25,11 +21,21 @@ 81ACC3942BD1B2860089FEBA /* BootSplash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81ACC3922BD1B2860089FEBA /* BootSplash.storyboard */; }; 8E3793752CA2790500D3A9B4 /* NotificationServiceExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 815E55452C94A396000F8E0F /* NotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 8E3793792CA2790C00D3A9B4 /* NotificationServiceExtensionInternal.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 815E550F2C92071A000F8E0F /* NotificationServiceExtensionInternal.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; - 8E858A5A28AFD47300236EF2 /* Inter-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BAAA733269F480900722C85 /* Inter-Bold.ttf */; }; - 8E858A5C28AFD47300236EF2 /* Inter-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BAAA732269F480900722C85 /* Inter-Regular.ttf */; }; - 8E858A5D28AFD47300236EF2 /* Inter-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0B66D74A270B75C3006530A8 /* Inter-SemiBold.ttf */; }; + 8E80035A2CAAF3E400FFC562 /* Aeonik-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003532CAAF3D800FFC562 /* Aeonik-Bold.otf */; }; + 8E80035B2CAAF3E400FFC562 /* Aeonik-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003542CAAF3D800FFC562 /* Aeonik-Medium.otf */; }; + 8E80035C2CAAF3E400FFC562 /* DejaVuSansMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003592CAAF3D800FFC562 /* DejaVuSansMono.ttf */; }; + 8E80035D2CAAF3E400FFC562 /* Inter-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003582CAAF3D800FFC562 /* Inter-Bold.ttf */; }; + 8E80035E2CAAF3E400FFC562 /* Inter-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003552CAAF3D800FFC562 /* Inter-ExtraBold.ttf */; }; + 8E80035F2CAAF3E400FFC562 /* Inter-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003572CAAF3D800FFC562 /* Inter-Regular.ttf */; }; + 8E8003602CAAF3E400FFC562 /* Inter-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003562CAAF3D800FFC562 /* Inter-SemiBold.ttf */; }; + 8E8003612CAAF3F100FFC562 /* Aeonik-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003532CAAF3D800FFC562 /* Aeonik-Bold.otf */; }; + 8E8003622CAAF3F100FFC562 /* Aeonik-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003542CAAF3D800FFC562 /* Aeonik-Medium.otf */; }; + 8E8003632CAAF3F100FFC562 /* DejaVuSansMono.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003592CAAF3D800FFC562 /* DejaVuSansMono.ttf */; }; + 8E8003642CAAF3F100FFC562 /* Inter-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003582CAAF3D800FFC562 /* Inter-Bold.ttf */; }; + 8E8003652CAAF3F100FFC562 /* Inter-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003552CAAF3D800FFC562 /* Inter-ExtraBold.ttf */; }; + 8E8003662CAAF3F100FFC562 /* Inter-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003572CAAF3D800FFC562 /* Inter-Regular.ttf */; }; + 8E8003672CAAF3F100FFC562 /* Inter-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 8E8003562CAAF3D800FFC562 /* Inter-SemiBold.ttf */; }; 8E858A5E28AFD47300236EF2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 8E858A5F28AFD47300236EF2 /* Inter-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0B1C89B027E4D7EF00C19912 /* Inter-ExtraBold.ttf */; }; 8EA3A01028EF825900F753C2 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8EA3A00D28EF825900F753C2 /* AppDelegate.mm */; }; 8EA3A01328EF82E100F753C2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EA3A01128EF82E100F753C2 /* main.m */; }; 8EA4B4D028EF9B4D00A06DBA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8EA3A01128EF82E100F753C2 /* main.m */; }; @@ -116,13 +122,9 @@ /* Begin PBXFileReference section */ 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* AvaxWalletTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AvaxWalletTests.m; sourceTree = ""; }; - 0B1C89B027E4D7EF00C19912 /* Inter-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-ExtraBold.ttf"; path = "../app/assets/fonts/Inter-ExtraBold.ttf"; sourceTree = ""; }; 0B66CE2A2C91C7D70059E353 /* core_receive.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = core_receive.wav; sourceTree = ""; }; - 0B66D74A270B75C3006530A8 /* Inter-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Inter-SemiBold.ttf"; sourceTree = ""; }; 0B73DE0A2C80D72900DED1DF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 0BA5138A27D234C200A25188 /* AvaxWallet-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AvaxWallet-Bridging-Header.h"; sourceTree = ""; }; - 0BAAA732269F480900722C85 /* Inter-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-Regular.ttf"; path = "../android/app/src/main/assets/fonts/Inter-Regular.ttf"; sourceTree = ""; }; - 0BAAA733269F480900722C85 /* Inter-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-Bold.ttf"; path = "../android/app/src/main/assets/fonts/Inter-Bold.ttf"; sourceTree = ""; }; 13B07F961A680F5B00A75B9A /* AvaxWallet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AvaxWallet.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AvaxWallet/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = AvaxWallet/Info.plist; sourceTree = ""; }; @@ -138,6 +140,13 @@ 815E55492C94A396000F8E0F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 815E55502C94A3A8000F8E0F /* NotificationServiceExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationServiceExtension.entitlements; sourceTree = ""; }; 81ACC3922BD1B2860089FEBA /* BootSplash.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = BootSplash.storyboard; sourceTree = ""; }; + 8E8003532CAAF3D800FFC562 /* Aeonik-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Aeonik-Bold.otf"; path = "../app/assets/fonts/Aeonik-Bold.otf"; sourceTree = ""; }; + 8E8003542CAAF3D800FFC562 /* Aeonik-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Aeonik-Medium.otf"; path = "../app/assets/fonts/Aeonik-Medium.otf"; sourceTree = ""; }; + 8E8003552CAAF3D800FFC562 /* Inter-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-ExtraBold.ttf"; path = "../app/assets/fonts/Inter-ExtraBold.ttf"; sourceTree = ""; }; + 8E8003562CAAF3D800FFC562 /* Inter-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-SemiBold.ttf"; path = "../app/assets/fonts/Inter-SemiBold.ttf"; sourceTree = ""; }; + 8E8003572CAAF3D800FFC562 /* Inter-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-Regular.ttf"; path = "../app/assets/fonts/Inter-Regular.ttf"; sourceTree = ""; }; + 8E8003582CAAF3D800FFC562 /* Inter-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Inter-Bold.ttf"; path = "../app/assets/fonts/Inter-Bold.ttf"; sourceTree = ""; }; + 8E8003592CAAF3D800FFC562 /* DejaVuSansMono.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = DejaVuSansMono.ttf; path = ../app/assets/fonts/DejaVuSansMono.ttf; sourceTree = ""; }; 8E83528A28F09E0900880FD3 /* OpenSSL.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = OpenSSL.xcframework; path = "Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework"; sourceTree = ""; }; 8E858A6628AFD47300236EF2 /* AvaxWalletInternal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AvaxWalletInternal.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8EA3A00D28EF825900F753C2 /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = ""; }; @@ -294,10 +303,13 @@ D43AD4CD4B1C41E484E6B9ED /* Resources */ = { isa = PBXGroup; children = ( - 0B1C89B027E4D7EF00C19912 /* Inter-ExtraBold.ttf */, - 0B66D74A270B75C3006530A8 /* Inter-SemiBold.ttf */, - 0BAAA733269F480900722C85 /* Inter-Bold.ttf */, - 0BAAA732269F480900722C85 /* Inter-Regular.ttf */, + 8E8003532CAAF3D800FFC562 /* Aeonik-Bold.otf */, + 8E8003542CAAF3D800FFC562 /* Aeonik-Medium.otf */, + 8E8003592CAAF3D800FFC562 /* DejaVuSansMono.ttf */, + 8E8003582CAAF3D800FFC562 /* Inter-Bold.ttf */, + 8E8003552CAAF3D800FFC562 /* Inter-ExtraBold.ttf */, + 8E8003572CAAF3D800FFC562 /* Inter-Regular.ttf */, + 8E8003562CAAF3D800FFC562 /* Inter-SemiBold.ttf */, ); name = Resources; sourceTree = ""; @@ -450,17 +462,20 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 0BAAA735269F480900722C85 /* Inter-Bold.ttf in Resources */, - 0BAAA734269F480900722C85 /* Inter-Regular.ttf in Resources */, + 8E80035A2CAAF3E400FFC562 /* Aeonik-Bold.otf in Resources */, + 8E80035B2CAAF3E400FFC562 /* Aeonik-Medium.otf in Resources */, + 8E80035C2CAAF3E400FFC562 /* DejaVuSansMono.ttf in Resources */, + 8E80035D2CAAF3E400FFC562 /* Inter-Bold.ttf in Resources */, + 8E80035E2CAAF3E400FFC562 /* Inter-ExtraBold.ttf in Resources */, + 8E80035F2CAAF3E400FFC562 /* Inter-Regular.ttf in Resources */, + 8E8003602CAAF3E400FFC562 /* Inter-SemiBold.ttf in Resources */, 501C50832C35C63800DAFF77 /* core_send.wav in Resources */, 0B66CE2B2C91C7D70059E353 /* core_receive.wav in Resources */, 81ACC3932BD1B2860089FEBA /* BootSplash.storyboard in Resources */, - 0B66D74B270B75C3006530A8 /* Inter-SemiBold.ttf in Resources */, 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 8EE9988B28B537A40088DE7C /* InfoRelease.plist in Resources */, 0B73DE0B2C80D72900DED1DF /* GoogleService-Info.plist in Resources */, 8EACAADB2BD84A3300A987BA /* PrivacyInfo.xcprivacy in Resources */, - 0B1C89B127E4D7EF00C19912 /* Inter-ExtraBold.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -482,17 +497,20 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 8E8003612CAAF3F100FFC562 /* Aeonik-Bold.otf in Resources */, + 8E8003622CAAF3F100FFC562 /* Aeonik-Medium.otf in Resources */, + 8E8003632CAAF3F100FFC562 /* DejaVuSansMono.ttf in Resources */, + 8E8003642CAAF3F100FFC562 /* Inter-Bold.ttf in Resources */, + 8E8003652CAAF3F100FFC562 /* Inter-ExtraBold.ttf in Resources */, + 8E8003662CAAF3F100FFC562 /* Inter-Regular.ttf in Resources */, + 8E8003672CAAF3F100FFC562 /* Inter-SemiBold.ttf in Resources */, 5084807F2C3C3E78008762B2 /* core_send.wav in Resources */, - 8E858A5A28AFD47300236EF2 /* Inter-Bold.ttf in Resources */, - 8E858A5C28AFD47300236EF2 /* Inter-Regular.ttf in Resources */, 0B66CE2C2C91C7D70059E353 /* core_receive.wav in Resources */, 81ACC3942BD1B2860089FEBA /* BootSplash.storyboard in Resources */, - 8E858A5D28AFD47300236EF2 /* Inter-SemiBold.ttf in Resources */, 8E858A5E28AFD47300236EF2 /* Images.xcassets in Resources */, 8EE9988C28B537A40088DE7C /* InfoRelease.plist in Resources */, 0B73DE0C2C80D72900DED1DF /* GoogleService-Info.plist in Resources */, 8EACAADC2BD84A3300A987BA /* PrivacyInfo.xcprivacy in Resources */, - 8E858A5F28AFD47300236EF2 /* Inter-ExtraBold.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/packages/core-mobile/ios/AvaxWallet/Info.plist b/packages/core-mobile/ios/AvaxWallet/Info.plist index 336d6c359f..e7a4187156 100644 --- a/packages/core-mobile/ios/AvaxWallet/Info.plist +++ b/packages/core-mobile/ios/AvaxWallet/Info.plist @@ -67,13 +67,16 @@ NSFaceIDUsageDescription $(DISPLAY_NAME) requires Face ID access to allow you quick and secure access to your wallet. NSLocationWhenInUseUsageDescription - + UIAppFonts Inter-Regular.ttf Inter-Bold.ttf Inter-SemiBold.ttf Inter-ExtraBold.ttf + Aeonik-Bold.otf + Aeonik-Medium.otf + DejaVuSansMono.ttf UIBackgroundModes diff --git a/packages/core-mobile/package.json b/packages/core-mobile/package.json index 62a5dc373c..ee70d75fea 100644 --- a/packages/core-mobile/package.json +++ b/packages/core-mobile/package.json @@ -9,7 +9,6 @@ "podInstall": "bundle _2.1.4_ install && cd ios && bundle exec pod install", "ios": "ENVFILE=.env.development react-native run-ios", "start": "react-native start", - "link": "react-native link", "test": "jest", "tsc": "tsc -p .", "lint": "eslint .", @@ -32,6 +31,7 @@ "@avalabs/core-wallets-sdk": "3.1.0-alpha.7", "@avalabs/evm-module": "0.7.2", "@avalabs/glacier-sdk": "3.1.0-alpha.7", + "@avalabs/k2-alpine": "workspace:*", "@avalabs/k2-mobile": "workspace:*", "@avalabs/types": "3.1.0-alpha.7", "@avalabs/vm-module-types": "0.7.2", diff --git a/packages/core-mobile/tsconfig.json b/packages/core-mobile/tsconfig.json index edc5882039..2a3c85aaea 100644 --- a/packages/core-mobile/tsconfig.json +++ b/packages/core-mobile/tsconfig.json @@ -1,6 +1,8 @@ { "extends": "@avalabs/tsconfig-mobile/base.json", "compilerOptions": { + "target": "esnext", + "module": "esnext", "baseUrl": "./app", "paths": { "tests/*": ["../tests/*"] @@ -15,7 +17,8 @@ ".eslintrc.js", "jest.config.js", ".prettierrc.js", - "../k2-mobile/src/theme.d.ts" + "../k2-mobile/src/theme.d.ts", + "../k2-alpine/src/theme.d.ts" ], "exclude": ["node_modules"] } diff --git a/packages/k2-alpine/package.json b/packages/k2-alpine/package.json index a088ccc441..73888cd0d9 100644 --- a/packages/k2-alpine/package.json +++ b/packages/k2-alpine/package.json @@ -2,10 +2,7 @@ "name": "@avalabs/k2-alpine", "license": "Limited Ecosystem License", "version": "1.0.0", - "main": "expo/AppEntry.js", - "files": [ - "./src/index.ts" - ], + "main": "src/index.ts", "scripts": { "setup": "yarn allow-scripts", "start": "expo start", diff --git a/packages/k2-alpine/src/components/button/Button.stories.tsx b/packages/k2-alpine/src/components/button/Button.stories.tsx deleted file mode 100644 index 14367b4e9e..0000000000 --- a/packages/k2-alpine/src/components/button/Button.stories.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import type { Meta, StoryObj } from '@storybook/react' -import { Button } from './Button' - -const ButtonMeta: Meta = { - title: 'Button', - component: Button, - argTypes: { - onPress: { action: 'pressed the button' } - }, - args: { - onPress: () => { - // do nothing - }, - children: 'Next', - type: 'primary' - } -} - -export default ButtonMeta - -export const Basic: StoryObj = {} diff --git a/packages/k2-alpine/src/components/button/Button.tsx b/packages/k2-alpine/src/components/button/Button.tsx deleted file mode 100644 index c37ab8f03d..0000000000 --- a/packages/k2-alpine/src/components/button/Button.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import React, { type FC, type PropsWithChildren } from 'react' -import { type K2AlpineTheme } from '../../theme/theme' -import { Pressable, Text } from '../Primitives' -import { useTheme } from '../..' - -export type Props = { - onPress: () => void - type?: 'primary' | 'secondary' | 'tertiary' - size?: 'small' | 'medium' | 'large' - disabled?: boolean -} - -const getTypeColors = ( - type: Props['type'], - theme: K2AlpineTheme -): { background: string; text: string } => { - switch (type) { - case 'secondary': - return { - background: theme.colors.$surfaceSecondary, - text: theme.colors.$textSecondary - } - case 'tertiary': - return { - background: theme.colors.$surfaceTertiary, - text: theme.colors.$textPrimary - } - case 'primary': - default: - return { - background: theme.colors.$surfacePrimary, - text: theme.colors.$textPrimary - } - } -} - -export const Button: FC> = ({ - onPress, - type = 'primary', - size = 'large', - disabled, - children -}) => { - const { theme } = useTheme() - const colors = getTypeColors(type, theme) - - return ( - - {children} - - ) -} diff --git a/packages/k2-alpine/src/components/index.ts b/packages/k2-alpine/src/components/index.ts index 735fd62a9f..16238a9931 100644 --- a/packages/k2-alpine/src/components/index.ts +++ b/packages/k2-alpine/src/components/index.ts @@ -1 +1 @@ -export * from './button/Button' +export * from './Primitives' diff --git a/packages/k2-alpine/src/theme.d.ts b/packages/k2-alpine/src/theme.d.ts new file mode 100644 index 0000000000..f4e132f649 --- /dev/null +++ b/packages/k2-alpine/src/theme.d.ts @@ -0,0 +1,7 @@ +// add intellisense to theme +import type { K2AlpineTheme } from './theme/theme' + +declare module 'dripsy' { + // eslint-disable-next-line @typescript-eslint/no-empty-interface + interface DripsyCustomTheme extends K2AlpineTheme {} +} diff --git a/packages/k2-alpine/src/theme/ThemeProvider.tsx b/packages/k2-alpine/src/theme/ThemeProvider.tsx index c4b7c9ec34..1ba5b32fe9 100644 --- a/packages/k2-alpine/src/theme/ThemeProvider.tsx +++ b/packages/k2-alpine/src/theme/ThemeProvider.tsx @@ -1,7 +1,8 @@ +// @ts-nocheck - we need to ignore this for now until https://ava-labs.atlassian.net/browse/CP-9297 is done import React, { PropsWithChildren, type FC } from 'react' import { DripsyProvider } from 'dripsy' -import { darkTheme, type K2AlpineTheme } from './theme' +import { darkTheme } from './theme' export const K2AlpineThemeProvider: FC = ({ children }) => ( - {children} + {children} ) diff --git a/packages/k2-alpine/src/theme/theme.ts b/packages/k2-alpine/src/theme/theme.ts index 47aff860fc..a9d5490756 100644 --- a/packages/k2-alpine/src/theme/theme.ts +++ b/packages/k2-alpine/src/theme/theme.ts @@ -1,7 +1,6 @@ import { makeTheme } from 'dripsy' import { darkModeColors, lightModeColors } from './tokens/colors' import { text } from './tokens/text' -import { styles } from './tokens/styles' export const darkTheme = makeTheme({ types: { @@ -9,8 +8,7 @@ export const darkTheme = makeTheme({ reactNativeTypesOnly: true }, colors: darkModeColors, - text, - styles + text }) export const lightTheme = { @@ -18,13 +16,4 @@ export const lightTheme = { colors: lightModeColors } -export type K2AlpineTheme = typeof darkTheme & { - colors: typeof darkModeColors - styles: typeof styles - text: typeof text -} - -declare module 'dripsy' { - // eslint-disable-next-line @typescript-eslint/no-empty-interface - interface DripsyCustomTheme extends K2AlpineTheme {} -} +export type K2AlpineTheme = typeof darkTheme diff --git a/packages/k2-alpine/src/theme/tokens/Colors.stories.tsx b/packages/k2-alpine/src/theme/tokens/Colors.stories.tsx index 302dec9be2..a36c30fc56 100644 --- a/packages/k2-alpine/src/theme/tokens/Colors.stories.tsx +++ b/packages/k2-alpine/src/theme/tokens/Colors.stories.tsx @@ -23,17 +23,17 @@ const Color = ({ return ( - + {name.substring(1)} - + {value} diff --git a/packages/k2-alpine/src/theme/tokens/Text.stories.tsx b/packages/k2-alpine/src/theme/tokens/Text.stories.tsx index 8464bef0b8..44dba34bbf 100644 --- a/packages/k2-alpine/src/theme/tokens/Text.stories.tsx +++ b/packages/k2-alpine/src/theme/tokens/Text.stories.tsx @@ -27,6 +27,7 @@ export const All = (): JSX.Element => { style={{ marginBottom: 20 }} /> {Object.keys(text).map((variant, index) => ( + // @ts-expect-error {variant} diff --git a/packages/k2-alpine/src/theme/tokens/styles.ts b/packages/k2-alpine/src/theme/tokens/styles.ts deleted file mode 100644 index 020b1715b2..0000000000 --- a/packages/k2-alpine/src/theme/tokens/styles.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const styles = { - disabledOpacity: 0.3, - borderRadius: 25 -} diff --git a/packages/k2-alpine/src/theme/tokens/text.ts b/packages/k2-alpine/src/theme/tokens/text.ts index 70daef9e2a..98eb7402d7 100644 --- a/packages/k2-alpine/src/theme/tokens/text.ts +++ b/packages/k2-alpine/src/theme/tokens/text.ts @@ -15,7 +15,7 @@ export const text = { heading3: { fontFamily: 'Aeonik-Bold', fontSize: 27, - lineHeight: 30 + lineHeight: 27 }, heading4: { fontFamily: 'Inter-SemiBold', diff --git a/packages/k2-alpine/src/utils/Link.tsx b/packages/k2-alpine/src/utils/Link.tsx index 002f09beb6..46ecdf7387 100644 --- a/packages/k2-alpine/src/utils/Link.tsx +++ b/packages/k2-alpine/src/utils/Link.tsx @@ -15,11 +15,15 @@ const Link = ({ title, url, style }: Props): JSX.Element => { onPress={() => { Linking.openURL(url) }} + style={[ + style, + { + textDecorationLine: 'underline' + } + ]} sx={{ - color: '$textPrimary', - textDecorationLine: 'underline' - }} - style={style}> + color: '$textPrimary' + }}> {title} ) diff --git a/scripts/generate-metro-monorepo-config.js b/scripts/generate-metro-monorepo-config.js index bc0f57ac13..d9ab428e0c 100644 --- a/scripts/generate-metro-monorepo-config.js +++ b/scripts/generate-metro-monorepo-config.js @@ -4,38 +4,43 @@ * check symlink packages and their peer dependencies * and generate metro.config.js accordingly */ -const path = require('path'); -const fs = require('fs'); +const path = require('path') +const fs = require('fs') -const METRO_CONFIG_NAME = 'metro.monorepo.config.js'; -const AVALABS_ALIAS = '@avalabs'; -const PACKAGES_TO_PROCESS = ['k2-mobile']; -const CWD = process.cwd(); +const METRO_CONFIG_NAME = 'metro.monorepo.config.js' +const AVALABS_ALIAS = '@avalabs' +const PACKAGES_TO_PROCESS = ['k2-mobile', 'k2-alpine'] +const CWD = process.cwd() function getSymlinkedDependenciesPaths() { const symlinkedDependencies = fs .readdirSync(`${CWD}/node_modules/${AVALABS_ALIAS}`) - .filter((dependency) => { - return PACKAGES_TO_PROCESS.includes(dependency) && fs.lstatSync(`node_modules/${AVALABS_ALIAS}/${dependency}`).isSymbolicLink() - }); + .filter(dependency => { + return ( + PACKAGES_TO_PROCESS.includes(dependency) && + fs + .lstatSync(`node_modules/${AVALABS_ALIAS}/${dependency}`) + .isSymbolicLink() + ) + }) - return symlinkedDependencies.map((dependency) => + return symlinkedDependencies.map(dependency => fs.realpathSync(`node_modules/${AVALABS_ALIAS}/${dependency}`) - ); + ) } function getPeerDependencies(symlinkedDependenciesPaths) { return ( symlinkedDependenciesPaths - .map((item) => require(`${item}/package.json`).peerDependencies) - .map((peerDependencies) => + .map(item => require(`${item}/package.json`).peerDependencies) + .map(peerDependencies => peerDependencies ? Object.keys(peerDependencies) : [] ) // flatten the array of arrays .reduce( (flatDependencies, dependencies) => [ ...flatDependencies, - ...dependencies, + ...dependencies ], [] ) @@ -43,7 +48,7 @@ function getPeerDependencies(symlinkedDependenciesPaths) { .filter( (dependency, i, dependencies) => dependencies.indexOf(dependency) === i ) - ); + ) } function generateBlacklist( @@ -51,19 +56,19 @@ function generateBlacklist( peerDependenciesOfSymlinkedDependencies ) { return symlinkedDependenciesPaths - .map((p) => { + .map(p => { return peerDependenciesOfSymlinkedDependencies - .map((peerDependency) => { - return `${peerDependency.replace(/\//g, '[/\\\\]')}`; + .map(peerDependency => { + return `${peerDependency.replace(/\//g, '[/\\\\]')}` }) - .map((formattedPeerDependency) => { + .map(formattedPeerDependency => { return `/${p.replace( /\//g, '[/\\\\]' - )}[/\\\\]node_modules[/\\\\]${formattedPeerDependency}[/\\\\].*/`; - }); + )}[/\\\\]node_modules[/\\\\]${formattedPeerDependency}[/\\\\].*/` + }) }) - .flat(); + .flat() } function generateRnCliConfig( @@ -71,17 +76,17 @@ function generateRnCliConfig( peerDependenciesOfSymlinkedDependencies ) { const extraNodeModules = peerDependenciesOfSymlinkedDependencies - .map((name) => `'${name}': path.resolve(__dirname, 'node_modules/${name}')`) - .join(',\n'); + .map(name => `'${name}': path.resolve(__dirname, 'node_modules/${name}')`) + .join(',\n') const blacklistRE = generateBlacklist( symlinkedDependenciesPaths, peerDependenciesOfSymlinkedDependencies - ); + ) const projectRoots = symlinkedDependenciesPaths - .map((item) => `'${path.resolve(item)}'`) - .join(',\n'); + .map(item => `'${path.resolve(item)}'`) + .join(',\n') const fileBody = ` const path = require('path'); @@ -105,20 +110,20 @@ ${extraNodeModules} // include symlinked packages as additional roots watchFolders: [${projectRoots}], }; - `; + ` - fs.writeFileSync(METRO_CONFIG_NAME, fileBody); + fs.writeFileSync(METRO_CONFIG_NAME, fileBody) } function generate() { - const symlinkedDependenciesPaths = getSymlinkedDependenciesPaths(); + const symlinkedDependenciesPaths = getSymlinkedDependenciesPaths() const peerDependenciesOfSymlinkedDependencies = getPeerDependencies( symlinkedDependenciesPaths - ); + ) generateRnCliConfig( symlinkedDependenciesPaths, peerDependenciesOfSymlinkedDependencies - ); + ) } -generate() \ No newline at end of file +generate() diff --git a/yarn.lock b/yarn.lock index e3dd637b26..c86da30756 100644 --- a/yarn.lock +++ b/yarn.lock @@ -162,6 +162,7 @@ __metadata: "@avalabs/core-wallets-sdk": 3.1.0-alpha.7 "@avalabs/evm-module": 0.7.2 "@avalabs/glacier-sdk": 3.1.0-alpha.7 + "@avalabs/k2-alpine": "workspace:*" "@avalabs/k2-mobile": "workspace:*" "@avalabs/tsconfig-mobile": "workspace:*" "@avalabs/types": 3.1.0-alpha.7 @@ -459,7 +460,7 @@ __metadata: languageName: node linkType: hard -"@avalabs/k2-alpine@workspace:packages/k2-alpine": +"@avalabs/k2-alpine@workspace:*, @avalabs/k2-alpine@workspace:packages/k2-alpine": version: 0.0.0-use.local resolution: "@avalabs/k2-alpine@workspace:packages/k2-alpine" dependencies: @@ -8163,9 +8164,9 @@ __metadata: linkType: hard "@scure/base@npm:~1.1.8": - version: 1.1.9 - resolution: "@scure/base@npm:1.1.9" - checksum: 120820a37dfe9dfe4cab2b7b7460552d08e67dee8057ed5354eb68d8e3440890ae983ce3bee957d2b45684950b454a2b6d71d5ee77c1fd3fddc022e2a510337f + version: 1.1.8 + resolution: "@scure/base@npm:1.1.8" + checksum: 1fc8a355ba68663c0eb430cf6a2c5ff5af790c347c1ba1953f344e8681ab37e37e2545e495f7f971b0245727d710fea8c1e57d232d0c6c543cbed4965c7596a1 languageName: node linkType: hard @@ -10195,11 +10196,11 @@ __metadata: linkType: hard "@types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0": - version: 22.5.4 - resolution: "@types/node@npm:22.5.4" + version: 22.7.4 + resolution: "@types/node@npm:22.7.4" dependencies: undici-types: ~6.19.2 - checksum: 77ac225c38c428200036780036da0bc6764e2721cfa8f528c7e7da7cfefe01a32a5791e28a54efbeedbc977949058d7db902b2e00139298225d4686cee4ae6db + checksum: a3f4154147639369aed08fe6f8d62eff637cf87b187bb252d7bbccdc82884626007af424b08a653c53f2182adfa0340001b4888cb7cbb942cef351210fc742a5 languageName: node linkType: hard