CW-59-New-update-highlight-popup (#863)

* add update pop up

* add release notes for monero com

* PR comments fixes

* Pr coments fixes

* minor fixes

* update from main

* [skip ci] remove unrelated mac os files

* add check isNewInstall

* update pop-up UI

* fix size

* Add update popup to desktop dashboard page [skip ci]

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
This commit is contained in:
Serhii 2023-04-21 18:21:31 +03:00 committed by GitHub
parent 3fc927f742
commit 8ffac75e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 263 additions and 37 deletions

View file

@ -0,0 +1,13 @@
Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)Added Fixed Rate for exchanges
WWEE(enter the "receive" amount on the exchange page to get the fixed rate)Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Keep screen awake while the synchronization function
Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Keep screen awake while the synchronization function
Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Keep screen awake while the synchronizatio

View file

@ -0,0 +1,13 @@
Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)Added Fixed Rate for exchanges
WWEE(enter the "receive" amount on the exchange page to get the fixed rate)Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Keep screen awake while the synchronization function
Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Keep screen awake while the synchronization function
Added Fixed Rate for exchanges (enter the "receive" amount on the exchange page to get the fixed rate)
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Changed algorithm for choosing of change address for BTC and LTC electrum wallets
Keep screen awake while the synchronizatio

View file

@ -208,7 +208,7 @@ Future setup(
required Box<TransactionDescription> transactionDescriptionBox,
required Box<Order> ordersSource,
Box<UnspentCoinsInfo>? unspentCoinsInfoSource,
required Box<AnonpayInvoiceInfo> anonpayInvoiceInfoSource
required Box<AnonpayInvoiceInfo> anonpayInvoiceInfoSource,
}) async {
_walletInfoSource = walletInfoSource;
_nodeSource = nodeSource;
@ -396,6 +396,7 @@ Future setup(
dashboardViewModel: getIt.get<DashboardViewModel>(),
addressListViewModel: getIt.get<WalletAddressListViewModel>(),
));
getIt.registerFactory<DesktopSidebarWrapper>(() {
final GlobalKey<NavigatorState> _navigatorKey = GlobalKey<NavigatorState>();
return DesktopSidebarWrapper(

View file

@ -42,6 +42,13 @@ Future defaultSettingsMigration(
// check current nodes for nullability regardless of the version
await checkCurrentNodes(nodes, sharedPreferences);
final isNewInstall = sharedPreferences
.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion) == null;
await sharedPreferences.setBool(
PreferencesKey.isNewInstall, isNewInstall);
final currentVersion = sharedPreferences
.getInt(PreferencesKey.currentDefaultSettingsMigrationVersion) ??
0;

View file

@ -41,6 +41,8 @@ class PreferencesKey {
static const exchangeProvidersSelection = 'exchange-providers-selection';
static const clearnetDonationLink = 'clearnet_donation_link';
static const onionDonationLink = 'onion_donation_link';
static const onionDonationLink = 'onion_donation_link';
static const lastSeenAppVersion = 'last_seen_app_version';
static const shouldShowMarketPlaceInDashboard = 'should_show_marketplace_in_dashboard';
static const isNewInstall = 'is_new_install';
}

View file

@ -187,8 +187,7 @@ Future<void> initialSetup(
transactionDescriptionBox: transactionDescriptions,
ordersSource: ordersSource,
anonpayInvoiceInfoSource: anonpayInvoiceInfo,
unspentCoinsInfoSource: unspentCoinsInfoSource,
);
unspentCoinsInfoSource: unspentCoinsInfoSource);
await bootstrap(navigatorKey);
monero?.onStartup();
}

View file

@ -1,8 +1,10 @@
import 'dart:async';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/entities/main_actions.dart';
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/market_place_page.dart';
import 'package:cake_wallet/utils/version_comparator.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
@ -22,8 +24,12 @@ import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:mobx/mobx.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/buy/moonpay/moonpay_buy_provider.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:cake_wallet/src/screens/release_notes/release_notes_screen.dart';
class DashboardPage extends StatelessWidget {
DashboardPage({
@ -117,7 +123,7 @@ class _DashboardPageView extends BasePage {
@override
Widget body(BuildContext context) {
final controller = PageController(initialPage: initialPage);
reaction((_) => dashboardViewModel.shouldShowMarketPlaceInDashboard, (bool value) {
if (!dashboardViewModel.shouldShowMarketPlaceInDashboard) {
controller.jumpToPage(0);
@ -131,7 +137,7 @@ class _DashboardPageView extends BasePage {
} else {
controller.jumpToPage(0);
}
});
});
_setEffects(context);
return SafeArea(
@ -266,6 +272,25 @@ class _DashboardPageView extends BasePage {
}
});
final sharedPrefs = await SharedPreferences.getInstance();
final currentAppVersion =
VersionComparator.getExtendedVersionNumber(dashboardViewModel.settingsStore.appVersion);
final lastSeenAppVersion = sharedPrefs.getInt(PreferencesKey.lastSeenAppVersion);
final isNewInstall = sharedPrefs.getBool(PreferencesKey.isNewInstall);
if (currentAppVersion != lastSeenAppVersion && !isNewInstall!) {
await Future<void>.delayed(Duration(seconds: 1));
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
return ReleaseNotesScreen(
title: 'Version ${dashboardViewModel.settingsStore.appVersion}');
});
sharedPrefs.setInt(PreferencesKey.lastSeenAppVersion, currentAppVersion);
} else if (isNewInstall!) {
sharedPrefs.setInt(PreferencesKey.lastSeenAppVersion, currentAppVersion);
}
var needToPresentYat = false;
var isInactive = false;

View file

@ -1,9 +1,12 @@
import 'dart:async';
import 'package:cake_wallet/entities/preferences_key.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/release_notes/release_notes_screen.dart';
import 'package:cake_wallet/src/screens/yat_emoji_id.dart';
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
import 'package:cake_wallet/utils/show_pop_up.dart';
import 'package:cake_wallet/utils/version_comparator.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/balance_page.dart';
@ -11,6 +14,7 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_v
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/main.dart';
import 'package:cake_wallet/router.dart' as Router;
import 'package:shared_preferences/shared_preferences.dart';
class DesktopDashboardPage extends StatelessWidget {
DesktopDashboardPage({
@ -107,5 +111,24 @@ class DesktopDashboardPage extends StatelessWidget {
needToPresentYat = true;
});
final sharedPrefs = await SharedPreferences.getInstance();
final currentAppVersion =
VersionComparator.getExtendedVersionNumber(dashboardViewModel.settingsStore.appVersion);
final lastSeenAppVersion = sharedPrefs.getInt(PreferencesKey.lastSeenAppVersion);
final isNewInstall = sharedPrefs.getBool(PreferencesKey.isNewInstall);
if (currentAppVersion != lastSeenAppVersion && !isNewInstall!) {
await Future<void>.delayed(Duration(seconds: 1));
await showPopUp<void>(
context: context,
builder: (BuildContext context) {
return ReleaseNotesScreen(
title: 'Version ${dashboardViewModel.settingsStore.appVersion}');
});
sharedPrefs.setInt(PreferencesKey.lastSeenAppVersion, currentAppVersion);
} else if (isNewInstall!) {
sharedPrefs.setInt(PreferencesKey.lastSeenAppVersion, currentAppVersion);
}
}
}

View file

@ -16,7 +16,6 @@ class FilterWidget extends StatelessWidget {
FilterWidget({required this.dashboardViewModel});
final DashboardViewModel dashboardViewModel;
final closeIcon = Image.asset('assets/images/close.png', color: Palette.darkBlueCraiola);
@override
Widget build(BuildContext context) {
@ -101,7 +100,7 @@ class FilterWidget extends StatelessWidget {
),
],
),
AlertCloseButton(image: closeIcon)
AlertCloseButton()
],
),
);

