Skip to content

Commit

Permalink
notify, camera
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyboy1004 committed Nov 24, 2023
1 parent 9a76ea3 commit 885e037
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
<data android:scheme="lightning"/>
</intent-filter>

<intent-filter android:autoVerify="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="test.shockwallet.app" />
<data android:scheme="https" android:host="test.shockwallet.app" />
<data android:scheme="http" android:host="my.shockwallet.app" />
<data android:scheme="https"/>
<data android:scheme="https" android:host="my.shockwallet.app" />
</intent-filter>
</activity>

Expand Down
38 changes: 16 additions & 22 deletions src/Components/Background.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ export const Background = () => {
onClick: onClick,
});
};
window.onbeforeunload = function () {return null;};

useEffect(() => {
const handleBeforeUnload = (event: BeforeUnloadEvent) => {
// Call your function here
localStorage.setItem("lastOnline", Date.now().toString())
localStorage.setItem("getHistory", "false");
return false;
};

window.addEventListener('beforeunload', handleBeforeUnload);

return () => {
return window.removeEventListener('beforeunload', handleBeforeUnload);
}
}, []);

useEffect(() => {
const subbed: string[] = []
Expand All @@ -53,13 +69,6 @@ export const Background = () => {
c.GetLiveUserOperations(newOp => {
if (newOp.status === "OK") {
console.log(newOp)
dispatch(addNotification({
header: 'Payments',
icon: '⚡',
desc: `You received ` + newOp.operation.amount + ` payments.`,
date: Date.now(),
link: '/home',
}))
openNotification("top", "Payments", "You received payment.");
dispatch(setLatestOperation({ pub: pubkey, operation: newOp.operation }))
} else {
Expand All @@ -68,21 +77,6 @@ export const Background = () => {
})
})
});

const handleBeforeUnload = (event: BeforeUnloadEvent) => {
event.returnValue = null;
window.onbeforeunload = null;
event.preventDefault();
// Call your function here
localStorage.setItem("lastOnline", Date.now().toString())
localStorage.setItem("getHistory", "false")
};

window.addEventListener('beforeunload', handleBeforeUnload);

return () => {
return window.removeEventListener('beforeunload', handleBeforeUnload);
}
}, [nostrSource.length])

useEffect(() => {
Expand Down
4 changes: 4 additions & 0 deletions src/Pages/NodeUp/NodeUp.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
color: #268fbc;
text-align: center;
}

&_manual_text:hover {
text-decoration: underline;
}

&_manual_btn{
margin-top: 20px;
Expand Down
3 changes: 1 addition & 2 deletions src/Pages/NodeUp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { } from "react-router-dom";
import { useIonRouter } from '@ionic/react';
import { setNostrPrivateKey } from "../../Api/nostr";
import { NOSTR_PRIVATE_KEY_STORAGE_KEY, NOSTR_PUB_DESTINATION, NOSTR_RELAYS, options } from "../../constants";
import { useDispatch } from "../../State/store";
import { useSelector } from "../../State/store";
import { useDispatch, useSelector } from "../../State/store";
import { nip19 } from "nostr-tools";
import { addPaySources } from "../../State/Slices/paySourcesSlice";
import { addSpendSources } from "../../State/Slices/spendSourcesSlice";
Expand Down
7 changes: 6 additions & 1 deletion src/Pages/Scan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,16 @@ export const Scan = () => {

const handleSubmit = async (qrcode: string) => {
qrcode = qrcode.replace("lightning:", "");

if (scaned) return;
scaned = true;
if (qrcode.startsWith('lnbc')) {
if (qrcode.slice(0,4).toLowerCase()=="lnbc") {
router.push("/send?url="+qrcode)
return;
}
if (validate(qrcode)) {
router.push("/send?url="+qrcode)
return;
}
try {
let { words: dataPart } = bech32.decode(qrcode, 2000);
Expand All @@ -74,8 +77,10 @@ export const Scan = () => {
} else {
router.push("/send?url="+qrcode)
}
return;
} catch (error) {
scaned = false;
router.push("/home");
return openNotification("top", "Error", "Please scan correct QRcode!");
}
}
Expand Down

0 comments on commit 885e037

Please sign in to comment.