Skip to content

Commit 9ecd9a8

Browse files
authored
Support missing proposals on democracy page (#1755)
* regenerate polkadart types with local node (make sure that democracy params are not overwritten) * [democracy] rudimentary support for swap native option on propose and democracy page * [proposalPage] disable burn field * [democracy] properly localize issue swap native option * [democracy] fixedPointUtil rename u* utils to i* utils * [location] store field as double instead of string * Support addLocation, setInactivityTimeout, removeLocation on democracy page. * fmt
1 parent 6001696 commit 9ecd9a8

File tree

34 files changed

+1208
-63
lines changed

34 files changed

+1208
-63
lines changed

app/lib/l10n/arb/app_de.arb

+48
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,33 @@
420420
}
421421
}
422422
},
423+
"proposalSetInactivityTimeoutTo": "Global: Setze das neue Inaktivitätszeitlimit auf {value}",
424+
"@proposalSetInactivityTimeoutTo": {
425+
"placeholders": {
426+
"value": {
427+
"type": "String",
428+
"example": "0.00"
429+
}
430+
}
431+
},
432+
"proposalAddLocation": "{cid}: Füge einen neuen Standort hinzu",
433+
"@proposalAddLocation": {
434+
"placeholders": {
435+
"cid": {
436+
"type": "String",
437+
"example": "global"
438+
}
439+
}
440+
},
441+
"proposalRemoveLocation": "{cid}: Entferne einen Standort",
442+
"@proposalRemoveLocation": {
443+
"placeholders": {
444+
"cid": {
445+
"type": "String",
446+
"example": "global"
447+
}
448+
}
449+
},
423450
"proposalUpdateNominalIncome": "Gemeinschaftseinkommen anpassen auf {value} {currency}",
424451
"@proposalUpdateNominalIncome": {
425452
"placeholders": {
@@ -472,6 +499,27 @@
472499
}
473500
}
474501
},
502+
"proposalIssueSwapNativeOption": "{cid}: Erlaubt {beneficiary}, bis zu {allowance} KSM mit einem Kurs von {rate} zu tauschen",
503+
"@proposalIssueSwapNativeOption": {
504+
"placeholders": {
505+
"cid": {
506+
"type": "String",
507+
"example": "global"
508+
},
509+
"beneficiary": {
510+
"type": "String",
511+
"example": "HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F"
512+
},
513+
"allowance": {
514+
"type": "String",
515+
"example": "0.00"
516+
},
517+
"rate": {
518+
"type": "String",
519+
"example": "1.2"
520+
}
521+
}
522+
},
475523
"proposalSupersededBy": "Verdrängt durch: {id}",
476524
"@proposalSupersededBy": {
477525
"placeholders": {

app/lib/l10n/arb/app_en.arb

+48
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,33 @@
572572
}
573573
}
574574
},
575+
"proposalSetInactivityTimeoutTo": "Global: Set the new inactivity timeout to {value}",
576+
"@proposalSetInactivityTimeoutTo": {
577+
"placeholders": {
578+
"value": {
579+
"type": "String",
580+
"example": "0.00"
581+
}
582+
}
583+
},
584+
"proposalAddLocation": "{cid}: Add a new location",
585+
"@proposalAddLocation": {
586+
"placeholders": {
587+
"cid": {
588+
"type": "String",
589+
"example": "global"
590+
}
591+
}
592+
},
593+
"proposalRemoveLocation": "{cid} Remove a location",
594+
"@proposalRemoveLocation": {
595+
"placeholders": {
596+
"cid": {
597+
"type": "String",
598+
"example": "global"
599+
}
600+
}
601+
},
575602
"proposalUpdateNominalIncome": "Update community income to {value} {currency}",
576603
"@proposalUpdateNominalIncome": {
577604
"placeholders": {
@@ -624,6 +651,27 @@
624651
}
625652
}
626653
},
654+
"proposalIssueSwapNativeOption": "{cid}: Let {beneficiary} exchange up to {allowance} KSM with rate: {rate}",
655+
"@proposalIssueSwapNativeOption": {
656+
"placeholders": {
657+
"cid": {
658+
"type": "String",
659+
"example": "global"
660+
},
661+
"beneficiary": {
662+
"type": "String",
663+
"example": "HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F"
664+
},
665+
"allowance": {
666+
"type": "String",
667+
"example": "0.00"
668+
},
669+
"rate": {
670+
"type": "String",
671+
"example": "1.2"
672+
}
673+
}
674+
},
627675
"proposalSupersededBy": "Superseded by: {id}",
628676
"@proposalSupersededBy": {
629677
"placeholders": {

app/lib/l10n/arb/app_fr.arb

+48
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,33 @@
433433
}
434434
}
435435
},
436+
"proposalSetInactivityTimeoutTo": "Global : Définir le nouveau délai d'inactivité sur {value}",
437+
"@proposalSetInactivityTimeoutTo": {
438+
"placeholders": {
439+
"value": {
440+
"type": "String",
441+
"example": "0.00"
442+
}
443+
}
444+
},
445+
"proposalAddLocation": "{cid} : Ajouter un nouvel emplacement",
446+
"@proposalAddLocation": {
447+
"placeholders": {
448+
"cid": {
449+
"type": "String",
450+
"example": "global"
451+
}
452+
}
453+
},
454+
"proposalRemoveLocation": "{cid} : Supprimer un emplacement",
455+
"@proposalRemoveLocation": {
456+
"placeholders": {
457+
"cid": {
458+
"type": "String",
459+
"example": "global"
460+
}
461+
}
462+
},
436463
"proposalUpdateDemurrage": "Ajuster demurrage à {value}%/mois",
437464
"@proposalUpdateDemurrage": {
438465
"placeholders": {
@@ -472,6 +499,27 @@
472499
}
473500
}
474501
},
502+
"proposalIssueSwapNativeOption": "{cid} : Permet à {beneficiary} d'échanger jusqu'à {allowance} KSM avec un taux de {rate}",
503+
"@proposalIssueSwapNativeOption": {
504+
"placeholders": {
505+
"cid": {
506+
"type": "String",
507+
"example": "global"
508+
},
509+
"beneficiary": {
510+
"type": "String",
511+
"example": "HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F"
512+
},
513+
"allowance": {
514+
"type": "String",
515+
"example": "0.00"
516+
},
517+
"rate": {
518+
"type": "String",
519+
"example": "1.2"
520+
}
521+
}
522+
},
475523
"proposalSupersededBy": "Epargné par: {id}",
476524
"@proposalSupersededBy": {
477525
"placeholders": {

app/lib/l10n/arb/app_ru.arb

+48
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,33 @@
433433
}
434434
}
435435
},
436+
"proposalSetInactivityTimeoutTo": "Глобально: Установить новый тайм-аут неактивности на {value}",
437+
"@proposalSetInactivityTimeoutTo": {
438+
"placeholders": {
439+
"value": {
440+
"type": "String",
441+
"example": "0.00"
442+
}
443+
}
444+
},
445+
"proposalAddLocation": "{cid}: Добавить новое местоположение",
446+
"@proposalAddLocation": {
447+
"placeholders": {
448+
"cid": {
449+
"type": "String",
450+
"example": "global"
451+
}
452+
}
453+
},
454+
"proposalRemoveLocation": "{cid}: Удалить местоположение",
455+
"@proposalRemoveLocation": {
456+
"placeholders": {
457+
"cid": {
458+
"type": "String",
459+
"example": "global"
460+
}
461+
}
462+
},
436463
"proposalUpdateDemurrage": "Обновить Demurrage до {value}%/месяц",
437464
"@proposalUpdateDemurrage": {
438465
"placeholders": {
@@ -472,6 +499,27 @@
472499
}
473500
}
474501
},
502+
"proposalIssueSwapNativeOption": "{cid}: позволяет {beneficiary} обменять до {allowance} KSM по курсу {rate}",
503+
"@proposalIssueSwapNativeOption": {
504+
"placeholders": {
505+
"cid": {
506+
"type": "String",
507+
"example": "global"
508+
},
509+
"beneficiary": {
510+
"type": "String",
511+
"example": "HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F"
512+
},
513+
"allowance": {
514+
"type": "String",
515+
"example": "0.00"
516+
},
517+
"rate": {
518+
"type": "String",
519+
"example": "1.2"
520+
}
521+
}
522+
},
475523
"proposalSupersededBy": "заменен на: {id}",
476524
"@proposalSupersededBy": {
477525
"placeholders": {

app/lib/l10n/arb/app_sw.arb

+48
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,33 @@
586586
}
587587
}
588588
},
589+
"proposalSetInactivityTimeoutTo": "Kimataifa: Weka muda mpya wa kutokufanya kazi kuwa {value}",
590+
"@proposalSetInactivityTimeoutTo": {
591+
"placeholders": {
592+
"value": {
593+
"type": "String",
594+
"example": "0.00"
595+
}
596+
}
597+
},
598+
"proposalAddLocation": "{cid}: Ongeza eneo jipya",
599+
"@proposalAddLocation": {
600+
"placeholders": {
601+
"cid": {
602+
"type": "String",
603+
"example": "global"
604+
}
605+
}
606+
},
607+
"proposalRemoveLocation": "{cid}: Ondoa eneo",
608+
"@proposalRemoveLocation": {
609+
"placeholders": {
610+
"cid": {
611+
"type": "String",
612+
"example": "global"
613+
}
614+
}
615+
},
589616
"proposalUpdateDemurrage": "Sasisha demurrage kuwa {value}%/mwezi",
590617
"@proposalUpdateDemurrage": {
591618
"placeholders": {
@@ -625,6 +652,27 @@
625652
}
626653
}
627654
},
655+
"proposalIssueSwapNativeOption": "{cid}: inamruhusu {beneficiary} kubadilisha hadi {allowance} KSM kwa kiwango cha {rate}",
656+
"@proposalIssueSwapNativeOption": {
657+
"placeholders": {
658+
"cid": {
659+
"type": "String",
660+
"example": "global"
661+
},
662+
"beneficiary": {
663+
"type": "String",
664+
"example": "HNZata7iMYWmk5RvZRTiAsSDhV8366zq2YGb3tLH5Upf74F"
665+
},
666+
"allowance": {
667+
"type": "String",
668+
"example": "0.00"
669+
},
670+
"rate": {
671+
"type": "String",
672+
"example": "1.2"
673+
}
674+
}
675+
},
628676
"proposalSupersededBy": "Imetanguliwa na: {id}",
629677
"@proposalSupersededBy": {
630678
"placeholders": {

app/lib/models/encointer_balance_data/balance_entry.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class BalanceEntry {
1313
BalanceEntry(this.principal, this.lastUpdate);
1414

1515
factory BalanceEntry.fromPolkadart(et.BalanceEntry entry) {
16-
return BalanceEntry(u64F64Util.toDouble(entry.principal.bits), entry.lastUpdate);
16+
return BalanceEntry(i64F64Util.toDouble(entry.principal.bits), entry.lastUpdate);
1717
}
1818

1919
factory BalanceEntry.fromJson(Map<String, dynamic> json) => _$BalanceEntryFromJson(json);

app/lib/models/location/location.dart

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
// Run: `flutter pub run build_runner build` in order to create/update the *.g.dart
22
import 'dart:convert';
33

4+
import 'package:ew_primitives/ew_primitives.dart';
45
import 'package:json_annotation/json_annotation.dart';
56
import 'package:latlong2/latlong.dart';
67

8+
import 'package:ew_polkadart/encointer_types.dart' as et;
9+
710
part 'location.g.dart';
811

912
@JsonSerializable(createFactory: false)
@@ -12,21 +15,30 @@ class Location {
1215

1316
// explicitly use `toString()`, which works for the old `Degree` type `i64` and the new one `i128`
1417
factory Location.fromJson(Map<String, dynamic> json) => Location(
15-
json['lat'].toString(),
16-
json['lon'].toString(),
18+
double.parse(json['lat'].toString()),
19+
double.parse(json['lon'].toString()),
20+
);
21+
22+
factory Location.fromPolkadart(et.Location loc) => Location(
23+
latLongToDouble(loc.lat),
24+
latLongToDouble(loc.lon),
1725
);
1826

1927
Map<String, dynamic> toJson() => _$LocationToJson(this);
2028

21-
final String lat;
22-
final String lon;
29+
final double lat;
30+
final double lon;
2331

2432
@override
2533
String toString() {
2634
return jsonEncode(this);
2735
}
2836

37+
String latLongFmt() {
38+
return 'lat=${lat.toStringAsFixed(6)},lon=${lon.toStringAsFixed(6)}';
39+
}
40+
2941
LatLng toLatLng() {
30-
return LatLng(double.parse(lat), double.parse(lon));
42+
return LatLng(lat, lon);
3143
}
3244
}

app/lib/page-encointer/bazaar/single_business/widgets/single_business_detail.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ class SingleBusinessDetail extends StatelessWidget {
116116
MapButton(
117117
onPressed: () {
118118
final location = Location(
119-
singleBusiness.latitude.toString(),
120-
singleBusiness.longitude.toString(),
119+
singleBusiness.latitude,
120+
singleBusiness.longitude,
121121
);
122122
AppLaunch.launchMap(location);
123123
},

0 commit comments

Comments
 (0)