Skip to content

Commit

Permalink
Bug fix trying to open an non installed app
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Jan 11, 2024
1 parent c474a2d commit 7c79250
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 20 deletions.
Binary file modified assets/png/2.0x/logo_wc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/png/3.0x/logo_wc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions example/ios/Runner/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
22 changes: 22 additions & 0 deletions example/ios/Runner/Assets.xcassets/Logo.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 15 additions & 7 deletions example/ios/Runner/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -14,24 +16,30 @@
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="Logo" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
<rect key="frame" x="98.333333333333329" y="327.66666666666669" width="196.33333333333337" height="196.66666666666669"/>
<constraints>
<constraint firstAttribute="width" secondItem="YRO-k0-Ey4" secondAttribute="height" multiplier="1:1" id="M9e-tx-moi"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.92941176470588238" green="0.94509803921568625" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="width" secondItem="Ze5-6b-2t3" secondAttribute="width" multiplier="0.5" id="g57-Kp-Pbu"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="80.916030534351137" y="264.08450704225356"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
<image name="Logo" width="341.33334350585938" height="341.33334350585938"/>
</resources>
</document>
2 changes: 1 addition & 1 deletion lib/services/coinbase_service/coinbase_service.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'dart:convert';

import 'package:flutter/foundation.dart';

import 'package:flutter/services.dart';

import 'package:web3modal_flutter/services/coinbase_service/i_coinbase_service.dart';
import 'package:web3modal_flutter/services/coinbase_service/models/coinbase_events.dart';
import 'package:web3modal_flutter/web3modal_flutter.dart';
Expand Down
27 changes: 16 additions & 11 deletions lib/utils/url/url_utils.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:appcheck/appcheck.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:url_launcher/url_launcher.dart' as launcher;
import 'package:web3modal_flutter/services/explorer_service/models/redirect.dart';
import 'package:web3modal_flutter/utils/core/core_utils_singleton.dart';
import 'package:web3modal_flutter/utils/platform/i_platform_utils.dart';
Expand All @@ -11,13 +10,18 @@ import 'package:web3modal_flutter/utils/url/launch_url_exception.dart';

import 'package:web3modal_flutter/utils/w3m_logger.dart';

Future<bool> _launchUrl(Uri url, {LaunchMode? mode}) async {
Future<bool> _launchUrl(Uri url, {launcher.LaunchMode? mode}) async {
try {
debugPrint('[url_utils] _launchUrl $url');
return await launchUrl(
final success = await launcher.launchUrl(
url,
mode: mode ?? LaunchMode.platformDefault,
mode: mode ?? launcher.LaunchMode.platformDefault,
);
if (!success) {
throw LaunchUrlException('App not installed');
}
return true;
} on LaunchUrlException {
rethrow;
} on PlatformException catch (e, s) {
W3MLoggerUtil.logger.e(
'Error launching URL $url',
Expand All @@ -43,11 +47,12 @@ class UrlUtils extends IUrlUtils {
UrlUtils({
this.androidAppCheck = _androidAppCheck,
this.launchUrlFunc = _launchUrl,
this.canLaunchUrlFunc = canLaunchUrl,
this.canLaunchUrlFunc = launcher.canLaunchUrl,
});

final Future<bool> Function(String uri) androidAppCheck;
final Future<bool> Function(Uri url, {LaunchMode? mode}) launchUrlFunc;
final Future<bool> Function(Uri url, {launcher.LaunchMode? mode})
launchUrlFunc;
final Future<bool> Function(Uri url) canLaunchUrlFunc;

@override
Expand Down Expand Up @@ -78,8 +83,8 @@ class UrlUtils extends IUrlUtils {
}

@override
Future<bool> launchUrl(Uri url, {LaunchMode? mode}) async {
return launchUrlFunc(
Future<bool> launchUrl(Uri url, {launcher.LaunchMode? mode}) async {
return await launchUrlFunc(
url,
mode: mode,
);
Expand Down Expand Up @@ -129,7 +134,7 @@ class UrlUtils extends IUrlUtils {
}
return await launchUrlFunc(
uriToOpen!,
mode: LaunchMode.externalApplication,
mode: launcher.LaunchMode.externalApplication,
);
}
}
2 changes: 1 addition & 1 deletion lib/widgets/w3m_qr_code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class QRCodeWidget extends StatelessWidget {
final responsiveData = ResponsiveData.of(context);
final isPortrait = ResponsiveData.isPortrait(context);
final isDarkMode = Web3ModalTheme.maybeOf(context)?.isDarkMode ?? false;
final imageSize = isPortrait ? 90.0 : 60.0;
final imageSize = isPortrait ? 80.0 : 60.0;
final maxRadius = min(radiuses.radiusL, 36.0);
return Container(
constraints: BoxConstraints(
Expand Down

0 comments on commit 7c79250

Please sign in to comment.