Skip to content

Commit 1a6a296

Browse files
Merge branch 'zulip:main' into add-language-setting
2 parents 4ce5505 + 6ff20f6 commit 1a6a296

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2320
-1177
lines changed

assets/icons/ZulipIcons.ttf

268 Bytes
Binary file not shown.

assets/icons/edit.svg

Lines changed: 4 additions & 0 deletions
Loading

ios/Flutter/AppFrameworkInfo.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>12.0</string>
24+
<string>14.0</string>
2525
</dict>
2626
</plist>

ios/Podfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This should match the iOS Deployment Target
22
# (in Xcode, that's in project > Runner > Info)
3+
# and MinimumOSVersion in ios/Flutter/AppFrameworkInfo.plist.
34
platform :ios, '14.0'
45

56
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.

lib/api/model/model.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,24 @@ class ZulipStream {
363363
required this.streamWeeklyTraffic,
364364
});
365365

366+
/// Construct a plain [ZulipStream] from [subscription].
367+
factory ZulipStream.fromSubscription(Subscription subscription) {
368+
return ZulipStream(
369+
streamId: subscription.streamId,
370+
name: subscription.name,
371+
description: subscription.description,
372+
renderedDescription: subscription.renderedDescription,
373+
dateCreated: subscription.dateCreated,
374+
firstMessageId: subscription.firstMessageId,
375+
inviteOnly: subscription.inviteOnly,
376+
isWebPublic: subscription.isWebPublic,
377+
historyPublicToSubscribers: subscription.historyPublicToSubscribers,
378+
messageRetentionDays: subscription.messageRetentionDays,
379+
channelPostPolicy: subscription.channelPostPolicy,
380+
streamWeeklyTraffic: subscription.streamWeeklyTraffic,
381+
);
382+
}
383+
366384
factory ZulipStream.fromJson(Map<String, dynamic> json) =>
367385
_$ZulipStreamFromJson(json);
368386

