Skip to content

Commit 968bc4e

Browse files
committed
Version 1.0.0 for release
1 parent bd40f08 commit 968bc4e

27 files changed

+490
-288
lines changed

.idea/workspace.xml

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

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.1
2+
3+
Added documentation and GeoPoints
4+
15
## 1.0.0
26

37
First full release!

README.md

Lines changed: 3 additions & 2 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,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: ^0.0.4
16+
parse_server_sdk: ^1.0.1
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

@@ -170,6 +170,7 @@ Main:
170170
* Objects
171171
* Queries
172172
* LiveQueries
173+
* GeoPoints
173174
* Debug Mode - Logging API calls
174175
* Manage Session ID's tokens
175176

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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import 'package:web_socket_channel/io.dart';
1111

1212
part 'src/base/parse_constants.dart';
1313
part 'src/data/parse_data.dart';
14-
part 'src/data/parse_data_objects.dart';
1514
part 'src/data/parse_data_server.dart';
1615
part 'src/data/parse_data_user.dart';
1716
part 'src/enums/parse_enum_function_call.dart';
@@ -23,30 +22,44 @@ part 'src/network/parse_query.dart';
2322
part 'src/objects/parse_base.dart';
2423
part 'src/objects/parse_exception.dart';
2524
part 'src/objects/parse_function.dart';
25+
part 'src/objects/parse_geo_point.dart';
2626
part 'src/objects/parse_object.dart';
2727
part 'src/objects/parse_response.dart';
2828
part 'src/objects/parse_user.dart';
29-
3029
part 'src/utils/parse_utils_date.dart';
3130
part 'src/utils/parse_utils_objects.dart';
31+
part 'src/utils/parse_utils.dart';
3232

3333
class Parse {
3434
ParseDataServer data;
3535
final ParseHTTPClient client = new ParseHTTPClient();
3636

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

46-
return newInstance(ParseDataServer());
58+
return _newInstance(ParseDataServer());
4759
}
4860

49-
Parse newInstance(ParseDataServer data) {
61+
/// Creates a singleton instance of [ParseDataServer] that contains all the server information
62+
Parse _newInstance(ParseDataServer data) {
5063
var parse = Parse();
5164
parse.data = data;
5265
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,

0 commit comments

Comments
 (0)