From 56ff964de0ecd11ce71ceea58591aaada22c3715 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 6 Aug 2024 17:58:09 -0700 Subject: [PATCH 1/8] Updated entrypoint script for Dockerfile --- gai-backend/run.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gai-backend/run.sh b/gai-backend/run.sh index fd44dec00..aac7f4c5d 100644 --- a/gai-backend/run.sh +++ b/gai-backend/run.sh @@ -1,4 +1,30 @@ #!/bin/bash + +set -e + +file_env() { + local var="$1" + local fileVar="${var}_FILE" + local def="${2:-}" + + if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then + echo >&2 "error: both $var and $fileVar are set (but are exclusive)" + exit 1 + fi + local val="$def" + if [ "${!var:-}" ]; then + val="${!var}" + elif [ "${!fileVar:-}" ]; then + val="$(< "${!fileVar}")" + fi + export "$var"="$val" + unset "$fileVar" +} + +file_env "ORCHID_GENAI_LLM_AUTH_KEY" +file_env "ORCHID_GENAI_RECIPIENT_KEY" +file_env "ORCHID_GENAI_LLM_URL" + while true do python server.py; From 505d42ff51c3a19050bb6965b20d6829e06a8146 Mon Sep 17 00:00:00 2001 From: Patrick Niemeyer Date: Wed, 21 Aug 2024 22:32:21 -0500 Subject: [PATCH 2/8] app, dapps: Improve UI handling of very small token values. --- app-shared/engine | 2 +- app-shared/flutter | 2 +- gui-orchid/lib/api/orchid_eth/token_type.dart | 26 ++- .../api/orchid_eth/v0/orchid_market_v0.dart | 8 +- .../api/orchid_eth/v1/orchid_market_v1.dart | 8 +- .../lib/api/pricing/orchid_pricing.dart | 4 +- .../lib/api/pricing/orchid_pricing_v0.dart | 2 +- gui-orchid/lib/api/pricing/usd.dart | 6 +- .../lib/common/app_buttons_deprecated.dart | 7 +- .../lib/orchid/account/account_card.dart | 32 ++- .../orchid/account/market_stats_dialog.dart | 14 +- gui-orchid/lib/orchid/account_chart.dart | 8 +- .../field/orchid_labeled_numeric_field.dart | 1 + .../orchid_labeled_token_value_field.dart | 7 +- .../lib/orchid/field/orchid_text_field.dart | 2 + .../field/test_orchid_token_value_field.dart | 82 ++++++++ .../lib/orchid/orchid_action_button.dart | 2 +- gui-orchid/lib/orchid/test_textfield.dart | 5 +- .../account_manager/account_manager_page.dart | 2 +- .../lib/pages/circuit/orchid_hop_page.dart | 4 +- .../lib/pages/connect/connect_page.dart | 2 +- .../pages/connect/connect_status_panel.dart | 4 +- .../pages/connect/manage_accounts_card.dart | 4 +- .../lib/pages/connect/welcome_panel.dart | 10 +- gui-orchid/lib/pages/help/help_overview.dart | 2 +- .../lib/pages/purchase/purchase_page.dart | 8 +- gui-orchid/lib/pages/side_drawer.dart | 2 +- gui-orchid/lib/util/format_currency.dart | 62 ------ gui-orchid/lib/util/format_decimal.dart | 186 ++++++++++++++++++ gui-orchid/pubspec.lock | 179 ++++++++++------- gui-orchid/pubspec.yaml | 20 +- gui-orchid/test/utils_test.dart | 13 ++ modules | 2 +- .../dapp/orchid/dapp_wallet_info_panel.dart | 4 +- .../lib/pages/v0/dapp_move_funds_v0.dart | 2 +- web-ethereum/account_dapp/pubspec.lock | 96 ++++++--- web-ethereum/account_dapp/pubspec.yaml | 3 +- .../lib/pages/orchid_widget_home.dart | 4 +- web-ethereum/price_widget/pubspec.lock | 96 ++++++--- web-ethereum/price_widget/pubspec.yaml | 3 +- web-ethereum/stake_dapp/pubspec.lock | 96 ++++++--- web-ethereum/stake_dapp/pubspec.yaml | 4 +- 42 files changed, 723 insertions(+), 303 deletions(-) create mode 100644 gui-orchid/lib/orchid/field/test_orchid_token_value_field.dart delete mode 100644 gui-orchid/lib/util/format_currency.dart create mode 100644 gui-orchid/lib/util/format_decimal.dart diff --git a/app-shared/engine b/app-shared/engine index 0545f8705..b8800d88b 160000 --- a/app-shared/engine +++ b/app-shared/engine @@ -1 +1 @@ -Subproject commit 0545f8705df301877d787107bac1a6e9fc9ee1ad +Subproject commit b8800d88be4866db1b15f8b954ab2573bba9960f diff --git a/app-shared/flutter b/app-shared/flutter index d211f4286..80c2e8497 160000 --- a/app-shared/flutter +++ b/app-shared/flutter @@ -1 +1 @@ -Subproject commit d211f42860350d914a5ad8102f9ec32764dc6d06 +Subproject commit 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819 diff --git a/gui-orchid/lib/api/orchid_eth/token_type.dart b/gui-orchid/lib/api/orchid_eth/token_type.dart index b2dfeb150..3f05f74dc 100644 --- a/gui-orchid/lib/api/orchid_eth/token_type.dart +++ b/gui-orchid/lib/api/orchid_eth/token_type.dart @@ -4,7 +4,8 @@ import 'package:flutter_svg/svg.dart'; import 'package:orchid/api/pricing/orchid_pricing.dart'; import '../orchid_crypto.dart'; import 'chains.dart'; -import 'package:orchid/util/format_currency.dart' as units; +import 'package:orchid/util/format_decimal.dart' as units; +import 'package:decimal/decimal.dart'; // Token type // Note: Unfortunately Dart does not have a polyomorphic 'this' type so the @@ -47,7 +48,8 @@ class TokenType { required this.iconPath, }); - // Return 1eN where N is the decimal count. + // Return 1eN where N is the 'decimals' value. + // (Note that Dart int can handle up to 2^53-1 on JS and 2^64-1 elsewhere.) int get multiplier { return Math.pow(10, this.decimals).toInt(); } @@ -72,6 +74,11 @@ class TokenType { return fromInt(BigInt.from(val * this.multiplier)); } + // From a number representing the nominal token denomination, e.g. 1.0 OXT + Token fromDecimal(Decimal val) { + return fromInt((val * Decimal.fromInt(this.multiplier)).toBigInt()); + } + @override bool operator ==(Object other) => identical(this, other) || @@ -97,10 +104,14 @@ class Token { Token(this.type, this.intValue); // The float value in nominal units (e.g. ETH, OXT) - double get floatValue { + double get doubleValue { return intValue.toDouble() / type.multiplier; } + Decimal get decimalValue { + return Decimal.fromBigInt(intValue).shift(-type.decimals); + } + /// No token symbol String toFixedLocalized({ required Locale locale, @@ -109,8 +120,8 @@ class Token { int? minPrecision, bool showPrecisionIndicator = false, }) { - return units.formatCurrency( - floatValue, + return units.formatDecimal( + decimalValue, locale: locale, minPrecision: minPrecision, maxPrecision: maxPrecision, @@ -128,7 +139,8 @@ class Token { int? minPrecision, bool showPrecisionIndicator = false, }) { - return units.formatCurrency(floatValue, + print("XXX: format decimal value: $decimalValue"); + return units.formatDecimal(decimalValue, locale: locale, precision: precision, minPrecision: minPrecision, @@ -260,7 +272,7 @@ class Token { @override String toString() { - return 'Token{type: ${type.symbol}, floatValue: $floatValue}'; + return 'Token{type: ${type.symbol}, doubleValue: $doubleValue}'; } } diff --git a/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart b/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart index 320b50377..c65dbc084 100644 --- a/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart +++ b/gui-orchid/lib/api/orchid_eth/v0/orchid_market_v0.dart @@ -34,16 +34,16 @@ class MarketConditionsV0 implements MarketConditions { // log("eth v0: Fetch market conditions"); // TODO: Add refresh option var costToRedeem = await getCostToRedeemTicketV0(); - var limitedByBalance = balance.floatValue <= (escrow / 2.0).floatValue; + var limitedByBalance = balance.doubleValue <= (escrow / 2.0).doubleValue; Token maxFaceValue = LotteryPot.maxTicketFaceValueFor(balance, escrow); // value received as a fraction of ticket face value - double efficiency = maxFaceValue.floatValue == 0 + double efficiency = maxFaceValue.doubleValue == 0 ? 0 : max( 0, - (maxFaceValue - costToRedeem.oxtCostToRedeem).floatValue / - maxFaceValue.floatValue) + (maxFaceValue - costToRedeem.oxtCostToRedeem).doubleValue / + maxFaceValue.doubleValue) .toDouble(); return new MarketConditionsV0( diff --git a/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart b/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart index 56dec27e2..55a6d510c 100644 --- a/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart +++ b/gui-orchid/lib/api/orchid_eth/v1/orchid_market_v1.dart @@ -32,16 +32,16 @@ class MarketConditionsV1 implements MarketConditions { // Infer the chain from the balance token type. Chain chain = balance.type.chain; var costToRedeem = await getCostToRedeemTicket(chain, refresh: refresh); - var limitedByBalance = balance.floatValue <= (escrow / 2.0).floatValue; + var limitedByBalance = balance.doubleValue <= (escrow / 2.0).doubleValue; var maxFaceValue = LotteryPot.maxTicketFaceValueFor(balance, escrow); // value received as a fraction of ticket face value - double efficiency = maxFaceValue.floatValue == 0 + double efficiency = maxFaceValue.doubleValue == 0 ? 0 : max( 0, - (maxFaceValue - costToRedeem).floatValue / - maxFaceValue.floatValue) + (maxFaceValue - costToRedeem).doubleValue / + maxFaceValue.doubleValue) .toDouble(); //log("market conditions for: $balance, $escrow, costToRedeem = $costToRedeem, maxFaceValue=$maxFaceValue"); diff --git a/gui-orchid/lib/api/pricing/orchid_pricing.dart b/gui-orchid/lib/api/pricing/orchid_pricing.dart index 9fdc8fc77..c7b876d7c 100644 --- a/gui-orchid/lib/api/pricing/orchid_pricing.dart +++ b/gui-orchid/lib/api/pricing/orchid_pricing.dart @@ -20,13 +20,13 @@ class OrchidPricing { /// The USD value of the token quantity. Future tokenToUSD(Token token) async { - return USD(token.floatValue * await tokenToUsdRate(token.type)); + return USD(token.doubleValue * await tokenToUsdRate(token.type)); } /// Convert value of from token to equivalant USD value in 'to' token type. Future tokenToToken(Token fromToken, TokenType toType) async { return toType.fromDouble( - fromToken.floatValue * await tokenToTokenRate(fromToken.type, toType)); + fromToken.doubleValue * await tokenToTokenRate(fromToken.type, toType)); } /// (toType / fromType): The conversion rate from fromType to toType diff --git a/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart b/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart index ed93b8604..55b3a2a44 100644 --- a/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart +++ b/gui-orchid/lib/api/pricing/orchid_pricing_v0.dart @@ -54,7 +54,7 @@ class PricingV0 { if (oxt == null) { return null; } - return USD(oxt.floatValue * oxtPriceUSD); + return USD(oxt.doubleValue * oxtPriceUSD); } OXT? toOXT(USD? usd) { diff --git a/gui-orchid/lib/api/pricing/usd.dart b/gui-orchid/lib/api/pricing/usd.dart index 031ae8b5a..51d79c8a1 100644 --- a/gui-orchid/lib/api/pricing/usd.dart +++ b/gui-orchid/lib/api/pricing/usd.dart @@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart'; import 'package:orchid/api/orchid_eth/token_type.dart'; import 'package:orchid/api/orchid_eth/tokens.dart'; import 'package:orchid/util/localization.dart'; -import '../../util/format_currency.dart'; +import '../../util/format_decimal.dart'; class USD extends ScalarValue { static const zero = USD(0.0); @@ -50,7 +50,7 @@ class USD extends ScalarValue { USD? price, bool showSuffix = true, }) { - return ((price ?? USD.zero) * (tokenAmount ?? Tokens.TOK.zero).floatValue) + return ((price ?? USD.zero) * (tokenAmount ?? Tokens.TOK.zero).doubleValue) .formatCurrency( locale: context.locale, precision: 2, @@ -59,7 +59,7 @@ class USD extends ScalarValue { } } -final _formatCurrency = formatCurrency; +final _formatCurrency = formatDouble; class ScalarValue { final T value; diff --git a/gui-orchid/lib/common/app_buttons_deprecated.dart b/gui-orchid/lib/common/app_buttons_deprecated.dart index 29de3b47a..402662715 100644 --- a/gui-orchid/lib/common/app_buttons_deprecated.dart +++ b/gui-orchid/lib/common/app_buttons_deprecated.dart @@ -19,7 +19,7 @@ class FlatButtonDeprecated extends StatelessWidget { @override Widget build(BuildContext context) { final ButtonStyle flatButtonStyle = TextButton.styleFrom( - primary: Colors.black87, + foregroundColor: Colors.black87, minimumSize: Size(88, 36), padding: padding ?? EdgeInsets.symmetric(horizontal: 16.0), shape: shape ?? @@ -61,15 +61,14 @@ class RaisedButtonDeprecated extends StatelessWidget { @override Widget build(BuildContext context) { final ButtonStyle raisedButtonStyle = ElevatedButton.styleFrom( - onPrimary: Colors.black87, - primary: Colors.grey[300], + foregroundColor: Colors.black87, minimumSize: Size(88, 36), padding: padding ?? EdgeInsets.symmetric(horizontal: 16), shape: shape ?? const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(2)), ), - backgroundColor: color, + backgroundColor: color ?? Colors.grey[300], elevation: elevation, tapTargetSize: materialTapTargetSize, disabledBackgroundColor: disabledColor, diff --git a/gui-orchid/lib/orchid/account/account_card.dart b/gui-orchid/lib/orchid/account/account_card.dart index 53c385be9..f77b60375 100644 --- a/gui-orchid/lib/orchid/account/account_card.dart +++ b/gui-orchid/lib/orchid/account/account_card.dart @@ -1,3 +1,4 @@ +import 'package:orchid/api/orchid_platform.dart'; import 'package:orchid/orchid/orchid.dart'; import 'package:orchid/api/orchid_crypto.dart'; import 'package:orchid/api/orchid_eth/tokens.dart'; @@ -15,7 +16,7 @@ import 'package:orchid/orchid/orchid_circular_identicon.dart'; import 'package:orchid/orchid/orchid_circular_progress.dart'; import 'package:orchid/orchid/orchid_gradients.dart'; import 'package:orchid/util/timed_builder.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/api/pricing/usd.dart'; import '../orchid_panel.dart'; import '../../api/orchid_eth/orchid_account_detail.dart'; @@ -360,7 +361,7 @@ class _AccountCardState extends State String? _balanceText() { return widget.accountDetail == null - ? formatCurrency(0.0, locale: context.locale, precision: 2) + ? formatDouble(0.0, locale: context.locale, precision: 2) : (pot?.balance.formatCurrency(locale: context.locale, precision: 2)); } @@ -505,15 +506,32 @@ class _AccountCardState extends State // display token value and symbol on a row with usd price in a row below Widget _buildTokenValueTextRow({Token? value, USD? price, Color? textColor}) { - final valueText = ((value ?? (tokenType ?? Tokens.TOK).zero).formatCurrency( + final valueOrZero = value ?? (tokenType ?? Tokens.TOK).zero; + + final valueText = valueOrZero.formatCurrency( locale: context.locale, minPrecision: 1, - maxPrecision: 5, + maxPrecision: OrchidPlatform.isWeb ? 18 : 4, showPrecisionIndicator: true, showSuffix: false, - )); - final valueWidget = - Text(valueText).extra_large.withColor(textColor ?? Colors.white); + ); + + final fullValueText = valueOrZero.formatCurrency( + locale: context.locale, + minPrecision: 1, + maxPrecision: (tokenType ?? Tokens.TOK).decimals, + showSuffix: false, + ); + + final style = + OrchidText.extra_large.copyWith(color: textColor ?? Colors.white); + final valueWidget = TapToCopyText( + padding: EdgeInsets.zero, + fullValueText, + displayText: valueText, + style: style, + ); + return TokenValueWidgetRow( context: context, child: valueWidget, diff --git a/gui-orchid/lib/orchid/account/market_stats_dialog.dart b/gui-orchid/lib/orchid/account/market_stats_dialog.dart index 2112ebd29..f1d15312b 100644 --- a/gui-orchid/lib/orchid/account/market_stats_dialog.dart +++ b/gui-orchid/lib/orchid/account/market_stats_dialog.dart @@ -6,7 +6,7 @@ import 'package:orchid/api/pricing/orchid_pricing_v0.dart'; import 'package:orchid/common/app_dialogs.dart'; import 'package:orchid/common/link_text.dart'; import 'package:orchid/orchid/orchid.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; class MarketStatsDialog { static Future show({ @@ -29,9 +29,9 @@ class MarketStatsDialog { if (pricing == null) { return; } - var ethPriceText = formatCurrency(1.0 / pricing.ethPriceUSD, + var ethPriceText = formatDouble(1.0 / pricing.ethPriceUSD, locale: context.locale, suffix: 'USD'); - var oxtPriceText = formatCurrency(1.0 / pricing.oxtPriceUSD, + var oxtPriceText = formatDouble(1.0 / pricing.oxtPriceUSD, locale: context.locale, suffix: 'USD'); tokenPrices = [ Text(s.ethPrice + " " + ethPriceText).body2, @@ -41,7 +41,7 @@ class MarketStatsDialog { var tokenType = account.chain.nativeCurrency; var tokenPrice = await OrchidPricing().tokenToUsdRate(tokenType); var priceText = - formatCurrency(tokenPrice, locale: context.locale, suffix: 'USD'); + formatDouble(tokenPrice, locale: context.locale, suffix: 'USD'); tokenPrices = [ Text(tokenType.symbol + ' ' + s.price + ': ' + priceText).body2, ]; @@ -49,7 +49,7 @@ class MarketStatsDialog { // Show gas prices as "GWEI" regardless of token type. var gasPriceGwei = gasPrice.multiplyDouble(1e9); - var gasPriceText = formatCurrency(gasPriceGwei.floatValue, + var gasPriceText = formatDouble(gasPriceGwei.doubleValue, locale: context.locale, suffix: 'GWEI'); String maxFaceValueText = @@ -57,8 +57,8 @@ class MarketStatsDialog { String costToRedeemText = marketConditions.costToRedeem.formatCurrency(locale: context.locale); - bool ticketUnderwater = marketConditions.costToRedeem.floatValue >= - marketConditions.maxFaceValue.floatValue; + bool ticketUnderwater = marketConditions.costToRedeem.doubleValue >= + marketConditions.maxFaceValue.doubleValue; String limitedByText = marketConditions.limitedByBalance ? s.yourMaxTicketValueIsCurrentlyLimitedByYourBalance + diff --git a/gui-orchid/lib/orchid/account_chart.dart b/gui-orchid/lib/orchid/account_chart.dart index bb4ad6c94..aaba34585 100644 --- a/gui-orchid/lib/orchid/account_chart.dart +++ b/gui-orchid/lib/orchid/account_chart.dart @@ -142,16 +142,16 @@ class AccountBalanceChartTicketModel { int get availableTicketsCurrentMax { return pot.maxTicketFaceValue.lteZero() ? 0 - : (pot.balance.floatValue / pot.maxTicketFaceValue.floatValue).floor(); + : (pot.balance.doubleValue / pot.maxTicketFaceValue.doubleValue).floor(); } // The number of tickets that could be written using the max possible face value // at the time of the last high-water mark int get availableTicketsHighWatermarkMax { - return pot.maxTicketFaceValue.floatValue == 0 + return pot.maxTicketFaceValue.doubleValue == 0 ? 0 - : (_lastBalanceHighWatermark.floatValue / - pot.maxTicketFaceValue.floatValue) + : (_lastBalanceHighWatermark.doubleValue / + pot.maxTicketFaceValue.doubleValue) .floor(); } diff --git a/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart b/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart index edb32889b..287cbfad7 100644 --- a/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart +++ b/gui-orchid/lib/orchid/field/orchid_labeled_numeric_field.dart @@ -4,6 +4,7 @@ import 'package:flutter/services.dart'; import 'package:orchid/orchid/field/orchid_labeled_text_field.dart'; import 'package:orchid/orchid/field/value_field_controller.dart'; +/// A styled numeric decimal or integer text field. class OrchidLabeledNumericField extends StatefulWidget { final String label; final NumericValueFieldController? controller; diff --git a/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart b/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart index b2be5fcb0..b454b2a8d 100644 --- a/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart +++ b/gui-orchid/lib/orchid/field/orchid_labeled_token_value_field.dart @@ -1,3 +1,4 @@ +import 'package:decimal/decimal.dart'; import 'package:orchid/common/rounded_rect.dart'; import 'package:orchid/orchid/orchid.dart'; import 'package:orchid/api/orchid_eth/token_type.dart'; @@ -132,11 +133,11 @@ class TypedTokenValueFieldController extends ValueFieldController { return type!.zero; } try { - var value = double.parse( + var value = Decimal.parse( // Allow comma as decimal separator for localization text.replaceAll(',', '.'), ); - return type!.fromDouble(value); + return type!.fromDecimal(value); } catch (err) { return null; } @@ -144,6 +145,6 @@ class TypedTokenValueFieldController extends ValueFieldController { @override set value(Token? value) { - textController.text = value == null ? '' : value.floatValue.toString(); + textController.text = value == null ? '' : value.doubleValue.toString(); } } diff --git a/gui-orchid/lib/orchid/field/orchid_text_field.dart b/gui-orchid/lib/orchid/field/orchid_text_field.dart index 0d5c97da0..141f77b16 100644 --- a/gui-orchid/lib/orchid/field/orchid_text_field.dart +++ b/gui-orchid/lib/orchid/field/orchid_text_field.dart @@ -2,6 +2,8 @@ import 'package:orchid/orchid/orchid.dart'; import 'package:flutter/services.dart'; /// A styled text field with an optional custom trailing component. +/// The text field can be optionally configured as numeric (integer or decimal) with text output. +/// @see OrchidLabledNumericField for a typed numeric field. class OrchidTextField extends StatelessWidget { final String? hintText; final Widget? trailing; diff --git a/gui-orchid/lib/orchid/field/test_orchid_token_value_field.dart b/gui-orchid/lib/orchid/field/test_orchid_token_value_field.dart new file mode 100644 index 000000000..247a0ae2d --- /dev/null +++ b/gui-orchid/lib/orchid/field/test_orchid_token_value_field.dart @@ -0,0 +1,82 @@ +import 'package:orchid/api/orchid_eth/tokens.dart'; +import 'package:orchid/orchid/orchid.dart'; +import 'package:orchid/orchid/test_app.dart'; +import 'orchid_labeled_token_value_field.dart'; + +// Note: This redundant import of material is required in the main dart file. +import 'package:flutter/material.dart'; + + +void main() { + runApp(TestApp(scale: 1.0, content: _Test())); +} + +class _Test extends StatefulWidget { + const _Test({Key? key}) : super(key: key); + + @override + __TestState createState() => __TestState(); +} + +class __TestState extends State<_Test> with TickerProviderStateMixin { + @override + void initState() { + super.initState(); + controller.addListener(() { + print(controller.value?.intValue); + }); + } + + static final tokenType = Tokens.OXT; + final controller = TypedTokenValueFieldController(type: tokenType); + final textFieldDefaultHeightNonDense = 48.0; + + @override + Widget build(BuildContext context) { + TextStyle defaultStyle = TextStyle( + fontWeight: FontWeight.normal, + color: Colors.white, + fontSize: 16, + height: 1.0, + ); + TextStyle baloo2Style = defaultStyle.copyWith(fontFamily: 'Baloo2', height: 0.95); + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + buildExample(defaultStyle), + pady(24), + buildExample(baloo2Style), + ], + ), + ); + } + + Widget buildExample(TextStyle textStyle) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + textStyle.fontFamily ?? "Default", + style: textStyle, + ), + pady(8), + Stack( + alignment: Alignment.center, + children: [ + SizedBox(width: 450, child: _buildTextField(textStyle)), + ], + ), + ], + ); + } + + Widget _buildTextField(TextStyle textStyle) { + return OrchidLabeledTokenValueField( + type: tokenType, + controller: controller, + label: s.balanceToDeposit1, + // labelWidth: 180, + ); + } +} diff --git a/gui-orchid/lib/orchid/orchid_action_button.dart b/gui-orchid/lib/orchid/orchid_action_button.dart index dba5b1686..0155442c5 100644 --- a/gui-orchid/lib/orchid/orchid_action_button.dart +++ b/gui-orchid/lib/orchid/orchid_action_button.dart @@ -62,7 +62,7 @@ class OrchidActionButton extends StatelessWidget { final label = Text(text, style: textStyle ?? OrchidText.button.black); final ButtonStyle buttonStyle = TextButton.styleFrom( - primary: Colors.black87, + foregroundColor: Colors.black87, minimumSize: Size(88, 36), padding: EdgeInsets.zero, backgroundColor: isEnabled ? null : (backgroundColor ?? Color(0xffaca3bc)), diff --git a/gui-orchid/lib/orchid/test_textfield.dart b/gui-orchid/lib/orchid/test_textfield.dart index 72b03cc70..d756adf84 100644 --- a/gui-orchid/lib/orchid/test_textfield.dart +++ b/gui-orchid/lib/orchid/test_textfield.dart @@ -2,8 +2,11 @@ import 'package:orchid/orchid/orchid.dart'; import 'package:orchid/orchid/field/orchid_text_field.dart'; import 'package:orchid/orchid/test_app.dart'; +// Note: This redundant import of material is required in the main dart file. +import 'package:flutter/material.dart'; + void main() { - runApp(TestApp(scale: 5.0, content: _Test())); + runApp(TestApp(scale: 2.0, content: _Test())); } class _Test extends StatefulWidget { diff --git a/gui-orchid/lib/pages/account_manager/account_manager_page.dart b/gui-orchid/lib/pages/account_manager/account_manager_page.dart index 8ab7d966e..08f02d450 100644 --- a/gui-orchid/lib/pages/account_manager/account_manager_page.dart +++ b/gui-orchid/lib/pages/account_manager/account_manager_page.dart @@ -179,7 +179,7 @@ class _AccountManagerPageState extends State { child: PurchaseStatus(), ), pady(8), - Divider(height: 1), + // Divider(height: 1), Expanded( child: accountsEmpty ? _buildNoAccountsEmptyState() diff --git a/gui-orchid/lib/pages/circuit/orchid_hop_page.dart b/gui-orchid/lib/pages/circuit/orchid_hop_page.dart index 22e0e8bee..2a3578818 100644 --- a/gui-orchid/lib/pages/circuit/orchid_hop_page.dart +++ b/gui-orchid/lib/pages/circuit/orchid_hop_page.dart @@ -22,7 +22,7 @@ import 'package:orchid/orchid/account/market_stats_dialog.dart'; import 'package:orchid/orchid/orchid_titled_page_base.dart'; import 'package:orchid/orchid/field/orchid_text_field.dart'; import 'package:orchid/pages/account_manager/account_manager_page.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:styled_text/styled_text.dart'; import '../../common/app_sizes.dart'; import '../../common/app_text.dart'; @@ -363,7 +363,7 @@ class _OrchidHopPageState extends State { width: 150, child: Text(s.balance + ': ' + - formatCurrency(utx.update.endBalance.floatValue, + formatDouble(utx.update.endBalance.doubleValue, locale: context.locale, suffix: 'OXT')), ), padx(8), diff --git a/gui-orchid/lib/pages/connect/connect_page.dart b/gui-orchid/lib/pages/connect/connect_page.dart index f2094b525..86c5ce89d 100644 --- a/gui-orchid/lib/pages/connect/connect_page.dart +++ b/gui-orchid/lib/pages/connect/connect_page.dart @@ -167,7 +167,7 @@ class _ConnectPageState extends State LotteryPot pot = await _selectedAccount!.getLotteryPot(); var tokenToUsd = await OrchidPricing().tokenToUsdRate(pot.balance.type); _bandwidthAvailableGB = - pot.balance.floatValue * tokenToUsd / _bandwidthPrice!.value; + pot.balance.doubleValue * tokenToUsd / _bandwidthPrice!.value; } catch (err) { _bandwidthAvailableGB = null; log("error calculating bandwidth available: $err"); diff --git a/gui-orchid/lib/pages/connect/connect_status_panel.dart b/gui-orchid/lib/pages/connect/connect_status_panel.dart index 89300ce15..8ca9f6f18 100644 --- a/gui-orchid/lib/pages/connect/connect_status_panel.dart +++ b/gui-orchid/lib/pages/connect/connect_status_panel.dart @@ -7,7 +7,7 @@ import 'package:orchid/orchid/orchid_colors.dart'; import 'package:orchid/orchid/orchid_panel.dart'; import 'package:orchid/orchid/orchid_text.dart'; import 'package:orchid/util/localization.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/api/pricing/usd.dart'; import '../app_routes.dart'; @@ -57,7 +57,7 @@ class ConnectStatusPanel extends StatelessWidget { Widget _buildUSDPanel(BuildContext context) { var price = (bandwidthPrice != null && !MockOrchidAPI.hidePrices) - ? '\$' + formatCurrency(bandwidthPrice!.value, locale: context.locale) + ? '\$' + formatDouble(bandwidthPrice!.value, locale: context.locale) : '...'; return _buildPanel( icon: SvgPicture.asset(OrchidAssetSvg.dollars_icon_path, diff --git a/gui-orchid/lib/pages/connect/manage_accounts_card.dart b/gui-orchid/lib/pages/connect/manage_accounts_card.dart index 1efb62411..d6c20a414 100644 --- a/gui-orchid/lib/pages/connect/manage_accounts_card.dart +++ b/gui-orchid/lib/pages/connect/manage_accounts_card.dart @@ -12,7 +12,7 @@ import 'package:orchid/vpn/model/circuit.dart'; import 'package:orchid/vpn/model/circuit_hop.dart'; import 'package:orchid/vpn/model/orchid_hop.dart'; import 'package:orchid/util/localization.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import '../../orchid/orchid_circular_identicon.dart'; import '../../orchid/orchid_panel.dart'; import '../../orchid/orchid_text.dart'; @@ -264,7 +264,7 @@ class _ManageAccountsCardState extends State { : signerAddress.toString(elide: true); final textWidth = signerAddress == null ? null : 120.0; final balanceText = signerAddress == null - ? formatCurrency(0.0, locale: context.locale, precision: 2) + ? formatDouble(0.0, locale: context.locale, precision: 2) : (_selectedAccount?.lotteryPot?.balance .formatCurrency(precision: 2, locale: context.locale) ?? "..."); diff --git a/gui-orchid/lib/pages/connect/welcome_panel.dart b/gui-orchid/lib/pages/connect/welcome_panel.dart index 8e727ffcc..edee4af75 100644 --- a/gui-orchid/lib/pages/connect/welcome_panel.dart +++ b/gui-orchid/lib/pages/connect/welcome_panel.dart @@ -23,7 +23,7 @@ import 'package:orchid/orchid/orchid_circular_identicon.dart'; import 'package:orchid/orchid/orchid_circular_progress.dart'; import 'package:orchid/orchid/orchid_titled_panel.dart'; import 'package:orchid/pages/purchase/purchase_page.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:styled_text/styled_text.dart'; import '../app_routes.dart'; @@ -697,21 +697,21 @@ class _WelcomePanelState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.vpnCredits).body2, - Text(formatCurrency(credits, locale: context.locale)).body2, + Text(formatDouble(credits, locale: context.locale)).body2, ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.blockchainFee).body2, - Text('+ ' + formatCurrency(fee, locale: context.locale)).body2, + Text('+ ' + formatDouble(fee, locale: context.locale)).body2, ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.promotion, style: OrchidText.body2.blueHightlight), - Text('- ' + formatCurrency(promo, locale: context.locale), + Text('- ' + formatDouble(promo, locale: context.locale), style: OrchidText.body2.blueHightlight), ], ), @@ -720,7 +720,7 @@ class _WelcomePanelState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(s.total.toUpperCase()).subtitle, - Text(formatCurrency(total, locale: context.locale)).subtitle, + Text(formatDouble(total, locale: context.locale)).subtitle, ], ) ], diff --git a/gui-orchid/lib/pages/help/help_overview.dart b/gui-orchid/lib/pages/help/help_overview.dart index 71e5140db..be0091184 100644 --- a/gui-orchid/lib/pages/help/help_overview.dart +++ b/gui-orchid/lib/pages/help/help_overview.dart @@ -63,7 +63,7 @@ class _HelpOverviewPageState extends State { return Html.fromElement( documentElement: doc, - onLinkTap: (url, context, attributes, element) { + onLinkTap: (url, attributes, element) { launch(url ?? '', forceSafariVC: false); }, style: { diff --git a/gui-orchid/lib/pages/purchase/purchase_page.dart b/gui-orchid/lib/pages/purchase/purchase_page.dart index 933671da0..793907a0b 100644 --- a/gui-orchid/lib/pages/purchase/purchase_page.dart +++ b/gui-orchid/lib/pages/purchase/purchase_page.dart @@ -22,7 +22,7 @@ import 'package:orchid/orchid/orchid_titled_page_base.dart'; import 'package:in_app_purchase_storekit/store_kit_wrappers.dart'; import 'package:orchid/orchid/orchid_gradients.dart'; import 'package:orchid/orchid/orchid_panel.dart'; -import 'package:orchid/util/format_currency.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/api/pricing/usd.dart'; import 'package:styled_text/styled_text.dart'; import '../../common/app_sizes.dart'; @@ -187,7 +187,7 @@ class _PurchasePageState extends State { final titleStyle = OrchidText.medium_24_050; var payPerUse = s.payPerUseVpnService; var price = (_bandwidthPrice != null && !MockOrchidAPI.hidePrices) - ? "\$" + formatCurrency(_bandwidthPrice!.value, locale: context.locale) + ? "\$" + formatDouble(_bandwidthPrice!.value, locale: context.locale) : "..."; var currentAvgVPNPrice = s.averagePriceIsUSDPerGb(price); var notASub = s.notASubscriptionCreditsDontExpire; @@ -549,12 +549,12 @@ class _PurchasePageState extends State { textAlign: TextAlign.right, ), Text( - '+ ' + formatCurrency(fee, locale: context.locale), + '+ ' + formatDouble(fee, locale: context.locale), style: valueStyle, textAlign: TextAlign.right, ), Text( - '- ' + formatCurrency(promo, locale: context.locale), + '- ' + formatDouble(promo, locale: context.locale), style: valueStyle, textAlign: TextAlign.right, ), diff --git a/gui-orchid/lib/pages/side_drawer.dart b/gui-orchid/lib/pages/side_drawer.dart index ed2d9ac5f..7140b0c48 100644 --- a/gui-orchid/lib/pages/side_drawer.dart +++ b/gui-orchid/lib/pages/side_drawer.dart @@ -204,7 +204,7 @@ class SideDrawerTile extends StatelessWidget { child: Container( child: ListTile( contentPadding: EdgeInsets.only(left: 16, right: 16), - horizontalTitleGap: 0, + // horizontalTitleGap: 0, leading: Padding( padding: EdgeInsets.only(left: hoffset), child: leading, diff --git a/gui-orchid/lib/util/format_currency.dart b/gui-orchid/lib/util/format_currency.dart deleted file mode 100644 index 68f052d77..000000000 --- a/gui-orchid/lib/util/format_currency.dart +++ /dev/null @@ -1,62 +0,0 @@ -import 'dart:ui'; -import 'package:intl/intl.dart'; - -String toFixedLocalized(num value, - {int precision = 2, String ifNull = "...", required Locale locale}) { - return formatCurrency(value, - locale: locale, ifNull: ifNull, precision: precision); -} - -/// Format a currency to default precision with an optional suffix and null behavior. -String formatCurrency( - num? value, { - String? suffix, - - /// The exact number of digits, possibly zero padded, to display after the decimal. - /// If minPrecision and maxPrecision are specified this value is ignored. - /// e.g. 1.00, 1.01 - int precision = 2, - - /// If minPrecision and maxPrecision are specified the value shows the required number - /// of digits after the decimal with a minimum (zero padded) and up to the maximum provided. - /// e.g. 1.0, 1.123456789 - int? maxPrecision, - int? minPrecision, - - /// If true show ellipsis when full precision is not shown - bool showPrecisionIndicator = false, - String ifNull = "...", - required Locale locale, -}) { - if (value == null) { - return ifNull; - } - - final suffixPadded = (suffix != null ? " $suffix" : ""); - - // min/max precision - if (minPrecision != null && maxPrecision != null) { - final format = - "#0." + "0" * minPrecision + "#" * (maxPrecision - minPrecision); - - final restricted = - NumberFormat(format, locale.toLanguageTag()).format(value); - - var precisionIndicator = ''; - if (showPrecisionIndicator) { - const ellipsis = '…'; - final unrestricted = - NumberFormat("#0." + "#" * 16, locale.toLanguageTag()).format(value); - precisionIndicator = - restricted.length < unrestricted.length ? ellipsis : ''; - } - - return restricted + precisionIndicator + suffixPadded; - } - // fixed precision - else { - final format = "#0." + "0" * precision; - return NumberFormat(format, locale.toLanguageTag()).format(value) + - suffixPadded; - } -} diff --git a/gui-orchid/lib/util/format_decimal.dart b/gui-orchid/lib/util/format_decimal.dart new file mode 100644 index 000000000..7243b4e28 --- /dev/null +++ b/gui-orchid/lib/util/format_decimal.dart @@ -0,0 +1,186 @@ +import 'dart:ui'; +import 'package:decimal/decimal.dart'; +import 'package:decimal/intl.dart'; +import 'package:intl/intl.dart'; + +// Legacy-named helper method for formatting decimal with a fixed precision. +String toFixedLocalized(double value, + {int precision = 2, String ifNull = "...", required Locale locale}) { + return formatDouble(value, + locale: locale, ifNull: ifNull, precision: precision); +} + +/// Format a double to default precision with an optional suffix (units) and null behavior. +String formatDouble( + double? value, { + String? suffix, + + /// The exact number of digits, possibly zero padded, to display after the decimal. + /// If minPrecision and maxPrecision are specified this value is ignored. + /// e.g. 1.00, 1.01 + int precision = 2, + + /// If minPrecision and maxPrecision are specified the value shows the required number + /// of digits after the decimal with a minimum (zero padded) and up to the maximum provided. + /// e.g. 1.0, 1.123456789 + int? maxPrecision, + int? minPrecision, + + /// If true show ellipsis when full precision is not shown + bool showPrecisionIndicator = false, + String ifNull = "...", + required Locale locale, +}) { + if (value == null) { + return ifNull; + } + + final suffixPadded = (suffix != null ? " $suffix" : ""); + + // min/max precision + if (minPrecision != null && maxPrecision != null) { + final format = + "#0." + "0" * minPrecision + "#" * (maxPrecision - minPrecision); + + final restricted = + NumberFormat(format, locale.toLanguageTag()).format(value); + + var precisionIndicator = ''; + if (showPrecisionIndicator) { + const ellipsis = '…'; + final unrestricted = + NumberFormat("#0." + "#" * 18, locale.toLanguageTag()).format(value); + precisionIndicator = + restricted.length < unrestricted.length ? ellipsis : ''; + } + + return restricted + precisionIndicator + suffixPadded; + } + // fixed precision + else { + final format = "#0." + "0" * precision; + return NumberFormat(format, locale.toLanguageTag()).format(value) + + suffixPadded; + } +} + +// Note: This is the same logic as formatDouble but there are intl issues preventing +// Note: us from combining the two more at the moment. (see below) +/// Format a decimal to default precision with an optional suffix (units) and null behavior. +String formatDecimal( + Decimal? value, { + String? suffix, + + /// The exact number of digits, possibly zero padded, to display after the decimal. + /// If minPrecision and maxPrecision are specified this value is ignored. + /// e.g. 1.00, 1.01 + int precision = 2, + + /// If minPrecision and maxPrecision are specified the value shows the required number + /// of digits after the decimal with a minimum (zero padded) and up to the maximum provided. + /// e.g. 1.0, 1.123456789 + int? maxPrecision, + int? minPrecision, + + /// If true show ellipsis when full precision is not shown + bool showPrecisionIndicator = false, + String ifNull = "...", + required Locale locale, +}) { + if (value == null) { + return ifNull; + } + + final suffixPadded = (suffix != null ? " $suffix" : ""); + + // Force 'min' fixed digits (e.g. zeroes) after the decimal and then allow up to 'max' fractional digits total. + if (minPrecision != null && maxPrecision != null) { + final format = + "#0." + "0" * minPrecision + "#" * (maxPrecision - minPrecision); + + /// BUG: There is an issue with the decimal package intl integration. + /// "WARNING: For now (2024.05.30) intl doesn't work with " + /// "NumberFormat.maximumFractionDigits greater than 15 on web plateform and 18 otherwise." + // final restricted = DecimalFormatter(NumberFormat(format, locale.toLanguageTag())).format(value); + // Workaround: no internationalization at this stage + var restricted = value.toStringAsFixed(maxPrecision); + + // Implement the min/max manually + restricted = trimAndPadDecimal(restricted, minPrecision, maxPrecision); + print("XXX: restricted: $restricted"); + + var precisionIndicator = ''; + if (showPrecisionIndicator) { + const ellipsis = '…'; + + /// BUG: There is an issue with the decimal package intl integration. + /// "WARNING: For now (2024.05.30) intl doesn't work with " + /// "NumberFormat.maximumFractionDigits greater than 15 on web plateform and 18 otherwise." + // final unrestricted = DecimalFormatter( + // NumberFormat("#0." + "#" * 18, locale.toLanguageTag())) + // .format(value); + // Workaround: no internationalization at this stage + final unrestricted = value.toString(); + + print("XXX: unrestricted: $unrestricted"); + precisionIndicator = + restricted.length < unrestricted.length ? ellipsis : ''; + } + + // Hack some basic internationalization + // replace '.' with the locale-specific decimal separator + final decimalSeparator = + NumberFormat.decimalPattern(locale.toString()).symbols.DECIMAL_SEP; + restricted = restricted.replaceFirst('.', decimalSeparator); + + return restricted + precisionIndicator + suffixPadded; + } + // fixed precision + else { + final format = "#0." + "0" * precision; + return DecimalFormatter(NumberFormat(format, locale.toLanguageTag())) + .format(value) + + suffixPadded; + } +} + +// Temporary workaround for the lack of intl formatting support for long decimals +// in the decimal package (see above). +String trimAndPadDecimal(String value, int minPrecision, int maxPrecision) { + // Handle cases where the value is just '0' or '0.' or '0.0...' + if (value == "0" || value.replaceAll("0", "") == ".") { + value = "0"; + } + + // Ensure there's a decimal point for further processing + if (!value.contains('.')) { + value += '.'; + } + + // Split into integer and fractional parts + List parts = value.split('.'); + String integerPart = parts[0].isEmpty ? '0' : parts[0]; + String fractionalPart = parts.length > 1 ? parts[1] : ''; + + // Apply maxPrecision: truncate if necessary + if (fractionalPart.length > maxPrecision) { + fractionalPart = fractionalPart.substring(0, maxPrecision); + } + + // Apply minPrecision: pad with zeros if necessary + while (fractionalPart.length < minPrecision) { + fractionalPart += '0'; + } + + // Remove trailing zeros beyond minPrecision + if (fractionalPart.length > minPrecision) { + fractionalPart = fractionalPart.replaceAll(RegExp(r'0+$'), ''); + } + + // If the fractional part is empty, return just the integer part with minPrecision zeros + if (fractionalPart.isEmpty) { + fractionalPart = '0' * minPrecision; + } + + return '$integerPart.$fractionalPart'; +} diff --git a/gui-orchid/pubspec.lock b/gui-orchid/pubspec.lock index cddf4b6d4..ceef1d2fb 100644 --- a/gui-orchid/pubspec.lock +++ b/gui-orchid/pubspec.lock @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -89,6 +89,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" dotted_border: dependency: "direct main" description: @@ -162,18 +170,18 @@ packages: dependency: "direct main" description: name: flutter_html - sha256: "342c7908f0a67bcec62b6e0f7cf23e23bafe7f64693665dd35be98d5e783bdfd" + sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee" url: "https://pub.dev" source: hosted - version: "3.0.0-alpha.6" + version: "3.0.0-beta.2" flutter_js: dependency: "direct main" description: name: flutter_js - sha256: "5bf5db354fe78fe24cb90a5fa6b4423d38712440c88e3445c3dc88bc134c452f" + sha256: d19cde4bad2f7c301ff5f69d7b3452ff91f2ca89d153569dd03e544579d8610d url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.8.1" flutter_localizations: dependency: "direct main" description: flutter @@ -209,10 +217,10 @@ packages: dependency: transitive description: name: html - sha256: d9793e10dbe0e6c364f4c59bf3e01fb33a9b2a674bc7a1081693dba0614b6269 + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" url: "https://pub.dev" source: hosted - version: "0.15.1" + version: "0.15.4" http: dependency: "direct main" description: @@ -257,10 +265,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" jdenticon_dart: dependency: "direct main" description: @@ -293,39 +301,70 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + list_counter: + dependency: transitive + description: + name: list_counter + sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237 + url: "https://pub.dev" + source: hosted + version: "1.0.2" matcher: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" mobile_scanner: dependency: "direct main" description: - path: "." - ref: "9e4e9a167980f8413c1d8860873e582d0747edd9" - resolved-ref: "9e4e9a167980f8413c1d8860873e582d0747edd9" - url: "https://github.com/juliansteenbakker/mobile_scanner.git" - source: git - version: "3.0.0-beta.4" + name: mobile_scanner + sha256: "6ac2913ad98c83f558d2c8a55bc8f511bdcf28b86639701c04b04c16da1e9ee1" + url: "https://pub.dev" + source: hosted + version: "5.2.1" nested: dependency: transitive description: @@ -334,22 +373,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" - numerus: - dependency: transitive - description: - name: numerus - sha256: "436759d84f233b40107d0cc31cfa92d24e0960afeb2e506be70926d4cddffd9e" - url: "https://pub.dev" - source: hosted - version: "2.0.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -426,10 +457,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.8" pointycastle: dependency: "direct main" description: @@ -470,6 +501,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -490,66 +529,58 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: eb7cfb572af1ccc8b81f66bfd525ae0e8d196574874105b5c27db64bef9f155a + sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" url: "https://pub.dev" source: hosted - version: "2.0.12" + version: "2.3.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "8e251f3c986002b65fed6396bce81f379fb63c27317d49743cf289fd0fd1ab97" + sha256: a7e8467e9181cef109f601e3f65765685786c1a738a83d7fbbde377589c0d974 url: "https://pub.dev" source: hosted - version: "2.0.14" - shared_preferences_ios: + version: "2.3.1" + shared_preferences_foundation: dependency: transitive description: - name: shared_preferences_ios - sha256: "585a14cefec7da8c9c2fb8cd283a3bb726b4155c0952afe6a0caaa7b2272de34" + name: shared_preferences_foundation + sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.5.2" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: fbc3cd6826896b66a5f576b025e4f344f780c84ea7f8203097a353370607a2c8 + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.1.2" - shared_preferences_macos: - dependency: transitive - description: - name: shared_preferences_macos - sha256: fbb94bf296576f49be37a1496d5951796211a8db0aa22cc0d68c46440dad808c - url: "https://pub.dev" - source: hosted - version: "2.0.4" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3 + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958 + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.4.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "07c274c2115d4d5e4280622abb09f0980e2c5b1fcdc98ae9f59a3bad5bfc1f26" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -583,18 +614,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -615,10 +646,10 @@ packages: dependency: "direct main" description: name: styled_text - sha256: f72928d1ebe8cb149e3b34a689cb1ddca696b808187cf40ac3a0bd183dff379c + sha256: fd624172cf629751b4f171dd0ecf9acf02a06df3f8a81bb56c0caa4f1df706c3 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "8.1.0" sync_http: dependency: transitive description: @@ -647,10 +678,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -723,6 +754,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + url: "https://pub.dev" + source: hosted + version: "14.2.4" wallet: dependency: transitive description: @@ -735,10 +774,10 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.0" web3dart: dependency: "direct main" description: @@ -787,5 +826,5 @@ packages: source: hosted version: "1.0.0" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.7.0" + dart: ">=3.4.0 <4.0.0" + flutter: ">=3.22.0" diff --git a/gui-orchid/pubspec.yaml b/gui-orchid/pubspec.yaml index 708477e33..47993ae30 100644 --- a/gui-orchid/pubspec.yaml +++ b/gui-orchid/pubspec.yaml @@ -20,10 +20,10 @@ dependencies: dotted_border: 2.0.0+2 email_validator: 2.0.1 fixnum: 1.1.0 - flutter_js: 0.8.0 + flutter_js: 0.8.1 flutter: sdk: flutter - flutter_html: 3.0.0-alpha.6 + flutter_html: 3.0.0-beta.2 flutter_localizations: sdk: flutter #flutter_secure_storage: 3.3.5 # XXX: macOS @@ -32,23 +32,25 @@ dependencies: http: 1.1.0 in_app_purchase_storekit: 0.3.5+2 in_app_purchase_android: 0.2.3+7 - intl: 0.18.1 + intl: 0.19.0 jdenticon_dart: 2.0.0 + decimal: 3.0.2 # Tracking this issue which has been merged but is not yet in a tagged release. # https://github.com/juliansteenbakker/mobile_scanner/issues/241 - mobile_scanner: - git: - url: https://github.com/juliansteenbakker/mobile_scanner.git - ref: 9e4e9a167980f8413c1d8860873e582d0747edd9 + # mobile_scanner: + # git: + # url: https://github.com/juliansteenbakker/mobile_scanner.git + # ref: 9e4e9a167980f8413c1d8860873e582d0747edd9 + mobile_scanner: 5.2.1 percent_indicator: 3.0.1 pointycastle: 3.7.3 provider: 5.0.0 qr_flutter: 4.0.0 rxdart: 0.27.7 - shared_preferences: 2.0.12 - styled_text: 7.0.0 + shared_preferences: 2.3.2 + styled_text: 8.1.0 sqflite: 2.0.0+3 url_launcher: 6.0.3 uuid: 3.0.7 diff --git a/gui-orchid/test/utils_test.dart b/gui-orchid/test/utils_test.dart index 96a509f24..a7981e290 100644 --- a/gui-orchid/test/utils_test.dart +++ b/gui-orchid/test/utils_test.dart @@ -7,6 +7,7 @@ import 'package:orchid/api/orchid_crypto.dart'; import 'package:orchid/api/orchid_eth/chains.dart'; import 'package:orchid/api/orchid_eth/token_type.dart'; import 'package:orchid/api/orchid_eth/tokens.dart'; +import 'package:orchid/util/format_decimal.dart'; import 'package:orchid/vpn/purchase/orchid_pac_transaction.dart'; import 'package:orchid/util/cacheable.dart'; import 'package:orchid/util/json.dart'; @@ -200,6 +201,18 @@ void main() { print("bar = " +eval.toString()); }); + test('decimal format util test 1', () async { + TestWidgetsFlutterBinding.ensureInitialized(); + expect(trimAndPadDecimal("0", 2, 8), equals("0.00")); + expect(trimAndPadDecimal(".0", 2, 8), equals("0.00")); + expect(trimAndPadDecimal("0.000000000000000000", 2, 8), equals("0.00")); + expect(trimAndPadDecimal("0.000000123000000000", 2, 8), equals("0.00000012")); + expect(trimAndPadDecimal("1.123456789", 2, 5), equals("1.12345")); + expect(trimAndPadDecimal("1.1", 2, 5), equals("1.10")); + expect(trimAndPadDecimal("1.0", 2, 5), equals("1.00")); + print("passed"); + }); + // }); } diff --git a/modules b/modules index 36568cd9f..fe3ce3733 100755 --- a/modules +++ b/modules @@ -14,7 +14,7 @@ tag lib-shared/boost 'boost-[0-9.]*' tag min-openssl/openssl 'OpenSSL_[0-9_]*[a-z]' tag lib-shared/sqlite 'version-[0-9.]*' -head[app-shared/flutter]=3.13.9 +head[app-shared/flutter]=3.24.0 head[app-shared/engine]=$(cat app-shared/flutter/bin/internal/engine.version) head[min-v8/v8]=$(sed -e '/url = "https:\/\/github.com\/v8\/v8\//!d;s/^.*\///;s/\.tar\.gz",$//' srv-worker/workerd/WORKSPACE) diff --git a/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart b/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart index ffd4f89e1..622da47ec 100644 --- a/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart +++ b/web-ethereum/account_dapp/lib/dapp/orchid/dapp_wallet_info_panel.dart @@ -102,7 +102,7 @@ class DappWalletInfoPanel extends StatelessWidget { final priceStyle = OrchidText.medium_14.newPurpleBright; final tokenType = balance.type; return TapToCopyText( - balance.floatValue.toString(), + balance.decimalValue.toString(), style: OrchidText.title.copyWith(height: 1.8), padding: EdgeInsets.zero, displayWidget: Column( @@ -134,7 +134,7 @@ class DappWalletInfoPanel extends StatelessWidget { TokenPriceBuilder( tokenType: tokenType, builder: (USD? tokenPrice) { - final usdText = ((tokenPrice ?? USD.zero) * balance.floatValue) + final usdText = ((tokenPrice ?? USD.zero) * balance.doubleValue) .formatCurrency(locale: context.locale); return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart b/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart index 24cbe76f9..e71c6913a 100644 --- a/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart +++ b/web-ethereum/account_dapp/lib/pages/v0/dapp_move_funds_v0.dart @@ -19,7 +19,7 @@ class MoveFundsPaneV0 extends StatefulWidget { final bool enabled; const MoveFundsPaneV0({ - Key? key, + Key? key, required this.context, required this.pot, required this.signer, diff --git a/web-ethereum/account_dapp/pubspec.lock b/web-ethereum/account_dapp/pubspec.lock index 32c290a03..4dd07e259 100644 --- a/web-ethereum/account_dapp/pubspec.lock +++ b/web-ethereum/account_dapp/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -161,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" dotted_border: dependency: "direct main" description: @@ -288,10 +296,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" jdenticon_dart: dependency: "direct main" description: @@ -324,6 +332,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -344,26 +376,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" package_config: dependency: transitive description: @@ -376,10 +408,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -508,6 +540,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -581,18 +621,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -629,10 +669,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -721,22 +761,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - watcher: + vm_service: dependency: transitive description: - name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "1.0.2" - web: + version: "14.2.4" + watcher: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.2" web3dart: dependency: "direct main" description: @@ -786,5 +826,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/web-ethereum/account_dapp/pubspec.yaml b/web-ethereum/account_dapp/pubspec.yaml index ca69fa7a8..3a29ef8eb 100644 --- a/web-ethereum/account_dapp/pubspec.yaml +++ b/web-ethereum/account_dapp/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sdk: flutter flutter_svg: 1.0.3 font_awesome_flutter: 9.0.0 - intl: 0.18.1 + intl: 0.19.0 jdenticon_dart: 2.0.0 percent_indicator: 3.0.1 pointycastle: 3.5.0 @@ -29,6 +29,7 @@ dependencies: url_launcher: 6.1.3 uuid: 3.0.5 web3dart: 2.3.3 # Utils used in orchid_crypto + decimal: 3.0.2 #flutter_web3: 2.1.9 # Dapp ether.js and WalletConnect wrapper flutter_web3: diff --git a/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart b/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart index 760423ed6..036a4499b 100644 --- a/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart +++ b/web-ethereum/price_widget/lib/pages/orchid_widget_home.dart @@ -173,7 +173,7 @@ class _OrchidWidgetHomeState extends State { return Container(); } if (_showPricesUSD) { - return Text((tokenPrice * token.floatValue) + return Text((tokenPrice * token.doubleValue) .formatCurrency(locale: context.locale)) .body2; } else { @@ -257,7 +257,7 @@ class _ChainModel { if (version == 0) { costToCreateAccountUSD = (await MarketConditionsV0.getPotStats( efficiency: targetEfficiency, tickets: targetTickets)) - .floatValue * + .doubleValue * tokenPriceUSD; // log('XXX: V0! tokenPrice = $tokenPriceUSD, cost = $costToCreateAccountUSD'); } diff --git a/web-ethereum/price_widget/pubspec.lock b/web-ethereum/price_widget/pubspec.lock index 5ffb67102..248ddb630 100644 --- a/web-ethereum/price_widget/pubspec.lock +++ b/web-ethereum/price_widget/pubspec.lock @@ -109,10 +109,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -145,6 +145,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" fake_async: dependency: transitive description: @@ -249,10 +257,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" js: dependency: transitive description: @@ -277,6 +285,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -297,26 +329,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" package_config: dependency: transitive description: @@ -329,10 +361,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -437,6 +469,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.2" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -510,18 +550,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -558,10 +598,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -650,22 +690,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - watcher: + vm_service: dependency: transitive description: - name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "1.0.2" - web: + version: "14.2.4" + watcher: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.2" web3dart: dependency: "direct main" description: @@ -715,5 +755,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/web-ethereum/price_widget/pubspec.yaml b/web-ethereum/price_widget/pubspec.yaml index c3359f1df..d2023d627 100644 --- a/web-ethereum/price_widget/pubspec.yaml +++ b/web-ethereum/price_widget/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: flutter_lints: ^1.0.0 flutter_svg: 1.0.3 flutter_web3: 2.1.6 - intl: 0.18.1 + intl: 0.19.0 pointycastle: 3.5.0 rxdart: 0.27.7 shared_preferences: 2.0.5 @@ -23,6 +23,7 @@ dependencies: uuid: 3.0.5 url_launcher: 6.1.3 web3dart: 2.3.3 + decimal: 3.0.2 dev_dependencies: flutter_test: diff --git a/web-ethereum/stake_dapp/pubspec.lock b/web-ethereum/stake_dapp/pubspec.lock index 32c290a03..4dd07e259 100644 --- a/web-ethereum/stake_dapp/pubspec.lock +++ b/web-ethereum/stake_dapp/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -161,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "4140a688f9e443e2f4de3a1162387bf25e1ac6d51e24c9da263f245210f41440" + url: "https://pub.dev" + source: hosted + version: "3.0.2" dotted_border: dependency: "direct main" description: @@ -288,10 +296,10 @@ packages: dependency: "direct main" description: name: intl - sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf url: "https://pub.dev" source: hosted - version: "0.18.1" + version: "0.19.0" jdenticon_dart: dependency: "direct main" description: @@ -324,6 +332,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + url: "https://pub.dev" + source: hosted + version: "10.0.5" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + url: "https://pub.dev" + source: hosted + version: "3.0.5" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" lints: dependency: transitive description: @@ -344,26 +376,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.11.1" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" package_config: dependency: transitive description: @@ -376,10 +408,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -508,6 +540,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" rxdart: dependency: "direct main" description: @@ -581,18 +621,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -629,10 +669,10 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.7.2" typed_data: dependency: transitive description: @@ -721,22 +761,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - watcher: + vm_service: dependency: transitive description: - name: watcher - sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" + name: vm_service + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "1.0.2" - web: + version: "14.2.4" + watcher: dependency: transitive description: - name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + name: watcher + sha256: "6a7f46926b01ce81bfc339da6a7f20afbe7733eff9846f6d6a5466aa4c6667c0" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "1.0.2" web3dart: dependency: "direct main" description: @@ -786,5 +826,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" - flutter: ">=3.3.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/web-ethereum/stake_dapp/pubspec.yaml b/web-ethereum/stake_dapp/pubspec.yaml index ca69fa7a8..7d03942d1 100644 --- a/web-ethereum/stake_dapp/pubspec.yaml +++ b/web-ethereum/stake_dapp/pubspec.yaml @@ -18,7 +18,7 @@ dependencies: sdk: flutter flutter_svg: 1.0.3 font_awesome_flutter: 9.0.0 - intl: 0.18.1 + intl: 0.19.0 jdenticon_dart: 2.0.0 percent_indicator: 3.0.1 pointycastle: 3.5.0 @@ -29,6 +29,8 @@ dependencies: url_launcher: 6.1.3 uuid: 3.0.5 web3dart: 2.3.3 # Utils used in orchid_crypto + decimal: 3.0.2 + #flutter_web3: 2.1.9 # Dapp ether.js and WalletConnect wrapper flutter_web3: From ad98f3cf52dc216fe8a50dd506d938233f04766c Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 28 Aug 2024 07:33:22 -0700 Subject: [PATCH 3/8] Updated Dockerfile --- gai-backend/Dockerfile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/gai-backend/Dockerfile b/gai-backend/Dockerfile index 2b7efb4da..44cd50e8f 100644 --- a/gai-backend/Dockerfile +++ b/gai-backend/Dockerfile @@ -1,39 +1,38 @@ FROM python:3.8.5 ENV TINI_VERSION="v0.19.0" +WORKDIR /gai-backend -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini -RUN chmod +x /tini +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini ./tini +RUN chmod +x ./tini RUN pip install -U \ pip \ setuptools \ wheel -WORKDIR /gai-backend COPY requirements.txt ./ -COPY run.sh / -RUN chmod +x /run.sh +COPY run.sh ./ +RUN chmod +x ./run.sh COPY *.py ./ RUN pip install -r requirements.txt -COPY . . - -RUN useradd -m -r gai && chown gai /gai-backend +#COPY . . +RUN useradd -m -r gai && chown -R gai /gai-backend USER gai -ENV ORCHID_GENAI_ADDR=127.0.0.1 +ENV ORCHID_GENAI_ADDR=0.0.0.0 ENV ORCHID_GENAI_PORT=8000 ENV ORCHID_GENAI_LLM_MODEL="open-mixtral-8x22b" -ENV ORCHID_GENAI_RECIPIENT_KEY="" -ENV ORCHID_GENAI_LLM_AUTH_KEY="" +#ENV ORCHID_GENAI_RECIPIENT_KEY="" +#ENV ORCHID_GENAI_LLM_AUTH_KEY="" ENV ORCHID_GENAI_LLM_URL="https://api.mistral.ai/v1/chat/completions" -ENV ORCHID_GENAI_LLM_PARAMS="{}" +#ENV ORCHID_GENAI_LLM_PARAMS="{}" -ENTRYPOINT ["/tini", "--", "/run.sh"] +ENTRYPOINT ["./tini", "--", "./run.sh"] EXPOSE 8000 8000 HEALTHCHECK CMD bash -c "exec 6<> /dev/tcp/localhost/8000" From 644a27c2f38be8d202b5f48f3b4c3c742c005861 Mon Sep 17 00:00:00 2001 From: Patrick Niemeyer Date: Fri, 30 Aug 2024 13:39:42 -0500 Subject: [PATCH 4/8] app: Upgrade Android IAP to billing API 6.2. --- .../lib/pages/purchase/purchase_page.dart | 4 +- .../lib/vpn/purchase/android_purchase.dart | 57 ++++++++++++------- gui-orchid/lib/vpn/purchase/orchid_pac.dart | 9 ++- .../lib/vpn/purchase/orchid_pac_server.dart | 14 +++-- gui-orchid/pubspec.yaml | 11 +--- 5 files changed, 58 insertions(+), 37 deletions(-) diff --git a/gui-orchid/lib/pages/purchase/purchase_page.dart b/gui-orchid/lib/pages/purchase/purchase_page.dart index 793907a0b..cd941cb7a 100644 --- a/gui-orchid/lib/pages/purchase/purchase_page.dart +++ b/gui-orchid/lib/pages/purchase/purchase_page.dart @@ -85,6 +85,7 @@ class _PurchasePageState extends State { } Widget buildPage(BuildContext context) { + // log("iap: purchase page storeDown: $_storeDown, showStoreMessage: $_showStoreMessage, storeStatus: $_storeStatus"); return SafeArea( child: Stack( children: [ @@ -119,9 +120,10 @@ class _PurchasePageState extends State { } Widget _buildStoreMessage() { + // log("iap: buildStoreMessage"); Size size = MediaQuery.of(context).size; var text = _storeStatus?.message != null - ? _storeStatus!.message + ? _storeStatus!.message! : s.theOrchidStoreIsTemporarilyUnavailablePleaseCheckBackIn; return Center( child: Container( diff --git a/gui-orchid/lib/vpn/purchase/android_purchase.dart b/gui-orchid/lib/vpn/purchase/android_purchase.dart index ba6b6e56a..19291dce9 100644 --- a/gui-orchid/lib/vpn/purchase/android_purchase.dart +++ b/gui-orchid/lib/vpn/purchase/android_purchase.dart @@ -7,7 +7,6 @@ import 'orchid_purchase.dart'; import 'package:in_app_purchase_android/billing_client_wrappers.dart'; class AndroidOrchidPurchaseAPI extends OrchidPurchaseAPI { - late BillingClient _billingClient; AndroidOrchidPurchaseAPI() : super.internal(); @@ -28,17 +27,21 @@ class AndroidOrchidPurchaseAPI extends OrchidPurchaseAPI { return OrchidPurchaseAPI.apiConfigWithOverrides(prodAPIConfig); } - @override Future initStoreListenerImpl() async { try { - _billingClient = BillingClient(_onPurchaseResult); + // UserSelectedAlternativeBillingListener alternativeBillingListener = (billingResult) { + // log('iap: alternative billing listener: $billingResult'); + // }; + UserSelectedAlternativeBillingListener? alternativeBillingListener = null; + _billingClient = + BillingClient(_onPurchaseResult, alternativeBillingListener); // _billingClient.enablePendingPurchases(); var billingResult = await _billingClient.startConnection( onBillingServiceDisconnected: () { log('iap: billing client disconnected'); }); - + if (billingResult.responseCode == BillingResponse.ok) { log('iap: billing client setup done'); } else { @@ -52,7 +55,7 @@ class AndroidOrchidPurchaseAPI extends OrchidPurchaseAPI { @override Future purchaseImpl(PAC pac) async { var billingResultWrapper = - await _billingClient.launchBillingFlow(sku: pac.productId); + await _billingClient.launchBillingFlow(product: pac.productId); log('iap: billing result response = ${billingResultWrapper.responseCode}'); } @@ -67,7 +70,8 @@ class AndroidOrchidPurchaseAPI extends OrchidPurchaseAPI { if (purchasesResult.responseCode != BillingResponse.ok) { log('iap: Error: purchase result response code: ${purchasesResult.responseCode}'); (PacTransaction.shared.get()) - ?.error('iap failed 1: responseCode = ${purchasesResult.responseCode}') + ?.error( + 'iap failed 1: responseCode = ${purchasesResult.responseCode}') .save(); return; } @@ -120,27 +124,40 @@ class AndroidOrchidPurchaseAPI extends OrchidPurchaseAPI { var skuList = OrchidPurchaseAPI.pacProductIds; log('iap: product ids requested: $skuList'); - var skuDetailsResponse = await _billingClient.querySkuDetails( - skuType: SkuType.inapp, skusList: skuList); - log('iap: sku query billing result: ${skuDetailsResponse.billingResult}'); - log('iap: sku details list: ${skuDetailsResponse.skuDetailsList}'); - - var toPAC = (SkuDetailsWrapper prod) { - double localizedPrice = prod.originalPriceAmountMicros / 1e6; - String currencyCode = prod.priceCurrencyCode; - String currencySymbol = prod.price[0]; - log('iap: originalPriceAmountMicros=${prod.originalPriceAmountMicros}, currencyCode=${prod.priceCurrencyCode}, currencySymbol=${prod.price[0]}'); - var productId = prod.sku; - return PAC( + List productList = skuList.map((sku) { + return ProductWrapper(productId: sku, productType: ProductType.inapp); + }).toList(); + var productDetailsResponse = + await _billingClient.queryProductDetails(productList: productList); + log('iap: sku query billing result: ${productDetailsResponse.billingResult}'); + log('iap: sku details list: ${productDetailsResponse.productDetailsList}'); + + PAC? Function(ProductDetailsWrapper prod) toPAC = + (ProductDetailsWrapper prod) { + final otp = prod.oneTimePurchaseOfferDetails; + if (otp == null) { + log('iap: no oneTimePurchaseOfferDetails for product: ${prod.productId}'); + return null; + } + // double localizedPrice = prod.originalPriceAmountMicros / 1e6; + double localizedPrice = otp.priceAmountMicros / 1e6; + // String currencyCode = prod.priceCurrencyCode; + String currencyCode = otp.priceCurrencyCode; + var productId = prod.productId; + var pac = PAC( productId: productId, localPrice: localizedPrice, localCurrencyCode: currencyCode, - localCurrencySymbol: currencySymbol, usdPriceExact: OrchidPurchaseAPI.usdPriceForProduct(productId), ); + log('iap: priceAmountMicros=${otp.priceAmountMicros}, currencyCode=${otp.priceCurrencyCode}, localCurrencySymbol=${pac.localCurrencySymbol}'); + return pac; }; - var pacs = skuDetailsResponse.skuDetailsList.map(toPAC).toList(); + var pacs = productDetailsResponse.productDetailsList + .map(toPAC) + .whereType() // remove nulls + .toList(); Map products = {for (var pac in pacs) pac.productId: pac}; //productsCached = products; log('iap: returning products: $products'); diff --git a/gui-orchid/lib/vpn/purchase/orchid_pac.dart b/gui-orchid/lib/vpn/purchase/orchid_pac.dart index 7e98159b1..e34c34421 100644 --- a/gui-orchid/lib/vpn/purchase/orchid_pac.dart +++ b/gui-orchid/lib/vpn/purchase/orchid_pac.dart @@ -6,7 +6,7 @@ class PAC { final String productId; final double localPrice; final String localCurrencyCode; // e.g. 'USD' - final String localCurrencySymbol; // e.g. '$' + late String localCurrencySymbol; // e.g. '$' final USD usdPriceExact; /// Format the local price as a currency value with symbol. @@ -24,9 +24,12 @@ class PAC { required this.productId, required this.localPrice, required this.localCurrencyCode, - required this.localCurrencySymbol, required this.usdPriceExact, - }); + String? localCurrencySymbol, + }) { + this.localCurrencySymbol = localCurrencySymbol ?? + NumberFormat.simpleCurrency(name: localCurrencyCode).currencySymbol; + } @override String toString() { diff --git a/gui-orchid/lib/vpn/purchase/orchid_pac_server.dart b/gui-orchid/lib/vpn/purchase/orchid_pac_server.dart index 4359b1019..d06788f43 100644 --- a/gui-orchid/lib/vpn/purchase/orchid_pac_server.dart +++ b/gui-orchid/lib/vpn/purchase/orchid_pac_server.dart @@ -377,9 +377,9 @@ class OrchidPACServer { Json.toIntSafe(responseJson['store_status'], defaultValue: 0); // parse store message - var jsonMessage = Json.trimStringOrNull(responseJson['message']); - String message = (OrchidUserConfig().getUserConfig()) - .evalStringDefault('pacs.storeMessage', jsonMessage ?? ''); + String? jsonMessage = Json.trimStringOrNull(responseJson['message']); + String? message = (OrchidUserConfig().getUserConfig()) + .evalStringDefaultNullable('pacs.storeMessage', jsonMessage); // parse the seller address map // TODO: ... @@ -462,12 +462,18 @@ class PACStoreStatus { final bool open; // Message to display or null if none. - final String message; + final String? message; // product status //Map product; PACStoreStatus({required this.message, required this.open}); + + // tostring + @override + String toString() { + return 'PACStoreStatus{open: $open, message: $message}'; + } } class PacAccount { diff --git a/gui-orchid/pubspec.yaml b/gui-orchid/pubspec.yaml index 47993ae30..e8f4347e1 100644 --- a/gui-orchid/pubspec.yaml +++ b/gui-orchid/pubspec.yaml @@ -31,19 +31,12 @@ dependencies: font_awesome_flutter: 9.0.0 http: 1.1.0 in_app_purchase_storekit: 0.3.5+2 - in_app_purchase_android: 0.2.3+7 +# in_app_purchase_android: 0.2.3+7 + in_app_purchase_android: 0.3.6+8 intl: 0.19.0 jdenticon_dart: 2.0.0 decimal: 3.0.2 - - # Tracking this issue which has been merged but is not yet in a tagged release. - # https://github.com/juliansteenbakker/mobile_scanner/issues/241 - # mobile_scanner: - # git: - # url: https://github.com/juliansteenbakker/mobile_scanner.git - # ref: 9e4e9a167980f8413c1d8860873e582d0747edd9 mobile_scanner: 5.2.1 - percent_indicator: 3.0.1 pointycastle: 3.7.3 provider: 5.0.0 From 03e941515ef1a17853c8c5e4a78fad7e13e8e65d Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sun, 1 Sep 2024 20:58:33 -0700 Subject: [PATCH 5/8] Add a couple clang flags I saw in CocoaPods+Xcode. --- env/target-any.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/env/target-any.mk b/env/target-any.mk index d735b2fd9..ace3c87c6 100644 --- a/env/target-any.mk +++ b/env/target-any.mk @@ -79,6 +79,8 @@ cflags += -Wno-tautological-overlap-compare cflags += -fmessage-length=0 cflags += -ferror-limit=0 cflags += -ftemplate-backtrace-limit=0 +cflags += -fmacro-backtrace-limit=0 +cflags += -fdiagnostics-show-note-include-stack beta := false From 03c963a6f31c98c98146c6687ff19b64d0ad3a05 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 2 Sep 2024 15:42:59 -0700 Subject: [PATCH 6/8] Upgrade to the r27 NDK and fix a ton of new lints. --- .github/workflows/main.yml | 2 +- README.md | 2 +- app-linux/source/main.cpp | 2 +- env/checks.mk | 26 +++++++++++--- env/output.mk | 2 +- env/revision.sh | 4 ++- env/setup-ndk.sh | 11 +++++- lib-protocol/source/drain.hpp | 2 +- lib-protocol/source/jsonrpc.hpp | 10 +++--- lib-protocol/source/lwip.hpp | 1 + lib-protocol/source/memory.cpp | 58 ++++++++++++++++--------------- lib-protocol/source/nest.hpp | 2 +- lib-protocol/source/spawn.hpp | 2 +- lib-protocol/source/transport.cpp | 4 ++- lib-shared/source/address.hpp | 2 ++ lib-shared/source/buffer.hpp | 18 +++++----- min-wireshark/target.mk | 10 ++++++ srv-daemon/source/egress.cpp | 6 ++++ srv-daemon/source/engine.cpp | 2 ++ srv-daemon/source/lottery.cpp | 2 +- srv-daemon/source/lottery0.hpp | 4 +-- srv-daemon/source/lottery1.hpp | 2 +- srv-daemon/source/server.cpp | 16 +++++---- srv-kernel/makefile | 1 + srv-worker/capnproto.mk | 2 ++ vpn-apple/source/family.hpp | 2 +- vpn-apple/source/protect.cpp | 2 +- vpn-shared/source/capture.cpp | 5 ++- vpn-shared/source/client.cpp | 2 +- 29 files changed, 132 insertions(+), 72 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0ba16726b..b27012704 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -370,7 +370,7 @@ jobs: build-lnx-bad: needs: [cache-submodule] - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index cc91ebf97..2d7674b4b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Orchid is a decentralized marketplace "for bandwidth"; providers run a server (i Many users would like to compile Orchid. Thankfully, Orchid is extremely easy to build... so easy, in fact, that a lot of people seem confused by a lack of complex instructions :(. Every single library dependency of Orchid is included as a git submodule (so don't forget to run "git submodule update --init --recursive") and is compiled by the Orchid build system, so there is no need for a lengthy DEPS list: there are no "external" steps (as you often see with many other C/C++ projects). -Of course, you do need to have the requisite build tooling installed... in addition to the standard set of C/C++ development tools (autotools, bison/flex, make, etc.) we specifically require clang (for which I'm truly sorry: maybe one day we'll support gcc) and ldd (neither binutils ld nor gold are sufficient). Some of the build scripts for our dependencies use Python (I think only 3.x), one insists on being built using meson/ninja, and we use a couple libraries that are written in Rust. +Of course, you do need to have the requisite build tooling installed... in addition to the standard set of C/C++ development tools (autotools, bison/flex, make, etc.) we specifically require clang 16+ (for which I'm truly sorry: maybe one day we'll support gcc) and ldd (neither binutils ld nor gold are sufficient). Some of the build scripts for our dependencies use Python (I think only 3.x), one insists on being built using meson/ninja, and we use a couple libraries that are written in Rust. (At this point I will note, as this has come up multiple times: it is neither practical nor appropriate for Orchid's documentation to detail how to install any of these toolchains. The instructions are different for every operating system, are different for every single distribution of Linux, and are often even different for specific versions of a distribution. FWIW, developers already have most of this software installed; and, if you don't, these projects have their own documentation.) diff --git a/app-linux/source/main.cpp b/app-linux/source/main.cpp index 0b72ee057..0874e84da 100644 --- a/app-linux/source/main.cpp +++ b/app-linux/source/main.cpp @@ -32,7 +32,7 @@ struct _MyApplication { char **dart_entrypoint_arguments; }; -// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables,performance-no-int-to-ptr) +// NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange,cppcoreguidelines-avoid-non-const-global-variables,performance-no-int-to-ptr) G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) static void my_application_activate(GApplication *application) { diff --git a/env/checks.mk b/env/checks.mk index bd6d2f358..58ec97edc 100644 --- a/env/checks.mk +++ b/env/checks.mk @@ -15,6 +15,8 @@ checks += bugprone-* checks/bugprone-argument-comment.StrictMode := true checks += -bugprone-branch-clone checks += -bugprone-easily-swappable-parameters +# XXX: I should enable this check and do a comprehensive audit +checks += -bugprone-empty-catch # XXX: this is higher priority but I'm not ready for this yet checks += -bugprone-exception-escape checks/bugprone-exception-escape.IgnoredExceptions := "broken_promise" @@ -34,9 +36,12 @@ checks += -cert-env33-c checks += -cert-err58-cpp checks += clang-analyzer-* +# XXX: this flags something in boost multiprecision (of course) +checks += -clang-analyzer-core.BitwiseShift checks += cppcoreguidelines-* checks += -cppcoreguidelines-avoid-c-arrays +checks += -cppcoreguidelines-avoid-capturing-lambda-coroutines # this check is the exact opposite of a good guideline :/ checks += -cppcoreguidelines-avoid-const-or-ref-data-members checks += -cppcoreguidelines-avoid-do-while @@ -49,6 +54,10 @@ checks += -cppcoreguidelines-avoid-reference-coroutine-parameters checks += -cppcoreguidelines-init-variables # XXX: I didn't pay any attention to whether this check was interesting or not checks += -cppcoreguidelines-macro-usage +# this was accidentally helpful, actually, but isn't an acceptable decision :/ +checks += -cppcoreguidelines-misleading-capture-default-by-value +# this check doesn't handle unused parameters; am I doing this wrong?! +checks += -cppcoreguidelines-missing-std-forward checks += -cppcoreguidelines-non-private-member-variables-in-classes # XXX: the code which most hates this apparently does allow for memory leaks :( checks += -cppcoreguidelines-prefer-member-initializer @@ -57,8 +66,13 @@ checks += -cppcoreguidelines-pro-bounds-array-to-pointer-decay checks += -cppcoreguidelines-pro-bounds-pointer-arithmetic checks += -cppcoreguidelines-pro-type-reinterpret-cast checks += -cppcoreguidelines-pro-type-union-access +# XXX: this check is interesting, but I'm unsure about move/forward confusion +checks += -cppcoreguidelines-rvalue-reference-param-not-moved +checks/cppcoreguidelines-rvalue-reference-param-not-moved.IgnoreUnnamedParams := true # this check makes utility classes super frustrating :/ checks += -cppcoreguidelines-special-member-functions +# this check makes separates definitions of related variables +checks += -cppcoreguidelines-use-default-member-init # XXX: I'm using a lot of statically constructed objects #checks += fuchsia-statically-constructed-objects @@ -67,6 +81,9 @@ checks += fuchsia-virtual-inheritance checks += google-build-* checks += misc-* +# I love the idea of this check, but boost does this a lot +checks += -misc-header-include-cycle +checks += -misc-include-cleaner checks += -misc-misplaced-const checks += -misc-no-recursion # this check doesn't allow for any protected members :/ @@ -76,6 +93,8 @@ checks += -misc-unused-parameters checks += modernize-* checks += -modernize-avoid-c-arrays +# XXX: I don't want this, but it also crashes on boost::multiprecision::abs +checks += -modernize-use-constraints checks += -modernize-use-default-member-init checks += -modernize-use-nodiscard checks += -modernize-use-trailing-return-type @@ -84,6 +103,8 @@ checks += -modernize-use-using checks += performance-* checks/performance-move-const-arg.CheckTriviallyCopyableMove := 0 +# XXX: I am pretty sure I just disagree with this optimization +checks += -performance-avoid-endl checks += readability-const-return-type checks += readability-container-size-empty @@ -98,11 +119,6 @@ checks += readability-redundant-string-init checks += readability-static-definition-in-anonymous-namespace checks += readability-uniqueptr-delete-release -ifeq ($(target),and) -# XXX: boost multiprecision on android -#checks += -clang-analyzer-core.UndefinedBinaryOperatorResult -endif - ifeq ($(target),win) # XXX: boost::asio::detail::do_throw_error should be [[noreturn]] # (though, marking it [[noreturn]] didn't actually make it work) diff --git a/env/output.mk b/env/output.mk index 2d55e90bc..42d73b725 100644 --- a/env/output.mk +++ b/env/output.mk @@ -30,7 +30,7 @@ code = $(patsubst @/%,$(output)/$(arch)/%,$(header)) $(sysroot) # in this model, cflags would be something controlled only by the user flags_ = $(if $(filter ./,$(1)),,$(call flags_,$(dir $(patsubst %/,%,$(1)))) $(cflags/$(1))) flags- = $(call flags_,$(patsubst ./$(output)/%,%,$(patsubst ./$(output)/$(arch)/%,./$(output)/%,./$(dir $<)))) -flags = $(qflags) $(patsubst -I@/%,-I$(output)/$(arch)/%,$(filter -I%,$(cflags/./$<) $(flags-) $(cflags)) $(filter-out -I%,$(cflags) $(flags-) $(cflags/./$<))) +flags = $(filter-out $(dflags/./$<),$(qflags)) $(patsubst -I@/%,-I$(output)/$(arch)/%,$(filter -I%,$(cflags/./$<) $(flags-) $(cflags)) $(filter-out -I%,$(cflags) $(flags-) $(cflags/./$<))) flags += $(if $(filter $(output)/%,$<),-D__FILE__='"$(patsubst $(output)/%,%,$<)"' -Wno-builtin-macro-redefined) define compile diff --git a/env/revision.sh b/env/revision.sh index 8f52d3736..2d1d537a8 100755 --- a/env/revision.sh +++ b/env/revision.sh @@ -22,7 +22,9 @@ echo if [[ $# -eq 0 ]]; then echo; echo else - "$@" --version | head -n 1 + # Android NDK annotates version with their clang build-time flags + # (as in, the strategy used to optimize clang, not configuration) + "$@" --version | sed -e '1!d;s/, [+-][a-z]*//g' # ld64 doesn't support --version and prints its version to stderr # Android NDK uses inconsistent directories / urls for repository "$@" -Wl,-v 2>&1 | sed -e '1!d;s/([^ ]* /(/' || true diff --git a/env/setup-ndk.sh b/env/setup-ndk.sh index 1fd7e9bee..fdc3af34f 100755 --- a/env/setup-ndk.sh +++ b/env/setup-ndk.sh @@ -1,4 +1,13 @@ #!/bin/bash set -e set -o pipefail -echo y | "${ANDROID_HOME}"/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.2" "ndk;26.3.11579264" "platforms;android-33" >/dev/null + +ndk=27.0.12077973 + +echo y | "${ANDROID_HOME}"/cmdline-tools/latest/bin/sdkmanager "ndk;${ndk}" "build-tools;29.0.2" "platforms;android-33" >/dev/null + +export ANDROID_NDK_ROOT="${ANDROID_HOME}/ndk/${ndk}" + +if [[ -n ${GITHUB_ENV} ]]; then + echo "ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT}" >>"${GITHUB_ENV}" +fi diff --git a/lib-protocol/source/drain.hpp b/lib-protocol/source/drain.hpp index 1a4effd12..72e593a6d 100644 --- a/lib-protocol/source/drain.hpp +++ b/lib-protocol/source/drain.hpp @@ -90,7 +90,7 @@ class Sunk { } }; -template >().Inner())>::type> +template >().Inner())>> class Sink : public Super_, public Sunk diff --git a/lib-protocol/source/jsonrpc.hpp b/lib-protocol/source/jsonrpc.hpp index e2b5a1ef8..62f5a696d 100644 --- a/lib-protocol/source/jsonrpc.hpp +++ b/lib-protocol/source/jsonrpc.hpp @@ -79,7 +79,7 @@ struct Numeric { }; template -struct Coded::value>::type> : +struct Coded>> : public Numeric { static void Name(std::ostringstream &signature) { @@ -88,7 +88,7 @@ struct Coded::value>::typ }; template -struct Coded::value>::type> : +struct Coded>> : public Numeric { static void Name(std::ostringstream &signature) { @@ -97,7 +97,7 @@ struct Coded::value>::type> }; template -struct Coded>, typename std::enable_if::type> : +struct Coded>, typename std::enable_if_t> : public Numeric> 3), boost::multiprecision::number>> { static void Name(std::ostringstream &signature) { @@ -106,7 +106,7 @@ struct Coded -struct Coded>, typename std::enable_if::type> : +struct Coded>, typename std::enable_if_t> : public Numeric> 3), boost::multiprecision::number>> { static void Name(std::ostringstream &signature) { @@ -161,7 +161,7 @@ struct Coded { }; template -struct Coded, typename std::enable_if::type> { +struct Coded, typename std::enable_if_t> { static const bool dynamic_ = false; static void Name(std::ostringstream &signature) { diff --git a/lib-protocol/source/lwip.hpp b/lib-protocol/source/lwip.hpp index 317dad024..1c210b032 100644 --- a/lib-protocol/source/lwip.hpp +++ b/lib-protocol/source/lwip.hpp @@ -56,6 +56,7 @@ typedef int SOCKET; using namespace rtc; // Event constants for the Dispatcher class. +// NOLINTNEXTLINE(performance-enum-size) enum DispatcherEvent { DE_READ = 0x0001, DE_WRITE = 0x0002, diff --git a/lib-protocol/source/memory.cpp b/lib-protocol/source/memory.cpp index 36c329799..a71a42eac 100644 --- a/lib-protocol/source/memory.cpp +++ b/lib-protocol/source/memory.cpp @@ -34,8 +34,9 @@ // NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables) namespace orc { +namespace { -static int file_(-1); +int file_(-1); // XXX: there are a number of arrays in this file; are they correct? @@ -74,7 +75,7 @@ class Out { if (value == 0) *--end = '0'; else do { - unsigned digit(value % 10); + const unsigned digit(value % 10); value /= 10; *--end = static_cast('0' + digit); } while (value != 0); @@ -100,7 +101,7 @@ class Out { if (value == 0) *--end = '0'; else do { - unsigned digit(value & 0xf); + const unsigned digit(value & 0xf); value >>= 4; *--end = static_cast((digit < 10 ? '0' : 'a' - 10) + digit); } while (value != 0); @@ -110,9 +111,9 @@ class Out { } }; -static size_t total_(0); +size_t total_(0); -static void Audit(size_t add, size_t sub) { +void Audit(size_t add, size_t sub) { total_ += add; total_ -= sub; if (add < sub) @@ -122,8 +123,8 @@ static void Audit(size_t add, size_t sub) { Out() << total_ << " (" << (add - sub) << ")"; } -static decltype(std::declval<_malloc_zone_t *>()->malloc) apl_malloc; -static void *orc_malloc(struct _malloc_zone_t *zone, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->malloc) apl_malloc; +void *orc_malloc(struct _malloc_zone_t *zone, size_t size) { auto value(apl_malloc(zone, size)); if (value == nullptr) return nullptr; @@ -134,8 +135,8 @@ static void *orc_malloc(struct _malloc_zone_t *zone, size_t size) { return value; } -static decltype(std::declval<_malloc_zone_t *>()->calloc) apl_calloc; -static void *orc_calloc(struct _malloc_zone_t *zone, size_t count, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->calloc) apl_calloc; +void *orc_calloc(struct _malloc_zone_t *zone, size_t count, size_t size) { auto value(apl_calloc(zone, count, size)); if (value == nullptr) return nullptr; @@ -146,8 +147,8 @@ static void *orc_calloc(struct _malloc_zone_t *zone, size_t count, size_t size) return value; } -static decltype(std::declval<_malloc_zone_t *>()->valloc) apl_valloc; -static void *orc_valloc(struct _malloc_zone_t *zone, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->valloc) apl_valloc; +void *orc_valloc(struct _malloc_zone_t *zone, size_t size) { auto value(apl_valloc(zone, size)); if (value == nullptr) return nullptr; @@ -158,8 +159,8 @@ static void *orc_valloc(struct _malloc_zone_t *zone, size_t size) { return value; } -static decltype(std::declval<_malloc_zone_t *>()->realloc) apl_realloc; -static void *orc_realloc(struct _malloc_zone_t *zone, void *old, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->realloc) apl_realloc; +void *orc_realloc(struct _malloc_zone_t *zone, void *old, size_t size) { auto before(zone->size(zone, old)); auto value(apl_realloc(zone, old, size)); auto after(zone->size(zone, value)); @@ -169,8 +170,8 @@ static void *orc_realloc(struct _malloc_zone_t *zone, void *old, size_t size) { return value; } -static decltype(std::declval<_malloc_zone_t *>()->free) apl_free; -static void orc_free(struct _malloc_zone_t *zone, void *value) { +decltype(std::declval<_malloc_zone_t *>()->free) apl_free; +void orc_free(struct _malloc_zone_t *zone, void *value) { auto full(zone->size(zone, value)); if (file_ != -1) Out() << "free(" << value << ")"; @@ -178,33 +179,33 @@ static void orc_free(struct _malloc_zone_t *zone, void *value) { return apl_free(zone, value); } -static decltype(std::declval<_malloc_zone_t *>()->batch_malloc) apl_batch_malloc; -static unsigned orc_batch_malloc(struct _malloc_zone_t *zone, size_t size, void **values, unsigned count) { +decltype(std::declval<_malloc_zone_t *>()->batch_malloc) apl_batch_malloc; +unsigned orc_batch_malloc(struct _malloc_zone_t *zone, size_t size, void **values, unsigned count) { count = apl_batch_malloc(zone, size, values, count); size_t full(0); for (size_t i(0); i != count; ++i) { full += zone->size(zone, values[i]); if (file_ != -1) - Out() << "batch_malloc(" << size << ", " << values << "[" << i << "]) = " << values[i]; + Out() << "batch_malloc(" << size << ", " << reinterpret_cast(values) << "[" << i << "]) = " << values[i]; } Audit(full, 0); return count; } -static decltype(std::declval<_malloc_zone_t *>()->batch_free) apl_batch_free; -static void orc_batch_free(struct _malloc_zone_t *zone, void **values, unsigned count) { +decltype(std::declval<_malloc_zone_t *>()->batch_free) apl_batch_free; +void orc_batch_free(struct _malloc_zone_t *zone, void **values, unsigned count) { size_t full(0); for (size_t i(0); i != count; ++i) { full += zone->size(zone, values[i]); if (file_ != -1) - Out() << "batch_free(" << values << "[" << i << "] = " << values[i] << ")"; + Out() << "batch_free(" << reinterpret_cast(values) << "[" << i << "] = " << values[i] << ")"; } Audit(0, full); return apl_batch_free(zone, values, count); } -static decltype(std::declval<_malloc_zone_t *>()->memalign) apl_memalign; -static void *orc_memalign(struct _malloc_zone_t *zone, size_t alignment, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->memalign) apl_memalign; +void *orc_memalign(struct _malloc_zone_t *zone, size_t alignment, size_t size) { auto value(apl_memalign(zone, alignment, size)); auto full(zone->size(zone, value)); if (file_ != -1) @@ -213,8 +214,8 @@ static void *orc_memalign(struct _malloc_zone_t *zone, size_t alignment, size_t return value; } -static decltype(std::declval<_malloc_zone_t *>()->free_definite_size) apl_free_definite_size; -static void orc_free_definite_size(struct _malloc_zone_t *zone, void *value, size_t size) { +decltype(std::declval<_malloc_zone_t *>()->free_definite_size) apl_free_definite_size; +void orc_free_definite_size(struct _malloc_zone_t *zone, void *value, size_t size) { auto full(zone->size(zone, value)); if (file_ != -1) Out() << "free_definite_size(" << value << ", " << size << ")"; @@ -229,6 +230,9 @@ static void orc_free_definite_size(struct _malloc_zone_t *zone, void *value, siz zone->name = &orc_ ## name; \ } while (false) +} } + +namespace orc { void Hook() { return; @@ -257,9 +261,7 @@ void Hook() { orc_swizzle(batch_free); orc_swizzle(memalign); orc_swizzle(free_definite_size); -} - -} +} } #else namespace orc { diff --git a/lib-protocol/source/nest.hpp b/lib-protocol/source/nest.hpp index c5de2d43b..49cd9907e 100644 --- a/lib-protocol/source/nest.hpp +++ b/lib-protocol/source/nest.hpp @@ -94,7 +94,7 @@ class Nest final : } template - auto Hatch(Code_ code, const char *name) noexcept -> typename std::enable_if::type { + auto Hatch(Code_ code, const char *name) noexcept -> typename std::enable_if_t { Count count(this); if (count > limit_) return false; diff --git a/lib-protocol/source/spawn.hpp b/lib-protocol/source/spawn.hpp index a434218cc..a19721cc3 100644 --- a/lib-protocol/source/spawn.hpp +++ b/lib-protocol/source/spawn.hpp @@ -110,7 +110,7 @@ class Detached { }; template -auto Spawn(Code_ code, const char *name) noexcept -> typename std::enable_if::type { +auto Spawn(Code_ code, const char *name) noexcept -> typename std::enable_if_t { [](Code_ code, const char *name) mutable noexcept -> Detached { co_await Schedule(); #ifdef ORC_FIBER diff --git a/lib-protocol/source/transport.cpp b/lib-protocol/source/transport.cpp index 743a2c6e5..b02b4b33f 100644 --- a/lib-protocol/source/transport.cpp +++ b/lib-protocol/source/transport.cpp @@ -332,7 +332,7 @@ class Middle : } openvpn::TunClient::Ptr new_tun_client_obj(openvpn_io::io_context &context, openvpn::TunClientParent &parent, openvpn::TransportClient *transport) noexcept override { - return new Tunnel(middle_, config_, context, parent); + return {new Tunnel(middle_, config_, context, parent)}; } }; @@ -365,10 +365,12 @@ class Middle : } openvpn::TransportClientFactory *new_transport_factory(const openvpn::ExternalTransport::Config &config) noexcept override { + // NOLINTNEXTLINE(cppcoreguidelines-owning-memory) return new orc::Factory(base_, config); } openvpn::TunClientFactory *new_tun_factory(const openvpn::ExternalTun::Config &config, const openvpn::OptionList &options) noexcept override { + // NOLINTNEXTLINE(cppcoreguidelines-owning-memory) return new Factory(*this, config); } diff --git a/lib-shared/source/address.hpp b/lib-shared/source/address.hpp index 77eb92f72..c7f927909 100644 --- a/lib-shared/source/address.hpp +++ b/lib-shared/source/address.hpp @@ -36,6 +36,8 @@ class Address : private uint160_t { public: + // XXX: this check is false positive here + // NOLINTNEXTLINE(modernize-type-traits) using uint160_t::uint160_t; Address(const uint160_t &value) : diff --git a/lib-shared/source/buffer.hpp b/lib-shared/source/buffer.hpp index 1f5ca4f4a..e16b9c640 100644 --- a/lib-shared/source/buffer.hpp +++ b/lib-shared/source/buffer.hpp @@ -153,7 +153,7 @@ template struct Cast; template -struct Cast::value>::type> { +struct Cast>> { static auto Load(const uint8_t *data, size_t size) { orc_assert(size == sizeof(Type_)); return boost::endian::big_to_native(*reinterpret_cast(data)); @@ -161,7 +161,7 @@ struct Cast::value>::ty }; template -struct Cast>, typename std::enable_if::type> { +struct Cast>, typename std::enable_if_t> { static auto Load(const uint8_t *data, size_t size) { orc_assert(size == Bits_ / 8); boost::multiprecision::number> value; @@ -171,7 +171,7 @@ struct Cast -struct Cast, typename std::enable_if::type> { +struct Cast, typename std::enable_if_t> { static auto Load(const uint8_t *data, size_t size) { orc_assert(size == Bits_ / 8); return intx::be::load>(*reinterpret_cast(data)); @@ -735,7 +735,7 @@ inline Brick operator ^(const Data &lhs, const Data &rhs) { return value; } -template ::value> +template > class Number; template @@ -1041,12 +1041,12 @@ inline bool Each(const char &data, const std::function -inline typename std::enable_if::value && !std::is_same_v, bool>::type Each(const Type_ &value, const std::function &code) { +inline typename std::enable_if_t && !std::is_same_v, bool> Each(const Type_ &value, const std::function &code) { return Number(value).each(code); } template -inline typename std::enable_if::type Each(const boost::multiprecision::number> &value, const std::function &code) { +inline typename std::enable_if_t Each(const boost::multiprecision::number> &value, const std::function &code) { return Number>>(value).each(code); } @@ -1355,7 +1355,7 @@ static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { } }; template -struct Taking>, typename std::enable_if::type, Taking_...> final { +struct Taking>, typename std::enable_if_t, Taking_...> final { template static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { Brick brick; @@ -1365,7 +1365,7 @@ static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { } }; template -struct Taking::value>::type, Taking_...> { +struct Taking>, Taking_...> { template static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { Brick brick; @@ -1378,7 +1378,7 @@ template struct Taking { template static bool Take(Tuple_ &tuple, Window &window, Buffer_ &&buffer) { - static_assert(!std::is_rvalue_reference::value); + static_assert(!std::is_rvalue_reference_v); std::get(tuple) = std::move(window); return false; } }; diff --git a/min-wireshark/target.mk b/min-wireshark/target.mk index 3323619a0..ffeeaf7c2 100644 --- a/min-wireshark/target.mk +++ b/min-wireshark/target.mk @@ -139,6 +139,16 @@ cflags/$(pwd/wireshark)/ += -Wno-pointer-sign # XXX: fwrite used without check; submit patch cflags/$(pwd/wireshark)/ += -Wno-unused-result +# XXX: packet-5co-legacy.c:923:9: error: 'snprintf' will always be truncated; specified size is 8, but format string expands to at least 9 [-Werror,-Wformat-truncation] +# snprintf( result, 8, "Disabled"); +# ^ +cflags/$(pwd/wireshark)/epan/dissectors/packet-5co-legacy.c += -Wno-format-truncation + +# XXX: packet-ipars.c:131:33: error: 'snprintf' will always be truncated; specified size is 16, but format string expands to at least 24 [-Werror,-Wformat-truncation] +# default: snprintf(eom_msg, MAX_EOM_MSG_SIZE, "Unknown EOM type (0x%2.2X)", ia); break; +# ^ +cflags/$(pwd/wireshark)/epan/dissectors/packet-ipars.c += -Wno-format-truncation + # XXX: this is only used if you have libgnutls and I don't know what I think about that :/ cflags/$(pwd/wireshark)/epan/dissectors/packet-tls-utils.c += -Wno-unused-but-set-variable diff --git a/srv-daemon/source/egress.cpp b/srv-daemon/source/egress.cpp index 16d64d07f..2084857b3 100644 --- a/srv-daemon/source/egress.cpp +++ b/srv-daemon/source/egress.cpp @@ -154,6 +154,9 @@ task Egress::Translator::Send(const Buffer &data) { Forge(icmp, &openvpn::ICMPv4::id, translated.Port()); co_return co_await egress_->Send(beam); } break; + + default: { + } break; } } @@ -193,6 +196,9 @@ void Egress::Land(const Buffer &data) { return translation->translator_.Land(beam); } } break; + + default: { + } break; } } diff --git a/srv-daemon/source/engine.cpp b/srv-daemon/source/engine.cpp index 80802f02a..aec6f41ed 100644 --- a/srv-daemon/source/engine.cpp +++ b/srv-daemon/source/engine.cpp @@ -149,6 +149,8 @@ int Engine() { case 0x80000001: orc_assert((entry.edx & (1 << 29)) != 0); break; + default: + break; } } #else diff --git a/srv-daemon/source/lottery.cpp b/srv-daemon/source/lottery.cpp index 65def39f5..b83d3a32e 100644 --- a/srv-daemon/source/lottery.cpp +++ b/srv-daemon/source/lottery.cpp @@ -31,7 +31,7 @@ std::ostream &operator <<(std::ostream &out, const Pot &pot) { } void Lottery::Open() { - Spawn([=]() mutable noexcept -> task { + Spawn([this]() mutable noexcept -> task { for (auto height(co_await Height());;) try { co_await Sleep(10*1000); auto next(co_await Height()); diff --git a/srv-daemon/source/lottery0.hpp b/srv-daemon/source/lottery0.hpp index 97af25649..b76b6c7c3 100644 --- a/srv-daemon/source/lottery0.hpp +++ b/srv-daemon/source/lottery0.hpp @@ -84,10 +84,10 @@ class Lottery0 : Bytes /*receipt*/, std::vector /*old*/ > grab("grab"); - Spawn([=]() mutable noexcept -> task { + Spawn([this, executor, args...]() mutable noexcept -> task { for (;;) { orc_ignore({ - co_await executor->Send(*token_.market_.chain_, {}, contract_, 0, grab(std::forward(args)...)); + co_await executor->Send(*token_.market_.chain_, {}, contract_, 0, grab(args...)); break; }); diff --git a/srv-daemon/source/lottery1.hpp b/srv-daemon/source/lottery1.hpp index 86505eda6..83c916fb0 100644 --- a/srv-daemon/source/lottery1.hpp +++ b/srv-daemon/source/lottery1.hpp @@ -74,7 +74,7 @@ class Lottery1 : std::vector /*refunds*/ > claim("claim"); - Spawn([=]() mutable noexcept -> task { + Spawn([this, executor, recipient, payment]() mutable noexcept -> task { for (;;) { orc_ignore({ co_await executor->Send(*market_.chain_, {}, contract_, 0, claim({}, recipient, {payment}, {})); diff --git a/srv-daemon/source/server.cpp b/srv-daemon/source/server.cpp index b2e1f5a88..bfbd51a22 100644 --- a/srv-daemon/source/server.cpp +++ b/srv-daemon/source/server.cpp @@ -200,7 +200,7 @@ void Server::Submit0(Pipe *pipe, const Socket &source, const Bytes32 &id nonces.erase(oldest); } - const auto reveal([&, &commit = commit]() { + const auto reveal([&]() { for (const auto &reveal : locked->reveals_) if (HashK(reveal.first) == commit) { const auto &expire(reveal.second); @@ -217,8 +217,9 @@ void Server::Submit0(Pipe *pipe, const Socket &source, const Bytes32 &id Commit(locked); std::make_tuple(reveal, winner); }); - // XXX: the C++ prohibition on automatic capture of a binding name because it isn't a "variable" is ridiculous - nest_.Hatch([&, &commit = commit, &issued = issued, &nonce = nonce, &v = v, &r = r, &s = s, &amount = amount, &ratio = ratio, &start = start, &range = range, &funder = funder, &recipient = recipient, &reveal = reveal, &winner = winner]() noexcept { return [=]() noexcept -> task { try { + // XXX: this is related to the long-standing issue with boost multiprecision and clang-tidy + // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) + nest_.Hatch([&]() noexcept { return [=, this]() noexcept -> task { try { const auto usable(co_await lottery->Check(signer, funder, recipient)); const auto valid(usable >= amount); @@ -306,7 +307,7 @@ void Server::Submit1(Pipe *pipe, const Socket &source, const Bytes32 &id nonces.erase(oldest); } - const auto reveal([&, &commit = commit]() { + const auto reveal([&]() { for (const auto &reveal : locked->reveals_) if (HashK(reveal.first) == commit) { const auto &expire(reveal.second); @@ -323,8 +324,9 @@ void Server::Submit1(Pipe *pipe, const Socket &source, const Bytes32 &id Commit(locked); std::make_tuple(reveal, winner); }); - // XXX: the C++ prohibition on automatic capture of a binding name because it isn't a "variable" is ridiculous - nest_.Hatch([&, &amount = amount, &funder = funder, &recipient = recipient, &reveal = reveal, &winner = winner]() noexcept { return [=]() noexcept -> task { try { + // XXX: this is related to the long-standing issue with boost multiprecision and clang-tidy + // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) + nest_.Hatch([&]() noexcept { return [=, this]() noexcept -> task { try { const auto usable(co_await lottery->Check(signer, funder, recipient)); const auto valid(usable >= amount); @@ -361,7 +363,7 @@ void Server::Land(Pipe *pipe, const Buffer &data) { orc_ignore({ const auto &[magic, id] = header; orc_assert(magic == Magic_); - Scan(window, [&, &id = id](const Buffer &data) { try { + Scan(window, [&](const Buffer &data) { try { const auto [command, window] = Take(data); if (false); else if (command == Submit0_) diff --git a/srv-kernel/makefile b/srv-kernel/makefile index 318110ebf..c05886b5d 100644 --- a/srv-kernel/makefile +++ b/srv-kernel/makefile @@ -93,6 +93,7 @@ qflags += -mno-red-zone qflags += -mno-sse cflags/$(pwd)/source/paging.cpp += -m32 cflags/$(pwd)/source/paging.cpp += -g0 +dflags/$(pwd)/source/paging.cpp += -mcmodel=% oflags/$(pwd)/source/paging.cpp += -O elf64-x86-64 endif diff --git a/srv-worker/capnproto.mk b/srv-worker/capnproto.mk index 22e4724c7..6f722c98c 100644 --- a/srv-worker/capnproto.mk +++ b/srv-worker/capnproto.mk @@ -40,4 +40,6 @@ $(output)/capnp/%.capnp.h: %.capnp $(capnp) cflags += -I$(pwd)/capnproto/c++/src cflags += -I$(output)/capnp/capnproto/c++/src +cflags/$(pwd)/capnproto/ += -Wno-deprecated-this-capture + source += $(shell find $(pwd)/capnproto/c++/src/kj -name '*.c++' -not -name '*test.c++') diff --git a/vpn-apple/source/family.hpp b/vpn-apple/source/family.hpp index 849239825..ee2151a20 100644 --- a/vpn-apple/source/family.hpp +++ b/vpn-apple/source/family.hpp @@ -39,8 +39,8 @@ class Family : switch (protocol) { case 4: return AF_INET; case 6: return AF_INET6; + default: return 0; } - return 0; } protected: diff --git a/vpn-apple/source/protect.cpp b/vpn-apple/source/protect.cpp index 25c0efdd0..9d4cc8b59 100644 --- a/vpn-apple/source/protect.cpp +++ b/vpn-apple/source/protect.cpp @@ -36,7 +36,7 @@ namespace orc { int Protect(int socket, int (*attach)(int, const sockaddr *, socklen_t), const sockaddr *address, socklen_t length) { - std::unique_ptr interfaces([]() { + const std::unique_ptr interfaces([]() { ifaddrs *interfaces; orc_assert(getifaddrs(&interfaces) != -1); return interfaces; diff --git a/vpn-shared/source/capture.cpp b/vpn-shared/source/capture.cpp index 1fb56a8dd..8ccc6c455 100644 --- a/vpn-shared/source/capture.cpp +++ b/vpn-shared/source/capture.cpp @@ -216,7 +216,7 @@ void Capture::Land(const Buffer &data) { orc_ignore({ if (Datagram(data, [&](const Socket &source, const Socket &destination, const Buffer &data) { if (destination != Socket(Resolver_, 53)) return false; - up_.Hatch([&]() noexcept { return [=, data = Beam(data)]() mutable -> task { + up_.Hatch([&]() noexcept { return [this, source, destination, data = Beam(data)]() mutable -> task { const Query query(data.span()); const auto resolver([&]() { @@ -625,6 +625,9 @@ task Transform::Send(const Beam &data) { Log() << "ICMP" << subset << std::endl; co_return true; } break; + + default: + break; } co_return false; diff --git a/vpn-shared/source/client.cpp b/vpn-shared/source/client.cpp index a46a6c919..58d98dc3a 100644 --- a/vpn-shared/source/client.cpp +++ b/vpn-shared/source/client.cpp @@ -111,7 +111,7 @@ void Client::Land(Pipe *pipe, const Buffer &data) { const auto &[magic, id] = header; orc_assert(magic == Magic_); - Scan(window, [&, &id = id](const Buffer &data) { try { + Scan(window, [&](const Buffer &data) { try { Invoice(id, data); } orc_catch({}) }); } orc_catch({}) return true; })) { From 02c5522bb21772b97e7e7a1c8895799dfe6bc79a Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 2 Sep 2024 23:57:52 -0700 Subject: [PATCH 7/8] Finish upgrading to the latest version of Flutter. --- .github/workflows/main.yml | 1 + app-android/build.gradle | 14 ++-- app-flutter.mk | 11 ++- app-ios/makefile | 8 +- app-shared/ios/Podfile | 2 +- app-shared/target-all.mk | 8 +- app-shared/target-and.mk | 3 +- app-shared/target-apl.mk | 5 -- env/lnx-arch.sh | 2 +- env/lnx-ubuntu.sh | 2 +- env/setup-mac.sh | 1 + env/setup-ndk.sh | 2 +- env/target-apl.mk | 3 - env/target-mac.mk | 2 + gui-orchid/ios/Podfile.lock | 144 ++++++++++++++++------------------ gui-orchid/macos/Podfile.lock | 25 +++--- gui-orchid/pubspec.lock | 108 +++++++++++-------------- vpn-apple/source/tunnel.cpp | 1 + vpn-apple/source/tunnel.mm | 6 +- vpn-apple/target.mk | 8 +- 20 files changed, 177 insertions(+), 179 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b27012704..e4100f605 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -157,6 +157,7 @@ jobs: needs: [cache-submodule] runs-on: ubuntu-24.04 + if: ${{ false }} # XXX: Flutter 3.24 --windows steps: - uses: actions/checkout@v4 - run: env/setup.sh diff --git a/app-android/build.gradle b/app-android/build.gradle index 815af5140..e70487d8d 100644 --- a/app-android/build.gradle +++ b/app-android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.8.0' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } @@ -30,12 +30,12 @@ apply plugin: 'kotlin-android' def flutter = files(orcFlutter) android { - compileSdkVersion 33 + compileSdkVersion 34 defaultConfig { applicationId orcUnique minSdkVersion 21 - targetSdkVersion 33 + targetSdkVersion 34 versionCode orcMonotonic.toInteger() - 946684800 versionName orcVersion manifestPlaceholders = [orcUnique: orcUnique, orcName: orcName] @@ -102,6 +102,8 @@ plugins.plugins.android.each { dependency -> } plugin.afterEvaluate { + plugin.android { compileSdkVersion 34 } + plugin.android.buildTypes { profile { initWith debug diff --git a/app-flutter.mk b/app-flutter.mk index b2e0b096a..1c4b30acc 100644 --- a/app-flutter.mk +++ b/app-flutter.mk @@ -27,13 +27,18 @@ $(call include,shared/target-all.mk) $(foreach fork,$(forks),$(shell ln -sf $(patsubst %/pubspec.yaml,%,$(fork)) >/dev/null)) +sed := $(shell which gsed sed | head -n1) + .PHONY: create create: $(pwd/flutter)/packages/flutter/pubspec.lock $(flutter) create -i objc -a java --no-pub --project-name orchid . $(flutter) pub get - sed -ie 's/flutter\.compileSdkVersion/33/g;s/flutter.minSdkVersion/21/g' android/app/build.gradle - sed -ie "/^platform :osx/{s/,.*/, '10.15'/g;}" macos/Podfile - sed -ie "/MACOSX_DEPLOYMENT_TARGET =/{s/=.*/= 10.15;/g;}" macos/Runner.xcodeproj/project.pbxproj + $(sed) -ie 's/flutter\.compileSdkVersion/34/g;s/flutter.minSdkVersion/21/g' android/app/build.gradle + $(sed) -ie '0,/subprojects {/s//\0 afterEvaluate { android { compileSdkVersion 34 } }/' android/build.gradle + $(sed) -ie '/org\.jetbrains\.kotlin\.android/s/\(version "\)[^"]*/\11.8.0/' android/settings.gradle + $(sed) -ie "/^# platform :ios/{s/^# //;}" ios/Podfile + $(sed) -ie "/^platform :osx/{s/,.*/, '10.15'/;}" macos/Podfile + $(sed) -ie "/MACOSX_DEPLOYMENT_TARGET =/{s/=.*/= 10.15;/g;}" macos/Runner.xcodeproj/project.pbxproj builds := builds += apk diff --git a/app-ios/makefile b/app-ios/makefile index 7bb13ba3a..7e13e662b 100644 --- a/app-ios/makefile +++ b/app-ios/makefile @@ -68,7 +68,11 @@ $(call include,shared/target-ios.mk) local := local += app.mm.o -local += $(subst %,.,$(word 1,$(generated))).o +temp := $(subst %,.,$(word 1,$(generated))) +local += $(temp).o + +$(call depend,$(temp).o,$(output)/XCBuildData/build.db) +cflags/$(temp) += -fmodules $(patsubst %,-fmodule-map-file=%,$(wildcard $(output)/Release-$(sdk)/*/*.modulemap)) -Wno-ignored-attributes include env/output.mk @@ -139,7 +143,7 @@ $(bundle)/Assets.car: $(wildcard Assets.xcassets/*/*) @mkdir -p $(output)/info # XXX: --launch-image LaunchImage actool --output-format human-readable-text --errors --warnings --notices \ - --target-device iphone --target-device ipad --minimum-deployment-target 11.0 \ + --target-device iphone --target-device ipad --minimum-deployment-target 12.0 \ --platform iphoneos \ --app-icon AppIcon \ --compress-pngs \ diff --git a/app-shared/ios/Podfile b/app-shared/ios/Podfile index a9bc11ace..760fd4c74 100644 --- a/app-shared/ios/Podfile +++ b/app-shared/ios/Podfile @@ -2,7 +2,7 @@ install! 'cocoapods', :integrate_targets => false # Uncomment this line to define a global platform for your project -platform :ios, '11.0' +platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/app-shared/target-all.mk b/app-shared/target-all.mk index 5ddee4f60..57c853a53 100644 --- a/app-shared/target-all.mk +++ b/app-shared/target-all.mk @@ -26,13 +26,17 @@ flutter := $(CURDIR)/$(pwd/flutter)/bin/flutter --suppress-analytics --verbose - # -a is needed as flutter (incorrectly) only installs files for windows *target* on windows *host* # https://github.com/flutter/flutter/issues/58379 -precache := --android --ios --linux --macos --windows -a + +# XXX: ugh. now I had to disable all the windows support due to Failed to download https://storage.googleapis.com/flutter_infra_release/flutter/b8800d88be4866db1b15f8b954ab2573bba9960f/windows-arm64/artifacts.zip. Ensure you have network connectivity and then try again. Exception: 404 +# I actually think I can get them to fix this, as this breaks precache -a even without --windows and even without --enable-windows-desktop + +precache := --android --ios --linux --macos #--windows $(pwd/flutter)/packages/flutter/pubspec.lock: $(pwd/flutter)/packages/flutter/pubspec.yaml $(call head,$(pwd/flutter)) cd $(pwd/flutter) && git clean -fxd cd $(pwd/flutter) && bin/flutter config --enable-linux-desktop cd $(pwd/flutter) && bin/flutter config --enable-macos-desktop - cd $(pwd/flutter) && bin/flutter config --enable-windows-desktop + #cd $(pwd/flutter) && bin/flutter config --enable-windows-desktop cd $(pwd/flutter) && bin/flutter precache $(precache) cd $(pwd/flutter) && bin/flutter update-packages diff --git a/app-shared/target-and.mk b/app-shared/target-and.mk index e290e1383..d6fd50076 100644 --- a/app-shared/target-and.mk +++ b/app-shared/target-and.mk @@ -20,13 +20,13 @@ assemble := android platform := android +capped := Android generated := $(pwd/gui)/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant%java include $(pwd)/target-all.mk jni := armeabi-v7a arm64-v8a -#jnis := $(subst $(space),$(comma),$(foreach arch,$(jni),android-$(flutter/$(arch)))) assembled := $(output)/flutter/flutter_assets/AssetManifest%json $(if $(filter noaot,$(debug)),,$(foreach arch,$(jni),$(output)/flutter/$(arch)/app%so)) $(assembled): $(dart) @@ -35,6 +35,7 @@ $(assembled): $(dart) -dTargetPlatform="$(platform)" \ -dTargetFile="lib/main.dart" \ -dBuildMode="$(mode)" \ + -d$(capped)Archs="$(foreach arch,$(jni),$(flutter/$(arch)))" \ -dTreeShakeIcons="true" \ -dTrackWidgetCreation="true" \ --output="$(CURDIR)/$(output)/flutter" \ diff --git a/app-shared/target-apl.mk b/app-shared/target-apl.mk index 9b60cf153..ce236c0a0 100644 --- a/app-shared/target-apl.mk +++ b/app-shared/target-apl.mk @@ -37,13 +37,8 @@ endif codesign += && touch $(3) -ifeq ($(target),mac) -cflags += -F$(engine) -lflags += -F$(engine) -else cflags += -F$(engine)/$(framework).xcframework/$(xcframework) lflags += -F$(engine)/$(framework).xcframework/$(xcframework) -endif app := $(bundle)$(contents)/Frameworks/App.framework embed := $(bundle)$(contents)/Frameworks/$(framework).framework diff --git a/env/lnx-arch.sh b/env/lnx-arch.sh index dfcab72c4..9b62eb387 100755 --- a/env/lnx-arch.sh +++ b/env/lnx-arch.sh @@ -3,7 +3,7 @@ set -e pacman -Sy \ ubuntu-keyring \ - bc tcl vim \ + bc sed tcl vim \ curl git rsync wget \ fakeroot talloc \ cpio rpm-tools unzip zstd \ diff --git a/env/lnx-ubuntu.sh b/env/lnx-ubuntu.sh index f61e45ddd..2f8cc063b 100755 --- a/env/lnx-ubuntu.sh +++ b/env/lnx-ubuntu.sh @@ -6,7 +6,7 @@ apt-get update apt-get -y install \ ubuntu-keyring \ - bc tcl xxd \ + bc sed tcl xxd \ curl git-core rsync wget \ fakeroot libtalloc-dev \ cpio rpm unzip zstd \ diff --git a/env/setup-mac.sh b/env/setup-mac.sh index 9de388998..6ee678936 100755 --- a/env/setup-mac.sh +++ b/env/setup-mac.sh @@ -4,6 +4,7 @@ which brew &>/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubuserconte # XXX: duplicate linux setup as much as possible brew install \ + gnu-sed \ fakeroot \ rpm2cpio zstd \ binutils \ diff --git a/env/setup-ndk.sh b/env/setup-ndk.sh index fdc3af34f..79a553f14 100755 --- a/env/setup-ndk.sh +++ b/env/setup-ndk.sh @@ -4,7 +4,7 @@ set -o pipefail ndk=27.0.12077973 -echo y | "${ANDROID_HOME}"/cmdline-tools/latest/bin/sdkmanager "ndk;${ndk}" "build-tools;29.0.2" "platforms;android-33" >/dev/null +echo y | "${ANDROID_HOME}"/cmdline-tools/latest/bin/sdkmanager "ndk;${ndk}" "build-tools;30.0.3" "platforms;android-34" >/dev/null export ANDROID_NDK_ROOT="${ANDROID_HOME}/ndk/${ndk}" diff --git a/env/target-apl.mk b/env/target-apl.mk index 835988d5f..e6429cffa 100644 --- a/env/target-apl.mk +++ b/env/target-apl.mk @@ -28,9 +28,6 @@ signature := /_CodeSignature/CodeResources isysroot := $(shell xcrun --sdk $(sdk) --show-sdk-path) more += -isysroot $(isysroot) -ifneq ($(sdk),macosx) -more += -idirafter $(shell xcrun --sdk macosx --show-sdk-path)/usr/include -endif define _ more/$(1) := -arch $(1) diff --git a/env/target-mac.mk b/env/target-mac.mk index 497a28212..3cb411664 100644 --- a/env/target-mac.mk +++ b/env/target-mac.mk @@ -39,6 +39,8 @@ runtime := osx more := -mmacosx-version-min=10.15 include $(pwd)/target-apl.mk +xcframework := macos-arm64_x86_64 + contents := /Contents resources := /Resources versions := /Versions/A diff --git a/gui-orchid/ios/Podfile.lock b/gui-orchid/ios/Podfile.lock index 28c4da638..f9404d698 100644 --- a/gui-orchid/ios/Podfile.lock +++ b/gui-orchid/ios/Podfile.lock @@ -2,74 +2,70 @@ PODS: - Flutter (1.0.0) - flutter_js (0.1.0): - Flutter - - FMDB (2.7.5): - - FMDB/standard (= 2.7.5) - - FMDB/standard (2.7.5) - - GoogleDataTransport (9.2.0): + - FMDB (2.7.12): + - FMDB/standard (= 2.7.12) + - FMDB/Core (2.7.12) + - FMDB/standard (2.7.12): + - FMDB/Core + - GoogleDataTransport (9.4.1): - GoogleUtilities/Environment (~> 7.7) - - nanopb (< 2.30910.0, >= 2.30908.0) + - nanopb (< 2.30911.0, >= 2.30908.0) - PromisesObjC (< 3.0, >= 1.2) - - GoogleMLKit/BarcodeScanning (3.2.0): + - GoogleMLKit/BarcodeScanning (6.0.0): - GoogleMLKit/MLKitCore - - MLKitBarcodeScanning (~> 2.2.0) - - GoogleMLKit/MLKitCore (3.2.0): - - MLKitCommon (~> 8.0.0) - - GoogleToolboxForMac/DebugUtils (2.3.2): - - GoogleToolboxForMac/Defines (= 2.3.2) - - GoogleToolboxForMac/Defines (2.3.2) - - GoogleToolboxForMac/Logger (2.3.2): - - GoogleToolboxForMac/Defines (= 2.3.2) - - "GoogleToolboxForMac/NSData+zlib (2.3.2)": - - GoogleToolboxForMac/Defines (= 2.3.2) - - "GoogleToolboxForMac/NSDictionary+URLArguments (2.3.2)": - - GoogleToolboxForMac/DebugUtils (= 2.3.2) - - GoogleToolboxForMac/Defines (= 2.3.2) - - "GoogleToolboxForMac/NSString+URLArguments (= 2.3.2)" - - "GoogleToolboxForMac/NSString+URLArguments (2.3.2)" - - GoogleUtilities/Environment (7.10.0): + - MLKitBarcodeScanning (~> 5.0.0) + - GoogleMLKit/MLKitCore (6.0.0): + - MLKitCommon (~> 11.0.0) + - GoogleToolboxForMac/Defines (4.2.1) + - GoogleToolboxForMac/Logger (4.2.1): + - GoogleToolboxForMac/Defines (= 4.2.1) + - "GoogleToolboxForMac/NSData+zlib (4.2.1)": + - GoogleToolboxForMac/Defines (= 4.2.1) + - GoogleUtilities/Environment (7.13.3): + - GoogleUtilities/Privacy - PromisesObjC (< 3.0, >= 1.2) - - GoogleUtilities/Logger (7.10.0): + - GoogleUtilities/Logger (7.13.3): - GoogleUtilities/Environment - - GoogleUtilities/UserDefaults (7.10.0): + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (7.13.3) + - GoogleUtilities/UserDefaults (7.13.3): - GoogleUtilities/Logger + - GoogleUtilities/Privacy - GoogleUtilitiesComponents (1.1.0): - GoogleUtilities/Logger - - GTMSessionFetcher/Core (1.7.2) + - GTMSessionFetcher/Core (3.5.0) - in_app_purchase_storekit (0.0.1): - Flutter - FlutterMacOS - - MLImage (1.0.0-beta3) - - MLKitBarcodeScanning (2.2.0): - - MLKitCommon (~> 8.0) - - MLKitVision (~> 4.2) - - MLKitCommon (8.0.0): - - GoogleDataTransport (~> 9.0) - - GoogleToolboxForMac/Logger (~> 2.1) - - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" - - "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)" - - GoogleUtilities/UserDefaults (~> 7.0) + - MLImage (1.0.0-beta5) + - MLKitBarcodeScanning (5.0.0): + - MLKitCommon (~> 11.0) + - MLKitVision (~> 7.0) + - MLKitCommon (11.0.0): + - GoogleDataTransport (< 10.0, >= 9.4.1) + - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) + - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" + - GoogleUtilities/UserDefaults (< 8.0, >= 7.13.0) - GoogleUtilitiesComponents (~> 1.0) - - GTMSessionFetcher/Core (~> 1.1) - - Protobuf (~> 3.12) - - MLKitVision (4.2.0): - - GoogleToolboxForMac/Logger (~> 2.1) - - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" - - GTMSessionFetcher/Core (~> 1.1) - - MLImage (= 1.0.0-beta3) - - MLKitCommon (~> 8.0) - - Protobuf (~> 3.12) - - mobile_scanner (3.0.0): + - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) + - MLKitVision (7.0.0): + - GoogleToolboxForMac/Logger (< 5.0, >= 4.2.1) + - "GoogleToolboxForMac/NSData+zlib (< 5.0, >= 4.2.1)" + - GTMSessionFetcher/Core (< 4.0, >= 3.3.2) + - MLImage (= 1.0.0-beta5) + - MLKitCommon (~> 11.0) + - mobile_scanner (5.2.1): - Flutter - - GoogleMLKit/BarcodeScanning (~> 3.2.0) - - nanopb (2.30909.0): - - nanopb/decode (= 2.30909.0) - - nanopb/encode (= 2.30909.0) - - nanopb/decode (2.30909.0) - - nanopb/encode (2.30909.0) - - PromisesObjC (2.1.1) - - Protobuf (3.21.12) - - shared_preferences_ios (0.0.1): + - GoogleMLKit/BarcodeScanning (~> 6.0.0) + - nanopb (2.30910.0): + - nanopb/decode (= 2.30910.0) + - nanopb/encode (= 2.30910.0) + - nanopb/decode (2.30910.0) + - nanopb/encode (2.30910.0) + - PromisesObjC (2.4.0) + - shared_preferences_foundation (0.0.1): - Flutter + - FlutterMacOS - sqflite (0.0.2): - Flutter - FMDB (>= 2.7.5) @@ -81,7 +77,7 @@ DEPENDENCIES: - flutter_js (from `.symlinks/plugins/flutter_js/ios`) - in_app_purchase_storekit (from `.symlinks/plugins/in_app_purchase_storekit/darwin`) - mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) - - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) @@ -100,7 +96,6 @@ SPEC REPOS: - MLKitVision - nanopb - PromisesObjC - - Protobuf EXTERNAL SOURCES: Flutter: @@ -111,36 +106,35 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/in_app_purchase_storekit/darwin" mobile_scanner: :path: ".symlinks/plugins/mobile_scanner/ios" - shared_preferences_ios: - :path: ".symlinks/plugins/shared_preferences_ios/ios" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" sqflite: :path: ".symlinks/plugins/sqflite/ios" url_launcher: :path: ".symlinks/plugins/url_launcher/ios" SPEC CHECKSUMS: - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_js: 95929d4e146e8ceb1c8e1889d8c2065c5d840076 - FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a - GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f - GoogleMLKit: 0017a6a8372e1a182139b9def4d89be5d87ca5a7 - GoogleToolboxForMac: 8bef7c7c5cf7291c687cf5354f39f9db6399ad34 - GoogleUtilities: bad72cb363809015b1f7f19beb1f1cd23c589f95 + FMDB: 728731dd336af3936ce00f91d9d8495f5718a0e6 + GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a + GoogleMLKit: 97ac7af399057e99182ee8edfa8249e3226a4065 + GoogleToolboxForMac: d1a2cbf009c453f4d6ded37c105e2f67a32206d8 + GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe - GTMSessionFetcher: 5595ec75acf5be50814f81e9189490412bad82ba + GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 in_app_purchase_storekit: 6b297e2b5eab9fa3251a492d57301722e4132a71 - MLImage: 489dfec109f21da8621b28d476401aaf7a0d4ff4 - MLKitBarcodeScanning: d92fe1911001ec36870162c5a0eb206f612b7169 - MLKitCommon: f6da6c5659618c070b50a80db01248ebe2964175 - MLKitVision: 96c96571190b7f63eddf4a12068ce8a8689e0d2c - mobile_scanner: 004f7ad2fe4e2b5a3e6ed0bc4b83ca9c5b5dd975 - nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 - PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb - Protobuf: 120350fc38646e2dedc26f49ecba778184ea1de2 - shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad + MLImage: 1824212150da33ef225fbd3dc49f184cf611046c + MLKitBarcodeScanning: 10ca0845a6d15f2f6e911f682a1998b68b973e8b + MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1 + MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1 + mobile_scanner: 131a34df36b024cc53457809fb991700f16f72d7 + nanopb: 438bc412db1928dac798aa6fd75726007be04262 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef -PODFILE CHECKSUM: 21e78760fee629465f00ee6e1b0ca78764f69ff7 +PODFILE CHECKSUM: 7f1e4acaf8036ffd17b53cc1bccdd9d11d323dbd COCOAPODS: 1.15.2 diff --git a/gui-orchid/macos/Podfile.lock b/gui-orchid/macos/Podfile.lock index 14f277bb7..846b7ca9b 100644 --- a/gui-orchid/macos/Podfile.lock +++ b/gui-orchid/macos/Podfile.lock @@ -2,15 +2,18 @@ PODS: - flutter_js (0.0.1): - FlutterMacOS - FlutterMacOS (1.0.0) - - FMDB (2.7.5): - - FMDB/standard (= 2.7.5) - - FMDB/standard (2.7.5) + - FMDB (2.7.12): + - FMDB/standard (= 2.7.12) + - FMDB/Core (2.7.12) + - FMDB/standard (2.7.12): + - FMDB/Core - in_app_purchase_storekit (0.0.1): - Flutter - FlutterMacOS - - mobile_scanner (3.0.0): + - mobile_scanner (5.2.1): - FlutterMacOS - - shared_preferences_macos (0.0.1): + - shared_preferences_foundation (0.0.1): + - Flutter - FlutterMacOS - sqflite (0.0.2): - FlutterMacOS @@ -25,7 +28,7 @@ DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) - in_app_purchase_storekit (from `Flutter/ephemeral/.symlinks/plugins/in_app_purchase_storekit/darwin`) - mobile_scanner (from `Flutter/ephemeral/.symlinks/plugins/mobile_scanner/macos`) - - shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`) + - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`) @@ -43,8 +46,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/in_app_purchase_storekit/darwin mobile_scanner: :path: Flutter/ephemeral/.symlinks/plugins/mobile_scanner/macos - shared_preferences_macos: - :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos + shared_preferences_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin sqflite: :path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos url_launcher_macos: @@ -55,10 +58,10 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: flutter_js: c664361655af1d8fc24e278c7d086e9cbe0d68bc FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + FMDB: 728731dd336af3936ce00f91d9d8495f5718a0e6 in_app_purchase_storekit: 6b297e2b5eab9fa3251a492d57301722e4132a71 - mobile_scanner: 9c643c89604da4c76917f7bd37266fcdd48bda75 - shared_preferences_macos: a64dc611287ed6cbe28fd1297898db1336975727 + mobile_scanner: 4d1f08373cb0321594c81c7709aa460c17b8b84f + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4 window_size: 339dafa0b27a95a62a843042038fa6c3c48de195 diff --git a/gui-orchid/pubspec.lock b/gui-orchid/pubspec.lock index ceef1d2fb..9b1fff511 100644 --- a/gui-orchid/pubspec.lock +++ b/gui-orchid/pubspec.lock @@ -69,18 +69,18 @@ packages: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.5" csslib: dependency: transitive description: name: csslib - sha256: b36c7f7e24c0bdf1bf9a3da461c837d1de64b9f8beb190c9011d8c72a3dfd745 + sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f" url: "https://pub.dev" source: hosted - version: "0.17.2" + version: "0.17.3" cupertino_icons: dependency: "direct main" description: @@ -141,18 +141,18 @@ packages: dependency: transitive description: name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.3" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" fixnum: dependency: "direct main" description: @@ -241,18 +241,18 @@ packages: dependency: "direct main" description: name: in_app_purchase_android - sha256: a43295532f8d9fba4dfa46c110073a6ac43413903426bddeeb81580c021df154 + sha256: "25eb8694819caca282a527c26d5a1775164965c554ee99b9c10f3a0e44675c75" url: "https://pub.dev" source: hosted - version: "0.2.3+7" + version: "0.3.6+8" in_app_purchase_platform_interface: dependency: transitive description: name: in_app_purchase_platform_interface - sha256: d20d37a3cb513a647a570bfcae7ca0ec2038dab6258f58926ddc926a859a03d0 + sha256: "1d353d38251da5b9fea6635c0ebfc6bb17a2d28d0e86ea5e083bf64244f1fb4c" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" in_app_purchase_storekit: dependency: "direct main" description: @@ -281,18 +281,18 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" json_annotation: dependency: transitive description: name: json_annotation - sha256: "3520fa844009431b5d4491a5a778603520cdc399ab3406332dcc50f93547258c" + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "4.9.0" json_rpc_2: dependency: transitive description: @@ -401,26 +401,26 @@ packages: dependency: transitive description: name: path_provider_linux - sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.3.0" pedantic: dependency: "direct dev" description: @@ -441,18 +441,18 @@ packages: dependency: transitive description: name: petitparser - sha256: "49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4" + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.4.0" platform: dependency: transitive description: name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -469,14 +469,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.7.3" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" - source: hosted - version: "4.2.4" provider: dependency: "direct main" description: @@ -537,10 +529,10 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: a7e8467e9181cef109f601e3f65765685786c1a738a83d7fbbde377589c0d974 + sha256: "480ba4345773f56acda9abf5f50bd966f581dac5d514e5fc4a18c62976bbba7e" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shared_preferences_foundation: dependency: transitive description: @@ -606,10 +598,10 @@ packages: dependency: transitive description: name: sqflite_common - sha256: "0c21a187d645aa65da5be6997c0c713eed61e049158870ae2de157e6897067ab" + sha256: "7b41b6c3507854a159e24ae90a8e3e9cc01eb26a477c118d6dca065b5f55453e" url: "https://pub.dev" source: hosted - version: "2.4.0+2" + version: "2.5.4+2" stack_trace: dependency: transitive description: @@ -662,10 +654,10 @@ packages: dependency: transitive description: name: synchronized - sha256: "7b530acd9cb7c71b0019a1e7fa22c4105e675557a4400b6a401c71c5e0ade1ac" + sha256: a824e842b8a054f91a728b783c177c1e4731f6b124f9192468457a8913371255 url: "https://pub.dev" source: hosted - version: "3.0.0+3" + version: "3.2.0" term_glyph: dependency: transitive description: @@ -686,10 +678,10 @@ packages: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" url_launcher: dependency: "direct main" description: @@ -718,18 +710,18 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.3.2" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "5669882643b96bb6d5786637cac727c6e918a790053b09245fd4513b8a07df2a" + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" url: "https://pub.dev" source: hosted - version: "2.0.13" + version: "2.3.3" url_launcher_windows: dependency: transitive description: @@ -766,10 +758,10 @@ packages: dependency: transitive description: name: wallet - sha256: "569c91c2af13a9e1119c001f9c09218eccf3f383eb8d15ba13a5b558010c1bc0" + sha256: "687fd89a16557649b26189e597792962f405797fc64113e8758eabc2c2605c32" url: "https://pub.dev" source: hosted - version: "0.0.12+1" + version: "0.0.13" web: dependency: transitive description: @@ -786,14 +778,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.7.1" - win32: - dependency: transitive - description: - name: win32 - sha256: ca121dbbadb3e43b449053feab0cdf3f2bff93b107cacf0290e3d29f717374b6 - url: "https://pub.dev" - source: hosted - version: "3.1.2" window_size: dependency: "direct main" description: @@ -805,10 +789,10 @@ packages: dependency: transitive description: name: xdg_directories - sha256: "11541eedefbcaec9de35aa82650b695297ce668662bbd6e3911a7fabdbde589f" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "0.2.0+2" + version: "1.0.4" xml: dependency: transitive description: @@ -821,10 +805,10 @@ packages: dependency: transitive description: name: xmlstream - sha256: "2d10c69a9d5fc46f71798b80ee6db15bc0d5bf560fdbdd264776cbeee0c83631" + sha256: cfc14e3f256997897df9481ae630d94c2d85ada5187ebeb868bb1aabc2c977b4 url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.1" sdks: - dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.5.0 <4.0.0" + flutter: ">=3.24.0" diff --git a/vpn-apple/source/tunnel.cpp b/vpn-apple/source/tunnel.cpp index 0bc10d470..2a20b04c6 100644 --- a/vpn-apple/source/tunnel.cpp +++ b/vpn-apple/source/tunnel.cpp @@ -20,6 +20,7 @@ /* }}} */ +// the order of these headers matters :/ #include #include #include diff --git a/vpn-apple/source/tunnel.mm b/vpn-apple/source/tunnel.mm index 3ee7cd31d..81f1a73ae 100644 --- a/vpn-apple/source/tunnel.mm +++ b/vpn-apple/source/tunnel.mm @@ -20,10 +20,8 @@ /* }}} */ -// the order of these headers matters :/ -#include -#include -#include +#define SYSPROTO_CONTROL 2 +#define UTUN_OPT_IFNAME 2 #include diff --git a/vpn-apple/target.mk b/vpn-apple/target.mk index d8d8237ec..0899139d0 100644 --- a/vpn-apple/target.mk +++ b/vpn-apple/target.mk @@ -23,7 +23,13 @@ lflags += -framework SystemConfiguration cflags += -I$(pwd)/source -source += $(wildcard $(pwd)/source/*.cpp) +ifneq ($(target),ios) +# XXX: this works on iOS, but requires MacOSX.sdk and is useless +source += $(pwd)/source/tunnel.cpp +endif + +source += $(pwd)/source/protect.cpp + source += $(wildcard $(pwd)/source/*.mm) # XXX: this will be fixed with the Capture refactor From 2077a2c5f9ef974c75655e426ab919d643f33ee2 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 4 Nov 2024 12:50:59 -0800 Subject: [PATCH 8/8] Add temporary fix for MinGW's repository reorg :/. --- env/target-win.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/target-win.mk b/env/target-win.mk index 85da28abb..3d2608831 100644 --- a/env/target-win.mk +++ b/env/target-win.mk @@ -130,7 +130,7 @@ sysroot += $$(temp) $(output)/$(1)/%.msys2: @mkdir -p $$(dir $$@) - curl https://repo.msys2.org/mingw/$(1)/mingw-w64-$(1)-$$*-any.pkg.tar.zst | zstd -d | tar -C $(output)/$(1) -xvf- + curl -L https://repo.msys2.org/mingw/$(1)/mingw-w64-$(1)-$$*-any.pkg.tar.zst | zstd -d | tar -C $(output)/$(1) -xvf- @touch $$@ sysroot += $(patsubst %,$(output)/$(1)/%.msys2,$(msys2)) endef