Skip to content

Commit

Permalink
fix wallets issues
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Oct 3, 2024
1 parent d255d59 commit cbe2e43
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
8 changes: 4 additions & 4 deletions packages/reown_appkit/generate_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ dart run dependency_validator

cd ios

pod deintegrate
pod cache clean -all
# pod deintegrate
# pod cache clean -all
pod install

cd ..
Expand All @@ -42,8 +42,8 @@ dart run dependency_validator

cd ios

pod deintegrate
pod cache clean -all
# pod deintegrate
# pod cache clean -all
pod install

cd ..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,11 +787,9 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
DEVELOPMENT_TEAM = W5R8AG9K22;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "FL WalletKit";
Expand All @@ -802,7 +800,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.walletconnect.flutterwallet;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match AppStore com.walletconnect.flutterwallet";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class DeepLinkHandler {
static void checkInitialLink() async {
if (kIsWeb) return;
try {
_methodChannel.invokeMethod('initialLink');
final initialLink = await _methodChannel.invokeMethod('initialLink');
if (initialLink != null) {
_onLink(initialLink);
}
} catch (e) {
debugPrint('[SampleWallet] [DeepLinkHandler] checkInitialLink $e');
}
Expand All @@ -40,19 +43,17 @@ class DeepLinkHandler {
static String get host => universalUri.host;

static void _onLink(Object? event) async {
final ev = ReownCoreUtils.getSearchParamFromURL('$event', 'wc_ev');
if (ev.isNotEmpty) {
debugPrint('[SampleWallet] is linkMode $event');
await _walletKit.dispatchEnvelope('$event');
} else {
try {
return await _walletKit.dispatchEnvelope('$event');
} catch (e) {
final decodedUri = Uri.parse(Uri.decodeFull(event.toString()));
if (decodedUri.isScheme('wc')) {
debugPrint('[SampleWallet] is legacy uri $decodedUri');
waiting.value = true;
await _walletKit.pair(uri: decodedUri);
} else {
final uriParam = ReownCoreUtils.getSearchParamFromURL(
'$decodedUri',
decodedUri.toString(),
'uri',
);
if (decodedUri.isScheme(nativeUri.scheme) && uriParam.isNotEmpty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,19 @@ class WalletKitService extends IWalletKitService {
// generatedNamespaces is constructed based on registered methods handlers
// so if you want to handle requests using onSessionRequest event then you would need to manually add that method in the approved namespaces
try {
final session = await _walletKit!.approveSession(
_walletKit!.approveSession(
id: args.id,
namespaces: NamespaceUtils.regenerateNamespacesWithChains(
args.params.generatedNamespaces!,
),
sessionProperties: args.params.sessionProperties,
);
debugPrint('[$runtimeType] approveSession $session');
MethodsUtils.handleRedirect(
session.topic,
session.session!.peer.metadata.redirect,
'',
true,
);
// MethodsUtils.handleRedirect(
// session.topic,
// session.session!.peer.metadata.redirect,
// '',
// true,
// );
} on ReownSignError catch (error) {
MethodsUtils.handleRedirect(
'',
Expand Down Expand Up @@ -274,7 +273,13 @@ class WalletKitService extends IWalletKitService {
void _onSessionConnect(SessionConnect? args) {
if (args != null) {
final session = jsonEncode(args.session.toJson());
debugPrint('[SampleWallet] _onSessionConnect $session');
log('[SampleWallet] _onSessionConnect $session');
MethodsUtils.handleRedirect(
args.session.topic,
args.session.peer.metadata.redirect,
'',
true,
);
}
}

Expand Down
4 changes: 1 addition & 3 deletions packages/reown_walletkit/example/lib/pages/apps_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class AppsPageState extends State<AppsPage> with GetItStateMixin {
//
_registerListeners();
// TODO _walletKit.core.echo.register(firebaseAccessToken);
Future.delayed(Duration(seconds: 2), () {
DeepLinkHandler.checkInitialLink();
});
DeepLinkHandler.checkInitialLink();
}

void _registerListeners() {
Expand Down
4 changes: 2 additions & 2 deletions packages/reown_walletkit/generate_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ dart run dependency_validator

cd ios

pod deintegrate
pod cache clean -all
# pod deintegrate
# pod cache clean -all
pod install

cd ..
Expand Down

0 comments on commit cbe2e43

Please sign in to comment.