Skip to content

Commit aa6bed5

Browse files
Merge pull request #566 from parse-community/release/2.1.0
Release/2.1.0
2 parents 30ba45c + 312f0f0 commit aa6bed5

Some content is hidden

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

54 files changed

+1125
-389
lines changed

packages/dart/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 2.1.0
2+
Option para uses ParseHTTPClient (default) or ParseDioClient (slow on Flutter Web).
3+
**BREAKING CHANGE** if use progress callback at the file upload in version 2.0.1
4+
Added method excludeKeys: Exclude specific fields from the returned query
5+
Changed to the method POST on Login
6+
Bug fixes
7+
General improvements
8+
Updated dependencies
19
## 2.0.1
210
Fixed network exceptions. [#482](https://github.com/parse-community/Parse-SDK-Flutter/pull/482)
311

packages/dart/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This is a work in progress and we are consistently updating it. Please let us kn
2020
To install, either add to your pubspec.yaml
2121
```yml
2222
dependencies:
23-
parse_server_sdk: ^2.0.1
23+
parse_server_sdk: ^2.1.0
2424
```
2525
or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added.
2626
@@ -50,7 +50,6 @@ It's possible to add other parameters to work with your instance of Parse Server
5050
await Parse().initialize(
5151
keyApplicationId,
5252
keyParseServerUrl,
53-
masterKey: keyParseMasterKey, // Required for Back4App and others
5453
clientKey: keyParseClientKey, // Required for some setups
5554
debug: true, // When enabled, prints logs to console
5655
liveQueryUrl: keyLiveQueryUrl, // Required if using LiveQuery

packages/dart/lib/parse_server_sdk.dart

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import 'dart:io';
66
import 'dart:math';
77
import 'dart:typed_data';
88

9-
import 'package:dio/dio.dart' hide Options;
10-
import 'package:dio/dio.dart' as dio show Options;
119
import 'package:meta/meta.dart';
1210
import 'package:mime_type/mime_type.dart';
13-
import 'package:parse_server_sdk/src/network/http_client_adapter.dart';
11+
import 'package:parse_server_sdk/src/network/parse_http_client.dart';
1412
import 'package:parse_server_sdk/src/network/parse_websocket.dart'
1513
as parse_web_socket;
1614
import 'package:path/path.dart' as path;
@@ -21,13 +19,16 @@ import 'package:uuid/uuid.dart';
2119
import 'package:web_socket_channel/web_socket_channel.dart';
2220
import 'package:xxtea/xxtea.dart';
2321

22+
export 'src/network/parse_dio_client.dart';
23+
export 'src/network/parse_http_client.dart';
24+
2425
part 'src/base/parse_constants.dart';
2526
part 'src/data/parse_core_data.dart';
2627
part 'src/data/parse_subclass_handler.dart';
2728
part 'src/enums/parse_enum_api_rq.dart';
28-
part 'src/network/dio-options.dart';
29+
part 'src/network/options.dart';
30+
part 'src/network/parse_client.dart';
2931
part 'src/network/parse_connectivity.dart';
30-
part 'src/network/parse_http_client.dart';
3132
part 'src/network/parse_live_query.dart';
3233
part 'src/network/parse_query.dart';
3334
part 'src/objects/parse_acl.dart';
@@ -77,7 +78,7 @@ class Parse {
7778
/// Parse().initialize(
7879
/// "PARSE_APP_ID",
7980
/// "https://parse.myaddress.com/parse/,
80-
/// masterKey: "asd23rjh234r234r234r",
81+
/// clientKey: "asd23rjh234r234r234r",
8182
/// debug: true,
8283
/// liveQuery: true);
8384
/// ```
@@ -93,7 +94,7 @@ class Parse {
9394
String clientKey,
9495
String masterKey,
9596
String sessionId,
96-
bool autoSendSessionId,
97+
bool autoSendSessionId = true,
9798
SecurityContext securityContext,
9899
CoreStore coreStore,
99100
Map<String, ParseObjectConstructor> registeredSubClassMap,
@@ -103,6 +104,7 @@ class Parse {
103104
ParseConnectivityProvider connectivityProvider,
104105
String fileDirectory,
105106
Stream<void> appResumedStream,
107+
ParseClientCreator clientCreator,
106108
}) async {
107109
final String url = removeTrailingSlash(serverUrl);
108110

@@ -128,6 +130,7 @@ class Parse {
128130
connectivityProvider: connectivityProvider,
129131
fileDirectory: fileDirectory,
130132
appResumedStream: appResumedStream,
133+
clientCreator: clientCreator,
131134
);
132135

133136
_hasBeenInitialized = true;
@@ -138,13 +141,13 @@ class Parse {
138141
bool hasParseBeenInitialized() => _hasBeenInitialized;
139142

140143
Future<ParseResponse> healthCheck(
141-
{bool debug, ParseHTTPClient client, bool sendSessionIdByDefault}) async {
144+
{bool debug, ParseClient client, bool sendSessionIdByDefault}) async {
142145
ParseResponse parseResponse;
143146

144147
final bool _debug = isDebugEnabled(objectLevelDebug: debug);
145148

146-
final ParseHTTPClient _client = client ??
147-
ParseHTTPClient(
149+
final ParseClient _client = client ??
150+
ParseCoreData().clientCreator(
148151
sendSessionId:
149152
sendSessionIdByDefault ?? ParseCoreData().autoSendSessionId,
150153
securityContext: ParseCoreData().securityContext);
@@ -153,8 +156,8 @@ class Parse {
153156
const ParseApiRQ type = ParseApiRQ.healthCheck;
154157

155158
try {
156-
final Response<String> response = await _client
157-
.get<String>('${ParseCoreData().serverUrl}$keyEndPointHealth');
159+
final ParseNetworkResponse response =
160+
await _client.get('${ParseCoreData().serverUrl}$keyEndPointHealth');
158161
parseResponse =
159162
handleResponse<Parse>(null, response, type, _debug, className);
160163
} on Exception catch (e) {

packages/dart/lib/src/base/parse_constants.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
part of flutter_parse_sdk;
22

33
// Library
4-
const String keySdkVersion = '2.0.1';
4+
const String keySdkVersion = '2.1.0';
55
const String keyLibraryName = 'Flutter Parse SDK';
66

77
// End Points
@@ -46,7 +46,7 @@ const String keyHeaderSessionToken = 'X-Parse-Session-Token';
4646
const String keyHeaderRevocableSession = 'X-Parse-Revocable-Session';
4747
const String keyHeaderUserAgent = 'user-agent';
4848
const String keyHeaderApplicationId = 'X-Parse-Application-Id';
49-
const String keyHeaderContentType = Headers.contentTypeHeader;
49+
const String keyHeaderContentType = 'content-type';
5050
const String keyHeaderContentTypeJson = 'application/json';
5151
const String keyHeaderMasterKey = 'X-Parse-Master-Key';
5252
const String keyHeaderClientKey = 'X-Parse-Client-Key';

packages/dart/lib/src/data/parse_core_data.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class ParseCoreData {
3636
ParseConnectivityProvider connectivityProvider,
3737
String fileDirectory,
3838
Stream<void> appResumedStream,
39+
ParseClientCreator clientCreator,
3940
}) async {
4041
_instance = ParseCoreData._init(appId, serverUrl);
4142

@@ -98,6 +99,10 @@ class ParseCoreData {
9899
if (appResumedStream != null) {
99100
_instance.appResumedStream = appResumedStream;
100101
}
102+
103+
if (clientCreator != null) {
104+
_instance.clientCreator = clientCreator;
105+
}
101106
}
102107

103108
String appName;
@@ -119,6 +124,9 @@ class ParseCoreData {
119124
ParseConnectivityProvider connectivityProvider;
120125
String fileDirectory;
121126
Stream<void> appResumedStream;
127+
ParseClientCreator clientCreator =
128+
({bool sendSessionId, SecurityContext securityContext}) => ParseHTTPClient(
129+
sendSessionId: sendSessionId, securityContext: securityContext);
122130

123131
void registerSubClass(
124132
String className, ParseObjectConstructor objectConstructor) {
@@ -139,7 +147,7 @@ class ParseCoreData {
139147

140148
ParseUser createParseUser(
141149
String username, String password, String emailAddress,
142-
{String sessionToken, bool debug, ParseHTTPClient client}) {
150+
{String sessionToken, bool debug, ParseClient client}) {
143151
return _subClassHandler.createParseUser(username, password, emailAddress,
144152
sessionToken: sessionToken, debug: debug, client: client);
145153
}

packages/dart/lib/src/data/parse_subclass_handler.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ part of flutter_parse_sdk;
33
typedef ParseObjectConstructor = ParseObject Function();
44
typedef ParseUserConstructor = ParseUser Function(
55
String username, String password, String emailAddress,
6-
{String sessionToken, bool debug, ParseHTTPClient client});
6+
{String sessionToken, bool debug, ParseClient client});
77
typedef ParseFileConstructor = ParseFileBase Function(
88
{String name, String url});
99

@@ -58,7 +58,7 @@ class ParseSubClassHandler {
5858

5959
ParseUser createParseUser(
6060
String username, String password, String emailAddress,
61-
{String sessionToken, bool debug, ParseHTTPClient client}) {
61+
{String sessionToken, bool debug, ParseClient client}) {
6262
return _parseUserConstructor != null
6363
? _parseUserConstructor(username, password, emailAddress,
6464
sessionToken: sessionToken, debug: debug, client: client)

packages/dart/lib/src/network/dio-options.dart

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/dart/lib/src/network/http_client_adapter_native.dart renamed to packages/dart/lib/src/network/dio_adapter_io.dart

File renamed without changes.

packages/dart/lib/src/network/http_client_adapter_web.dart renamed to packages/dart/lib/src/network/dio_adapter_js.dart

File renamed without changes.

packages/dart/lib/src/network/http_client_adapter.dart

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)