Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ Shared code (anything that can be reused, cryptography, network fetchers, react

Development build for android (produces apk that has to load bundle remotely): `eas build --platform android --profile development-simulator --local`

Mac Catalyst builds from `mobile/`:

- Local debug build: `npm run mac`
- Local release build: `npm run mac:release`
- Local EAS custom build: `npm run mac:eas:local`
- EAS cloud build: `eas build --platform ios --profile mac-catalyst`

The Mac Catalyst path currently builds an unsigned `.app` artifact from the existing iOS native project. Local output is written under `mobile/ios/build/Build/Products`, and the EAS profile uploads `ios/build/Build/Products/Release-maccatalyst/LayerzWallet.app`.

## Tests

TBD
Expand All @@ -79,4 +88,6 @@ We are also relying on Expo EAS for builds, so a generic workflow to run e2e tes
## Build

* local android build: `eas build --platform android --profile preview --local`
* local mac build: `cd mobile && npm run mac`
* EAS mac build: `cd mobile && eas build --platform ios --profile mac-catalyst`
* ext build: `npm run build`
28 changes: 28 additions & 0 deletions mobile/.eas/build/mac-catalyst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
build:
name: Build Mac Catalyst app
steps:
- eas/checkout

- eas/install_node_modules

- run:
name: Install CocoaPods for Mac Catalyst
working_directory: ./ios
command: EXPO_ENABLE_MAC_CATALYST=1 pod install

- run:
name: Build Mac Catalyst app
command: |
set -euo pipefail

EXPO_ENABLE_MAC_CATALYST=1 xcodebuild \
-workspace ios/LayerzWallet.xcworkspace \
-scheme LayerzWallet \
-configuration Release \
-destination 'platform=macOS,variant=Mac Catalyst' \
-derivedDataPath ios/build \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGNING_REQUIRED=NO \
COMPILER_INDEX_STORE_ENABLE=NO

- eas/find_and_upload_build_artifacts
10 changes: 8 additions & 2 deletions mobile/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import 'react-native-reanimated';
import { SWRConfig } from 'swr';
import BigNumber from 'bignumber.js';

import '../src/modules/breeze-adapter'; // needed to be imported before we can use BreezWallet
import '../src/modules/spark-adapter'; // needed to be imported before we can use SparkWallet
import { isMacCatalyst } from '@/src/utils/platform';

import AutoClaimMonitor from '@/components/AutoClaimMonitor';
import { ErrorBoundary } from '@/components/ErrorBoundary';
Expand All @@ -34,6 +33,13 @@ import { appendLog, applogFilePath, handleError } from '@/src/modules/error-hand
import { TransferFlowProvider } from '@/src/transfer/TransferFlowContext';
import { TransferExecution } from '@shared/types/transfer';

if (isMacCatalyst) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This void import(...) is async. If anything reads global.breezAdapter/global.sparkAdapter during boot, you get an undefined crash. Prefer require()/static import behind the platform guard, or make the init path await the import.

void import('../src/modules/unsupported-network-adapters');
} else {
void import('../src/modules/breeze-adapter');
void import('../src/modules/spark-adapter');
}

// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
LogBox.ignoreLogs(['Require cycle:', 'Open debugger to view warnings.']);
Expand Down
18 changes: 18 additions & 0 deletions mobile/components/ScanQrComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import GradientFormSheet from '@/components/GradientFormSheet';
import PlatformBlurView from '@/components/PlatformBlurView';
import { ThemedText } from '@/components/ThemedText';
import { ScanQrContext } from '@/src/hooks/ScanQrContext';
import { isMacCatalyst } from '@/src/utils/platform';
import { NetworkContext } from '@shared/hooks/NetworkContext';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -45,6 +46,12 @@ const styles = StyleSheet.create({
gestureHandlerRoot: {
flex: 1,
},
unsupportedWrapper: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 24,
},
});

// Memoized camera component to prevent re-renders during sheet interactions
Expand Down Expand Up @@ -142,6 +149,17 @@ export default function ScanQrComponent() {
}

const renderCameraContent = () => {
if (isMacCatalyst) {
return (
<View style={styles.unsupportedWrapper}>
<ThemedText style={styles.message}>QR scanning is not supported in Mac Catalyst builds yet.</ThemedText>
<Pressable onPress={cancelCamera}>
<ThemedText style={styles.message}>Close</ThemedText>
</Pressable>
</View>
);
}

if (!isCameraReady) {
// Camera is not ready yet
return (
Expand Down
9 changes: 9 additions & 0 deletions mobile/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
"developmentClient": true,
"distribution": "internal"
},
"mac-catalyst": {
"extends": "base",
"withoutCredentials": true,
"ios": {
"config": "mac-catalyst.yml",
"buildConfiguration": "Release",
"applicationArchivePath": "ios/build/Build/Products/Release-maccatalyst/LayerzWallet.app"
}
},
"production": {
"extends": "base",
"autoIncrement": true
Expand Down
Loading
Loading