mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-11-17 09:47:35 +00:00
Update branch to null safety
Fix Conflicts with main
This commit is contained in:
parent
6210d8fba6
commit
ba783982e4
6 changed files with 25 additions and 28 deletions
|
@ -17,7 +17,7 @@ class Node extends HiveObject with Keyable {
|
||||||
{this.login,
|
{this.login,
|
||||||
this.password,
|
this.password,
|
||||||
this.useSSL,
|
this.useSSL,
|
||||||
this.trusted,
|
this.trusted = false,
|
||||||
String? uri,
|
String? uri,
|
||||||
WalletType? type,}) {
|
WalletType? type,}) {
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
|
@ -33,7 +33,7 @@ class Node extends HiveObject with Keyable {
|
||||||
login = map['login'] as String?,
|
login = map['login'] as String?,
|
||||||
password = map['password'] as String?,
|
password = map['password'] as String?,
|
||||||
useSSL = map['useSSL'] as bool?,
|
useSSL = map['useSSL'] as bool?,
|
||||||
useSSL = map['trusted'] as bool? ?? false;
|
trusted = map['trusted'] as bool? ?? false;
|
||||||
|
|
||||||
static const typeId = 1;
|
static const typeId = 1;
|
||||||
static const boxName = 'Nodes';
|
static const boxName = 'Nodes';
|
||||||
|
@ -58,8 +58,6 @@ class Node extends HiveObject with Keyable {
|
||||||
|
|
||||||
bool get isSSL => useSSL ?? false;
|
bool get isSSL => useSSL ?? false;
|
||||||
|
|
||||||
bool get isTrusted => trusted ?? false;
|
|
||||||
|
|
||||||
Uri get uri {
|
Uri get uri {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WalletType.monero:
|
case WalletType.monero:
|
||||||
|
|
|
@ -478,8 +478,9 @@ Future setup(
|
||||||
|
|
||||||
getIt.registerFactory(() => NodeListPage(getIt.get<NodeListViewModel>()));
|
getIt.registerFactory(() => NodeListPage(getIt.get<NodeListViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() =>
|
getIt.registerFactoryParam<NodeCreateOrEditViewModel, WalletType?, void>(
|
||||||
NodeCreateOrEditViewModel(_nodeSource, getIt.get<AppStore>().wallet!));
|
(WalletType? type, _) =>
|
||||||
|
NodeCreateOrEditViewModel(_nodeSource, type ?? getIt.get<AppStore>().wallet!.type));
|
||||||
|
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(
|
||||||
() => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
|
() => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
|
||||||
|
|
|
@ -4,7 +4,6 @@ import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.
|
||||||
import 'package:cake_wallet/view_model/privacy_settings_view_model.dart';
|
import 'package:cake_wallet/view_model/privacy_settings_view_model.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||||
|
@ -25,7 +24,7 @@ class AdvancedPrivacySettingsPage extends BasePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
class AdvancedPrivacySettingsBody extends StatefulWidget {
|
class AdvancedPrivacySettingsBody extends StatefulWidget {
|
||||||
const AdvancedPrivacySettingsBody(this.privacySettingsViewModel, this.nodeViewModel, {Key key})
|
const AdvancedPrivacySettingsBody(this.privacySettingsViewModel, this.nodeViewModel, {Key? key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
final PrivacySettingsViewModel privacySettingsViewModel;
|
final PrivacySettingsViewModel privacySettingsViewModel;
|
||||||
|
@ -85,7 +84,7 @@ class _AdvancedPrivacySettingsBodyState
|
||||||
LoadingPrimaryButton(
|
LoadingPrimaryButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
text: S.of(context).continue_text,
|
text: S.of(context).continue_text,
|
||||||
color: Theme.of(context).accentTextTheme.body2.color,
|
color: Theme.of(context).accentTextTheme.bodyText1!.color!,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
const SizedBox(height: 25),
|
||||||
|
@ -96,7 +95,7 @@ class _AdvancedPrivacySettingsBodyState
|
||||||
S.of(context).settings_can_be_changed_later,
|
S.of(context).settings_can_be_changed_later,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).accentTextTheme.display3.color,
|
color: Theme.of(context).accentTextTheme.headline2?.color,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -10,8 +10,8 @@ import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
class NodeForm extends StatelessWidget {
|
class NodeForm extends StatelessWidget {
|
||||||
NodeForm({
|
NodeForm({
|
||||||
@required this.nodeViewModel,
|
required this.nodeViewModel,
|
||||||
@required this.formKey,
|
required this.formKey,
|
||||||
}) : _addressController = TextEditingController(),
|
}) : _addressController = TextEditingController(),
|
||||||
_portController = TextEditingController(),
|
_portController = TextEditingController(),
|
||||||
_loginController = TextEditingController(),
|
_loginController = TextEditingController(),
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'package:cake_wallet/core/execution_state.dart';
|
import 'package:cake_wallet/core/execution_state.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
import 'package:cw_core/wallet_base.dart';
|
|
||||||
import 'package:cw_core/node.dart';
|
import 'package:cw_core/node.dart';
|
||||||
import 'package:cw_core/wallet_type.dart';
|
import 'package:cw_core/wallet_type.dart';
|
||||||
|
|
||||||
|
@ -11,7 +10,7 @@ class NodeCreateOrEditViewModel = NodeCreateOrEditViewModelBase
|
||||||
with _$NodeCreateOrEditViewModel;
|
with _$NodeCreateOrEditViewModel;
|
||||||
|
|
||||||
abstract class NodeCreateOrEditViewModelBase with Store {
|
abstract class NodeCreateOrEditViewModelBase with Store {
|
||||||
NodeCreateOrEditViewModelBase(this._nodeSource, this._wallet)
|
NodeCreateOrEditViewModelBase(this._nodeSource, this._walletType)
|
||||||
: state = InitialExecutionState(),
|
: state = InitialExecutionState(),
|
||||||
connectionState = InitialExecutionState(),
|
connectionState = InitialExecutionState(),
|
||||||
useSSL = false,
|
useSSL = false,
|
||||||
|
@ -49,8 +48,8 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||||
bool get isReady =>
|
bool get isReady =>
|
||||||
address.isNotEmpty && port.isNotEmpty;
|
address.isNotEmpty && port.isNotEmpty;
|
||||||
|
|
||||||
bool get hasAuthCredentials => _wallet.type == WalletType.monero ||
|
bool get hasAuthCredentials => _walletType == WalletType.monero ||
|
||||||
_wallet.type == WalletType.haven;
|
_walletType == WalletType.haven;
|
||||||
|
|
||||||
String get uri {
|
String get uri {
|
||||||
var uri = address;
|
var uri = address;
|
||||||
|
@ -62,7 +61,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WalletBase _wallet;
|
final WalletType _walletType;
|
||||||
final Box<Node> _nodeSource;
|
final Box<Node> _nodeSource;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
|
@ -80,7 +79,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||||
try {
|
try {
|
||||||
state = IsExecutingState();
|
state = IsExecutingState();
|
||||||
final node =
|
final node =
|
||||||
Node(uri: uri, type: _wallet.type, login: login, password: password,
|
Node(uri: uri, type: _walletType, login: login, password: password,
|
||||||
useSSL: useSSL, trusted: trusted);
|
useSSL: useSSL, trusted: trusted);
|
||||||
await _nodeSource.add(node);
|
await _nodeSource.add(node);
|
||||||
state = ExecutedSuccessfullyState();
|
state = ExecutedSuccessfullyState();
|
||||||
|
@ -94,7 +93,7 @@ abstract class NodeCreateOrEditViewModelBase with Store {
|
||||||
try {
|
try {
|
||||||
connectionState = IsExecutingState();
|
connectionState = IsExecutingState();
|
||||||
final node =
|
final node =
|
||||||
Node(uri: uri, type: _wallet.type, login: login, password: password);
|
Node(uri: uri, type: _walletType, login: login, password: password);
|
||||||
final isAlive = await node.requestNode();
|
final isAlive = await node.requestNode();
|
||||||
connectionState = ExecutedSuccessfullyState(payload: isAlive);
|
connectionState = ExecutedSuccessfullyState(payload: isAlive);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -9,13 +9,13 @@ class PrivacySettingsViewModel = PrivacySettingsViewModelBase
|
||||||
with _$PrivacySettingsViewModel;
|
with _$PrivacySettingsViewModel;
|
||||||
|
|
||||||
abstract class PrivacySettingsViewModelBase with Store {
|
abstract class PrivacySettingsViewModelBase with Store {
|
||||||
PrivacySettingsViewModelBase(this.type) {
|
PrivacySettingsViewModelBase(this.type)
|
||||||
_disableFiat = false;
|
: _disableFiat = false,
|
||||||
_disableExchange = false;
|
_disableExchange = false,
|
||||||
_addCustomNode = false;
|
_addCustomNode = false {
|
||||||
|
|
||||||
settings = [
|
settings = [
|
||||||
SwitcherListItem(
|
SwitcherListItem(
|
||||||
|
// TODO: replace when Disable Fiat PR is merged
|
||||||
title: "Disable Fiat API",
|
title: "Disable Fiat API",
|
||||||
// title: S.current.disable_fiat,
|
// title: S.current.disable_fiat,
|
||||||
value: () => _disableFiat,
|
value: () => _disableFiat,
|
||||||
|
@ -36,16 +36,16 @@ abstract class PrivacySettingsViewModelBase with Store {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SwitcherListItem> settings;
|
late List<SwitcherListItem> settings;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
bool _disableFiat;
|
bool _disableFiat = false;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
bool _disableExchange;
|
bool _disableExchange = false;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
bool _addCustomNode;
|
bool _addCustomNode = false;
|
||||||
|
|
||||||
final WalletType type;
|
final WalletType type;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue