add messages about offline status in onboarding screens

This commit is contained in:
poka 2022-08-17 23:01:20 +02:00
parent 0687ae072f
commit 0983c1d01e
18 changed files with 447 additions and 405 deletions

View File

@ -174,5 +174,6 @@
"noContacts": "You don't have any contact", "noContacts": "You don't have any contact",
"addContact": "Add\nto contacts", "addContact": "Add\nto contacts",
"removeContact": "Remove\nthis contact", "removeContact": "Remove\nthis contact",
"derivationsScanProgress": "Scan address {}/{}" "derivationsScanProgress": "Scan address {}/{}",
"youAreOffline": "You are offline..."
} }

View File

@ -174,5 +174,6 @@
"noContacts": "You don't have any contact", "noContacts": "You don't have any contact",
"addContact": "Add\nto contacts", "addContact": "Add\nto contacts",
"removeContact": "Remove\nthis contact", "removeContact": "Remove\nthis contact",
"derivationsScanProgress": "Scan address {}/{}" "derivationsScanProgress": "Scan address {}/{}",
"youAreOffline": "You are offline..."
} }

View File

@ -175,5 +175,6 @@
"noContacts": "Vous n'avez aucun contact", "noContacts": "Vous n'avez aucun contact",
"addContact": "Ajouter\naux contacts", "addContact": "Ajouter\naux contacts",
"removeContact": "Supprimer\nce contact", "removeContact": "Supprimer\nce contact",
"derivationsScanProgress": "Scan de l'adresse {}/{}" "derivationsScanProgress": "Scan de l'adresse {}/{}",
"youAreOffline": "Vous êtes hors ligne..."
} }

View File

@ -69,7 +69,8 @@ class SubstrateSdk with ChangeNotifier {
Future getStorageConst(String call) async { Future getStorageConst(String call) async {
return (await sdk.webView! return (await sdk.webView!
.evalJavascript('api.consts.$call', wrapPromise: false))[0]; .evalJavascript('api.consts.$call', wrapPromise: false) ??
[null])[0];
} }
TxSenderData _setSender() { TxSenderData _setSender() {
@ -307,6 +308,8 @@ class SubstrateSdk with ChangeNotifier {
Future<void> connectNode(BuildContext ctx) async { Future<void> connectNode(BuildContext ctx) async {
HomeProvider homeProvider = Provider.of<HomeProvider>(ctx, listen: false); HomeProvider homeProvider = Provider.of<HomeProvider>(ctx, listen: false);
MyWalletsProvider myWalletProvider =
Provider.of<MyWalletsProvider>(ctx, listen: false);
homeProvider.changeMessage("connectionPending".tr(), 0); homeProvider.changeMessage("connectionPending".tr(), 0);
@ -347,7 +350,7 @@ class SubstrateSdk with ChangeNotifier {
notifyListeners(); notifyListeners();
}); });
// currencyName = await getCurencyName(); await initCurrencyParameters();
notifyListeners(); notifyListeners();
homeProvider.changeMessage( homeProvider.changeMessage(
"wellConnectedToNode" "wellConnectedToNode"
@ -359,7 +362,7 @@ class SubstrateSdk with ChangeNotifier {
debugConnection = res.toString(); debugConnection = res.toString();
notifyListeners(); notifyListeners();
homeProvider.changeMessage("noDuniterEndointAvailable".tr(), 0); homeProvider.changeMessage("noDuniterEndointAvailable".tr(), 0);
// snackNode(ctx, false); if (!myWalletProvider.checkIfWalletExist()) snackNode(homeContext, false);
} }
log.d(sdk.api.connectedNode?.endpoint); log.d(sdk.api.connectedNode?.endpoint);
@ -795,7 +798,7 @@ void snackNode(BuildContext context, bool isConnected) {
String message; String message;
if (!isConnected) { if (!isConnected) {
message = message =
"${"noDuniterNodeAvailableTryLater".tr()}:\n${configBox.get('endpoint').first}"; "noDuniterNodeAvailableTryLater".tr();
} else { } else {
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false); SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);

View File

@ -159,8 +159,7 @@ class CommonElements {
} }
Widget offlineInfo(BuildContext context) { Widget offlineInfo(BuildContext context) {
// SubstrateSdk _sub = Provider.of<SubstrateSdk>(context, listen: false); final double screenWidth = MediaQuery.of(homeContext).size.width;
final double screenWidth = MediaQuery.of(context).size.width;
return Consumer<SubstrateSdk>(builder: (context, sub, _) { return Consumer<SubstrateSdk>(builder: (context, sub, _) {
return Visibility( return Visibility(
visible: !sub.nodeConnected, visible: !sub.nodeConnected,
@ -174,7 +173,7 @@ class CommonElements {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
"Vous êtes hors ligne...", 'youAreOffline'.tr(),
style: TextStyle(color: Colors.grey[50]), style: TextStyle(color: Colors.grey[50]),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),

View File

@ -167,7 +167,6 @@ class HomeScreen extends StatelessWidget {
sub.reload(); sub.reload();
} else { } else {
await sub.connectNode(ctx); await sub.connectNode(ctx);
await sub.initCurrencyParameters();
} }
}); });
} }

View File

@ -49,7 +49,8 @@ class RestoreChest extends StatelessWidget {
child: Text('restoreAChest'.tr()), child: Text('restoreAChest'.tr()),
)), )),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Stack(children: [
Column(children: <Widget>[
SizedBox(height: isTall ? 30 : 15), SizedBox(height: isTall ? 30 : 15),
bubbleSpeak('toRestoreEnterMnemonic'.tr()), bubbleSpeak('toRestoreEnterMnemonic'.tr()),
SizedBox(height: isTall ? 30 : 15), SizedBox(height: isTall ? 30 : 15),
@ -96,7 +97,8 @@ class RestoreChest extends StatelessWidget {
onPrimary: Colors.white, // foreground onPrimary: Colors.white, // foreground
), ),
onPressed: () async { onPressed: () async {
if (await sub.isMnemonicValid(genW.generatedMnemonic!)) { if (await sub
.isMnemonicValid(genW.generatedMnemonic!)) {
genW.resetImportView(); genW.resetImportView();
await Navigator.push( await Navigator.push(
context, context,
@ -154,6 +156,8 @@ class RestoreChest extends StatelessWidget {
) )
]) ])
]), ]),
CommonElements().offlineInfo(context),
]),
), ),
), ),
); );

