Skip to content

Commit

Permalink
Merge branch 'master' into feat/onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron authored Sep 2, 2024
2 parents e55c162 + 90c773f commit e0b0e39
Show file tree
Hide file tree
Showing 31 changed files with 344 additions and 217 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PR build
on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: 17
distribution: "temurin"

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: 🏗 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: 📦 Install dependencies
run: yarn install

- name: 🚀 Build app
run: eas build --non-interactive --platform android --local --profile production_apk --output=./app-release.apk

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: alby-go-android.apk
path: ./app-release.apk
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release tag

on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
draft_release:
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
id: ${{ steps.create_release.outputs.id }}
steps:
# Create Release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
# prerelease: true

build_android:
needs: [draft_release]
runs-on: ubuntu-latest
steps:
- name: 🏗 Setup repo
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v2
with:
java-version: 17
distribution: "temurin"

- name: 🏗 Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: 🏗 Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: 📦 Install dependencies
run: yarn install

- name: 🚀 Build app
run: eas build --non-interactive --platform android --local --profile production_apk --output=./app-release.apk

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: alby-go-android.apk
path: ./app-release.apk

# APK
- name: Upload APK to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: ./app-release.apk
asset_name: alby-go-${{ github.ref_name }}-android.apk
asset_content_type: application/vnd.android.package-archive

# publish-release:
# needs: [release, build_android]
# runs-on: ubuntu-latest
#
# steps:
# - uses: eregon/publish-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# release_id: ${{ needs.release.outputs.id }}
#
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Alby Mobile
# Alby Go

