@@ -72,7 +72,7 @@ class AnnouncementRepository {
72
72
}
73
73
74
74
List <Announcement >? getAnnouncements () {
75
- if (_tomlCache == null ){
75
+ if (_tomlCache == null ) {
76
76
return null ;
77
77
}
78
78
@@ -81,26 +81,33 @@ class AnnouncementRepository {
81
81
return [];
82
82
}
83
83
final list = (_tomlCache! ['dev_notice' ] as List <Map <String , dynamic >>)
84
- .where ((element) => (element['maxVersion ' ] as int ) >= version)
84
+ .where ((element) => (element['build ' ] as int ) >= version)
85
85
.toList ();
86
- return list.map <Announcement >((e) => Announcement .fromToml (e)).toList ();
86
+ final announcements =
87
+ list.map <Announcement >((e) => Announcement .fromToml (e)).toList ();
88
+ announcements.sort ((a, b) =>
89
+ (DateTime .parse (b.updatedAt! )).compareTo (DateTime .parse (a.updatedAt! )));
90
+ return announcements;
87
91
}
88
92
89
93
List <Announcement >? getAllAnnouncements () {
90
- if (_tomlCache == null ){
94
+ if (_tomlCache == null ) {
91
95
return null ;
92
96
}
93
97
94
98
if (_tomlCache! ['dev_notice' ] == null ) {
95
99
return [];
96
100
}
97
- return _tomlCache! ['dev_notice' ]
101
+ final announcements = _tomlCache! ['dev_notice' ]
98
102
.map <Announcement >((e) => Announcement .fromToml (e))
99
103
.toList ();
104
+ announcements? .sort ((a, b) =>
105
+ (DateTime .parse (b.updatedAt! )).compareTo (DateTime .parse (a.updatedAt! )));
106
+ return announcements;
100
107
}
101
108
102
109
TimeTableExtra ? getStartDates () {
103
- if (_tomlCache == null ){
110
+ if (_tomlCache == null ) {
104
111
return null ;
105
112
}
106
113
@@ -113,23 +120,23 @@ class AnnouncementRepository {
113
120
}
114
121
115
122
String ? getUserAgent () {
116
- if (_tomlCache == null ){
123
+ if (_tomlCache == null ) {
117
124
return null ;
118
125
}
119
126
120
127
return _tomlCache! ['user_agent' ];
121
128
}
122
129
123
130
List <String ?>? getStopWords () {
124
- if (_tomlCache == null ){
131
+ if (_tomlCache == null ) {
125
132
return null ;
126
133
}
127
134
128
135
return _tomlCache! ['stop_words' ].cast <String >();
129
136
}
130
137
131
138
List <BannerExtra ?>? getBannerExtras () {
132
- if (_tomlCache == null ){
139
+ if (_tomlCache == null ) {
133
140
return null ;
134
141
}
135
142
@@ -140,15 +147,15 @@ class AnnouncementRepository {
140
147
}
141
148
142
149
List <String ?>? getCareWords () {
143
- if (_tomlCache == null ){
150
+ if (_tomlCache == null ) {
144
151
return null ;
145
152
}
146
153
147
154
return _tomlCache! ['care_words' ].cast <String >();
148
155
}
149
156
150
157
UpdateInfo ? checkVersion () {
151
- if (_tomlCache == null ){
158
+ if (_tomlCache == null ) {
152
159
return null ;
153
160
}
154
161
@@ -163,7 +170,7 @@ class AnnouncementRepository {
163
170
}
164
171
165
172
List <Celebration >? getCelebrations () {
166
- if (_tomlCache == null ){
173
+ if (_tomlCache == null ) {
167
174
return null ;
168
175
}
169
176
0 commit comments