lib/api/route/messages.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ Future<UpdateMessageResult> updateMessage(
275275
bool? sendNotificationToOldThread,
276276
bool? sendNotificationToNewThread,
277277
String? content,
278+
String? prevContentSha256,
278279
int? streamId,
279280
}) {
280281
return connection.patch('updateMessage', UpdateMessageResult.fromJson, 'messages/$messageId', {
@@ -283,6 +284,7 @@ Future<UpdateMessageResult> updateMessage(
283284
if (sendNotificationToOldThread != null) 'send_notification_to_old_thread': sendNotificationToOldThread,
284285
if (sendNotificationToNewThread != null) 'send_notification_to_new_thread': sendNotificationToNewThread,
285286
if (content != null) 'content': RawParameter(content),
287+
if (prevContentSha256 != null) 'prev_content_sha256': RawParameter(prevContentSha256),
286288
if (streamId != null) 'stream_id': streamId,
287289
});
288290
}

lib/example/sticky_header.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@
1717
/// so as to set the app ID differently.
1818
library;
1919

20-
// ignore: undefined_hidden_name // anticipates https://github.com/flutter/flutter/pull/164818
21-
import 'package:flutter/material.dart' hide SliverPaintOrder;
20+
import 'package:flutter/material.dart';
2221

23-
import '../widgets/scrolling.dart';
2422
import '../widgets/sticky_header.dart';
2523

2624
/// Example page using [StickyHeaderListView] and [StickyHeaderItem] in a
@@ -153,7 +151,7 @@ class ExampleVerticalDouble extends StatelessWidget {
153151

154152
return Scaffold(
155153
appBar: AppBar(title: Text(title)),
156-
body: CustomPaintOrderScrollView(
154+
body: CustomScrollView(
157155
semanticChildCount: numSections,
158156
center: centerKey,
159157
paintOrder: headerAtBottom ?

lib/generated/l10n/zulip_localizations.dart

Lines changed: 59 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,17 @@ import 'zulip_localizations_uk.dart';
6868
/// be consistent with the languages listed in the ZulipLocalizations.supportedLocales
6969
/// property.
7070
abstract class ZulipLocalizations {
71-
ZulipLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
71+
ZulipLocalizations(String locale)
72+
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
7273

7374
final String localeName;
7475

7576
static ZulipLocalizations of(BuildContext context) {
7677
return Localizations.of<ZulipLocalizations>(context, ZulipLocalizations)!;
7778
}
7879

79-
static const LocalizationsDelegate<ZulipLocalizations> delegate = _ZulipLocalizationsDelegate();
80+
static const LocalizationsDelegate<ZulipLocalizations> delegate =
81+
_ZulipLocalizationsDelegate();
8082

8183
/// A list of this localizations delegate along with the default localizations
8284
/// delegates.
@@ -88,12 +90,13 @@ abstract class ZulipLocalizations {
8890
/// Additional delegates can be added by appending to this list in
8991
/// MaterialApp. This list does not have to be used at all if a custom list
9092
/// of delegates is preferred or required.
91-
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
92-
delegate,
93-
GlobalMaterialLocalizations.delegate,
94-
GlobalCupertinoLocalizations.delegate,
95-
GlobalWidgetsLocalizations.delegate,
96-
];
93+
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
94+
<LocalizationsDelegate<dynamic>>[
95+
delegate,
96+
GlobalMaterialLocalizations.delegate,
97+
GlobalCupertinoLocalizations.delegate,
98+
GlobalWidgetsLocalizations.delegate,
99+
];
97100

98101
/// A list of this localizations delegate's supported locales.
99102
static const List<Locale> supportedLocales = <Locale>[
@@ -104,7 +107,7 @@ abstract class ZulipLocalizations {
104107
Locale('pl'),
105108
Locale('ru'),
106109
Locale('sk'),
107-
Locale('uk')
110+
Locale('uk'),
108111
];
109112

110113
/// Title for About Zulip page.
@@ -381,7 +384,11 @@ abstract class ZulipLocalizations {
381384
///
382385
/// In en, this message translates to:
383386
/// **'{num, plural, =1{File is} other{{num} files are}} larger than the server\'s limit of {maxFileUploadSizeMib} MiB and will not be uploaded:\n\n{listMessage}'**
384-
String errorFilesTooLarge(int num, int maxFileUploadSizeMib, String listMessage);
387+
String errorFilesTooLarge(
388+
int num,
389+
int maxFileUploadSizeMib,
390+
String listMessage,
391+
);
385392

386393
/// Error title when attached files are too large in size.
387394
///
@@ -459,7 +466,11 @@ abstract class ZulipLocalizations {
459466
///
460467
/// In en, this message translates to:
461468
/// **'Error handling a Zulip event from {serverUrl}; will retry.\n\nError: {error}\n\nEvent: {event}'**
462-
String errorHandlingEventDetails(String serverUrl, String error, String event);
469+
String errorHandlingEventDetails(
470+
String serverUrl,
471+
String error,
472+
String event,
473+
);
463474

464475
/// Error title when opening a link failed.
465476
///
@@ -831,7 +842,11 @@ abstract class ZulipLocalizations {
831842
///
832843
/// In en, this message translates to:
833844
/// **'{url} is running Zulip Server {zulipVersion}, which is unsupported. The minimum supported version is Zulip Server {minSupportedZulipVersion}.'**
834-
String errorServerVersionUnsupportedMessage(String url, String zulipVersion, String minSupportedZulipVersion);
845+
String errorServerVersionUnsupportedMessage(
846+
String url,
847+
String zulipVersion,
848+
String minSupportedZulipVersion,
849+
);
835850

836851
/// Error message in the dialog for invalid API key.
837852
///
@@ -1302,40 +1317,58 @@ abstract class ZulipLocalizations {
13021317
String get systemDefaultLanguage;
13031318
}
13041319

1305-
class _ZulipLocalizationsDelegate extends LocalizationsDelegate<ZulipLocalizations> {
1320+
class _ZulipLocalizationsDelegate
1321+
extends LocalizationsDelegate<ZulipLocalizations> {
13061322
const _ZulipLocalizationsDelegate();
13071323

13081324
@override
13091325
Future<ZulipLocalizations> load(Locale locale) {
1310-
return SynchronousFuture<ZulipLocalizations>(lookupZulipLocalizations(locale));
1326+
return SynchronousFuture<ZulipLocalizations>(
1327+
lookupZulipLocalizations(locale),
1328+
);
13111329
}
13121330

13131331
@override
1314-
bool isSupported(Locale locale) => <String>['ar', 'en', 'ja', 'nb', 'pl', 'ru', 'sk', 'uk'].contains(locale.languageCode);
1332+
bool isSupported(Locale locale) => <String>[
1333+
'ar',
1334+
'en',
1335+
'ja',
1336+
'nb',
1337+
'pl',
1338+
'ru',
1339+
'sk',
1340+
'uk',
1341+
].contains(locale.languageCode);
13151342

13161343
@override
13171344
bool shouldReload(_ZulipLocalizationsDelegate old) => false;
13181345
}
13191346

13201347
ZulipLocalizations lookupZulipLocalizations(Locale locale) {
1321-
1322-
13231348
// Lookup logic when only language code is specified.
13241349
switch (locale.languageCode) {
1325-
case 'ar': return ZulipLocalizationsAr();
1326-
case 'en': return ZulipLocalizationsEn();
1327-
case 'ja': return ZulipLocalizationsJa();
1328-
case 'nb': return ZulipLocalizationsNb();
1329-
case 'pl': return ZulipLocalizationsPl();
1330-
case 'ru': return ZulipLocalizationsRu();
1331-
case 'sk': return ZulipLocalizationsSk();
1332-
case 'uk': return ZulipLocalizationsUk();
1350+
case 'ar':
1351+
return ZulipLocalizationsAr();
1352+
case 'en':
1353+
return ZulipLocalizationsEn();
1354+
case 'ja':
1355+
return ZulipLocalizationsJa();
1356+
case 'nb':
1357+
return ZulipLocalizationsNb();
1358+
case 'pl':
1359+
return ZulipLocalizationsPl();
1360+
case 'ru':
1361+
return ZulipLocalizationsRu();
1362+
case 'sk':
1363+
return ZulipLocalizationsSk();
1364+
case 'uk':
1365+
return ZulipLocalizationsUk();
13331366
}
13341367

13351368
throw FlutterError(
13361369
'ZulipLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
13371370
'an issue with the localizations generation tool. Please file an issue '
13381371
'on GitHub with a reproducible sample app and the gen-l10n configuration '
1339-
'that was used.'
1372+
'that was used.',
13401373
);
13411374
}

0 commit comments

Comments
 (0)