View File

@ -27,7 +27,8 @@ class OnboardingStepOne extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: common.infoIntro( child: Stack(children: [
common.infoIntro(
context, context,
'geckoGenerateYourWalletFromMnemonic'.tr(), 'geckoGenerateYourWalletFromMnemonic'.tr(),
'fabrication-de-portefeuille.png', 'fabrication-de-portefeuille.png',
@ -36,6 +37,8 @@ class OnboardingStepOne extends StatelessWidget {
0, 0,
isMd: true, isMd: true,
), ),
CommonElements().offlineInfo(context),
]),
), ),
); );
} }

View File

@ -49,7 +49,8 @@ class OnboardingStepTen extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Stack(children: [
Column(children: <Widget>[
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(9), common.buildProgressBar(9),
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
@ -114,8 +115,8 @@ class OnboardingStepTen extends StatelessWidget {
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Text(
'rememberPassword'.tr(), 'rememberPassword'.tr(),
style: style: TextStyle(
TextStyle(fontSize: 16, color: Colors.grey[700]), fontSize: 16, color: Colors.grey[700]),
), ),
const Spacer() const Spacer()
])) ]))
@ -123,6 +124,8 @@ class OnboardingStepTen extends StatelessWidget {
}), }),
const SizedBox(height: 10), const SizedBox(height: 10),
]), ]),
CommonElements().offlineInfo(context),
]),
)); ));
} }

View File

@ -29,13 +29,16 @@ class OnboardingStepTwo extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: common.infoIntro( child: Stack(children: [
common.infoIntro(
context, context,
'keepThisMnemonicSecure'.tr(), 'keepThisMnemonicSecure'.tr(),
'fabrication-de-portefeuille-impossible-sans-phrase.png', 'fabrication-de-portefeuille-impossible-sans-phrase.png',
'>', '>',
const OnboardingStepThree(), const OnboardingStepThree(),
1), 1),
CommonElements().offlineInfo(context),
]),
), ),
); );
} }

View File

@ -29,8 +29,11 @@ class OnboardingStepThree extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: common.infoIntro(context, 'warningForgotPassword'.tr(), child: Stack(children: [
common.infoIntro(context, 'warningForgotPassword'.tr(),
'forgot_password.png'.tr(), '>', const OnboardingStepFor(), 2), 'forgot_password.png'.tr(), '>', const OnboardingStepFor(), 2),
CommonElements().offlineInfo(context),
]),
), ),
); );
} }

View File

@ -29,7 +29,8 @@ class OnboardingStepFor extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: common.infoIntro( child: Stack(children: [
common.infoIntro(
context, context,
'itsTimeToUseAPenAndPaper'.tr(), 'itsTimeToUseAPenAndPaper'.tr(),
'gecko_also_can_forget.png'.tr(), 'gecko_also_can_forget.png'.tr(),
@ -37,6 +38,8 @@ class OnboardingStepFor extends StatelessWidget {
const OnboardingStepFive(), const OnboardingStepFive(),
3, 3,
isMd: true), isMd: true),
CommonElements().offlineInfo(context),
]),
), ),
); );
} }

View File

