CW-365-Wallet-QR-codes-not-working-properly-on-some-devices (#909)

* add exception for range error

* add app links for wallets

* Update reference to qr.flutter clone

* QrImage update

* Update fullscreen_qr_page.dart

* Add automatic version for wallet QR

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii 2023-05-08 23:30:14 +03:00 committed by GitHub
parent 9714961298
commit 086019d926
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 88 additions and 6 deletions

View file

@ -46,8 +46,14 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="bitcoin" />
<data android:scheme="bitcoin-wallet" />
<data android:scheme="bitcoin_wallet" />
<data android:scheme="monero" />
<data android:scheme="monero-wallet" />
<data android:scheme="monero_wallet" />
<data android:scheme="litecoin" />
<data android:scheme="litecoin-wallet" />
<data android:scheme="litecoin_wallet" />
</intent-filter>
</activity>
<meta-data

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -42,6 +42,26 @@
<string>bitcoin</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>bitcoin-wallet</string>
<key>CFBundleURLSchemes</key>
<array>
<string>bitcoin-wallet</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>bitcoin_wallet</string>
<key>CFBundleURLSchemes</key>
<array>
<string>bitcoin_wallet</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
@ -52,6 +72,26 @@
<string>monero</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>monero-wallet</string>
<key>CFBundleURLSchemes</key>
<array>
<string>monero-wallet</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>monero_wallet</string>
<key>CFBundleURLSchemes</key>
<array>
<string>monero_wallet</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
@ -62,6 +102,26 @@
<string>litecoin</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>litecoin-wallet</string>
<key>CFBundleURLSchemes</key>
<array>
<string>litecoin-wallet</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>litecoin_wallet</string>
<key>CFBundleURLSchemes</key>
<array>
<string>litecoin_wallet</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>

View file

@ -71,7 +71,10 @@ class FullscreenQRPage extends BasePage {
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(width: 3, color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!)),
child: QrImage(data: qrViewData.data, version: qrViewData.version),
child: Container(
decoration: BoxDecoration(
border: Border.all(width: 3, color: Colors.white)),
child: QrImage(data: qrViewData.data, version: qrViewData.version)),
),
),
),

View file

@ -16,7 +16,7 @@ class QrImage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return qr.QrImage(
return qr.QrImageView(
data: data,
errorCorrectionLevel: errorCorrectionLevel,
version: version ?? 9, // Previous value: 7 something happened after flutter upgrade monero wallets addresses are longer than ver. 7 ???

View file

@ -86,7 +86,14 @@ class QRWidget extends StatelessWidget {
Theme.of(context).accentTextTheme.headline2!.backgroundColor!,
),
),
child: QrImage(data: addressListViewModel.uri.toString()),
child: Container(
decoration: BoxDecoration(
border: Border.all(
width: 3,
color:Colors.white,
),
),
child: QrImage(data: addressListViewModel.uri.toString())),
),
),
),

View file

@ -25,7 +25,7 @@ class RestoreOptionsPage extends BasePage {
final bool isNewInstall;
final imageSeedKeys = Image.asset('assets/images/restore_wallet_image.png');
final imageBackup = Image.asset('assets/images/backup.png');
final qrCode = Image.asset('assets/images/qr_code_icon.png');
final qrCode = Image.asset('assets/images/restore_qr.png');
@override
Widget body(BuildContext context) {

View file

@ -11,6 +11,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/list_row.dart';
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
import 'package:cake_wallet/routes.dart';
import 'package:qr_flutter/qr_flutter.dart';
class WalletKeysPage extends BasePage {
WalletKeysPage(this.walletKeysViewModel);
@ -32,7 +33,7 @@ class WalletKeysPage extends BasePage {
await Navigator.pushNamed(
context,
Routes.fullscreenQR,
arguments: QrViewData(data: url.toString()),
arguments: QrViewData(data: url.toString(), version: QrVersions.auto),
);
// ignore: unawaited_futures
DeviceDisplayBrightness.setBrightness(brightness);

View file

@ -51,6 +51,7 @@ class WalletRestoreFromQRCode {
static String getFormattedUri(String code) {
final index = code.indexOf(':');
if (index == -1) return throw Exception('Unexpected wallet type: $code, try to scan again');
final scheme = code.substring(0, index).replaceAll('_', '-');
final query = code.substring(index + 1).replaceAll('?', '&');
final formattedUri = '$scheme:?$query';

View file

@ -6,7 +6,11 @@ dependencies:
flutter_cupertino_localizations: ^1.0.1
intl: ^0.17.0
url_launcher: ^6.1.4
qr_flutter: ^4.0.0
qr_flutter:
git:
url: https://github.com/cake-tech/qr.flutter.git
ref: cake-4.0.2
version: 4.0.2
uuid: 3.0.6
shared_preferences: ^2.0.15
flutter_secure_storage: