File tree 2 files changed +163
-135
lines changed
2 files changed +163
-135
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,13 @@ part 'realm.g.dart';
16
16
// See thread, and the zulip-mobile code and chat thread it links to:
17
17
// https://github.com/zulip/zulip-flutter/pull/55#discussion_r1160267577
18
18
Future <GetServerSettingsResult > getServerSettings ({
19
- required Uri realmUrl ,
19
+ required ApiConnection apiConnection ,
20
20
}) async {
21
21
final Map <String , dynamic > data;
22
- // TODO make this function testable by taking ApiConnection from caller
23
- final connection = ApiConnection .live (realmUrl: realmUrl);
24
22
try {
25
- data = await connection .get ('server_settings' , null );
23
+ data = await apiConnection .get ('server_settings' , null );
26
24
} finally {
27
- connection .close ();
25
+ apiConnection .close ();
28
26
}
29
27
30
28
return GetServerSettingsResult .fromJson (data);
@@ -67,7 +65,7 @@ class GetServerSettingsResult {
67
65
});
68
66
69
67
factory GetServerSettingsResult .fromJson (Map <String , dynamic > json) =>
70
- _$GetServerSettingsResultFromJson (json);
68
+ _$GetServerSettingsResultFromJson (json);
71
69
72
70
Map <String , dynamic > toJson () => _$GetServerSettingsResultToJson (this );
73
71
}
You can’t perform that action at this time.
0 commit comments