View file

@ -27,9 +27,6 @@ class MoneroAccountListPage extends StatelessWidget {
}
final MoneroAccountListViewModel accountListViewModel;
final closeIcon = Image.asset('assets/images/close.png',
color: Palette.darkBlueCraiola,
);
ScrollController controller;
double backgroundHeight;
@ -163,7 +160,7 @@ class MoneroAccountListPage extends StatelessWidget {
)
],
),
AlertCloseButton(image: closeIcon)
AlertCloseButton()
],
),
);

View file

@ -0,0 +1,141 @@
import 'dart:convert';
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class ReleaseNotesScreen extends StatelessWidget {
const ReleaseNotesScreen({
required this.title,
});
final String title;
Future<List<String>> _loadStrings() async {
String notesContent = await rootBundle.loadString(
isMoneroOnly ? 'assets/text/Monerocom_Release_Notes.txt' : 'assets/text/Release_Notes.txt');
return LineSplitter().convert(notesContent);
}
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: [
AlertBackground(
child: AlertDialog(
insetPadding: EdgeInsets.only(left: 16, right: 16, bottom: 48),
elevation: 0.0,
contentPadding: EdgeInsets.zero,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(30))),
content: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
gradient: LinearGradient(colors: [
Theme.of(context).colorScheme.secondary,
Theme.of(context).scaffoldBackgroundColor,
], begin: Alignment.centerLeft, end: Alignment.centerRight)),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24.0),
child: Stack(
children: [
SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Container(
alignment: Alignment.bottomCenter,
child: DefaultTextStyle(
style: TextStyle(
decoration: TextDecoration.none,
fontSize: 24.0,
fontWeight: FontWeight.bold,
fontFamily: 'Lato',
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
),
child: Text(title),
),
),
),
),
SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(top: 48, bottom: 16),
child: Container(
width: double.maxFinite,
child: Column(
children: <Widget>[
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.7,
),
child: _getNotesWidget(),
)
],
),
),
),
),
],
),
),
),
),
),
AlertCloseButton(
bottom: 30,
)
],
);
}
Widget _getNotesWidget() {
return FutureBuilder<List<String>>(
future: _loadStrings(),
builder: (BuildContext context, AsyncSnapshot<List<String>> snapshot) {
if (snapshot.hasData) {
return ListView.builder(
shrinkWrap: true,
itemCount: snapshot.data!.length,
itemBuilder: (BuildContext context, int index) {
return _getNoteItemWidget(snapshot.data![index], context);
},
);
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
return Center(child: CircularProgressIndicator());
}
},
);
}
Widget _getNoteItemWidget(String myString, BuildContext context) {
return Column(
children: [
DefaultTextStyle(
style: TextStyle(
decoration: TextDecoration.none,
fontSize: 16.0,
fontFamily: 'Lato',
color: Theme.of(context).accentTextTheme!.headline2!.backgroundColor!,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Text(''),
),
Expanded(
child: Text(myString),
),
],
)),
SizedBox(
height: 16.0,
)
],
);
}
}

