Skip to content

Commit d76ff99

Browse files
committed
corrected minor bugs and version naming updated
1 parent 3649f72 commit d76ff99

File tree

10 files changed

+65
-56
lines changed

10 files changed

+65
-56
lines changed

apps/box/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ android {
8282
applicationId "land.fx.blox"
8383
minSdkVersion rootProject.ext.minSdkVersion
8484
targetSdkVersion rootProject.ext.targetSdkVersion
85-
versionCode 244
86-
versionName "2.1.5"
85+
versionCode 245
86+
versionName "2.2.0"
8787
// buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
8888

8989
testBuildType System.getProperty('testBuildType', 'debug')

apps/box/ios/Box.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@
665665
"$(inherited)",
666666
"@executable_path/Frameworks",
667667
);
668-
MARKETING_VERSION = 2.1.5;
668+
MARKETING_VERSION = 2.2.0;
669669
OTHER_LDFLAGS = (
670670
"$(inherited)",
671671
"-ObjC",
@@ -702,7 +702,7 @@
702702
"$(inherited)",
703703
"@executable_path/Frameworks",
704704
);
705-
MARKETING_VERSION = 2.1.5;
705+
MARKETING_VERSION = 2.2.0;
706706
OTHER_LDFLAGS = (
707707
"$(inherited)",
708708
"-ObjC",

apps/box/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "box",
3-
"version": "2.1.5",
3+
"version": "2.2.0",
44
"private": true,
55
"dependencies": {
66
"@functionland/fula-sec": "*",

apps/box/src/components/Cards/EarningCard.tsx

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
FxButton,
1010
useToast,
1111
} from '@functionland/component-library';
12-
import { ActivityIndicator, StyleSheet } from 'react-native';
12+
import { ActivityIndicator, StyleSheet, Linking } from 'react-native';
1313
import { useTranslation } from 'react-i18next';
1414
import { useFulaBalance, useFormattedFulaBalance } from '../../hooks/useFulaBalance';
1515
import { useClaimableTokens } from '../../hooks/useClaimableTokens';
@@ -93,22 +93,15 @@ export const EarningCard = ({
9393
onRefreshPress?.();
9494
};
9595

96-
// Handler for claiming tokens
97-
const handleClaimTokens = async () => {
96+
// Handler for opening claim web portal
97+
const handleOpenClaimPortal = async () => {
9898
try {
99-
await claimTokens();
100-
queueToast({
101-
type: 'success',
102-
title: t('earningCard.rewardsClaimed'),
103-
message: t('earningCard.rewardsClaimedMessage', { amount: formattedTotalUnclaimed }),
104-
});
105-
// Refresh balance after claiming
106-
refreshBalance();
99+
await Linking.openURL('https://claim-web.fula.network');
107100
} catch (error: any) {
108101
queueToast({
109102
type: 'error',
110103
title: t('earningCard.claimFailed'),
111-
message: typeof error === 'object' && 'message' in error ? error.message : t('earningCard.claimFailedMessage'),
104+
message: 'Unable to open claim portal',
112105
});
113106
}
114107
};
@@ -188,13 +181,12 @@ export const EarningCard = ({
188181
</FxCard.Row.Data>
189182
</FxCard.Row>
190183

191-
{canClaim && (
184+
{(account || manualSignatureWalletAddress) && (
192185
<FxBox marginTop="12">
193186
<FxButton
194-
onPress={handleClaimTokens}
195-
disabled={claimableLoading || !canClaim}
187+
onPress={handleOpenClaimPortal}
196188
>
197-
{claimableLoading ? t('earningCard.claiming') : t('earningCard.claimRewards')}
189+
{t('earningCard.claimRewards')}
198190
</FxButton>
199191
</FxBox>
200192
)}

apps/box/src/hooks/useClaimableTokens.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ export const useClaimableTokens = () => {
4141
});
4242

4343
// Determine effective account (MetaMask or manual signature)
44-
const effectiveAccount = connectedAccount || manualSignatureWalletAddress;
44+
// When MetaMask is ready, use connectedAccount. Otherwise use manual signature as fallback.
45+
const effectiveAccount = isReady ? connectedAccount : (connectedAccount || manualSignatureWalletAddress);
4546
const useReadOnlyService = !isReady && !!manualSignatureWalletAddress;
4647

4748
const fetchClaimableTokens = useCallback(async () => {
@@ -165,9 +166,14 @@ export const useClaimableTokens = () => {
165166
console.error('Error fetching claimable rewards:', error);
166167

167168
let errorMessage = 'Failed to fetch claimable rewards';
168-
169-
// Handle specific network errors
170-
if (error.message?.includes('underlying network changed')) {
169+
let shouldShowError = true;
170+
171+
// Handle specific errors
172+
if (error.message?.includes('NotPoolMember') || error.errorName === 'NotPoolMember') {
173+
// User is not a member of the pool - show 0 rewards without error
174+
console.log('⚠️ Account is not a member of the pool, showing 0 rewards');
175+
shouldShowError = false;
176+
} else if (error.message?.includes('underlying network changed')) {
171177
errorMessage = 'Network changed during operation. Please refresh and try again.';
172178
} else if (error.message?.includes('timeout')) {
173179
errorMessage = 'Request timed out. Please try again.';
@@ -184,7 +190,7 @@ export const useClaimableTokens = () => {
184190
lastClaimedTimestamp: 0,
185191
timeSinceLastClaim: 0,
186192
loading: false,
187-
error: errorMessage,
193+
error: shouldShowError ? errorMessage : null,
188194
canClaim: false,
189195
});
190196
}

apps/box/src/hooks/usePoolsWithFallback.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export const usePoolsWithFallback = () => {
5959

6060
// Determine which account to use and which service to use
6161
const effectiveAccount = metamaskAccount || manualSignatureWalletAddress;
62-
const useReadOnlyService = !connected && !!manualSignatureWalletAddress;
62+
// Use read-only service when MetaMask account is not available but manual signature wallet is
63+
const useReadOnlyService = !metamaskAccount && !!manualSignatureWalletAddress;
6364

6465
console.log('usePoolsWithFallback state:', {
6566
hasHydrated,

apps/box/src/hooks/useTasksLogic.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { useState, useEffect, useCallback } from 'react';
22
import { useNavigation } from '@react-navigation/native';
33
import { useTranslation } from 'react-i18next';
4-
import { usePools } from './usePools';
4+
import { usePoolsWithFallback } from './usePoolsWithFallback';
55
import { useWalletConnection } from './useWalletConnection';
6+
import { useUserProfileStore } from '../stores/useUserProfileStore';
67
import { Routes } from '../navigation/navigationConfig';
78

89
export interface Task {
@@ -23,8 +24,11 @@ export interface TasksState {
2324
export const useTasksLogic = () => {
2425
const { t } = useTranslation('tasks');
2526
const navigation = useNavigation();
26-
const { userIsMemberOfAnyPool, userActiveRequests } = usePools();
27+
const { userIsMemberOfAnyPool, userActiveRequests } = usePoolsWithFallback();
2728
const { connected, connectWallet } = useWalletConnection();
29+
const manualSignatureWalletAddress = useUserProfileStore(
30+
(state) => state.manualSignatureWalletAddress
31+
);
2832

2933
const [state, setState] = useState<TasksState>({
3034
tasks: [],
@@ -46,20 +50,23 @@ export const useTasksLogic = () => {
4650
userActiveRequests.length > 0 &&
4751
userActiveRequests[0] !== '0';
4852

53+
// Determine if wallet is connected (either MetaMask or manual signature)
54+
const hasWallet = connected || !!manualSignatureWalletAddress;
55+
4956
// Generate tasks based on current state
5057
const generateTasks = useCallback((): Task[] => {
5158
const tasks: Task[] = [
5259
{
5360
id: 'connect-wallet',
5461
title: t('connectWallet'),
55-
route: connected ? undefined : connectWallet,
56-
isCompleted: connected,
62+
route: hasWallet ? undefined : connectWallet,
63+
isCompleted: hasWallet,
5764
},
5865
{
5966
id: 'join-pool',
6067
title: hasPendingRequest ? t('joinPoolPending') : t('joinPool'),
6168
route:
62-
connected && !userIsMemberOfAnyPool && !hasPendingRequest
69+
hasWallet && !userIsMemberOfAnyPool && !hasPendingRequest
6370
? handleNavigateToPools
6471
: undefined,
6572
isCompleted: userIsMemberOfAnyPool,
@@ -70,7 +77,7 @@ export const useTasksLogic = () => {
7077
return tasks;
7178
}, [
7279
t,
73-
connected,
80+
hasWallet,
7481
userIsMemberOfAnyPool,
7582
hasPendingRequest,
7683
connectWallet,

apps/box/src/screens/Blox/Blox.screen.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ export const BloxScreen = () => {
492492
ref={bloxInfoBottomSheetRef}
493493
bloxInfo={bloxs[currentBloxPeerId]}
494494
onBloxRemovePress={handleOnBloxRemovePress}
495-
onRestToHotspotPress={handleOnResetToHotspotPress}
495+
onResetToHotspotPress={handleOnResetToHotspotPress}
496496
onRebootBloxPress={handleOnRebootBloxPress}
497497
onClearCachePress={handleOnClearCachePress}
498498
resetingBloxHotspot={resetingBloxHotspot}

apps/box/src/screens/InitialSetup/LinkPassword.screen.tsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -451,23 +451,20 @@ export const LinkPasswordScreen = () => {
451451
<>
452452
<FxButton
453453
size="large"
454-
disabled={!passwordInput || !iKnow || !metamaskOpen}
454+
disabled={!passwordInput || !iKnow || !metamaskOpen || !provider}
455455
onPress={
456-
provider
457-
? linking
458-
? disconnectWallet
459-
: handleLinkPassword
460-
: () => {}
456+
linking
457+
? disconnectWallet
458+
: handleLinkPassword
461459
}
462460
>
463-
{provider ? (
464-
linking ? (
465-
t('linkPassword.cancel')
466-
) : (
467-
t('linkPassword.signWithMetamask')
468-
)
461+
{linking ? (
462+
<>
463+
<ActivityIndicator />
464+
<FxText marginLeft="8">{t('linkPassword.cancel')}</FxText>
465+
</>
469466
) : (
470-
<ActivityIndicator />
467+
t('linkPassword.signWithMetamask')
471468
)}
472469
</FxButton>
473470
<FxSpacer height={10} />

apps/box/src/screens/Settings/ChainSelection.screen.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react';
2-
import { Alert } from 'react-native';
2+
import { Alert, ScrollView } from 'react-native';
33
import { useWalletConnection } from '../../hooks/useWalletConnection';
44
import { useContractIntegration } from '../../hooks/useContractIntegration';
55
import { useSDK } from '@metamask/sdk-react';
@@ -134,8 +134,9 @@ export const ChainSelectionScreen = () => {
134134

135135
return (
136136
<FxSafeAreaBox flex={1} edges={['top']}>
137-
<FxBox paddingHorizontal="20" paddingVertical="12">
138-
<FxHeader title="Chain Selection" />
137+
<ScrollView contentContainerStyle={{ flexGrow: 1 }} showsVerticalScrollIndicator={true}>
138+
<FxBox paddingHorizontal="20" paddingVertical="12">
139+
<FxHeader title="Chain Selection" />
139140

140141
{/* Wallet Connect/Disconnect Button */}
141142
<FxBox marginTop="16" marginBottom="8" flexDirection="row" alignItems="center">
@@ -153,6 +154,10 @@ export const ChainSelectionScreen = () => {
153154
{account}
154155
</FxText>
155156
</>
157+
) : manualSignatureWalletAddress ? (
158+
<FxText variant="bodyXSRegular" color="content2">
159+
Manual wallet stored
160+
</FxText>
156161
) : (
157162
<FxButton
158163
onPress={connectWallet}
@@ -175,7 +180,7 @@ export const ChainSelectionScreen = () => {
175180
<FxText variant="bodyMediumRegular">
176181
Wallet Account
177182
</FxText>
178-
{!connected && (
183+
{!account && (
179184
<FxButton
180185
variant="inverted"
181186
onPress={() => setIsEditingWalletAddress(!isEditingWalletAddress)}
@@ -186,7 +191,7 @@ export const ChainSelectionScreen = () => {
186191
</FxBox>
187192

188193
{/* Display Mode - MetaMask Connected (Read-only) */}
189-
{connected && account && (
194+
{account && (
190195
<FxBox>
191196
<FxText variant="bodyXSRegular" color="content2" marginBottom="4">
192197
Connected via MetaMask
@@ -198,7 +203,7 @@ export const ChainSelectionScreen = () => {
198203
)}
199204

200205
{/* Display Mode - Manual Signature Stored (Read-only) */}
201-
{!connected && manualSignatureWalletAddress && !isEditingWalletAddress && (
206+
{!account && manualSignatureWalletAddress && !isEditingWalletAddress && (
202207
<FxBox>
203208
<FxText variant="bodyXSRegular" color="content2" marginBottom="4">
204209
Manual Signature Wallet
@@ -210,7 +215,7 @@ export const ChainSelectionScreen = () => {
210215
)}
211216

212217
{/* Display Mode - No Account */}
213-
{!connected && !manualSignatureWalletAddress && !isEditingWalletAddress && (
218+
{!account && !manualSignatureWalletAddress && !isEditingWalletAddress && (
214219
<FxBox>
215220
<FxText variant="bodyXSRegular" color="content2">
216221
No wallet connected. Connect MetaMask or enter a wallet address manually.
@@ -219,7 +224,7 @@ export const ChainSelectionScreen = () => {
219224
)}
220225

221226
{/* Edit Mode - Manual Wallet Address Input */}
222-
{!connected && isEditingWalletAddress && (
227+
{!account && isEditingWalletAddress && (
223228
<FxBox>
224229
<FxTextInput
225230
placeholder="0x..."
@@ -398,7 +403,8 @@ export const ChainSelectionScreen = () => {
398403
</FxText>
399404
</FxBox>
400405
</FxBox>
401-
</FxBox>
406+
</FxBox>
407+
</ScrollView>
402408
</FxSafeAreaBox>
403409
);
404410
};

0 commit comments

Comments
 (0)