Skip to content

Commit

Permalink
minor changes in sample apps
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Apr 4, 2024
1 parent 73785cb commit e6621cd
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 29 deletions.
3 changes: 2 additions & 1 deletion example/dapp/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:taskAffinity="com.walletconnect.flutterdapp.activity"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
Expand Down
2 changes: 1 addition & 1 deletion example/dapp/lib/pages/connect_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ class ConnectPageState extends State<ConnectPage> {
final uri = 'wcflutterwallet://wc?uri=$encodedUri';
// final uri = 'metamask://wc?uri=$encodedUri';
if (await canLaunchUrlString(uri)) {
// ignore: use_build_context_synchronously
final openApp = await showDialog(
// ignore: use_build_context_synchronously
context: context,
builder: (BuildContext context) {
return AlertDialog(
Expand Down
3 changes: 2 additions & 1 deletion example/wallet/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<activity
android:name="com.walletconnect.flutterwallet.MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:taskAffinity="com.walletconnect.flutterwallet.activity"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
Expand Down
2 changes: 1 addition & 1 deletion example/wallet/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>13.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/wallet/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
2 changes: 1 addition & 1 deletion example/wallet/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: 0dbd5a87e0ace00c9610d2037ac22083a01f861d

COCOAPODS: 1.13.0
8 changes: 4 additions & 4 deletions example/wallet/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -342,7 +342,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -420,7 +420,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -469,7 +469,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
42 changes: 24 additions & 18 deletions example/wallet/lib/pages/apps_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AppsPage extends StatefulWidget with GetItStatefulWidgetMixin {
class AppsPageState extends State<AppsPage> with GetItStateMixin {
List<PairingInfo> _pairings = [];
late Web3Wallet web3Wallet;
bool _showLoading = false;

@override
void initState() {
Expand All @@ -36,18 +37,10 @@ class AppsPageState extends State<AppsPage> with GetItStateMixin {
web3Wallet.onSessionExpire.subscribe(_updateState);
web3Wallet.onSessionConnect.subscribe(_updateState);
// TODO web3Wallet.core.echo.register(firebaseAccessToken);
DeepLinkHandler.onLink.listen(_deepLinkListener);
DeepLinkHandler.onLink.listen(_onFoundUri);
DeepLinkHandler.checkInitialLink();
}

void _deepLinkListener(String uri) {
try {
_onFoundUri(uri);
} catch (e) {
debugPrint('[$runtimeType] onLink $e');
}
}

@override
void dispose() {
web3Wallet.core.pairing.onPairingDelete.unsubscribe(_onPairingDelete);
Expand Down Expand Up @@ -77,6 +70,21 @@ class AppsPageState extends State<AppsPage> with GetItStateMixin {
],
),
),
Visibility(
visible: _showLoading,
child: Center(
child: Container(
decoration: const BoxDecoration(
color: Colors.black38,
borderRadius: BorderRadius.all(Radius.circular(50.0)),
),
padding: const EdgeInsets.all(12.0),
child: const CircularProgressIndicator(
color: Colors.white,
),
),
),
),
],
);
}
Expand Down Expand Up @@ -151,15 +159,12 @@ class AppsPageState extends State<AppsPage> with GetItStateMixin {
_onFoundUri(s);
}

Future _onFoundUri(String? uri) async {
if (uri != null) {
try {
final Uri uriData = Uri.parse(uri);
await web3Wallet.pair(uri: uriData);
} catch (e) {
_invalidUriToast();
}
} else {
Future<void> _onFoundUri(String? uri) async {
try {
setState(() => _showLoading = true);
final Uri uriData = Uri.parse(uri!);
await web3Wallet.pair(uri: uriData);
} catch (e) {
_invalidUriToast();
}
}
Expand Down Expand Up @@ -194,6 +199,7 @@ class AppsPageState extends State<AppsPage> with GetItStateMixin {

void _updateState(dynamic args) {
setState(() {
_showLoading = false;
_pairings = web3Wallet.pairings.getAll();
});
}
Expand Down
7 changes: 7 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,10 @@ dev_dependencies:
json_serializable: ^6.7.0
mockito: ^5.4.3

platforms:
android:
ios:
# web:
# linux:
# macos:
# windows:

0 comments on commit e6621cd

Please sign in to comment.