@ -48,7 +48,8 @@ class _ChooseChestState extends State<OnboardingStepFive> {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Column(children: [ child: Stack(children: [
Column(children: [
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(4), common.buildProgressBar(4),
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
@ -61,7 +62,8 @@ class _ChooseChestState extends State<OnboardingStepFive> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return PrintWallet(generateWalletProvider.generatedMnemonic); return PrintWallet(
generateWalletProvider.generatedMnemonic);
}), }),
); );
}, },
@ -97,9 +99,12 @@ class _ChooseChestState extends State<OnboardingStepFive> {
), ),
), ),
SizedBox(height: 22 * ratio), SizedBox(height: 22 * ratio),
nextButton(context, "iNotedMyMnemonic".tr(), false, widget.skipIntro), nextButton(
context, "iNotedMyMnemonic".tr(), false, widget.skipIntro),
SizedBox(height: 35 * ratio), SizedBox(height: 35 * ratio),
]), ]),
CommonElements().offlineInfo(context),
]),
), ),
); );
} }

View File

@ -51,15 +51,17 @@ class OnboardingStepSix extends StatelessWidget {
), ),
), ),
body: SafeArea( body: SafeArea(
child: Align( child: Stack(children: [
Align(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: Column(children: [ child: Column(children: [
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(5), common.buildProgressBar(5),
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildText( common.buildText(
"didYouNoteMnemonicToBeSureTypeWord".tr( "didYouNoteMnemonicToBeSureTypeWord".tr(args: [
args: [(generateWalletProvider.nbrWord + 1).toString()]), (generateWalletProvider.nbrWord + 1).toString()
]),
20, 20,
true), true),
SizedBox(height: isTall ? 70 : 20), SizedBox(height: isTall ? 70 : 20),
@ -133,6 +135,8 @@ class OnboardingStepSix extends StatelessWidget {
SizedBox(height: 35 * ratio), SizedBox(height: 35 * ratio),
]), ]),
), ),
CommonElements().offlineInfo(context),
]),
), ),
), ),
); );

View File

@ -29,7 +29,8 @@ class OnboardingStepSeven extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: common.infoIntro( child: Stack(children: [
common.infoIntro(
context, context,
'geckoWillGenerateAPassword'.tr(), 'geckoWillGenerateAPassword'.tr(),
'coffre-fort-code-secret-dans-telephone.png', 'coffre-fort-code-secret-dans-telephone.png',
@ -37,6 +38,8 @@ class OnboardingStepSeven extends StatelessWidget {
OnboardingStepEight(scanDerivation: scanDerivation), OnboardingStepEight(scanDerivation: scanDerivation),
6, 6,
boxHeight: 400), boxHeight: 400),
CommonElements().offlineInfo(context),
]),
), ),
); );
} }

View File

@ -29,7 +29,8 @@ class OnboardingStepEight extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: common.infoIntro( child: Stack(children: [
common.infoIntro(
context, context,
'thisPasswordProtectsYourWalletsInASecureChest'.tr(), 'thisPasswordProtectsYourWalletsInASecureChest'.tr(),
'coffre-fort-protege-les-portefeuilles.png', 'coffre-fort-protege-les-portefeuilles.png',
@ -37,6 +38,8 @@ class OnboardingStepEight extends StatelessWidget {
OnboardingStepNine(scanDerivation: scanDerivation), OnboardingStepNine(scanDerivation: scanDerivation),
7, 7,
isMd: true), isMd: true),
CommonElements().offlineInfo(context),
]),
), ),
); );
} }

View File

@ -41,7 +41,8 @@ class OnboardingStepNine extends StatelessWidget {
), ),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Stack(children: [
Column(children: <Widget>[
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(8), common.buildProgressBar(8),
SizedBox(height: isTall ? 40 : 20), SizedBox(height: isTall ? 40 : 20),
@ -85,7 +86,8 @@ class OnboardingStepNine extends StatelessWidget {
onPrimary: Colors.black, // foreground onPrimary: Colors.black, // foreground
), ),
onPressed: () { onPressed: () {
generateWalletProvider.changePinCode(reload: true); generateWalletProvider.changePinCode(
reload: true);
}, },
child: Text("chooseAnotherPassword".tr(), child: Text("chooseAnotherPassword".tr(),
style: TextStyle( style: TextStyle(
@ -97,6 +99,8 @@ class OnboardingStepNine extends StatelessWidget {
OnboardingStepTen(scanDerivation: scanDerivation), false), OnboardingStepTen(scanDerivation: scanDerivation), false),
SizedBox(height: 35 * ratio), SizedBox(height: 35 * ratio),
]), ]),
CommonElements().offlineInfo(context),
]),
)); ));
} }
} }

View File

@ -5,7 +5,7 @@ description: Pay with G1.
# pub.dev using `pub publish`. This is preferred for private packages. # pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.9+22 version: 0.0.9+23
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'