Skip to content
Snippets Groups Projects
Commit 6cad9335 authored by vjrj's avatar vjrj
Browse files

Added again connectivy functinality but disabled for IOS

parent a67ae118
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@
"online_terminal": "Online",
"offline_terminal": "Offline",
"show_qr_to_client": "Show your public key to your client",
"show_qr_to_client_amount": "Display this QR code with that amount to your client",
"show_qr_to_client_amount": "Display this QR code with that amount to your clientG",
"keys_tooltip": "Public and private keys in Ğ1 and Duniter are like a lock and key system, where the public key acts as the lock that can be opened by anyone with the corresponding private key, providing a secure way to authenticate and verify transactions",
"card_validity": "Validity",
"card_validity_tooltip": "Please note that this wallet is only accessible while using this specific browser or app and device. If you delete or reset the browser or app, you will lose access to this wallet and the funds stored in it.",
......@@ -177,5 +177,7 @@
"feedback_submit": "SUBMIT",
"feedback_whats_wrong": "Describe your issue:",
"feedback_draw": "Draw",
"feedback_navigate": "Navigate"
"feedback_navigate": "Navigate",
"bug_report": "Bug Report",
"slidable_tutorial": "Swipe for more actions"
}
......@@ -178,5 +178,7 @@
"feedback_submit": "ENVIAR",
"feedback_whats_wrong": "Describe tu problema:",
"feedback_draw": "Dibuja",
"feedback_navigate": "Navegar"
"feedback_navigate": "Navegar",
"bug_report": "Reportar un error",
"slidable_tutorial": "Desliza para más acciones"
}
import 'dart:async';
import 'dart:io';
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
import 'package:cron/cron.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:feedback/feedback.dart';
......@@ -43,6 +44,7 @@ import 'ui/logger.dart';
import 'ui/notification_controller.dart';
import 'ui/screens/skeleton_screen.dart';
import 'ui/ui_helpers.dart';
import 'ui/widgets/connectivity_widget_wrapper_wrapper.dart';
void main() async {
await NotificationController.initializeLocalNotifications();
......@@ -327,56 +329,61 @@ class _GinkgoAppState extends State<GinkgoApp> {
Widget build(BuildContext context) {
return BlocBuilder<NodeListCubit, NodeListState>(
builder: (BuildContext nodeContext, NodeListState state) {
return FilesystemPickerDefaultOptions(
fileTileSelectMode: FileTileSelectMode.wholeTile,
theme: FilesystemPickerTheme(
topBar: FilesystemPickerTopBarThemeData(
backgroundColor: Theme.of(context).colorScheme.primary,
),
),
child: BetterFeedback(
localizationsDelegates: context.localizationDelegates
..add(CustomFeedbackLocalizationsDelegate()),
child: MaterialApp(
/// Localization is not available for the title.
title: 'Ğ1nkgo',
theme: ThemeData(
useMaterial3: true, colorScheme: lightColorScheme),
darkTheme:
ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
navigatorKey: GinkgoApp.navigatorKey,
/// Theme stuff
themeMode: context.watch<ThemeCubit>().state.themeMode,
/// Localization stuff
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
debugShowCheckedModeBanner: false,
home: context.read<AppCubit>().isIntroViewed
? const SkeletonScreen()
: const AppIntro(),
builder: (BuildContext buildContext, Widget? widget) {
NotificationController.locale = context.locale;
return ResponsiveWrapper.builder(
BouncingScrollWrapper.builder(
context,
widget!,
),
maxWidth: 480,
minWidth: 480,
// defaultScale: true,
breakpoints: <ResponsiveBreakpoint>[
const ResponsiveBreakpoint.resize(200, name: MOBILE),
const ResponsiveBreakpoint.resize(480, name: TABLET),
const ResponsiveBreakpoint.resize(1000, name: DESKTOP),
],
background: Container(color: const Color(0xFFF5F5F5)),
);
},
)));
return ConnectivityAppWrapper(
app: FilesystemPickerDefaultOptions(
fileTileSelectMode: FileTileSelectMode.wholeTile,
theme: FilesystemPickerTheme(
topBar: FilesystemPickerTopBarThemeData(
backgroundColor: Theme.of(context).colorScheme.primary,
),
),
child: BetterFeedback(
localizationsDelegates: context.localizationDelegates
..add(CustomFeedbackLocalizationsDelegate()),
child: MaterialApp(
/// Localization is not available for the title.
title: 'Ğ1nkgo',
theme: ThemeData(
useMaterial3: true, colorScheme: lightColorScheme),
darkTheme: ThemeData(
useMaterial3: true, colorScheme: darkColorScheme),
navigatorKey: GinkgoApp.navigatorKey,
/// Theme stuff
themeMode: context.watch<ThemeCubit>().state.themeMode,
/// Localization stuff
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
debugShowCheckedModeBanner: false,
home: context.read<AppCubit>().isIntroViewed
? const SkeletonScreen()
: const AppIntro(),
builder: (BuildContext buildContext, Widget? widget) {
NotificationController.locale = context.locale;
return ResponsiveWrapper.builder(
BouncingScrollWrapper.builder(
context,
ConnectivityWidgetWrapperWrapper(
message: tr('offline'),
height: 20,
child: widget!,
)),
maxWidth: 480,
minWidth: 480,
// defaultScale: true,
breakpoints: <ResponsiveBreakpoint>[
const ResponsiveBreakpoint.resize(200, name: MOBILE),
const ResponsiveBreakpoint.resize(480, name: TABLET),
const ResponsiveBreakpoint.resize(1000,
name: DESKTOP),
],
background: Container(color: const Color(0xFFF5F5F5)),
);
},
))));
});
}
}
import 'dart:io';
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
class ConnectivityWidgetWrapperWrapper extends ConnectivityWidgetWrapper {
ConnectivityWidgetWrapperWrapper(
{super.key,
Widget? offlineWidget,
required super.child,
super.stacked,
super.message,
super.height})
: super(offlineWidget: !kIsWeb && Platform.isIOS ? child : offlineWidget);
}
......@@ -15,6 +15,7 @@ import '../../../g1/api.dart';
import '../../logger.dart';
import '../../tutorial_keys.dart';
import '../../ui_helpers.dart';
import '../connectivity_widget_wrapper_wrapper.dart';
import 'g1_textfield.dart';
class PayForm extends StatefulWidget {
......@@ -94,24 +95,31 @@ class _PayFormState extends State<PayForm> {
autofillHints: const <String>[],
),
const SizedBox(height: 10.0),
ElevatedButton(
key: paySentKey,
onPressed: (!state.canBeSent() ||
state.amount == null ||
!_commentValidate() ||
!_weHaveBalance(context, state.amount!))
? null
: () async {
try {
await payWithRetry(context, state, false);
} on RetryException {
// Here the transactions can be lost, so we must implement some manual retry use
await payWithRetry(context, state, true);
}
},
style: payBtnStyle,
child: _buildBtn(payBtnText),
),
ConnectivityWidgetWrapperWrapper(
stacked: false,
offlineWidget: ElevatedButton(
onPressed: null,
style: payBtnStyle,
child: _buildBtn(Text(tr('offline'))),
),
child: ElevatedButton(
key: paySentKey,
onPressed: (!state.canBeSent() ||
state.amount == null ||
!_commentValidate() ||
!_weHaveBalance(context, state.amount!))
? null
: () async {
try {
await payWithRetry(context, state, false);
} on RetryException {
// Here the transactions can be lost, so we must implement some manual retry use
await payWithRetry(context, state, true);
}
},
style: payBtnStyle,
child: _buildBtn(payBtnText),
)),
const SizedBox(height: 8),
ValueListenableBuilder<String>(
valueListenable: _feedbackNotifier,
......
......@@ -6,6 +6,8 @@ import '../../../g1/g1_helper.dart';
import '../../../shared_prefs.dart';
import '../../tutorial_keys.dart';
import '../../ui_helpers.dart';
import '../connectivity_widget_wrapper_wrapper.dart';
import 'card_terminal_status.dart';
class CardTerminalScreen extends StatelessWidget {
const CardTerminalScreen({super.key, required this.amount});
......@@ -53,11 +55,10 @@ class CardTerminalScreen extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
/* if (_connectionStatus ==
InternetConnectionStatus.connected)
const CardTerminalStatus(online: true)
else
const CardTerminalStatus(online: false), */
ConnectivityWidgetWrapperWrapper(
offlineWidget:
const CardTerminalStatus(online: false),
child: const CardTerminalStatus(online: true)),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Text(
......@@ -69,10 +70,10 @@ class CardTerminalScreen extends StatelessWidget {
fontSize: amount.length < 5
? 28
: amount.length < 10
? 20
: amount.length < 15
? 14
: 12,
? 20
: amount.length < 15
? 14
: 12,
shadows: <Shadow>[
Shadow(
offset: const Offset(1, 1),
......@@ -87,16 +88,16 @@ class CardTerminalScreen extends StatelessWidget {
])),
Expanded(
child: Column(children: <Widget>[
if (!amount.contains('+'))
Expanded(
child: QrImage(
data: getQrUri(
pubKey: SharedPreferencesHelper().getPubKey(),
locale: context.locale.toLanguageTag(),
amount: amount),
// size: smallScreen(context) ? 95.0 : 140.0)
))
])),
if (!amount.contains('+'))
Expanded(
child: QrImage(
data: getQrUri(
pubKey: SharedPreferencesHelper().getPubKey(),
locale: context.locale.toLanguageTag(),
amount: amount),
// size: smallScreen(context) ? 95.0 : 140.0)
))
])),
Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
......
......@@ -12,17 +12,11 @@ class CardTerminalStatus extends StatelessWidget {
padding: const EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
Icon(
Icons.payment,
color: online ? Colors.green : Colors.red,
),
const SizedBox(width: 8),
Text(online ? tr('online_terminal') : tr('offline_terminal'),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontFamily: 'Roboto Mono',
fontSize: 18,
Tooltip(
message: online ? tr('online_terminal') : tr('offline_terminal'),
child: Icon(
Icons.payment,
color: online ? Colors.green : Colors.red,
)),
],
),
......
......@@ -233,6 +233,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.17.0"
connectivity_plus:
dependency: transitive
description:
name: connectivity_plus
sha256: b74247fad72c171381dbe700ca17da24deac637ab6d43c343b42867acb95c991
url: "https://pub.dev"
source: hosted
version: "3.0.6"
connectivity_plus_platform_interface:
dependency: transitive
description:
name: connectivity_plus_platform_interface
sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a
url: "https://pub.dev"
source: hosted
version: "1.2.4"
connectivity_wrapper:
dependency: "direct main"
description:
name: connectivity_wrapper
sha256: f7c3cefecc57ee290e5e49e7fb9e6a09b5839614b5e30bceebddb9d7925d054c
url: "https://pub.dev"
source: hosted
version: "1.1.3"
convert:
dependency: transitive
description:
......@@ -297,6 +321,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.0"
dbus:
dependency: transitive
description:
name: dbus
sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263"
url: "https://pub.dev"
source: hosted
version: "0.7.8"
dio:
dependency: transitive
description:
......@@ -886,6 +918,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
nm:
dependency: transitive
description:
name: nm
sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
normalize:
dependency: transitive
description:
......
......@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.1.2
version: 0.1.3-SNAPSHOT
environment:
sdk: ">=2.17.1 <3.0.0"
......@@ -84,6 +84,7 @@ dependencies:
feedback: ^2.6.0
feedback_sentry: ^2.4.0
feedback_gitlab: ^2.2.0
connectivity_wrapper: ^1.1.3
dev_dependencies:
flutter_test:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment