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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,7 +48,8 @@ class _ChooseChestState extends State<OnboardingStepFive> {
),
extendBodyBehindAppBar: true,
body: SafeArea(
child: Column(children: [
child: Stack(children: [
Column(children: [
SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(4),
SizedBox(height: isTall ? 40 : 20),
@ -61,7 +62,8 @@ class _ChooseChestState extends State<OnboardingStepFive> {
Navigator.push(
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),
nextButton(context, "iNotedMyMnemonic".tr(), false, widget.skipIntro),
nextButton(
context, "iNotedMyMnemonic".tr(), false, widget.skipIntro),
SizedBox(height: 35 * ratio),
]),
CommonElements().offlineInfo(context),
]),
),
);
}

View File

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

View File

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

View File

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

View File

@ -41,7 +41,8 @@ class OnboardingStepNine extends StatelessWidget {
),
extendBodyBehindAppBar: true,
body: SafeArea(
child: Column(children: <Widget>[
child: Stack(children: [
Column(children: <Widget>[
SizedBox(height: isTall ? 40 : 20),
common.buildProgressBar(8),
SizedBox(height: isTall ? 40 : 20),
@ -85,7 +86,8 @@ class OnboardingStepNine extends StatelessWidget {
onPrimary: Colors.black, // foreground
),
onPressed: () {
generateWalletProvider.changePinCode(reload: true);
generateWalletProvider.changePinCode(
reload: true);
},
child: Text("chooseAnotherPassword".tr(),
style: TextStyle(
@ -97,6 +99,8 @@ class OnboardingStepNine extends StatelessWidget {
OnboardingStepTen(scanDerivation: scanDerivation), false),
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.
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:
sdk: '>=2.12.0 <3.0.0'