Skip to content
Merged
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
191 changes: 177 additions & 14 deletions android/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ import WalletManagerScreen from "./screens/WalletManagerScreen";
import WalletSettingsScreen from "./screens/WalletSettingsScreen";
import AddressSelectorScreen from "./screens/AddressSelectorScreen";
import LedgerConnectionScreen from "./screens/LedgerConnectionScreen";
import Toast from "react-native-toast-message";

// Network configurations
const API_SERVER = "http://162.250.126.66:4000";
Expand Down Expand Up @@ -309,7 +310,8 @@ function AppContent() {

const [wallets, setWallets] = useState([]);
const [selectedWallet, setSelectedWallet] = useState(null);
const [selectedAddressFromSelector, setSelectedAddressFromSelector] = useState("");
const [selectedAddressFromSelector, setSelectedAddressFromSelector] =
useState("");
const [accounts, setAccounts] = useState(MOCK_ACCOUNTS);
const [selectedAccount, setSelectedAccount] = useState(MOCK_ACCOUNTS[0]);
const [balance, setBalance] = useState("0");
Expand Down Expand Up @@ -1111,7 +1113,12 @@ function AppContent() {
});
}

Alert.alert("Success", "Wallet deleted successfully");
Toast.show({
type: "success",
text1: "Success",
text2: "Wallet deleted successfully",
position: "bottom",
});
},
},
]
Expand Down Expand Up @@ -1215,37 +1222,66 @@ function AppContent() {
console.log("📋 selectedWallet.address:", selectedWallet?.address);
console.log("📋 selectedWallet.publicKey:", selectedWallet?.publicKey);
Clipboard.setString(text);
Alert.alert("Copied", "Address copied to clipboard");
Toast.show({
type: "success",
text1: "Copied",
text2: "Address copied to clipboard",
position: "bottom",
});
};

const handleSendSubmit = async () => {
const handleSendSubmit = async (amount, address) => {
// Dismiss keyboard when Send button is pressed
Keyboard.dismiss();

if (!selectedWallet) {
Alert.alert("Error", "No wallet selected");
Toast.show({
type: "error",
text1: "Error",
text2: "No wallet selected",
position: "bottom",
});
return;
}
if (!sendAddress || !sendAmount) {
Alert.alert("Error", "Please enter both address and amount");
if (!address || !amount) {
Toast.show({
type: "error",
text1: "Error",
text2: "Please enter both address and amount",
position: "bottom",
});
return;
}

// Store values in state for confirmation screen
setSendAmount(amount);
setSendAddress(address);

// Trim the address to remove any whitespace
const trimmedAddress = sendAddress.trim();
const trimmedAddress = address.trim();

// Validate address format
try {
new PublicKey(trimmedAddress);
} catch (e) {
Alert.alert("Error", "Invalid recipient address");
Toast.show({
type: "error",
text1: "Error",
text2: "Invalid recipient address",
position: "bottom",
});
return;
}

// Validate amount
const amountNum = parseFloat(sendAmount);
const amountNum = parseFloat(amount);
if (isNaN(amountNum) || amountNum <= 0) {
Alert.alert("Error", "Invalid amount");
Toast.show({
type: "error",
text1: "Error",
text2: "Invalid amount",
position: "bottom",
});
return;
}

Expand Down Expand Up @@ -1428,15 +1464,30 @@ function AppContent() {
};

const handleSwap = () => {
Alert.alert("Swap", "Swap functionality would open here");
Toast.show({
type: "info",
text1: "Swap",
text2: "Swap functionality would open here",
position: "bottom",
});
};

const handleStake = () => {
Alert.alert("Stake", "Stake functionality would open here");
Toast.show({
type: "info",
text1: "Stake",
text2: "Stake functionality would open here",
position: "bottom",
});
};

const handleBridge = () => {
Alert.alert("Bridge", "Bridge functionality would open here");
Toast.show({
type: "info",
text1: "Bridge",
text2: "Bridge functionality would open here",
position: "bottom",
});
};

const copyAddress = () => {
Expand Down Expand Up @@ -4687,6 +4738,118 @@ function AppContent() {
</View>
</View>
</TrueSheet>

{/* Toast notifications */}
<Toast
bottomOffset={80}
config={{
success: (props) => (
<View
style={{
backgroundColor: "#1a1a1a",
borderLeftColor: "#4CAF50",
borderLeftWidth: 6,
borderRadius: 12,
paddingVertical: 18,
paddingHorizontal: 20,
marginHorizontal: 20,
marginBottom: 8,
shadowColor: "#000",
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.3,
shadowRadius: 8,
elevation: 8,
}}
>
<Text
style={{
color: "#FFFFFF",
fontSize: 14,
fontWeight: "600",
marginBottom: 6,
}}
>
{props.text1}
</Text>
<Text
style={{ color: "#CCCCCC", fontSize: 12, lineHeight: 18 }}
>
{props.text2}
</Text>
</View>
),
error: (props) => (
<View
style={{
backgroundColor: "#1a1a1a",
borderLeftColor: "#F44336",
borderLeftWidth: 6,
borderRadius: 12,
paddingVertical: 18,
paddingHorizontal: 20,
marginHorizontal: 20,
marginBottom: 8,
shadowColor: "#000",
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.3,
shadowRadius: 8,
elevation: 8,
}}
>
<Text
style={{
color: "#FFFFFF",
fontSize: 14,
fontWeight: "600",
marginBottom: 6,
}}
>
{props.text1}
</Text>
<Text
style={{ color: "#CCCCCC", fontSize: 12, lineHeight: 18 }}
>
{props.text2}
</Text>
</View>
),
info: (props) => (
<View
style={{
backgroundColor: "#1a1a1a",
borderLeftColor: "#2196F3",
borderLeftWidth: 6,
borderRadius: 12,
paddingVertical: 18,
paddingHorizontal: 20,
marginHorizontal: 20,
marginBottom: 8,
shadowColor: "#000",
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.3,
shadowRadius: 8,
elevation: 8,
}}
>
<Text
style={{
color: "#FFFFFF",
fontSize: 14,
fontWeight: "600",
marginBottom: 6,
}}
>
{props.text1}
</Text>
<Text
style={{ color: "#CCCCCC", fontSize: 12, lineHeight: 18 }}
>
{props.text2}
</Text>
</View>
),
}}
/>
</GestureHandlerRootView>

{/* Settings - Full Page - Outside GestureHandler */}
Expand Down
2 changes: 1 addition & 1 deletion android/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<data android:scheme="https"/>
</intent>
</queries>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false">
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false" android:usesCleartextTraffic="true">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
Expand Down