mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
CAKE-356 | applied deep links to the app
This commit is contained in:
@@ -6,9 +6,13 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class YatAlert extends StatelessWidget {
|
||||
static const aspectRatioImage = 1.133;
|
||||
static const _baseUrl = 'https://yat.fyi';
|
||||
static const _signInSuffix = '/sign-in';
|
||||
static const _createSuffix = '/create';
|
||||
final image = Image.asset('assets/images/yat_crypto.png');
|
||||
|
||||
@override
|
||||
@@ -81,8 +85,12 @@ class YatAlert extends StatelessWidget {
|
||||
iconData: CupertinoIcons
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: () => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.yat, arguments: YatMode.create)),
|
||||
onPressed: () {
|
||||
//Navigator.of(context)
|
||||
// .popAndPushNamed(Routes.yat, arguments: YatMode.create);
|
||||
final url = _baseUrl + _createSuffix;
|
||||
launch(url);
|
||||
}),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: PrimaryIconButton(
|
||||
@@ -95,8 +103,12 @@ class YatAlert extends StatelessWidget {
|
||||
iconData: CupertinoIcons
|
||||
.arrow_up_right_square,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
onPressed: () => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.yat, arguments: YatMode.connect))
|
||||
onPressed: () {
|
||||
//Navigator.of(context)
|
||||
// .popAndPushNamed(Routes.yat, arguments: YatMode.connect);
|
||||
final url = _baseUrl + _signInSuffix;
|
||||
launch(url);
|
||||
})
|
||||
)
|
||||
]
|
||||
),
|
||||
|
||||
@@ -69,7 +69,7 @@ class YatWebViewPageBodyState extends State<YatWebViewPageBody> {
|
||||
super.initState();
|
||||
_webViewkey = GlobalKey();
|
||||
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
|
||||
_fetchYatInfo();
|
||||
WidgetsBinding.instance.addPostFrameCallback(_afterLayout);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -88,6 +88,10 @@ class YatWebViewPageBodyState extends State<YatWebViewPageBody> {
|
||||
setState(() => _webViewController = controller));
|
||||
}
|
||||
|
||||
void _afterLayout(dynamic _) {
|
||||
_fetchYatInfo();
|
||||
}
|
||||
|
||||
void _fetchYatInfo() {
|
||||
final keyword = 'dashboard';
|
||||
_timer?.cancel();
|
||||
@@ -103,6 +107,7 @@ class YatWebViewPageBodyState extends State<YatWebViewPageBody> {
|
||||
if (url.contains(keyword)) {
|
||||
timer.cancel();
|
||||
await yatViewModel.fetchCartInfo();
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
|
||||
Reference in New Issue
Block a user