A simple lightning mobile wallet interface that works great with [Alby Hub](https://albyhub.com)

Expand Down
4 changes: 2 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"expo": {
"name": "Alby Mobile",
"name": "Alby Go",
"slug": "alby-mobile",
"version": "1.3.0",
"scheme": [
Expand All @@ -23,7 +23,7 @@
[
"expo-camera",
{
"cameraPermission": "Allow Alby Mobile to use the camera to scan wallet connection and payment QR codes",
"cameraPermission": "Allow Alby Go to use the camera to scan wallet connection and payment QR codes",
"recordAudioAndroid": false
}
],
Expand Down
21 changes: 21 additions & 0 deletions components/Screen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Stack } from "expo-router";
import { StackAnimationTypes } from "react-native-screens";
import { HeaderButtonProps } from "@react-navigation/native-stack/src/types";

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

function Screen({ title, animation, right }: ScreenProps) {
return <Stack.Screen
options={{
title,
animation,
headerRight: right ? right : undefined,
headerShadowVisible: false,
}} />;
}

export default Screen;
16 changes: 0 additions & 16 deletions components/icons/AppIcon.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions components/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { TextClassContext } from "~/components/ui/text";
import { cn } from "~/lib/utils";

const buttonVariants = cva(
"group flex items-center justify-center rounded-md web:ring-offset-background web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2",
"group flex items-center justify-center rounded-lg web:ring-offset-background web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2",
{
variants: {
variant: {
Expand All @@ -22,7 +22,7 @@ const buttonVariants = cva(
size: {
default: "min-h-10 px-4 py-2 native:min-h-12 native:px-5 native:py-3",
sm: "min-h-9 rounded-md px-3",
lg: "min-h-11 rounded-md px-8 native:min-h-16",
lg: "min-h-11 rounded-lg px-8 native:min-h-16",
icon: "min-h-10 min-w-10",
},
},
Expand Down
7 changes: 6 additions & 1 deletion eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
"preview": {
"distribution": "internal"
},
"production": {}
"production": {},
"production_apk": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
Expand Down
8 changes: 5 additions & 3 deletions hooks/useGetFiatAmount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,24 @@ export function useGetFiatAmount() {
return `${new Intl.NumberFormat(undefined, {
style: "currency",
currency: fiatCurrency,
currencyDisplay: "narrowSymbol",
}).format(rate * amount)}`;
}

const amountWithCurrencyCode = new Intl.NumberFormat("en-US", {
style: "currency",
currency: fiatCurrency,
currencyDisplay: "code",
}).format(rate * amount);

return amountWithCurrencyCode.substring(
amountWithCurrencyCode.search(/\s/) + 1
amountWithCurrencyCode.search(/\s/) + 1,
);
}
return undefined;
},

[rate, fiatCurrency]
[rate, fiatCurrency],
);

return rate ? getFiatAmount : undefined;
Expand All @@ -65,7 +67,7 @@ export function useGetSatsAmount() {

const getSatsAmount = React.useCallback(
(fiatAmount: number) => (rate ? Math.round(fiatAmount / rate) : undefined),
[rate, fiatCurrency]
[rate, fiatCurrency],
);

return rate ? getSatsAmount : undefined;
Expand Down
4 changes: 2 additions & 2 deletions lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const NAV_THEME = {
light: {
background: "hsl(0 0% 100%)", // background
background: "hsl(210 20% 98%)", // background
border: "hsl(240 5.9% 90%)", // border
card: "hsl(0 0% 100%)", // card
card: "hsl(210 20% 98%)", // card
notification: "hsl(0 84.2% 60.2%)", // destructive
primary: "hsl(240 5.9% 10%)", // primary
text: "hsl(240 10% 3.9%)", // foreground
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "alby-mobile",
"name": "alby-go",
"version": "1.3.0",
"main": "expo-router/entry",
"scripts": {
Expand All @@ -17,7 +17,7 @@
},
"dependencies": {
"@getalby/lightning-tools": "^5.0.3",
"@getalby/sdk": "^3.6.1",
"@getalby/sdk": "^3.7.0",
"@react-native-async-storage/async-storage": "1.23.1",
"bech32": "^2.0.0",
"buffer": "^6.0.3",
Expand Down
51 changes: 21 additions & 30 deletions pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { View, Image, Pressable, StyleSheet } from "react-native";
import { View, Pressable, StyleSheet } from "react-native";
import React, { useState } from "react";
import { useBalance } from "hooks/useBalance";
import { useAppStore } from "lib/state/appStore";
import { WalletConnection } from "~/pages/settings/wallets/WalletConnection";
import {
Link,
router,
Stack,
useFocusEffect,
useRootNavigationState,
router, useFocusEffect,
useRootNavigationState
} from "expo-router";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
Expand All @@ -22,6 +20,7 @@ import LargeArrowUp from "~/components/icons/LargeArrowUp";
import LargeArrowDown from "~/components/icons/LargeArrowDown";
import { SvgProps } from "react-native-svg";
import { Button } from "~/components/ui/button";
import Screen from "~/components/Screen";

dayjs.extend(relativeTime);

Expand Down Expand Up @@ -69,23 +68,15 @@ export function Home() {

return (
<>
<Stack.Screen
options={{
title: "Home",
headerTitle: () => (
<Image
className="w-12 h-12"
source={require("../assets/adaptive-icon.png")}
/>
),
headerRight: () => (
<Link href="/settings" asChild className="absolute -right-4">
<Button variant="link">
<Settings2 className="text-foreground" />
</Button>
</Link>
),
}}
<Screen
title=""
right={() =>
<Link href="/settings" asChild className="absolute -right-4">
<Button variant="link">
<Settings2 className="text-foreground" />
</Button>
</Link>
}
/>
<View className="h-full flex">
<View className="grow flex flex-col items-center justify-center gap-4">
Expand All @@ -95,8 +86,8 @@ export function Home() {
style={{
...(pressed
? {
transform: "scale(0.98)",
}
transform: "scale(0.98)",
}
: []),
}}
onPress={switchBalanceState}
Expand All @@ -115,7 +106,7 @@ export function Home() {
getFiatAmount(Math.floor(balance.balance / 1000))}
{balanceState == BalanceState.HIDDEN && "****"}
</Text>
<Text className="text-muted-foreground text-3xl font-bold2">
<Text className="text-muted-foreground text-3xl font-semibold2">
{balanceState == BalanceState.SATS && "sats"}
</Text>
</>
Expand All @@ -140,10 +131,10 @@ export function Home() {
</View>
</Pressable>
</View>
<View className="flex items-center justify-center my-5">
<View className="flex items-center justify-center">
<Link href="/transactions" asChild>
<Button variant="ghost" className="p-10 rounded-full aspect-square">
<ChevronUp className="text-foreground" size={32} />
<ChevronUp className="text-muted-foreground" size={32} />
</Button>
</Link>
</View>
Expand Down Expand Up @@ -185,14 +176,14 @@ function MainButton({
style={{
flex: 1,
padding: 6,
borderRadius: 15,
borderRadius: 24,
elevation: 2,
justifyContent: "center",
alignItems: "center",
...(pressed
? {
transform: "scale(0.98)",
}
transform: "scale(0.98)",
}
: {}),
}}
>
Expand Down
Loading

0 comments on commit e0b0e39

Please sign in to comment.