Merged cake-105

This commit is contained in:
M 2020-10-22 18:20:26 +03:00
commit 62cf0d0b4c
5 changed files with 3905 additions and 179 deletions

File diff suppressed because it is too large Load diff

2343
assets/text/Wallet_Nouns.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -349,8 +349,8 @@ Future<void> ios_migrate_trades_list(Box<Trade> tradeSource) async {
final masterPassword = await flutterSecureStorage.read( final masterPassword = await flutterSecureStorage.read(
key: 'master_password', iOptions: IOSOptions(syncFlag: "syna")); key: 'master_password', iOptions: IOSOptions(syncFlag: "syna"));
final key = masterPassword.replaceAll('-', ''); final key = masterPassword.replaceAll('-', '');
final decoded = await ios_legacy_helper.decrypt(content, final decoded =
key: key, salt: secrets.keychainSalt); await ios_legacy_helper.decrypt(content, key: key, salt: secrets.salt);
final decodedJson = json.decode(decoded) as List<dynamic>; final decodedJson = json.decode(decoded) as List<dynamic>;
final trades = decodedJson.map((dynamic el) { final trades = decodedJson.map((dynamic el) {
final elAsMap = el as Map<String, dynamic>; final elAsMap = el as Map<String, dynamic>;

View file

@ -24,7 +24,8 @@ class DisclaimerPage extends BasePage {
isReadOnly ? super.leading(context) : null; isReadOnly ? super.leading(context) : null;
@override @override
Widget body(BuildContext context) => DisclaimerPageBody(isReadOnly: isReadOnly); Widget body(BuildContext context) =>
DisclaimerPageBody(isReadOnly: isReadOnly);
} }
class DisclaimerPageBody extends StatefulWidget { class DisclaimerPageBody extends StatefulWidget {
@ -37,7 +38,6 @@ class DisclaimerPageBody extends StatefulWidget {
} }
class DisclaimerBodyState extends State<DisclaimerPageBody> { class DisclaimerBodyState extends State<DisclaimerPageBody> {
static const xmrtoUrl = 'https://xmr.to/terms-of-service'; static const xmrtoUrl = 'https://xmr.to/terms-of-service';
static const changenowUrl = 'https://changenow.io/terms-of-use'; static const changenowUrl = 'https://changenow.io/terms-of-use';
static const morphUrl = 'http://morphtoken.com/terms'; static const morphUrl = 'http://morphtoken.com/terms';
@ -69,173 +69,183 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
SizedBox(height: 10.0), SizedBox(height: 10.0),
Expanded( Expanded(
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
SingleChildScrollView( SingleChildScrollView(
padding: EdgeInsets.only(left: 24.0, right: 24.0), padding: EdgeInsets.only(left: 24.0, right: 24.0),
child: Column( child: Column(
children: <Widget>[
Row(
children: <Widget>[ children: <Widget>[
Row( Expanded(
children: <Widget>[ child: Text(
Expanded( 'Terms and conditions',
child: Text( textAlign: TextAlign.center,
'Terms and conditions', style: TextStyle(
textAlign: TextAlign.center, fontSize: 20.0,
style: TextStyle( fontWeight: FontWeight.bold,
fontSize: 20.0, color: Theme.of(context)
fontWeight: FontWeight.bold, .primaryTextTheme
color: Theme.of(context).primaryTextTheme.title.color .title
), .color),
), ),
)
],
),
SizedBox(
height: 20.0,
),
Row(
children: <Widget>[
Expanded(
child: Text(
'Legal Disclaimer\nAnd\nTerms of Use',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color
),
),
)
],
),
SizedBox(
height: 16.0,
),
Row(
children: <Widget>[
Expanded(
child: Text(
_fileText,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.normal,
color: Theme.of(context).primaryTextTheme.title.color
),
))
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
'Other Terms and Conditions',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color
),
),
)
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () => launchUrl(xmrtoUrl),
child: Text(
xmrtoUrl,
textAlign: TextAlign.left,
style: TextStyle(
color: Palette.blueCraiola,
fontSize: 14.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline),
),
))
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () => launchUrl(changenowUrl),
child: Text(
changenowUrl,
textAlign: TextAlign.left,
style: TextStyle(
color: Palette.blueCraiola,
fontSize: 14.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline),
),
))
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () => launchUrl(morphUrl),
child: Text(
morphUrl,
textAlign: TextAlign.left,
style: TextStyle(
color: Palette.blueCraiola,
fontSize: 14.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline),
),
))
],
),
SizedBox(
height: 16.0,
) )
], ],
), ),
), SizedBox(
Container( height: 20.0,
alignment: Alignment.bottomCenter, ),
child: Container( Row(
height: 12.0, children: <Widget>[
child: ClipRect( Expanded(
child: BackdropFilter( child: Text(
filter: ImageFilter.blur(sigmaX: 0.7, sigmaY: 0.7), 'Legal Disclaimer\nAnd\nTerms of Use',
child: Container( textAlign: TextAlign.center,
decoration: BoxDecoration( style: TextStyle(
gradient: LinearGradient( fontSize: 12.0,
colors: [ fontWeight: FontWeight.bold,
Theme.of(context).backgroundColor.withOpacity(0.0), color: Theme.of(context)
Theme.of(context).backgroundColor, .primaryTextTheme
], .title
begin: FractionalOffset.topCenter, .color),
end: FractionalOffset.bottomCenter, ),
), )
), ],
),
SizedBox(
height: 16.0,
),
Row(
children: <Widget>[
Expanded(
child: Text(
_fileText,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.primaryTextTheme
.title
.color),
))
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: Text(
'Other Terms and Conditions',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.bold,
color: Theme.of(context)
.primaryTextTheme
.title
.color),
),
)
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () => launchUrl(xmrtoUrl),
child: Text(
xmrtoUrl,
textAlign: TextAlign.left,
style: TextStyle(
color: Palette.blueCraiola,
fontSize: 14.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline),
),
))
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () => launchUrl(changenowUrl),
child: Text(
changenowUrl,
textAlign: TextAlign.left,
style: TextStyle(
color: Palette.blueCraiola,
fontSize: 14.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline),
),
))
],
),
SizedBox(
height: 16.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: () => launchUrl(morphUrl),
child: Text(
morphUrl,
textAlign: TextAlign.left,
style: TextStyle(
color: Palette.blueCraiola,
fontSize: 14.0,
fontWeight: FontWeight.normal,
decoration: TextDecoration.underline),
),
))
],
),
SizedBox(
height: 16.0,
)
],
),
),
Container(
alignment: Alignment.bottomCenter,
child: Container(
height: 12.0,
child: ClipRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 0.7, sigmaY: 0.7),
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context)
.backgroundColor
.withOpacity(0.0),
Theme.of(context).backgroundColor,
],
begin: FractionalOffset.topCenter,
end: FractionalOffset.bottomCenter,
), ),
), ),
), ),
), ),
) ),
], ),
)), )
],
)),
if (!widget.isReadOnly) ...[ if (!widget.isReadOnly) ...[
Row( Row(
children: <Widget>[ children: <Widget>[
@ -260,25 +270,31 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: Theme.of(context).primaryTextTheme.caption.color, width: 1.0), color: Theme.of(context)
borderRadius: BorderRadius.all( .primaryTextTheme
Radius.circular(8.0)), .caption
.color,
width: 1.0),
borderRadius:
BorderRadius.all(Radius.circular(8.0)),
color: Theme.of(context).backgroundColor), color: Theme.of(context).backgroundColor),
child: _checked child: _checked
? Icon( ? Icon(
Icons.check, Icons.check,
color: Colors.blue, color: Colors.blue,
size: 20.0, size: 20.0,
) )
: null, : null,
), ),
Text( Text(
'I agree to Terms of Use', 'I agree to Terms of Use',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 14.0, fontSize: 14.0,
color: Theme.of(context).primaryTextTheme.title.color color: Theme.of(context)
), .primaryTextTheme
.title
.color),
) )
], ],
), ),
@ -287,12 +303,12 @@ class DisclaimerBodyState extends State<DisclaimerPageBody> {
], ],
), ),
Container( Container(
padding: padding: EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
EdgeInsets.only(left: 24.0, right: 24.0, bottom: 24.0),
child: PrimaryButton( child: PrimaryButton(
onPressed: _checked ? () => onPressed: _checked
Navigator.of(context).popAndPushNamed(Routes.welcome) ? () =>
: null, Navigator.of(context).popAndPushNamed(Routes.welcome)
: null,
text: 'Accept', text: 'Accept',
color: Colors.green, color: Colors.green,
textColor: Colors.white, textColor: Colors.white,

View file

@ -8,6 +8,8 @@ import 'package:cake_wallet/entities/pathForWallet.dart';
import 'package:cake_wallet/entities/wallet_info.dart'; import 'package:cake_wallet/entities/wallet_info.dart';
import 'package:cake_wallet/entities/wallet_type.dart'; import 'package:cake_wallet/entities/wallet_type.dart';
import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/store/app_store.dart';
import 'package:flutter/services.dart';
import 'dart:math';
part 'wallet_creation_vm.g.dart'; part 'wallet_creation_vm.g.dart';
@ -31,6 +33,24 @@ abstract class WalletCreationVMBase with Store {
final Box<WalletInfo> _walletInfoSource; final Box<WalletInfo> _walletInfoSource;
final AppStore _appStore; final AppStore _appStore;
Future<String> generateName() async {
final adjectiveStringRaw =
await rootBundle.loadString('assets/text/Wallet_Adjectives.txt');
final nounStringRaw =
await rootBundle.loadString('assets/text/Wallet_Nouns.txt');
final randomThing = new Random();
final adjectives = new List<String>.from(adjectiveStringRaw.split("\n"));
final nouns = new List<String>.from(nounStringRaw.split("\n"));
final chosenAdjective = adjectives[randomThing.nextInt(adjectives.length)];
final chosenNoun = nouns[randomThing.nextInt(nouns.length)];
final returnString = chosenAdjective + " " + chosenNoun;
return returnString;
}
Future<void> create({dynamic options}) async { Future<void> create({dynamic options}) async {
try { try {
state = IsExecutingState(); state = IsExecutingState();