Spam Filter
This commit is contained in:
parent
39abcf2d8d
commit
274c73ce88
|
@ -105,6 +105,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
MessageLookupByLibrary.simpleMessage("Amount must be positive"),
|
MessageLookupByLibrary.simpleMessage("Amount must be positive"),
|
||||||
"amountTooHigh":
|
"amountTooHigh":
|
||||||
MessageLookupByLibrary.simpleMessage("Amount too high"),
|
MessageLookupByLibrary.simpleMessage("Amount too high"),
|
||||||
|
"antispamFilter":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Anti-Spam Filter"),
|
||||||
"applicationReset":
|
"applicationReset":
|
||||||
MessageLookupByLibrary.simpleMessage("Application Reset"),
|
MessageLookupByLibrary.simpleMessage("Application Reset"),
|
||||||
"approve": MessageLookupByLibrary.simpleMessage("APPROVE"),
|
"approve": MessageLookupByLibrary.simpleMessage("APPROVE"),
|
||||||
|
|
|
@ -105,6 +105,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"Cantidad debe ser un positivo"),
|
"Cantidad debe ser un positivo"),
|
||||||
"amountTooHigh":
|
"amountTooHigh":
|
||||||
MessageLookupByLibrary.simpleMessage("Cantidad demasiado alta"),
|
MessageLookupByLibrary.simpleMessage("Cantidad demasiado alta"),
|
||||||
|
"antispamFilter":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Anti-Spam Filter"),
|
||||||
"applicationReset":
|
"applicationReset":
|
||||||
MessageLookupByLibrary.simpleMessage("Application Reset"),
|
MessageLookupByLibrary.simpleMessage("Application Reset"),
|
||||||
"approve": MessageLookupByLibrary.simpleMessage("APROBAR"),
|
"approve": MessageLookupByLibrary.simpleMessage("APROBAR"),
|
||||||
|
|
|
@ -106,6 +106,8 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||||
"Le montant doit être positif"),
|
"Le montant doit être positif"),
|
||||||
"amountTooHigh":
|
"amountTooHigh":
|
||||||
MessageLookupByLibrary.simpleMessage("Montant trop haut"),
|
MessageLookupByLibrary.simpleMessage("Montant trop haut"),
|
||||||
|
"antispamFilter":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Anti-Spam Filter"),
|
||||||
"applicationReset":
|
"applicationReset":
|
||||||
MessageLookupByLibrary.simpleMessage("Réinitialisation"),
|
MessageLookupByLibrary.simpleMessage("Réinitialisation"),
|
||||||
"approve": MessageLookupByLibrary.simpleMessage("APPROUVER"),
|
"approve": MessageLookupByLibrary.simpleMessage("APPROUVER"),
|
||||||
|
|
|
@ -2581,6 +2581,16 @@ class S {
|
||||||
args: [],
|
args: [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Anti-Spam Filter`
|
||||||
|
String get antispamFilter {
|
||||||
|
return Intl.message(
|
||||||
|
'Anti-Spam Filter',
|
||||||
|
name: 'antispamFilter',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||||
|
|
|
@ -251,5 +251,6 @@
|
||||||
"derivationPath": "Derivation Path",
|
"derivationPath": "Derivation Path",
|
||||||
"privateKey": "Private Key",
|
"privateKey": "Private Key",
|
||||||
"keyTool": "Key Tool",
|
"keyTool": "Key Tool",
|
||||||
"update": "Recalc"
|
"update": "Recalc",
|
||||||
|
"antispamFilter": "Anti-Spam Filter"
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,5 +249,6 @@
|
||||||
"derivationPath": "Ruta de Derivación",
|
"derivationPath": "Ruta de Derivación",
|
||||||
"privateKey": "Clave Privada",
|
"privateKey": "Clave Privada",
|
||||||
"keyTool": "Clave Utilidad",
|
"keyTool": "Clave Utilidad",
|
||||||
"update": "Recalcular"
|
"update": "Recalcular",
|
||||||
|
"antispamFilter": "Anti-Spam Filter"
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,5 +249,6 @@
|
||||||
"derivationPath": "Chemin de Dérivation",
|
"derivationPath": "Chemin de Dérivation",
|
||||||
"privateKey": "Clé Privée",
|
"privateKey": "Clé Privée",
|
||||||
"keyTool": "Clés Utilitaires",
|
"keyTool": "Clés Utilitaires",
|
||||||
"update": "Recalculer"
|
"update": "Recalculer",
|
||||||
|
"antispamFilter": "Anti-Spam Filter"
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,9 +213,14 @@ class SettingsState extends State<SettingsPage> with SingleTickerProviderStateMi
|
||||||
onSaved: _shieldBalance),
|
onSaved: _shieldBalance),
|
||||||
if (!simpleMode) FormBuilderCheckbox(
|
if (!simpleMode) FormBuilderCheckbox(
|
||||||
name: 'use_cold_qr',
|
name: 'use_cold_qr',
|
||||||
title: Text(S.of(context).useQrForOfflineSigning),
|
title: Text(s.useQrForOfflineSigning),
|
||||||
initialValue: settings.qrOffline,
|
initialValue: settings.qrOffline,
|
||||||
onSaved: _qrOffline),
|
onSaved: _qrOffline),
|
||||||
|
if (!simpleMode) FormBuilderCheckbox(
|
||||||
|
name: 'antispam',
|
||||||
|
title: Text(s.antispamFilter),
|
||||||
|
initialValue: settings.antispam,
|
||||||
|
onSaved: _antispam),
|
||||||
if (!simpleMode) FormBuilderTextField(
|
if (!simpleMode) FormBuilderTextField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: s.defaultMemo),
|
labelText: s.defaultMemo),
|
||||||
|
@ -295,6 +300,10 @@ class SettingsState extends State<SettingsPage> with SingleTickerProviderStateMi
|
||||||
settings.setProtectOpen(v);
|
settings.setProtectOpen(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_antispam(v) {
|
||||||
|
settings.setAntiSpam(v);
|
||||||
|
}
|
||||||
|
|
||||||
_onSave() async {
|
_onSave() async {
|
||||||
final form = _settingsFormKey.currentState!;
|
final form = _settingsFormKey.currentState!;
|
||||||
if (form.validate()) {
|
if (form.validate()) {
|
||||||
|
|
|
@ -181,6 +181,9 @@ abstract class _Settings with Store {
|
||||||
@observable
|
@observable
|
||||||
bool flat = false;
|
bool flat = false;
|
||||||
|
|
||||||
|
@observable
|
||||||
|
bool antispam = false;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<bool> restore() async {
|
Future<bool> restore() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
@ -213,6 +216,7 @@ abstract class _Settings with Store {
|
||||||
prefs.getInt('secondary.variant') ?? Colors.greenAccent.value;
|
prefs.getInt('secondary.variant') ?? Colors.greenAccent.value;
|
||||||
|
|
||||||
memoSignature = prefs.getString('memo_signature');
|
memoSignature = prefs.getString('memo_signature');
|
||||||
|
antispam = prefs.getBool('antispam') ?? false;
|
||||||
|
|
||||||
for (var s in servers) {
|
for (var s in servers) {
|
||||||
await s.loadPrefs();
|
await s.loadPrefs();
|
||||||
|
@ -272,6 +276,13 @@ abstract class _Settings with Store {
|
||||||
prefs.setInt('anchor_offset', offset);
|
prefs.setInt('anchor_offset', offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
Future<void> setAntiSpam(bool v) async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
antispam = v;
|
||||||
|
prefs.setBool('antispam', antispam);
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<void> setGapLimit(int _gapLimit) async {
|
Future<void> setGapLimit(int _gapLimit) async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
@ -605,6 +616,7 @@ abstract class _SyncStatus with Store {
|
||||||
if (!isSynced()) {
|
if (!isSynced()) {
|
||||||
final params = SyncParams(
|
final params = SyncParams(
|
||||||
active.coin, settings.getTx, settings.anchorOffset,
|
active.coin, settings.getTx, settings.anchorOffset,
|
||||||
|
settings.antispam ? 20 : 1000000,
|
||||||
syncPort.sendPort);
|
syncPort.sendPort);
|
||||||
final res = await compute(WarpApi.warpSync, params);
|
final res = await compute(WarpApi.warpSync, params);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 82a1872cccc355558794d3d926507ddf99cde647
|
Subproject commit fd53c1cb315ca2d9ee5062edda61c065108a7d5d
|
|
@ -86,7 +86,7 @@ class WarpApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int warpSync(SyncParams params) {
|
static int warpSync(SyncParams params) {
|
||||||
final res = warp_api_lib.warp(params.coin, params.getTx ? 1 : 0, params.anchorOffset, params.port!.nativePort);
|
final res = warp_api_lib.warp(params.coin, params.getTx ? 1 : 0, params.anchorOffset, params.maxCost, params.port!.nativePort);
|
||||||
params.port!.send(null);
|
params.port!.send(null);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -433,9 +433,10 @@ class SyncParams {
|
||||||
final int coin;
|
final int coin;
|
||||||
final bool getTx;
|
final bool getTx;
|
||||||
final int anchorOffset;
|
final int anchorOffset;
|
||||||
|
final int maxCost;
|
||||||
final SendPort? port;
|
final SendPort? port;
|
||||||
|
|
||||||
SyncParams(this.coin, this.getTx, this.anchorOffset, this.port);
|
SyncParams(this.coin, this.getTx, this.anchorOffset, this.maxCost, this.port);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PaymentParams {
|
class PaymentParams {
|
||||||
|
|
|
@ -235,12 +235,14 @@ class NativeLibrary {
|
||||||
int coin,
|
int coin,
|
||||||
int get_tx,
|
int get_tx,
|
||||||
int anchor_offset,
|
int anchor_offset,
|
||||||
|
int max_cost,
|
||||||
int port,
|
int port,
|
||||||
) {
|
) {
|
||||||
return _warp(
|
return _warp(
|
||||||
coin,
|
coin,
|
||||||
get_tx,
|
get_tx,
|
||||||
anchor_offset,
|
anchor_offset,
|
||||||
|
max_cost,
|
||||||
port,
|
port,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -885,6 +887,7 @@ typedef _c_warp = ffi.Uint8 Function(
|
||||||
ffi.Uint8 coin,
|
ffi.Uint8 coin,
|
||||||
ffi.Int8 get_tx,
|
ffi.Int8 get_tx,
|
||||||
ffi.Uint32 anchor_offset,
|
ffi.Uint32 anchor_offset,
|
||||||
|
ffi.Uint32 max_cost,
|
||||||
ffi.Int64 port,
|
ffi.Int64 port,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -892,6 +895,7 @@ typedef _dart_warp = int Function(
|
||||||
int coin,
|
int coin,
|
||||||
int get_tx,
|
int get_tx,
|
||||||
int anchor_offset,
|
int anchor_offset,
|
||||||
|
int max_cost,
|
||||||
int port,
|
int port,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue