Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add btc map #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default ({ config }) => {
icon: "./assets/notification.png",
},
],
"expo-location",
"expo-router",
"expo-secure-store",
],
Expand Down
5 changes: 5 additions & 0 deletions app/(app)/settings/bitcoin-map.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { BitcoinMap } from "../../../pages/settings/BitcoinMap";

export default function Page() {
return <BitcoinMap />;
}
3 changes: 3 additions & 0 deletions components/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
PopiconsNotificationSquareSolid as NotificationIcon,
PopiconsLifebuoySolid as OnboardingIcon,
PopiconsClipboardTextSolid as PasteIcon,
PopiconsPinSolid as PinIcon,
PopiconsReloadLine as RefreshIcon,
PopiconsReloadSolid as ResetIcon,
PopiconsSettingsMinimalSolid as SettingsIcon,
Expand Down Expand Up @@ -61,6 +62,7 @@ interopIcon(MoveUpIcon);
interopIcon(NotificationIcon);
interopIcon(OnboardingIcon);
interopIcon(PasteIcon);
interopIcon(PinIcon);
interopIcon(RefreshIcon);
interopIcon(ResetIcon);
interopIcon(SettingsIcon);
Expand Down Expand Up @@ -93,6 +95,7 @@ export {
NotificationIcon,
OnboardingIcon,
PasteIcon,
PinIcon,
RefreshIcon,
ResetIcon,
SettingsIcon,
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
"dependencies": {
"@alevy97/react-native-userdefaults": "^0.2.2",
"@getalby/expo-shared-preferences": "^0.0.1",
"@noble/curves": "^1.6.0",
"@getalby/lightning-tools": "^5.1.2",
"@getalby/sdk": "^3.9.0",
"@noble/curves": "^1.6.0",
"@popicons/react-native": "^0.0.20",
"@react-native-async-storage/async-storage": "1.23.1",
"@rn-primitives/dialog": "^1.0.3",
Expand All @@ -42,17 +42,18 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"dayjs": "^1.11.10",
"expo-device": "~6.0.2",
"expo-notification-service-extension-plugin": "^1.0.1",
"expo-notifications": "~0.29.11",
"expo": "~52.0.20",
"expo-camera": "~16.0.10",
"expo-clipboard": "~7.0.0",
"expo-constants": "~17.0.3",
"expo-device": "~6.0.2",
"expo-font": "~13.0.2",
"expo-linear-gradient": "~14.0.1",
"expo-linking": "~7.0.3",
"expo-local-authentication": "~15.0.1",
"expo-location": "~18.0.5",
"expo-notification-service-extension-plugin": "^1.0.1",
"expo-notifications": "~0.29.11",
"expo-router": "~4.0.15",
"expo-secure-store": "~14.0.0",
"expo-splash-screen": "^0.29.18",
Expand Down
53 changes: 53 additions & 0 deletions pages/settings/BitcoinMap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import * as Location from "expo-location";
import React from "react";
import { View } from "react-native";
import { WebView } from "react-native-webview";
import Loading from "~/components/Loading";
import Screen from "~/components/Screen";

import { Text } from "~/components/ui/text";
import { errorToast } from "~/lib/errorToast";

export function BitcoinMap() {
const [isLoading, setIsLoading] = React.useState(true);
const [mapUrl, setMapUrl] = React.useState("https://btcmap.org/map");

React.useEffect(() => {
(async () => {
try {
const { status } = await Location.requestForegroundPermissionsAsync();
if (status !== Location.PermissionStatus.GRANTED) {
throw new Error("Permission to access location was denied.");
}

const location = await Location.getCurrentPositionAsync({});
setMapUrl(
`https://btcmap.org/map#18/${location.coords.latitude}/${location.coords.longitude}`,
);
} catch (error) {
errorToast(error);
} finally {
setIsLoading(false);
}
})();
}, []);

return (
<View className="flex-1">
<Screen title="Bitcoin Map" />

{isLoading ? (
<View className="flex-1 justify-center items-center">
<Loading />
<Text className="mt-4">Loading BTC Map</Text>
</View>
) : (
<WebView
source={{ uri: mapUrl }}
className="flex-1 bg-blue-100"
geolocationEnabled
/>
)}
</View>
);
}
10 changes: 10 additions & 0 deletions pages/settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FingerprintIcon,
NotificationIcon,
OnboardingIcon,
PinIcon,
ResetIcon,
SignOutIcon,
ThemeIcon,
Expand Down Expand Up @@ -100,6 +101,15 @@ export function Settings() {
</Text>
</TouchableOpacity>

<Link href="/settings/bitcoin-map" asChild>
<TouchableOpacity className="flex flex-row gap-4">
<PinIcon className="text-muted-foreground" />
<Text className="text-foreground font-medium2 text-xl">
Bitcoin Map
</Text>
</TouchableOpacity>
</Link>

{developerMode && (
<>
<View className="mt-5 flex flex-col gap-6">
Expand Down
51 changes: 9 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -803,20 +803,7 @@
"@babel/parser" "^7.25.9"
"@babel/types" "^7.25.9"

"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3":
version "7.25.9"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84"
integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==
dependencies:
"@babel/code-frame" "^7.25.9"
"@babel/generator" "^7.25.9"
"@babel/parser" "^7.25.9"
"@babel/template" "^7.25.9"
"@babel/types" "^7.25.9"
debug "^4.3.1"
globals "^11.1.0"

"@babel/traverse@^7.23.0", "@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9":
"@babel/traverse--for-generate-function-map@npm:@babel/traverse@^7.25.3", "@babel/traverse@^7.23.0", "@babel/traverse@^7.25.3", "@babel/traverse@^7.25.9":
version "7.25.9"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.9.tgz#a50f8fe49e7f69f53de5bea7e413cd35c5e13c84"
integrity sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==
Expand Down Expand Up @@ -4626,6 +4613,11 @@ expo-local-authentication@~15.0.1:
dependencies:
invariant "^2.2.4"

expo-location@~18.0.5:
version "18.0.5"
resolved "https://registry.yarnpkg.com/expo-location/-/expo-location-18.0.5.tgz#d9421119a0ae5b91112d24168b57607a70b45686"
integrity sha512-fcTtHseRUBh3XiATs2ghycjUJOYEl78lWUuaKRKPZMt+pLhqCX7OstbsySySCHHfz2MudvWaq2yXpe5cDmENzg==

[email protected]:
version "2.0.4"
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-2.0.4.tgz#28fcd12fb0d066a2933cca3bf3b597da0f6b2f2a"
Expand Down Expand Up @@ -8959,16 +8951,7 @@ string-length@^5.0.1:
char-regex "^2.0.0"
strip-ansi "^7.0.1"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -9056,7 +9039,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand All @@ -9070,13 +9053,6 @@ strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^7.0.1, strip-ansi@^7.1.0:
version "7.1.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45"
Expand Down Expand Up @@ -9914,7 +9890,7 @@ word-wrap@^1.2.5:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -9932,15 +9908,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down