Skip to content

Commit

Permalink
Merge branch 'master' into task-receive-cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya committed Feb 7, 2025
2 parents ba71ff6 + 8f197b0 commit 0197c75
Show file tree
Hide file tree
Showing 35 changed files with 2,143 additions and 504 deletions.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ yarn-error.*
# typescript
*.tsbuildinfo

android
ios
/ios
/android

google-services.json
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@ A simple lightning mobile wallet interface that works great with [Alby Hub](http
`yarn install`

`yarn start`

### Notifications

Push notifications are only available when running the app on a **physical device** using the following commands:

For iOS:

`yarn ios:device`

For Android:

`yarn android:device`

**Note:** Notifications do not work in the Expo Go app. You must run the app on a standalone build or a device using the above commands.
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

1. Update version in

- `app.json`
- `app.config.js`
- `package.json`

2. Create a git tag and push it (a new draft release will be created)
Expand Down
108 changes: 108 additions & 0 deletions app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import withMessagingServicePlugin from "./plugins/android/withMessageServicePlugin";
import withOpenSSLPlugin from "./plugins/ios/withOpenSSLPlugin";

export default ({ config }) => {
return {
...config,
name: "Alby Go",
slug: "alby-mobile",
version: "1.8.1",
scheme: ["lightning", "bitcoin", "alby", "nostr+walletconnect"],
orientation: "portrait",
icon: "./assets/icon.png",
userInterfaceStyle: "automatic",
newArchEnabled: true,
assetBundlePatterns: ["**/*"],
plugins: [
[
withMessagingServicePlugin,
{
androidFMSFilePath: "./assets/android/MessagingService.kt",
},
],
[withOpenSSLPlugin],
[
"expo-notification-service-extension-plugin",
{
mode: "production",
iosNSEFilePath: "./assets/ios/NotificationService.m",
},
],
[
"expo-splash-screen",
{
backgroundColor: "#0B0930",
image: "./assets/icon.png",
imageWidth: "150",
},
],
[
"expo-local-authentication",
{
faceIDPermission: "Allow Alby Go to use Face ID.",
},
],
[
"expo-camera",
{
cameraPermission:
"Allow Alby Go to use the camera to scan wallet connection and payment QR codes",
recordAudioAndroid: false,
},
],
[
"expo-font",
{
fonts: [
"./assets/fonts/OpenRunde-Regular.otf",
"./assets/fonts/OpenRunde-Medium.otf",
"./assets/fonts/OpenRunde-Semibold.otf",
"./assets/fonts/OpenRunde-Bold.otf",
],
},
],
[
"expo-notifications",
{
icon: "./assets/notification.png",
},
],
"expo-router",
"expo-secure-store",
],
ios: {
supportsTablet: true,
bundleIdentifier: "com.getalby.mobile",
config: {
usesNonExemptEncryption: false,
},
infoPlist: {
LSMinimumSystemVersion: "12.0",
UIBackgroundModes: ["remote-notification"],
},
userInterfaceStyle: "automatic",
},
android: {
package: "com.getalby.mobile",
icon: "./assets/icon.png",
adaptiveIcon: {
foregroundImage: "./assets/adaptive-icon.png",
backgroundImage: "./assets/adaptive-icon-bg.png",
monochromeImage: "./assets/monochromatic.png",
},
permissions: [
"android.permission.CAMERA",
"android.permission.USE_BIOMETRIC",
"android.permission.USE_FINGERPRINT",
],
userInterfaceStyle: "automatic",
googleServicesFile: process.env.GOOGLE_SERVICES_JSON,
},
extra: {
eas: {
projectId: "294965ec-3a67-4994-8794-5cc1117ef155",
},
},
owner: "roland_alby",
};
};
81 changes: 0 additions & 81 deletions app.json

This file was deleted.

5 changes: 5 additions & 0 deletions app/(app)/settings/notifications.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Notifications } from "../../../pages/settings/Notifications";

export default function Page() {
return <Notifications />;
}
59 changes: 38 additions & 21 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ import { SafeAreaView } from "react-native-safe-area-context";
import Toast from "react-native-toast-message";
import { SWRConfig } from "swr";
import { toastConfig } from "~/components/ToastConfig";
import { NotificationProvider } from "~/context/Notification";
import { UserInactivityProvider } from "~/context/UserInactivity";
import "~/global.css";
import { useInfo } from "~/hooks/useInfo";
import { SessionProvider } from "~/hooks/useSession";
import { NAV_THEME } from "~/lib/constants";
import { IS_EXPO_GO, NAV_THEME } from "~/lib/constants";
import { isBiometricSupported } from "~/lib/isBiometricSupported";
import { useAppStore } from "~/lib/state/appStore";
import { useColorScheme } from "~/lib/useColorScheme";
import { registerForPushNotificationsAsync } from "~/services/Notifications";

const LIGHT_THEME: Theme = {
...DefaultTheme,
Expand Down Expand Up @@ -67,6 +69,16 @@ export default function RootLayout() {
}
}

// TODO: Do not prompt the user at all if FCM is disabled
async function checkAndPromptForNotifications() {
const isEnabled = useAppStore.getState().isNotificationsEnabled;
// prompt the user to enable notifications on first open
if (isEnabled === null) {
const enabled = await registerForPushNotificationsAsync();
useAppStore.getState().setNotificationsEnabled(enabled);
}
}

const loadTheme = React.useCallback((): Promise<void> => {
return new Promise((resolve) => {
const theme = useAppStore.getState().theme;
Expand All @@ -85,6 +97,9 @@ export default function RootLayout() {
await Promise.all([loadTheme(), loadFonts(), checkBiometricStatus()]);
} finally {
setResourcesLoaded(true);
if (!IS_EXPO_GO) {
await checkAndPromptForNotifications();
}
SplashScreen.hide();
}
};
Expand All @@ -98,26 +113,28 @@ export default function RootLayout() {

return (
<SWRConfig value={swrConfiguration}>
<ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
<StatusBar style={isDarkColorScheme ? "light" : "dark"} />
<SafeAreaView
className="w-full h-full bg-background"
edges={["left", "right", "bottom"]}
>
<UserInactivityProvider>
<SessionProvider>
<Slot />
</SessionProvider>
</UserInactivityProvider>
<Toast
config={toastConfig}
position="bottom"
bottomOffset={140}
topOffset={140}
/>
<PortalHost />
</SafeAreaView>
</ThemeProvider>
<NotificationProvider>
<ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
<StatusBar style={isDarkColorScheme ? "light" : "dark"} />
<SafeAreaView
className="w-full h-full bg-background"
edges={["left", "right", "bottom"]}
>
<UserInactivityProvider>
<SessionProvider>
<Slot />
</SessionProvider>
</UserInactivityProvider>
<Toast
config={toastConfig}
position="bottom"
bottomOffset={140}
topOffset={140}
/>
<PortalHost />
</SafeAreaView>
</ThemeProvider>
</NotificationProvider>
</SWRConfig>
);
}
Expand Down
Loading

0 comments on commit 0197c75

Please sign in to comment.