Fixes for yat

This commit is contained in:
M 2021-11-02 09:17:24 +00:00
parent c9482caa19
commit fe3d00f1a8
36 changed files with 543 additions and 88 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -85,6 +85,8 @@ PODS:
- Flutter
- SwiftProtobuf (1.12.0)
- SwiftyGif (5.3.0)
- uni_links (0.0.1):
- Flutter
- UnstoppableDomainsResolution (2.0.1):
- BigInt
- CryptoSwift
@ -109,6 +111,7 @@ DEPENDENCIES:
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- share (from `.symlinks/plugins/share/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- UnstoppableDomainsResolution (~> 2.0.1)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)
@ -155,6 +158,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/share/ios"
shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios"
uni_links:
:path: ".symlinks/plugins/uni_links/ios"
url_launcher:
:path: ".symlinks/plugins/url_launcher/ios"
webview_flutter:
@ -184,10 +189,11 @@ SPEC CHECKSUMS:
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699
SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
UnstoppableDomainsResolution: 856ba43f08b31f3f34157c7257092bd0c6e31cf8
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b
webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b
PODFILE CHECKSUM: bc2591d23316907c9c90ca1cd2fce063fd866508
COCOAPODS: 1.10.2
COCOAPODS: 1.9.3

View file

@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 59;
CURRENT_PROJECT_VERSION = 62;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -380,7 +380,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.7;
MARKETING_VERSION = 4.2.8;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -506,7 +506,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 59;
CURRENT_PROJECT_VERSION = 62;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -524,7 +524,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.7;
MARKETING_VERSION = 4.2.8;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@ -542,7 +542,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 59;
CURRENT_PROJECT_VERSION = 62;
DEVELOPMENT_TEAM = 32J6BB6VUS;
ENABLE_BITCODE = NO;
EXCLUDED_SOURCE_FILE_NAMES = "";
@ -560,7 +560,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 4.2.7;
MARKETING_VERSION = 4.2.8;
PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View file

@ -20,6 +20,19 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>y.at</string>
<key>CFBundleURLSchemes</key>
<array>
<string>cakewallet</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
@ -57,19 +70,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>y.at</string>
<key>CFBundleURLSchemes</key>
<array>
<string>cakewallet</string>
</array>
</dict>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>

View file

@ -2,7 +2,9 @@ import 'dart:async';
import 'package:cake_wallet/bitcoin/unspent_coins_info.dart';
import 'package:cake_wallet/entities/language_service.dart';
import 'package:cake_wallet/buy/order.dart';
import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -35,6 +37,7 @@ import 'package:cake_wallet/src/screens/root/root.dart';
import 'package:uni_links/uni_links.dart';
final navigatorKey = GlobalKey<NavigatorState>();
final rootKey = GlobalKey<RootState>();
Future<void> main() async {
try {
@ -106,6 +109,9 @@ Future<void> main() async {
await Hive.openBox<ExchangeTemplate>(ExchangeTemplate.boxName);
final unspentCoinsInfoSource =
await Hive.openBox<UnspentCoinsInfo>(UnspentCoinsInfo.boxName);
await visualisationForEmojiId('%E2%98%A0%EF%B8%8F%F0%9F%90%99%E2%98%A0%EF%B8%8F');
await initialSetup(
sharedPreferences: await SharedPreferences.getInstance(),
nodes: nodes,
@ -203,6 +209,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
Future<void> _handleInitialUri() async {
try {
final uri = await getInitialUri();
print('uri: $uri');
if (uri == null) {
return;
}
@ -217,6 +224,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
void _handleIncomingLinks() {
if (!kIsWeb) {
stream = getUriLinksStream().listen((Uri uri) {
print('uri: $uri');
if (!mounted) return;
_fetchEmojiFromUri(uri);
}, onError: (Object error) {
@ -238,6 +246,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
}
yatStore.emoji = emoji;
yatStore.refreshToken = refreshToken;
yatStore.emojiIncommingSC.add(emoji);
}
@override
@ -263,6 +272,7 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
statusBarIconBrightness: statusBarIconBrightness));
return Root(
key: rootKey,
authenticationStore: authenticationStore,
navigatorKey: navigatorKey,
child: MaterialApp(

View file

@ -1,7 +1,9 @@
import 'dart:async';
import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/yat/yat_popup.dart';
import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
@ -20,6 +22,7 @@ import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:cake_wallet/main.dart';
class DashboardPage extends BasePage {
DashboardPage({
@ -78,6 +81,7 @@ class DashboardPage extends BasePage {
var pages = <Widget>[];
bool _isEffectsInstalled = false;
StreamSubscription<bool> _onInactiveSub;
@override
Widget body(BuildContext context) {
@ -156,6 +160,8 @@ class DashboardPage extends BasePage {
pages.add(BalancePage(dashboardViewModel: walletViewModel));
pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
_isEffectsInstalled = true;
if (walletViewModel.shouldShowYatPopup) {
await Future<void>.delayed(Duration(seconds: 1));
await showPopUp<void>(
@ -186,7 +192,29 @@ class DashboardPage extends BasePage {
});
});
_isEffectsInstalled = true;
var needToPresentYat = false;
var isInactive = false;
_onInactiveSub = rootKey.currentState.isInactive.listen((inactive) {
isInactive = inactive;
if (needToPresentYat) {
Future<void>.delayed(Duration(milliseconds: 500)).then((_) {
showPopUp<void>(
context: navigatorKey.currentContext,
builder: (_) => YatEmojiId(walletViewModel.yatStore.emoji));
needToPresentYat = false;
});
}
});
walletViewModel.yatStore.emojiIncommingStream.listen((String emoji) {
if (!_isEffectsInstalled || emoji.isEmpty) {
return;
}
needToPresentYat = true;
});
}
Future<void> _onClickBuyButton(BuildContext context) async {

View file

@ -150,7 +150,7 @@ class QRWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
S.of(context).yat_address,
S.of(context).yat,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 13,
@ -160,14 +160,21 @@ class QRWidget extends StatelessWidget {
),
Padding(
padding: EdgeInsets.only(top: 5),
child: Text(
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(child:Text(
addressListViewModel.emoji,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 26,
fontSize: 26))),
Padding(
padding: EdgeInsets.only(left: 12),
child: copyImage,
)]
),
)
)
]
)
)),

View file

@ -1,3 +1,4 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
@ -24,11 +25,14 @@ class Root extends StatefulWidget {
}
class RootState extends State<Root> with WidgetsBindingObserver {
Stream<bool> get isInactive => _isInactiveController.stream;
StreamController<bool> _isInactiveController;
bool _isInactive;
bool _postFrameCallback;
@override
void initState() {
_isInactiveController = StreamController<bool>();
_isInactive = false;
_postFrameCallback = false;
WidgetsBinding.instance.addObserver(this);
@ -45,7 +49,7 @@ class RootState extends State<Root> with WidgetsBindingObserver {
if (!_isInactive &&
widget.authenticationStore.state == AuthenticationState.allowed) {
setState(() => _isInactive = true);
setState(() => _setInactive(true));
}
break;
@ -77,7 +81,12 @@ class RootState extends State<Root> with WidgetsBindingObserver {
void _reset() {
setState(() {
_postFrameCallback = false;
_isInactive = false;
_setInactive(false);
});
}
void _setInactive(bool value) {
_isInactive = value;
_isInactiveController.add(value);
}
}

View file

@ -1,5 +1,6 @@
import 'dart:ui';
import 'package:cake_wallet/src/screens/send/widgets/send_card.dart';
import 'package:cake_wallet/src/screens/yat/widgets/yat_close_button.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
import 'package:cake_wallet/src/widgets/template_tile.dart';
import 'package:cake_wallet/view_model/send/output.dart';
@ -21,6 +22,8 @@ import 'package:dotted_border/dotted_border.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/src/screens/send/widgets/confirm_sending_alert.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:cake_wallet/src/screens/yat/yat_sending.dart';
class SendPage extends BasePage {
SendPage({@required this.sendViewModel}) :_formKey = GlobalKey<FormState>();
@ -301,6 +304,10 @@ class SendPage extends BasePage {
}
await sendViewModel.createTransaction();
if (!sendViewModel.isBatchSending && sendViewModel.hasYat) {
Navigator.of(context).push<void>(YatSending.createRoute(sendViewModel));
}
},
text: S.of(context).send,
color: Theme.of(context).accentTextTheme.body2.color,
@ -336,7 +343,8 @@ class SendPage extends BasePage {
});
}
if (state is ExecutedSuccessfullyState) {
if (state is ExecutedSuccessfullyState
&& !(!sendViewModel.isBatchSending && sendViewModel.hasYat)) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showPopUp<void>(
context: context,

View file

@ -29,6 +29,6 @@ class SettingsLinkProviderCell extends StandardListRow {
color: Palette.blueCraiola));
static void _launchUrl(String url) async {
if (await canLaunch(url)) await launch(url);
if (await canLaunch(url)) await launch(url, forceSafariVC: false);
}
}

View file

@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class CircleClipper extends CustomClipper<Path> {
CircleClipper(this.center, this.radius);
final Offset center;
final double radius;
@override
Path getClip(Size size) =>
Path()..addOval(Rect.fromCircle(radius: radius, center: center));
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) => true;
}

View file

@ -10,13 +10,9 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:lottie/lottie.dart';
class YatAlert extends StatelessWidget {
YatAlert(this.yatStore)
: baseUrl = YatLink.isDevMode
? YatLink.baseDevUrl
: YatLink.baseReleaseUrl;
YatAlert(this.yatStore);
final YatStore yatStore;
final String baseUrl;
static const aspectRatioImage = 1.133;
final animation = Lottie.asset('assets/animation/anim1.json');
@ -88,8 +84,15 @@ class YatAlert extends StatelessWidget {
.arrow_up_right_square,
mainAxisAlignment: MainAxisAlignment.end,
onPressed: () {
final url = baseUrl + YatLink.createSuffix;
launch(url);
var createNewYatUrl = YatLink.startFlowUrl;
final createNewYatUrlParameters =
yatStore.defineQueryParameters();
if (createNewYatUrlParameters.isNotEmpty) {
createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
}
launch(createNewYatUrl, forceSafariVC: false);
}),
Padding(
padding: EdgeInsets.only(top: 24),
@ -104,13 +107,13 @@ class YatAlert extends StatelessWidget {
.arrow_up_right_square,
mainAxisAlignment: MainAxisAlignment.end,
onPressed: () {
String url = baseUrl + YatLink.signInSuffix;
String url = YatLink.baseUrl + YatLink.signInSuffix;
final parameters =
yatStore.defineQueryParameters();
if (parameters.isNotEmpty) {
url += YatLink.queryParameter + parameters;
}
launch(url);
launch(url, forceSafariVC: false);
})
)
]

View file

@ -160,8 +160,15 @@ class YatPopup extends StatelessWidget {
child: ThirdIntroduction(
onClose: onClose,
onGet: () {
final url = baseUrl + YatLink.createSuffix;
launch(url);
var createNewYatUrl = YatLink.startFlowUrl;
final createNewYatUrlParameters = dashboardViewModel.
yatStore.defineQueryParameters();
if (createNewYatUrlParameters.isNotEmpty) {
createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
}
launch(createNewYatUrl, forceSafariVC: false);
},
onConnect: () {
String url = baseUrl + YatLink.signInSuffix;
@ -170,7 +177,7 @@ class YatPopup extends StatelessWidget {
if (parameters.isNotEmpty) {
url += YatLink.queryParameter + parameters;
}
launch(url);
launch(url, forceSafariVC: false);
}
))
: Container()

View file

@ -0,0 +1,141 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/src/screens/yat/widgets/yat_close_button.dart';
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
import 'package:cake_wallet/src/screens/yat/circle_clipper.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:cake_wallet/core/execution_state.dart';
import 'package:cake_wallet/view_model/send/send_view_model.dart';
class YatSending extends BasePage {
YatSending(this.sendViewModel);
static Route createRoute(SendViewModel sendViewModel) {
return PageRouteBuilder<void>(
transitionDuration: Duration(seconds: 1),
reverseTransitionDuration: Duration(seconds: 1),
opaque: false,
barrierDismissible: false,
pageBuilder: (context, animation, secondaryAnimation) => YatSending(sendViewModel),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
final screenSize = MediaQuery.of(context).size;
final center = Offset(screenSize.width / 2, screenSize.height / 2);
final endRadius = screenSize.height * 1.2;
final tween = Tween(begin: 0.0, end: endRadius);
return ClipPath(
clipper: CircleClipper(center, animation.drive(tween).value),
child: child,
);
},
);
}
final SendViewModel sendViewModel;
@override
Color get titleColor => Colors.white;
@override
bool get resizeToAvoidBottomInset => false;
@override
bool get extendBodyBehindAppBar => true;
@override
AppBarStyle get appBarStyle => AppBarStyle.transparent;
@override
Widget trailing(context) =>
YatCloseButton(onClose: () => Navigator.of(context).pop());
@override
Widget leading(BuildContext context) => Container();
@override
Widget body(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return Container(
color: Colors.black,
child: Stack(
children: [
Center(
child:FutureBuilder<String>(
future: visualisationForEmojiId(sendViewModel.outputs.first.address),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.done:
if (snapshot.hasError || snapshot.data.isEmpty) {
return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
}
return Image.network(
snapshot.data,
scale: 0.7,
loadingBuilder: (Object z, Widget child, ImageChunkEvent loading)
=> loading != null
? CupertinoActivityIndicator(animating: true)
: child);
default:
return Image.asset('assets/images/yat_logo.png', width: screenWidth, color: Colors.white);
}
}),
),
Positioned(
bottom: 20,
child: Container(
width: screenWidth,
padding: EdgeInsets.fromLTRB(20, 0, 20, 10),
child: Column(children: [
Text(
'You are sending ${sendViewModel.outputs.first.cryptoAmount} ${sendViewModel.currency.title} to ${sendViewModel.outputs.first.address}'.toUpperCase(),
style: TextStyle(
fontSize: 28,
decoration: TextDecoration.none,
color: Theme.of(context).accentTextTheme.display3.backgroundColor),
textAlign: TextAlign.center),
Container(height: 30),
LoadingPrimaryButton(
onPressed: () {
sendViewModel.commitTransaction();
showPopUp<void>(
context: context,
builder: (BuildContext popContext) {
return Observer(builder: (_) {
final state = sendViewModel.state;
if (state is FailureState) {
Navigator.of(context).pop();
}
if (state is TransactionCommitted) {
return AlertWithOneAction(
alertTitle: '',
alertContent: S.of(popContext).send_success(
sendViewModel.currency
.toString()),
buttonText: S.of(popContext).ok,
buttonAction: () {
Navigator.of(popContext).pop();
Navigator.of(context).pop();
});
}
return Offstage();
});
});
},
text: S.of(context).confirm_sending,
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
isLoading: sendViewModel.state is IsExecutingState ||
sendViewModel.state is TransactionCommitting)])))]));
}
}

View file

@ -0,0 +1,129 @@
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/screens/yat/widgets/first_introduction.dart';
import 'package:cake_wallet/src/screens/yat/widgets/second_introduction.dart';
import 'package:cake_wallet/src/screens/yat/widgets/third_introduction.dart';
import 'package:cake_wallet/src/screens/yat/widgets/yat_close_button.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:flutter/material.dart';
import 'package:animate_do/animate_do.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:cake_wallet/generated/i18n.dart';
class YatEmojiId extends StatelessWidget {
YatEmojiId(this.emojiId);
static const durationInMilliseconds = 250;
final String emojiId;
final image = Image.asset('assets/images/emoji_popup.png');
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return Stack(
clipBehavior: Clip.none,
alignment: Alignment.bottomCenter,
children: [
AlertBackground(child: Container()),
SlideInUp(
from: 420,
duration: Duration(milliseconds: durationInMilliseconds),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24)),
child: Container(
height: 420,
color: Theme.of(context).buttonColor,
padding: EdgeInsets.fromLTRB(24, 15, 24, 24),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
YatCloseButton(onClose: () => Navigator.of(context).pop())
]
),
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.fromLTRB(10, 5, 10, 5),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(50))
),
child:
Text(
emojiId,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 46,
decoration: TextDecoration.none,
)
))
]
)
]
),
Container(
padding: EdgeInsets.only(left: 6, right: 6),
child: Column(
children: [
Text(
"That's one nice Yat!",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
fontFamily: 'Lato',
color: Theme.of(context).accentTextTheme.display3.backgroundColor,
decoration: TextDecoration.none,
)
),
Padding(
padding: EdgeInsets.only(top: 20),
child: Text(
'You can manage your Yat or purchase additional Yats in your account settings',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.normal,
fontFamily: 'Lato',
color: Theme.of(context)
.accentTextTheme
.display2
.backgroundColor,
decoration: TextDecoration.none,
)
)
)
]
)
),
PrimaryButton(
text: 'Got it',
textColor: Colors.white,
color: Palette.protectiveBlue,
onPressed: () => Navigator.of(context).pop()
)
],
)
)
),
)
],
);
}
}

View file

@ -12,20 +12,28 @@ import 'package:cake_wallet/monero/monero_wallet.dart';
import 'dart:convert';
import 'package:cake_wallet/store/yat/yat_exception.dart';
import 'package:http/http.dart';
import 'dart:async';
part 'yat_store.g.dart';
class YatLink {
static const partnerId = 'CW';
static const baseDevUrl = 'https://yat.fyi';
static const baseReleaseUrl = 'https://y.at';
static const signInSuffix = '/partner/CW/link-email';
static const signInSuffix = '/partner/$partnerId/link-email';
static const createSuffix = '/create';
static const managePath = '/partner/$partnerId/manage';
static const queryParameter = '?addresses=';
static const requestDevUrl = 'https://a.yat.fyi/emoji_id/';
static const requestReleaseUrl = 'https://a.y.at/emoji_id/';
static const isDevMode = true;
static const startFlowUrl = 'https://www.y03btrk.com/4RQSJ/55M6S/';
static const isDevMode = false;
static const tags = <String, List<String>>{"XMR" : ['0x1001', '0x1002'],
"BTC" : ['0x1003'], "LTC" : ['0x3fff']};
static String get baseUrl => YatLink.isDevMode
? YatLink.baseDevUrl
: YatLink.baseReleaseUrl;
}
Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
@ -65,6 +73,18 @@ Future<List<String>> fetchYatAddress(String emojiId, String ticker) async {
return addresses;
}
Future<String> visualisationForEmojiId(String emojiId) async {
final requestURL = YatLink.isDevMode
? YatLink.requestDevUrl
: YatLink.requestReleaseUrl;
final url = requestURL + emojiId + '/json/VisualizerFileLocations';
final response = await get(url);
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
final data = responseJSON['data'] as Map<String, dynamic>;
final result = data['gif'] as String ?? '';
return result;
}
class YatStore = YatStoreBase with _$YatStore;
abstract class YatStoreBase with Store {
@ -74,6 +94,7 @@ abstract class YatStoreBase with Store {
refreshToken = _wallet?.walletInfo?.yatToken ?? '';
reaction((_) => appStore.wallet, _onWalletChange);
reaction((_) => emoji, (String emoji) => _onEmojiChange());
emojiIncommingSC = StreamController<String>();
}
AppStore appStore;
@ -84,6 +105,10 @@ abstract class YatStoreBase with Store {
@observable
String refreshToken;
StreamController<String> emojiIncommingSC;
Stream<String> get emojiIncommingStream => emojiIncommingSC.stream;
@observable
WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo>
_wallet;

View file

@ -25,6 +25,7 @@ import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
import 'package:cake_wallet/store/settings_store.dart';
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
import 'package:cake_wallet/entities/parsed_address.dart';
part 'send_view_model.g.dart';
@ -134,6 +135,11 @@ abstract class SendViewModelBase with Store {
@computed
bool get isElectrumWallet => _wallet is ElectrumWallet;
bool get hasYat
=> outputs.any((out) => out.isParsedAddress
&& out.parsedAddress.parseFrom == ParseFrom.yatRecord);
WalletType get walletType => _wallet.type;
final WalletBase _wallet;
final SettingsStore _settingsStore;

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/src/screens/yat/yat_alert.dart';
import 'package:cake_wallet/store/yat/yat_store.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/view_model/settings/link_list_item.dart';
import 'package:flutter/cupertino.dart';
import 'package:mobx/mobx.dart';
import 'package:package_info/package_info.dart';
@ -69,6 +70,31 @@ abstract class SettingsViewModelBase with Store {
_settingsStore.priority[wallet.type] = priorities.first;
}
var connectYatUrl = YatLink.baseUrl + YatLink.signInSuffix;
final connectYatUrlParameters =
_yatStore.defineQueryParameters();
if (connectYatUrlParameters.isNotEmpty) {
connectYatUrl += YatLink.queryParameter + connectYatUrlParameters;
}
var manageYatUrl = YatLink.baseUrl + YatLink.managePath;
final manageYatUrlParameters =
_yatStore.defineQueryParameters();
if (manageYatUrlParameters.isNotEmpty) {
manageYatUrl += YatLink.queryParameter + manageYatUrlParameters;
}
var createNewYatUrl = YatLink.startFlowUrl;
final createNewYatUrlParameters =
_yatStore.defineQueryParameters();
if (createNewYatUrlParameters.isNotEmpty) {
createNewYatUrl += '?sub1=' + createNewYatUrlParameters;
}
sections = [
[
PickerListItem(
@ -158,16 +184,23 @@ abstract class SettingsViewModelBase with Store {
_settingsStore.currentTheme = theme)
],
[
RegularListItem(
if (_yatStore.emoji.isNotEmpty) ...[
LinkListItem(
title: S.current.manage_yats,
handler: (BuildContext context) async {
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
return YatAlert(_yatStore);
});
},
),
link: manageYatUrl,
linkTitle: ''),
] else ...[
LinkListItem(
title: S.current.connect_yats,
link: connectYatUrl,
linkTitle: ''),
LinkListItem(
title: 'Create new Yats',
link: createNewYatUrl,
linkTitle: '')
]
],
[
RegularListItem(
title: S.current.settings_terms_and_conditions,
handler: (BuildContext context) =>

View file

@ -200,7 +200,7 @@ packages:
name: cli_util
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.3.5"
clock:
dependency: transitive
description:
@ -228,21 +228,21 @@ packages:
name: connectivity
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.3"
version: "3.0.6"
connectivity_for_web:
dependency: transitive
description:
name: connectivity_for_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
version: "0.4.0+1"
connectivity_macos:
dependency: transitive
description:
name: connectivity_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
version: "0.2.1+2"
connectivity_platform_interface:
dependency: transitive
description:
@ -277,7 +277,7 @@ packages:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
version: "1.0.3"
cw_monero:
dependency: "direct main"
description:
@ -312,7 +312,7 @@ packages:
name: devicelocale
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
version: "0.4.3"
dio:
dependency: "direct main"
description:
@ -361,7 +361,7 @@ packages:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0"
version: "6.1.2"
file_picker:
dependency: "direct main"
description:
@ -420,7 +420,7 @@ packages:
name: flutter_plugin_android_lifecycle
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.3"
flutter_secure_storage:
dependency: "direct main"
description:
@ -443,7 +443,7 @@ packages:
name: flutter_spinkit
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
version: "5.1.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -460,7 +460,7 @@ packages:
name: get_it
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.0"
version: "6.1.1"
glob:
dependency: transitive
description:
@ -565,14 +565,14 @@ packages:
name: keyboard_actions
url: "https://pub.dartlang.org"
source: hosted
version: "3.4.0"
version: "3.4.4"
local_auth:
dependency: "direct main"
description:
name: local_auth
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.1.7"
logging:
dependency: transitive
description:
@ -607,7 +607,7 @@ packages:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.0.1"
mobx:
dependency: "direct main"
description:
@ -642,7 +642,7 @@ packages:
name: package_info
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
password:
dependency: "direct main"
description:
@ -712,7 +712,7 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
version: "1.11.1"
permission_handler:
dependency: "direct main"
description:
@ -740,7 +740,7 @@ packages:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
version: "3.0.2"
plugin_platform_interface:
dependency: transitive
description:
@ -768,14 +768,14 @@ packages:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.1"
version: "4.2.3"
protobuf:
dependency: transitive
description:
name: protobuf
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.1.4"
provider:
dependency: "direct main"
description:
@ -789,7 +789,7 @@ packages:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
pubspec_parse:
dependency: transitive
description:
@ -803,7 +803,7 @@ packages:
name: qr
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0"
quiver:
dependency: transitive
description:
@ -824,7 +824,7 @@ packages:
name: share
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.4"
shared_preferences:
dependency: "direct main"
description:
@ -990,21 +990,21 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.3"
version: "6.0.5"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
url_launcher_platform_interface:
dependency: transitive
description:
@ -1018,14 +1018,14 @@ packages:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.4"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.0.2"
uuid:
dependency: "direct main"
description:
@ -1060,7 +1060,7 @@ packages:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.13"
win32:
dependency: transitive
description:

View file

@ -501,7 +501,9 @@
"yat_alert_content" : "Cake Wallet-Benutzer können jetzt alle ihre Lieblingswährungen mit einem einzigartigen Emoji-basierten Benutzernamen senden und empfangen.",
"get_your_yat" : "Holen Sie sich Ihre Yat",
"connect_an_existing_yat" : "Verbinden Sie ein vorhandenes Yat",
"connect_yats": "Yats verbinden",
"yat_address" : "Yat-Adresse",
"yat" : "Yat",
"address_from_yat" : "Diese Adresse ist von ${emoji} auf Yat",
"yat_error" : "Yat-Fehler",
"yat_error_content" : "Keine Adressen mit diesem Yat verknüpft. Versuchen Sie es mit einem anderen Yat",

View file

@ -501,7 +501,9 @@
"yat_alert_content" : "Cake Wallet users can now send and receive all their favorite currencies with a one-of-a-kind emoji-based username.",
"get_your_yat" : "Get your Yat",
"connect_an_existing_yat" : "Connect an existing Yat",
"connect_yats": "Connect Yats",
"yat_address" : "Yat Address",
"yat" : "Yat",
"address_from_yat" : "This address is from ${emoji} on Yat",
"yat_error" : "Yat error",
"yat_error_content" : "No addresses linked with this Yat. Try another Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Obtén tu Yat",
"connect_an_existing_yat" : "Conectar un Yat existente",
"yat_address" : "Dirección de Yat",
"yat" : "Yat",
"connect_yats": "Conectar Yats",
"address_from_yat" : "Esta dirección es de ${emoji} en Yat",
"yat_error" : "Error de Yat",
"yat_error_content" : "No hay direcciones vinculadas con este Yat. Prueba con otro Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "अपना प्राप्त करें Yat",
"connect_an_existing_yat" : "मौजूदा Yat कनेक्ट करें",
"yat_address" : "Yat पता",
"yat" : "Yat",
"connect_yats": "कनेक्ट Yats",
"address_from_yat" : "यह पता ${emoji} से है Yat",
"yat_error" : "Yat त्रुटि",
"yat_error_content" : "इसके साथ कोई पता लिंक नहीं है Yat. कोई दूसरा आज़माएं Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Uzmi svoj Yat",
"connect_an_existing_yat" : "Povežite postojeći Yat",
"yat_address" : "Yat adresa",
"yat" : "Yat",
"connect_yats": "Povežite Yats",
"address_from_yat" : "To je adresa od ${emoji} na Yat",
"yat_error" : "Yat pogreška",
"yat_error_content" : "Nema adresa povezanih s ovim Yat -om. Pokušajte s drugim Yat -om",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Ottieni il tuo Yat",
"connect_an_existing_yat" : "Collegare un Yat esistente",
"yat_address" : "Indirizzo Yat",
"yat" : "Yat",
"connect_yats": "Connetti Yats",
"address_from_yat" : "Questo indirizzo è da ${emoji} in poi Yat",
"yat_error" : "Yat errore",
"yat_error_content" : "Nessun indirizzo collegato a questo Yat. Prova un altro Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "あなたのYatを入手してください",
"connect_an_existing_yat" : "既存のYatを接続します",
"yat_address" : "Yat住所",
"yat" : "Yat",
"connect_yats": "Yatsを接続します",
"address_from_yat" : "このアドレスは ${emoji} からのものです Yat",
"yat_error" : "Yatエラー",
"yat_error_content" : "このYatにリンクされているアドレスはありません。別のYatを試してください",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "당신의 Yat를 얻으십시오",
"connect_an_existing_yat" : "기존 Yat 연결",
"yat_address" : "Yat 주소",
"yat" : "Yat",
"connect_yats": "야츠 연결",
"address_from_yat" : "이 주소는 ${emoji} 의 주소입니다 Yat",
"yat_error" : "Yat 오류",
"yat_error_content" : "이 Yat와 연결된 주소가 없습니다. 다른 Yat 시도",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Haal je Yato",
"connect_an_existing_yat" : "Verbind een bestaande Yat",
"yat_address" : "Yat-adres",
"yat" : "Yat",
"connect_yats": "Verbind Yats",
"address_from_yat" : "Dit adres is van ${emoji} op Yat",
"yat_error" : "Yat fout",
"yat_error_content" : "Geen adressen gekoppeld aan deze Yat. Probeer een andere Yato",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Zdobądź swój Yat",
"connect_an_existing_yat" : "Podłącz istniejący Yat",
"yat_address" : "Adres Yat",
"yat" : "Yat",
"connect_yats": "Połącz Yats",
"address_from_yat" : "Ten adres jest od ${emoji} na Yat",
"yat_error" : "Pomyłka Yata",
"yat_error_content" : "Brak adresów powiązanych z tym Yat. Wypróbuj inny Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Pegue seu Yat",
"connect_an_existing_yat" : "Conecte um Yat existente",
"yat_address" : "Endereço Yat",
"yat" : "Yat",
"connect_yats": "Connect Yats",
"address_from_yat" : "Este endereço é de ${emoji} em Yat",
"yat_error" : "Yat erro",
"yat_error_content" : "Nenhum endereço vinculado a este Yat. Tente outro Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Получить свой Yat",
"connect_an_existing_yat" : "Подключить существующий Yat",
"yat_address" : "Yat адрес",
"yat" : "Yat",
"connect_yats": "Подключить Yats",
"address_from_yat" : "Этот адрес от ${emoji} на Yat",
"yat_error" : "Ошибка Yat",
"yat_error_content" : "Нет адресов, связанных с этим Yat. Попробуйте другой Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "Одержати свій Yat",
"connect_an_existing_yat" : "Підключити існуючий Yat",
"yat_address" : "Yat адреса",
"yat" : "Yat",
"connect_yats": "Підключіть Yats",
"address_from_yat" : "Ця адреса від ${emoji} на Yat",
"yat_error" : "Помилка Yat",
"yat_error_content" : "Немає адрес, пов'язаних з цим Yat. Спробуйте інший Yat",

View file

@ -502,6 +502,8 @@
"get_your_yat" : "得到你的 Yat",
"connect_an_existing_yat" : "連接現有 Yat",
"yat_address" : "Yat 地址",
"yat" : "Yat",
"connect_yats": "连接 Yats",
"address_from_yat" : "此地址來自 Yat 上的 ${emoji}",
"yat_error" : "Yat 誤差",
"yat_error_content" : "沒有與此 Yat 相關聯的地址。 嘗試另一個 Yat",

View file

@ -5,7 +5,7 @@
MIN_IOS_VERSION=10.0
BOOST_URL="https://github.com/cake-tech/Apple-Boost-BuildScript.git"
BOOST_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/Apple-Boost-BuildScript"
BOOST_VERSION=1.74.0
BOOST_VERSION=1.72.0
BOOST_LIBS="random regex graph random chrono thread filesystem system date_time locale serialization program_options"
echo "============================ Boost ============================"