Skip to content

Commit

Permalink
Merge branch 'nsis_shortcut_creator' of https://github.com/jadzeidan/…
Browse files Browse the repository at this point in the history
…bitbox-wallet-app into nsis_shortcut_creator
  • Loading branch information
jadzeidan committed Oct 29, 2024
2 parents 7c78f48 + 2cd8323 commit b202984
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Label UTXOs that were created as change, as such, in coin control
- Remove support for deprecated the Ethereum Goerli network
- Revamp transaction history in account overview to improve legibility
- Fix qrscanner when rotating the device or resizing the window

# 4.45.0
- Bundle BitBox02 firmware version v9.21.0
Expand Down
52 changes: 44 additions & 8 deletions frontends/ios/BitBoxApp/BitBoxApp/BitBoxAppApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ protocol SetMessageHandlersProtocol {
func setMessageHandlers(handlers: MessageHandlersProtocol)
}

class GoEnvironment: NSObject, MobileserverGoEnvironmentInterfaceProtocol {
func getSaveFilename(_ p0: String?) -> String {
// TODO
return ""
class GoEnvironment: NSObject, MobileserverGoEnvironmentInterfaceProtocol, UIDocumentInteractionControllerDelegate {
func getSaveFilename(_ fileName: String?) -> String {
let tempDirectory = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
// fileName cannot be nil this is called by Go and Go strings cannot be nil/null.
let fileURL = tempDirectory.appendingPathComponent(fileName!)
return fileURL.path
}

func auth() {
Expand Down Expand Up @@ -75,10 +77,44 @@ class GoEnvironment: NSObject, MobileserverGoEnvironmentInterfaceProtocol {
func setDarkTheme(_ p0: Bool) {
}

func systemOpen(_ url: String?) throws {
guard let url = URL(string: url!) else { return }
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
// Helper method to get the root view controller
private func getRootViewController() -> UIViewController? {
guard let scene = UIApplication.shared.connectedScenes
.filter({ $0.activationState == .foregroundActive })
.first as? UIWindowScene else {
return nil
}

return scene.windows.first(where: { $0.isKeyWindow })?.rootViewController
}

func systemOpen(_ urlString: String?) throws {
guard let urlString = urlString else { return }
// Check if it's a local file path (not a URL)
var url: URL
if urlString.hasPrefix("/") {
// This is a local file path, construct a file URL
url = URL(fileURLWithPath: urlString)
} else if let potentialURL = URL(string: urlString), potentialURL.scheme != nil {
// This is already a valid URL with a scheme
url = potentialURL
} else {
// Invalid URL or path
return
}
// Ensure we run on the main thread
DispatchQueue.main.async {
if url.isFileURL {
// Local file path, use UIDocumentInteractionController
if let rootViewController = self.getRootViewController() {
let activityViewController = UIActivityViewController(activityItems: [url], applicationActivities: nil)
rootViewController.present(activityViewController, animated: true, completion: nil)
}
} else {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions frontends/web/src/components/title/subtitle.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
line-height: 1.5;
margin: 0 0 calc(var(--space-half) * 1.5) 0;
}

@media (min-width: 1200px) {
.subtitle {
--size-subheader: 20px;
}
}
24 changes: 12 additions & 12 deletions frontends/web/src/hooks/qrcodescanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,22 @@ export const useQRScanner = (
}
);
}
});
return () => {
scanner.current?.stop();
scanner.current?.destroy();
scanner.current = null;
};
}, [onError, onResult, videoRef]);

useEffect(() => {
(async () => {
try {
await scanner.current?.start();
if (onStart) {
onStart();
await new Promise(r => setTimeout(r, 300));
if (scanner.current) {
await scanner.current.start();
if (onStart) {
onStart();
}
}
} catch (error: any) {
const stringifiedError = error.toString();
Expand All @@ -83,13 +91,5 @@ export const useQRScanner = (
})();
}, [videoRef, onStart, onResult, onError, t]);

useEffect(() => {
return () => {
scanner.current?.stop();
scanner.current?.destroy();
scanner.current = null;
};
});

return { initErrorMessage };
};
22 changes: 17 additions & 5 deletions frontends/web/src/routes/account/account.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
justify-content: flex-end;
}


.withWalletConnect .walletConnect {
display: flex;
}
Expand Down Expand Up @@ -85,6 +84,10 @@
margin-right: var(--space-eight);
}

.errorLoadTransactions {
text-align: center;
}

.titleWithButton {
align-items: baseline;
color: var(--color-secondary);
Expand All @@ -98,6 +101,11 @@
text-align: right;
}

.emptyTransactions {
color: var(--color-secondary);
text-align: center;
}

@media (max-width: 768px) {

.accountInfoLink {
Expand All @@ -112,8 +120,6 @@
.actionsContainer {
justify-content: space-between;
margin-bottom: var(--space-default);
margin-left: auto;
margin-right: auto;
padding-bottom: 0;
transform: none;
width: 100%;
Expand All @@ -138,8 +144,6 @@

.actionsContainer a {
flex: 1 0 30%;
margin-left: 0;
margin-right: 0;
max-width: 30%;
min-width: unset;
}
Expand All @@ -152,4 +156,12 @@
margin-bottom: 0;
width: auto;
}


.exchange:first-child,
.send:first-child,
.receive:first-child,
.walletConnect:first-child {
margin-left: 0;
}
}
12 changes: 7 additions & 5 deletions frontends/web/src/routes/account/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ export const Account = ({
)}

{!transactions?.success ? (
<div className={`flex flex-row flex-center ${style.empty}`}>
<p>{t('transactions.errorLoadTransactions')}</p>
</div>
) : (
<p className={style.errorLoadTransactions}>
{t('transactions.errorLoadTransactions')}
</p>
) : !isAccountEmpty && (
<SubTitle className={style.titleWithButton}>
{t('accountSummary.transactionHistory')}
{hasTransactions && (
Expand All @@ -367,7 +367,9 @@ export const Account = ({
/>
))
) : transactions?.success && (
<p>{t('transactions.placeholder')}</p>
<p className={style.emptyTransactions}>
{t('transactions.placeholder')}
</p>
)}

<TransactionDetails
Expand Down
9 changes: 5 additions & 4 deletions frontends/web/src/routes/account/info/buyReceiveCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { isBitcoinCoin, isEthereumBased } from '@/routes/account/utils';
import { getExchangeSupportedAccounts } from '@/routes/exchange/utils';
import { WalletConnectLight } from '@/components/icon';
import { useMountedRef } from '@/hooks/mount';
import { SubTitle } from '@/components/title';
import styles from './buyReceiveCTA.module.css';

type TBuyReceiveCTAProps = {
Expand Down Expand Up @@ -66,12 +67,12 @@ export const BuyReceiveCTA = ({

return (
<div className={`${styles.main}`}>
<h3 className="subTitle">
<SubTitle>
{t('accountInfo.buyCTA.information.looksEmpty')}
</h3>
<h3 className="subTitle">
</SubTitle>
<p>
{t('accountInfo.buyCTA.information.start')}
</h3>
</p>
<div className={styles.container}>
{balanceList && (
<Button primary onClick={onReceiveCTA}>
Expand Down
4 changes: 2 additions & 2 deletions util/config/appdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func AppDir() string {

// ExportsDir returns the absolute path to the folder which can be used to export files.
func ExportsDir() (string, error) {
if runtime.GOOS == "android" {
// Android apps are sandboxed, we don't need to specify a folder.
if runtime.GOOS == "android" || runtime.GOOS == "ios" {
// Android/iOS apps are sandboxed, we don't need to specify a folder.
return "", nil
}
homeFolder := os.Getenv("HOME")
Expand Down

0 comments on commit b202984

Please sign in to comment.