View file

@ -47,23 +47,19 @@ const List<String> seedLanguages = [
enum Places { topLeft, topRight, bottomLeft, bottomRight, inside }
class SeedLanguagePicker extends StatefulWidget {
SeedLanguagePicker(
{Key? key,
this.selected = defaultSeedLanguage,
required this.onItemSelected})
SeedLanguagePicker({Key? key, this.selected = defaultSeedLanguage, required this.onItemSelected})
: super(key: key);
final String selected;
final Function(String) onItemSelected;
@override
SeedLanguagePickerState createState() => SeedLanguagePickerState(
selected: selected, onItemSelected: onItemSelected);
SeedLanguagePickerState createState() =>
SeedLanguagePickerState(selected: selected, onItemSelected: onItemSelected);
}
class SeedLanguagePickerState extends State<SeedLanguagePicker> {
SeedLanguagePickerState(
{required this.selected, required this.onItemSelected});
SeedLanguagePickerState({required this.selected, required this.onItemSelected});
final String selected;
final Function(String) onItemSelected;

View file

@ -15,20 +15,18 @@ class AlertCloseButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Positioned(
bottom: bottom ?? 60,
child: GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
height: 42,
width: 42,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle
),
child: Center(
child: image ?? closeButton,
),
bottom: bottom ?? 60,
child: GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
height: 42,
width: 42,
decoration: BoxDecoration(color: Colors.white, shape: BoxShape.circle),
child: Center(
child: image ?? closeButton,
),
));
),
),
);
}
}
}

View file

@ -0,0 +1,13 @@
class VersionComparator {
static bool isVersion1Greater({required String v1, required String v2}) {
int v1Number = getExtendedVersionNumber(v1);
int v2Number = getExtendedVersionNumber(v2);
return v1Number > v2Number;
}
static int getExtendedVersionNumber(String version) {
List<String> stringVersionCells = version.split('.');
List<int> intVersionCells = stringVersionCells.map((i) => int.parse(i)).toList();
return intVersionCells[0] * 100000 + intVersionCells[1] * 1000 + intVersionCells[2];
}
}

View file

@ -43,8 +43,7 @@ abstract class DashboardViewModelBase with Store {
required this.settingsStore,
required this.yatStore,
required this.ordersStore,
required this.anonpayTransactionsStore,
})
required this.anonpayTransactionsStore})
: isOutdatedElectrumWallet = false,
hasSellAction = false,
isEnabledSellAction = false,