Skip to content

Commit 4baeb4e

Browse files
authored
Merge pull request #46 from phillwiggins/master
Merger
2 parents e4b6cd9 + 78d9c1e commit 4baeb4e

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.0.9
2+
Fixed Health Check issue
3+
14
## 1.0.8
25
Fixed some queries
36

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Want to get involved? Join our Slack channel and help out! (http://flutter-parse
1313
To install, either add to your pubspec.yaml
1414
```
1515
dependencies:
16-
parse_server_sdk: ^1.0.8
16+
parse_server_sdk: ^1.0.9
1717
```
1818
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.
1919

example/lib/main.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ class _MyAppState extends State<MyApp> {
3535

3636
initParse() async {
3737
// Initialize parse
38-
Parse().initialize(ApplicationConstants.keyParseApplicationId,
38+
Parse().initialize(
39+
ApplicationConstants.keyParseApplicationId,
3940
ApplicationConstants.keyParseServerUrl,
4041
masterKey: ApplicationConstants.keyParseMasterKey,
41-
appName: ApplicationConstants.keyAppName,
4242
debug: true);
4343

4444
// Check server is healthy and live - Debug is on in this instance so check logs for result
@@ -74,7 +74,7 @@ class _MyAppState extends State<MyApp> {
7474
}
7575

7676
void getAllItemsByName() async {
77-
var apiResponse = await ParseObject('ParseTableName').getAll();
77+
var apiResponse = await ParseObject('TestObjectForApi').getAll();
7878

7979
if (apiResponse.success && apiResponse.result != null) {
8080
for (var testObject in apiResponse.result) {
@@ -120,14 +120,14 @@ class _MyAppState extends State<MyApp> {
120120
}
121121

122122
void query() async {
123-
var queryBuilder = QueryBuilder<DietPlan>(DietPlan())
124-
..whereContains(DietPlan.keyName, "iet")
125-
..keysToReturn([DietPlan.keyName]);
123+
var queryBuilder = QueryBuilder<ParseObject>(ParseObject('TestObjectForApi'))
124+
..setLimit(10)
125+
..includeObject(['Day']);
126126

127127
var apiResponse = await queryBuilder.query();
128128

129129
if (apiResponse.success && apiResponse.result != null) {
130-
print("Result: ${((apiResponse.result as List<dynamic>).first as DietPlan).toString()}");
130+
print("Result: ${((apiResponse.result as List<dynamic>).first as ParseObject).toString()}");
131131
} else {
132132
print("Result: ${apiResponse.error.message}");
133133
}

lib/parse.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ class Parse {
6969
// liveQuery: true);
7070
// ```
7171
Parse initialize(String appId, String serverUrl,
72-
{bool debug,
73-
String appName,
72+
{bool debug: false,
73+
String appName: "",
7474
String liveQueryUrl,
7575
String masterKey,
7676
String sessionId}) {
@@ -96,7 +96,7 @@ class Parse {
9696

9797
try {
9898
var response = await ParseHTTPClient().get("${ParseCoreData().serverUrl}$keyEndPointHealth");
99-
parseResponse = ParseResponse.handleResponse(this, response);
99+
parseResponse = ParseResponse.handleResponse(this, response, returnAsResult: true);
100100
} on Exception catch (e) {
101101
parseResponse = ParseResponse.handleException(e);
102102
}

lib/src/objects/parse_response.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ParseResponse {
4646
/// Handles any errors returned in response
4747
static ParseResponse _handleError(ParseResponse response, Response apiResponse) {
4848
Map<String, dynamic> responseData = json.decode(apiResponse.body);
49-
response.error = ParseError(code: responseData['code'], message: responseData['error']);
49+
response.error = ParseError(code: responseData['code'], message: responseData['error'].toString());
5050
response.statusCode = responseData['code'];
5151
return response;
5252
}

lib/src/utils/parse_logger.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ void logger(
66
String type,
77
ParseResponse parseResponse) {
88
var responseString = ' \n';
9+
var name = appName;
10+
if (name.length > 0) name = "$appName ";
911

10-
responseString += "----\n$appName API Response ($className : $type) :";
12+
responseString += "----\n${name}API Response ($className : $type) :";
1113

1214
if (parseResponse.success) {
1315
responseString += "\nStatus Code: ${parseResponse.statusCode}";

0 commit comments

Comments
 (0)