Skip to content

Commit af6ca35

Browse files
authored
Merge pull request #19 from phillwiggins/release/1.0.1
Release/1.0.1
2 parents 781dd2b + 3f01691 commit af6ca35

27 files changed

+671
-368
lines changed

.idea/workspace.xml

Lines changed: 379 additions & 165 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.0.1
2+
3+
Added documentation and GeoPoints
4+
5+
## 1.0.0
6+
7+
First full release!
8+
19
## 0.0.4
210

311
Added description

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Parse For Flutter!
55
Hi, this is a Flutter plugin that allows communication with a Parse Server, (https://parseplatform.org) either hosted on your own server or another, like (http://Back4App.com).
66

7-
This is a work in project and we are consistently updating it. Please let us know if you think anything needs changing/adding, and more than ever, please do join in on this project.
7+
This is a work in project and we are consistently updating it. Please let us know if you think anything needs changing/adding, and more than ever, please do join in on this project (Even if it is just to improve our documentation.
88

99
## Join in!
1010
Want to get involved? Join our Slack channel and help out! (http://flutter-parse-sdk.slack.com)
@@ -13,7 +13,12 @@ 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.0
16+
17+
parse_server_sdk: ^1.0.1
18+
19+
20+
21+
1722
```
1823
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.
1924

@@ -33,7 +38,7 @@ Parse().initialize(
3338
ApplicationConstants.PARSE_APPLICATION_ID,
3439
ApplicationConstants.PARSE_SERVER_URL,
3540
masterKey: ApplicationConstants.PARSE_MASTER_KEY,
36-
debug: true,
41+
debug: true,
3742
liveQuery: true);
3843
```
3944

@@ -170,6 +175,7 @@ Main:
170175
* Objects
171176
* Queries
172177
* LiveQueries
178+
* GeoPoints
173179
* Debug Mode - Logging API calls
174180
* Manage Session ID's tokens
175181

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class _MyAppState extends State<MyApp> {
7575
}
7676

7777
void getSingleItem() async {
78-
var response = await DietPlan().get('R5EonpUDWy');
78+
var response = await DietPlan().getObject('R5EonpUDWy');
7979

8080
if (response.success) {
8181
print(ApplicationConstants.APP_NAME + ": " + (response.result as DietPlan).toString());

lib/parse.dart

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import 'package:meta/meta.dart';
1010
import 'package:web_socket_channel/io.dart';
1111

1212
part 'src/base/parse_constants.dart';
13-
part 'src/data/parse_data.dart';
14-
part 'src/data/parse_data_objects.dart';
1513
part 'src/data/parse_data_server.dart';
1614
part 'src/data/parse_data_user.dart';
1715
part 'src/enums/parse_enum_function_call.dart';
@@ -23,30 +21,44 @@ part 'src/network/parse_query.dart';
2321
part 'src/objects/parse_base.dart';
2422
part 'src/objects/parse_exception.dart';
2523
part 'src/objects/parse_function.dart';
24+
part 'src/objects/parse_geo_point.dart';
2625
part 'src/objects/parse_object.dart';
2726
part 'src/objects/parse_response.dart';
2827
part 'src/objects/parse_user.dart';
29-
3028
part 'src/utils/parse_utils_date.dart';
3129
part 'src/utils/parse_utils_objects.dart';
30+
part 'src/utils/parse_utils.dart';
3231

3332
class Parse {
3433
ParseDataServer data;
3534
final ParseHTTPClient client = new ParseHTTPClient();
3635

37-
Parse initialize(appId, serverUrl, {debug, appName, liveQueryUrl, masterKey, sessionId}) {
38-
ParseDataServer.init(appId,
39-
serverUrl,
36+
/// To initialise Parse Server in your application
37+
///
38+
/// This should be initialised in MyApp() creation
39+
///
40+
/// ```
41+
/// Parse().initialize(
42+
// "PARSE_APP_ID",
43+
// "https://parse.myaddress.com/parse/,
44+
// masterKey: "asd23rjh234r234r234r",
45+
// debug: true,
46+
// liveQuery: true);
47+
// ```
48+
Parse initialize(appId, serverUrl,
49+
{debug, appName, liveQueryUrl, masterKey, sessionId}) {
50+
ParseDataServer.init(appId, serverUrl,
4051
debug: debug,
4152
appName: appName,
4253
liveQueryUrl: liveQueryUrl,
4354
masterKey: masterKey,
4455
sessionId: sessionId);
4556

46-
return newInstance(ParseDataServer());
57+
return _newInstance(ParseDataServer());
4758
}
4859

49-
Parse newInstance(ParseDataServer data) {
60+
/// Creates a singleton instance of [ParseDataServer] that contains all the server information
61+
Parse _newInstance(ParseDataServer data) {
5062
var parse = Parse();
5163
parse.data = data;
5264
parse.client.data = data;

lib/src/base/parse_constants.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
part of flutter_parse_sdk;
22

3+
/// Class containing all constants for this library
34
class ParseConstants {
45

56
static const String PARSE_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm";

lib/src/data/parse_data.dart

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

lib/src/data/parse_data_objects.dart

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

lib/src/data/parse_data_server.dart

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

3+
/// Singleton class that defines all user keys and data
34
class ParseDataServer {
45
static ParseDataServer _instance;
56
static ParseDataServer get instance => _instance;
67

8+
/// Creates an instance of Parse Server
9+
///
10+
/// This class should not be user unless switching servers during the app,
11+
/// which is odd. Should only be user by Parse.init
712
static void init(appId, serverUrl, {debug, appName, liveQueryUrl, masterKey, sessionId}){
813
_instance = ParseDataServer._init(appId, serverUrl);
914

@@ -28,6 +33,10 @@ class ParseDataServer {
2833

2934
factory ParseDataServer() => _instance;
3035

36+
/// Sets the current sessionId.
37+
///
38+
/// This is generated when a users logs in, or calls currentUser to update
39+
/// their keys
3140
void setSessionId(String sessionId){
3241
this.sessionId = sessionId;
3342
}

lib/src/data/parse_data_user.dart

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

3+
/// User class that contains the current user data
34
class User extends ParseBase {
45
static User _instance;
56

67
static User get instance => _instance;
78

9+
/// Creates an instance of a ParseUser
810
static void init(username, password, emailAddress) =>
911
_instance ??= User._init(username, password, emailAddress);
1012

13+
/// Clears user data to mimic logout
14+
static void logout() => _instance = null;
15+
1116
String acl;
1217
String username;
1318
String password;
1419
String emailAddress;
1520

21+
/// Creates a singleton instance of a user.
22+
///
23+
/// There can only be one user
1624
User._init(this.username, this.password, this.emailAddress): super();
1725

1826
factory User() => _instance;
1927

28+
/// Returns a [User] from a [Map] object
2029
fromJson(Map objectData) {
2130
if (getObjectData() == null) setObjectData(objectData);
2231
getObjectData().addAll(objectData);
23-
if (getObjectData().containsKey(ParseConstants.OBJECT_ID)) objectId = getValue(ParseConstants.OBJECT_ID).toString();
24-
if (getObjectData().containsKey(ParseConstants.CREATED_AT)) createdAt = convertStringToDateTime(getValue(ParseConstants.CREATED_AT).toString());
25-
if (getObjectData().containsKey(ParseConstants.UPDATED_AT)) updatedAt = convertStringToDateTime(getValue(ParseConstants.UPDATED_AT).toString());
26-
if (getObjectData().containsKey(ACL)) acl = getValue(ACL).toString();
27-
if (getObjectData().containsKey(USERNAME)) username = getValue(USERNAME).toString();
28-
if (getObjectData().containsKey(PASSWORD)) password = getValue(PASSWORD).toString();
29-
if (getObjectData().containsKey(EMAIL)) emailAddress = getValue(EMAIL).toString();
32+
if (getObjectData().containsKey(ParseConstants.OBJECT_ID)) objectId = get(ParseConstants.OBJECT_ID).toString();
33+
if (getObjectData().containsKey(ParseConstants.CREATED_AT)) createdAt = convertStringToDateTime(get(ParseConstants.CREATED_AT).toString());
34+
if (getObjectData().containsKey(ParseConstants.UPDATED_AT)) updatedAt = convertStringToDateTime(get(ParseConstants.UPDATED_AT).toString());
35+
if (getObjectData().containsKey(ACL)) acl = get(ACL).toString();
36+
if (getObjectData().containsKey(USERNAME)) username = get(USERNAME).toString();
37+
if (getObjectData().containsKey(PASSWORD)) password = get(PASSWORD).toString();
38+
if (getObjectData().containsKey(EMAIL)) emailAddress = get(EMAIL).toString();
3039

3140
if (updatedAt == null) updatedAt = createdAt;
3241

3342
return this;
3443
}
3544

45+
/// Returns a JSON string of the current user
3646
Map<String, dynamic> toJson() => {
3747
ACL: acl,
3848
USERNAME: username,
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
part of flutter_parse_sdk;
22

3-
enum ParseApiFunctionCallType { execute }
4-
5-
class ParseApiFunctionCallTypeUtil {
6-
static getEnumValue(ParseApiFunctionCallType type) {
7-
switch (type) {
8-
case ParseApiFunctionCallType.execute:
9-
{
10-
return 'execure';
11-
}
12-
}
13-
}
14-
}
3+
/// Used to define the API calls made in ParseFunction logs
4+
enum ParseApiFunction { execute }
Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
11
part of flutter_parse_sdk;
22

3-
enum ParseApiObjectCallType { get, getAll, create, save, query, delete }
4-
5-
class ParseApiObjectCallTypeUtil {
6-
static getEnumValue(ParseApiObjectCallType type) {
7-
switch (type) {
8-
case ParseApiObjectCallType.get:
9-
{
10-
return 'get';
11-
}
12-
case ParseApiObjectCallType.getAll:
13-
{
14-
return 'getAll';
15-
}
16-
case ParseApiObjectCallType.create:
17-
{
18-
return 'create';
19-
}
20-
case ParseApiObjectCallType.save:
21-
{
22-
return 'save';
23-
}
24-
case ParseApiObjectCallType.query:
25-
{
26-
return 'query';
27-
}
28-
case ParseApiObjectCallType.delete:
29-
{
30-
return 'delete';
31-
}
32-
}
33-
}
34-
}
3+
/// Used to define the API calls made in ParseObject logs
4+
enum ParseApiObject { get, getAll, create, save, query, delete }
Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
part of flutter_parse_sdk;
22

3-
enum ParseApiUserCallType {
3+
/// Used to define the API calls made in ParseUser logs
4+
enum ParseApiUser {
45
currentUser,
56
signUp,
67
login,
@@ -10,42 +11,3 @@ enum ParseApiUserCallType {
1011
destroy,
1112
all
1213
}
13-
14-
class ParseApiUserCallTypeUtils {
15-
static getEnumValue(ParseApiUserCallType type) {
16-
switch (type) {
17-
case ParseApiUserCallType.currentUser:
18-
{
19-
return 'currentUser';
20-
}
21-
case ParseApiUserCallType.signUp:
22-
{
23-
return 'signUp';
24-
}
25-
case ParseApiUserCallType.login:
26-
{
27-
return 'login';
28-
}
29-
case ParseApiUserCallType.verificationEmailRequest:
30-
{
31-
return 'verificationEmailRequest';
32-
}
33-
case ParseApiUserCallType.requestPasswordReset:
34-
{
35-
return 'requestPasswordReset';
36-
}
37-
case ParseApiUserCallType.save:
38-
{
39-
return 'save';
40-
}
41-
case ParseApiUserCallType.destroy:
42-
{
43-
return 'destroy';
44-
}
45-
case ParseApiUserCallType.all:
46-
{
47-
return 'all';
48-
}
49-
}
50-
}
51-
}

lib/src/network/parse_http_client.dart

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

3+
/// Creates a custom version of HTTP Client that has Parse Data Preset
34
class ParseHTTPClient extends BaseClient {
45
final Client _client = new Client();
56
final String _userAgent = "Dart Parse SDK 0.1";
67
ParseDataServer data = ParseDataServer();
78

89
ParseHTTPClient();
910

11+
/// Overrides the call method for HTTP Client and adds custom headers
1012
@override
1113
Future<StreamedResponse> send(BaseRequest request) {
1214
request.headers['user-agent'] = _userAgent;

lib/src/network/parse_livequery.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
part of flutter_parse_sdk;
22

3+
/// Still under development
34
class LiveQuery {
45
final ParseHTTPClient client;
56
var channel;

0 commit comments

Comments
 (0)