Skip to content

Commit

Permalink
Merge branch 'master' into task-max-min
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Dec 12, 2024
2 parents 95da9dc + fe9dbaf commit b4863fd
Show file tree
Hide file tree
Showing 33 changed files with 2,657 additions and 3,566 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ yarn-error.*

# typescript
*.tsbuildinfo

android
ios
13 changes: 9 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"expo": {
"name": "Alby Go",
"slug": "alby-mobile",
"version": "1.7.1",
"scheme": ["bitcoin", "lightning", "alby"],
"version": "1.7.2",
"scheme": ["lightning", "bitcoin", "alby"],
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "cover",
"backgroundColor": "#0F0C40"
"backgroundColor": "#0B0930"
},
"newArchEnabled": true,
"assetBundlePatterns": ["**/*"],
"plugins": [
[
Expand Down Expand Up @@ -46,14 +47,18 @@
"bundleIdentifier": "com.getalby.mobile",
"config": {
"usesNonExemptEncryption": false
},
"infoPlist": {
"LSMinimumSystemVersion": "12.0"
}
},
"android": {
"package": "com.getalby.mobile",
"icon": "./assets/icon.png",
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundImage": "./assets/adaptive-icon-bg.png"
"backgroundImage": "./assets/adaptive-icon-bg.png",
"monochromeImage": "./assets/monochromatic.png"
},
"permissions": ["android.permission.CAMERA"]
},
Expand Down
4 changes: 2 additions & 2 deletions app/(app)/settings/wallets/[id]/lightning-address.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LightningAddress } from "../../../../../pages/settings/wallets/LightningAddress";
import { SetLightningAddress } from "../../../../../pages/settings/wallets/LightningAddress";

export default function Page() {
return <LightningAddress />;
return <SetLightningAddress />;
}
13 changes: 8 additions & 5 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Theme, ThemeProvider } from "@react-navigation/native";
import {
DarkTheme,
DefaultTheme,
Theme,
ThemeProvider,
} from "@react-navigation/native";
import { PortalHost } from "@rn-primitives/portal";
import * as Font from "expo-font";
import { Slot, SplashScreen } from "expo-router";
Expand All @@ -7,7 +12,6 @@ import { swrConfiguration } from "lib/swr";
import * as React from "react";
import { SafeAreaView } from "react-native";
import Toast from "react-native-toast-message";
import PolyfillCrypto from "react-native-webview-crypto";
import { SWRConfig } from "swr";
import { toastConfig } from "~/components/ToastConfig";
import { UserInactivityProvider } from "~/context/UserInactivity";
Expand All @@ -20,11 +24,11 @@ import { useAppStore } from "~/lib/state/appStore";
import { useColorScheme } from "~/lib/useColorScheme";

const LIGHT_THEME: Theme = {
dark: false,
...DefaultTheme,
colors: NAV_THEME.light,
};
const DARK_THEME: Theme = {
dark: true,
...DarkTheme,
colors: NAV_THEME.dark,
};

Expand Down Expand Up @@ -91,7 +95,6 @@ export default function RootLayout() {
<SWRConfig value={swrConfiguration}>
<ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
<StatusBar style={isDarkColorScheme ? "light" : "dark"} />
<PolyfillCrypto />
<SafeAreaView className="w-full h-full bg-background">
<UserInactivityProvider>
<SessionProvider>
Expand Down
Binary file added assets/monochromatic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions components/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import {
RefreshCw,
Settings2,
Share2,
Trash2,
TriangleAlert,
UserCircle2,
Wallet2,
WalletIcon,
X,
Expand Down Expand Up @@ -95,6 +97,8 @@ interopIcon(CircleCheck);
interopIcon(TriangleAlert);
interopIcon(LogOut);
interopIcon(ArchiveRestore);
interopIcon(UserCircle2);
interopIcon(Trash2);

export {
AlertCircle,
Expand Down Expand Up @@ -131,7 +135,9 @@ export {
RefreshCw,
Settings2,
Share2,
Trash2,
TriangleAlert,
UserCircle2,
Wallet2,
WalletIcon,
X,
Expand Down
2 changes: 1 addition & 1 deletion components/QRCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function QRCode({ value }: { value: string }) {
style={{ borderRadius: 28, elevation: 2 }}
>
<View className="flex items-center justify-center p-3 rounded-3xl bg-white w-96 h-96">
<QRCodeLibrary value={value} size={300} />
<QRCodeLibrary value={value} size={300} ecl="H" />
</View>
</LinearGradient>
);
Expand Down
19 changes: 10 additions & 9 deletions components/QRCodeScanner.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useIsFocused } from "@react-navigation/native";
import { Camera } from "expo-camera";
import { PermissionStatus } from "expo-modules-core/src/PermissionsInterface";
import React, { useEffect } from "react";
Expand All @@ -16,6 +17,7 @@ function QRCodeScanner({
onScanned,
startScanning = true,
}: QRCodeScannerProps) {
const isFocused = useIsFocused();
const [isScanning, setScanning] = React.useState(startScanning);
const [isLoading, setLoading] = React.useState(false);
const [permissionStatus, setPermissionStatus] = React.useState(
Expand All @@ -41,14 +43,11 @@ function QRCodeScanner({
}

const handleScanned = (data: string) => {
setScanning((current) => {
if (current === true) {
console.info(`Bar code with data ${data} has been scanned!`);
onScanned(data);
return true;
}
return false;
});
if (isScanning) {
console.info(`Bar code with data ${data} has been scanned!`);
onScanned(data);
setScanning(false);
}
};

return (
Expand All @@ -75,7 +74,9 @@ function QRCodeScanner({
</Text>
</View>
)}
{isScanning && <FocusableCamera onScanned={handleScanned} />}
{isScanning && isFocused && (
<FocusableCamera onScanned={handleScanned} />
)}
</>
)}
</View>
Expand Down
4 changes: 2 additions & 2 deletions components/Screen.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { HeaderButtonProps } from "@react-navigation/native-stack/src/types";
import { NativeStackHeaderRightProps } from "@react-navigation/native-stack/src/types";
import { Stack } from "expo-router";
import { StackAnimationTypes } from "react-native-screens";

type ScreenProps = {
title: string;
right?: (props: HeaderButtonProps) => React.ReactNode;
right?: (props: NativeStackHeaderRightProps) => React.ReactNode;
animation?: StackAnimationTypes;
};

Expand Down
8 changes: 1 addition & 7 deletions components/ToastConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Link } from "expo-router";
import { View } from "react-native";
import { ToastConfig } from "react-native-toast-message";
import { useAppStore } from "~/lib/state/appStore";
import { CircleCheck, XCircle } from "./Icons";
import { Button } from "./ui/button";
import { Text } from "./ui/text";
Expand Down Expand Up @@ -35,18 +34,13 @@ export const toastConfig: ToastConfig = {
</View>
),
connectionError: ({ text1, text2, hide }) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const selectedWalletId = useAppStore((store) => store.selectedWalletId);
return (
<View className="bg-foreground rounded-xl px-6 py-3 mx-6 flex flex-col gap-2">
<View className="flex flex-row gap-2 justify-center items-center">
<XCircle className="text-background" width={16} height={16} />
<Text className="text-background font-semibold2">{text1}</Text>
</View>
<Link
href={`/settings/wallets/${selectedWalletId}/wallet-connection`}
asChild
>
<Link href={`/settings/wallets`} asChild>
<Button variant="secondary" size="sm">
<Text>Update Wallet Connection</Text>
</Button>
Expand Down
36 changes: 21 additions & 15 deletions components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { cva, type VariantProps } from "class-variance-authority";
import { LinearGradient } from "expo-linear-gradient";
import * as React from "react";
import { Pressable, StyleSheet, View } from "react-native";
import { Platform, Pressable, StyleSheet, View } from "react-native";
import { TextClassContext } from "~/components/ui/text";
import { cn } from "~/lib/utils";

Expand Down Expand Up @@ -77,7 +77,10 @@ const Button = React.forwardRef<
{!variant || variant === "default" ? (
<View
style={[
{ borderRadius: size === "lg" ? 16 : 4, elevation: 2 },
{
borderRadius: size === "lg" ? 16 : 4,
backgroundColor: "white",
},
shadows.small,
]}
>
Expand All @@ -104,10 +107,7 @@ const Button = React.forwardRef<
props.disabled && "opacity-50 web:pointer-events-none",
buttonVariants({ variant, size, className }),
)}
style={[
{ elevation: variant === "ghost" ? 0 : 2 },
variant === "ghost" ? undefined : shadows.small,
]}
style={[variant === "ghost" ? {} : shadows.small]}
ref={ref}
role="button"
{...props}
Expand All @@ -121,16 +121,22 @@ Button.displayName = "Button";
export { Button, buttonTextVariants, buttonVariants };
export type { ButtonProps };

// NOTE: only applies on iOS
const shadows = StyleSheet.create({
small: {
// TODO: check dark mode
shadowColor: "black",
shadowOpacity: 0.15,
shadowOffset: {
width: 0,
height: 2,
},
shadowRadius: 2,
...Platform.select({
// make sure bg color is applied to avoid RCTView errors
ios: {
shadowColor: "black",
shadowOpacity: 0.15,
shadowOffset: {
width: 0,
height: 2,
},
shadowRadius: 2,
},
android: {
elevation: 2,
},
}),
},
});
12 changes: 7 additions & 5 deletions components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Card = React.forwardRef<
<View
ref={ref}
className={cn(
"rounded-lg border border-border bg-card shadow-sm shadow-foreground/10",
"rounded-2xl border border-border bg-card shadow-sm shadow-foreground/10",
className,
)}
{...props}
Expand All @@ -25,7 +25,7 @@ const CardHeader = React.forwardRef<
>(({ className, ...props }, ref) => (
<View
ref={ref}
className={cn("flex flex-col space-y-1.5 p-6", className)}
className={cn("flex flex-col space-y-1.5 p-5", className)}
{...props}
/>
));
Expand All @@ -39,6 +39,8 @@ const CardTitle = React.forwardRef<
role="heading"
aria-level={3}
ref={ref}
numberOfLines={1}
ellipsizeMode="tail"
className={cn(
"text-xl text-card-foreground font-semibold2 leading-none tracking-tight",
className,
Expand All @@ -54,7 +56,7 @@ const CardDescription = React.forwardRef<
>(({ className, ...props }, ref) => (
<Text
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
className={cn("mt-1 text-sm text-muted-foreground", className)}
{...props}
/>
));
Expand All @@ -65,7 +67,7 @@ const CardContent = React.forwardRef<
React.ComponentPropsWithoutRef<typeof View>
>(({ className, ...props }, ref) => (
<TextClassContext.Provider value="text-card-foreground">
<View ref={ref} className={cn("p-6 pt-0", className)} {...props} />
<View ref={ref} className={cn("p-5", className)} {...props} />
</TextClassContext.Provider>
));
CardContent.displayName = "CardContent";
Expand All @@ -76,7 +78,7 @@ const CardFooter = React.forwardRef<
>(({ className, ...props }, ref) => (
<View
ref={ref}
className={cn("flex flex-row items-center p-6 pt-0", className)}
className={cn("flex flex-row items-center p-5", className)}
{...props}
/>
));
Expand Down
Loading

0 comments on commit b4863fd

Please sign in to comment.