Skip to content

Commit c743e3a

Browse files
phillwigginsmregandlarommyarbth3brinkPawlikMichal25
authored
Release/1.0.26 (#343)
* Release/1.0.26 - Update docs * Updated Live Queries related documentation (#301) * Added an example of how to update existing object values (#309) * Fixed the Parse().initialize's return value (#307) * Release/1.0.26 - Update docs * Updated Live Queries related documentation (#301) * Fixed the parse initialize method Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance. Co-authored-by: Phill Wiggins <[email protected]> Co-authored-by: mregandla <[email protected]> * Added example for update existing Object values Maybe need some correction. Thank you. Co-authored-by: James Brinkerhoff <[email protected]> Co-authored-by: Phill Wiggins <[email protected]> Co-authored-by: mregandla <[email protected]> * Specifying return type of get<T> as T instead of dynamic (#310) * Fixed the Parse().initialize's return value (#307) * Release/1.0.26 - Update docs * Updated Live Queries related documentation (#301) * Fixed the parse initialize method Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance. Co-authored-by: Phill Wiggins <[email protected]> Co-authored-by: mregandla <[email protected]> * Specified T return type instead of dynamic for get<T> method Co-authored-by: James Brinkerhoff <[email protected]> Co-authored-by: Phill Wiggins <[email protected]> Co-authored-by: mregandla <[email protected]> * Live query connection stream (#314) * Fixed the Parse().initialize's return value (#307) * Release/1.0.26 - Update docs * Updated Live Queries related documentation (#301) * Fixed the parse initialize method Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance. Co-authored-by: Phill Wiggins <[email protected]> Co-authored-by: mregandla <[email protected]> * added live-query-client-event-stream * Update parse_live_query.dart * Cleanup Co-authored-by: James Brinkerhoff <[email protected]> Co-authored-by: Phill Wiggins <[email protected]> Co-authored-by: mregandla <[email protected]> * Livequery reconnecting controller (#316) * Fix: reconnecting Done as in #315 (comment) described. * Changed type of Future Done as described in fischerscode@805e830#r37587405. * Revert "Changed type of Future" This reverts commit fecee76. * adding LiveQueryReconnectingController This is a solution for #315 (comment) How it works: - Only the LiveQueryReconnectingController handles reconnecting after a connection loss. - LiveQueryReconnectingController holds informations: 1. connection state of the device 2. did the user disconnected from the server 3. is currently a connection to the server estalished - LiveQueryReconnectingController tries to reconnect after preset timespans. * cleanup * remove _userDisconnected from Client This is not needed any more. Keeping track of this information is now done by LiveQueryReconnectingController. * subscribe(query) modified Wait until client is connected to live-query-server. Fixes fischerscode@d058eb0#r37612749 * Parsequery OR (#317) * Start adding or First idea for #213 Works with normal Query and LiveQuery. Missing: - any kind of "UserError handling" - further testing * Update parse_query.dart * Fix for Sembast-API change (#322) See: #321 (comment) * added QueryBuilder.copy(QueryBuilder<T> query) (#320) * added QueryBuilder.copy(QueryBuilder<T> query) Added a implementation to create a new QueryBuilder based on an old one. This is a deep copy. Tested only with basic queries. * added QueryBuilder.copy(QueryBuilder<T> query) Added a implementation to create a new QueryBuilder based on an old one. This is a deep copy. Tested only with basic queries. * ParseLiveList (#324) * Created ParseLiveList * LiveList & LivListBuilder works * Cleanup * changed to animated list * Fix in dataloading * updated AnimatedList * Finished Animations & cleanup * handle reconnect * Added dispose methodes & renamed classes & cleanup * cleanup * Fix animation duration * added README ParseLiveList section * Initialized example_livelist * Update application_constants.dart * Update .gitignore * Revert "Update .gitignore" This reverts commit 4d8982d. * Update .gitignore * HotFix: object Update from client If the client changes the object. (ParseObject does not get copied) * Implemented simple example * Update README.md * Update main.dart * Update README.md * Update README.md * added ParseACL to parseEncode (#326) As described in #325 (comment). Should Fix #325 * ParseLiveList Performance improvement (#327) * Created ParseLiveList * LiveList & LivListBuilder works * Cleanup * changed to animated list * Fix in dataloading * updated AnimatedList * Finished Animations & cleanup * handle reconnect * Added dispose methodes & renamed classes & cleanup * cleanup * Fix animation duration * added README ParseLiveList section * Initialized example_livelist * Update application_constants.dart * Update .gitignore * Revert "Update .gitignore" This reverts commit 4d8982d. * Update .gitignore * HotFix: object Update from client If the client changes the object. (ParseObject does not get copied) * Implemented simple example * Update README.md * Update main.dart * Update README.md * Update README.md * LiveList - Performance Improvement This is the change mentioned in #324 (comment) Requires #326 * LiveList - Performance Improvement This is the change mentioned in #324 (comment) Requires #326 * example_livelist: use clientKey * Changed example_livelist query In the README I wrote, you can use a field called "show" to hide elements. * ParseLiveListElementSnapshot added (#329) * Created ParseLiveList * LiveList & LivListBuilder works * Cleanup * changed to animated list * Fix in dataloading * updated AnimatedList * Finished Animations & cleanup * handle reconnect * Added dispose methodes & renamed classes & cleanup * cleanup * Fix animation duration * added README ParseLiveList section * Initialized example_livelist * Update application_constants.dart * Update .gitignore * Revert "Update .gitignore" This reverts commit 4d8982d. * Update .gitignore * HotFix: object Update from client If the client changes the object. (ParseObject does not get copied) * Implemented simple example * Update README.md * Update main.dart * Update README.md * Update README.md * LiveList - Performance Improvement This is the change mentioned in #324 (comment) Requires #326 * LiveList - Performance Improvement This is the change mentioned in #324 (comment) Requires #326 * example_livelist: use clientKey * Changed example_livelist query In the README I wrote, you can use a field called "show" to hide elements. * Remove: RemovedItemBuilder duplicade to ChildBuilder * removed firstBuild * ParseLiveListElementSnapshot added * Clear unsaved changes (#331) * added clearUnsavedChanges An idea for #318 * moved clearUnsavedChanges to ParseBase * LiveQueryController: connect at init (#332) Should fix #330 * LiveList: fixed defaultBuilder (#333) * Added generics to Query/LiveQuery (#336) * LiveQuery: fixes list is null (#334) * Fix: #341 (#342) It seems like `subscription.on(LiveQueryEvent.update` reuses a existing object. * Updating LiveQuery for web (#340) * LiveQuery: fixes list is null * Updating LiveQuery for web parse_live_query_web was outdated compared to parse_live_query. Note: parse_live_query was copied and fixed again for this change. Co-authored-by: Phill Wiggins <[email protected]> * Release/1.0.26 - Code formatting, remove lint issues Co-authored-by: mregandla <[email protected]> Co-authored-by: L. Rommy Arbantas <[email protected]> Co-authored-by: James Brinkerhoff <[email protected]> Co-authored-by: Michal Baran <[email protected]> Co-authored-by: Maximilian Fischer <[email protected]>
1 parent 1a45a64 commit c743e3a

File tree

97 files changed

+3296
-234
lines changed

Some content is hidden

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

97 files changed

+3296
-234
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ build/
2828
example/ios/Frameworks/
2929
example/lib/ui/
3030

31+
example_livelist/lib/application_constants.dart
32+
3133
.flutter-plugins-dependencies
3234

3335
.vscode/

README.md

Lines changed: 68 additions & 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
```yml
1515
dependencies:
16-
parse_server_sdk: ^1.0.25
16+
parse_server_sdk: ^1.0.26
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
@@ -57,6 +57,13 @@ var dietPlan = ParseObject('DietPlan')
5757
..set('Fat', 65);
5858
await dietPlan.save();
5959
```
60+
Or update existing object by its objectId by calling:
61+
```dart
62+
var dietPlan = ParseObject('DietPlan')
63+
..objectId = 'R5EonpUDWy'
64+
..set('Fat', 70);
65+
await dietPlan.save();
66+
```
6067
Verify that the object has been successfully saved using
6168
```dart
6269
var response = await dietPlan.save();
@@ -423,6 +430,66 @@ LiveQuery server.
423430
liveQuery.client.unSubscribe(subscription);
424431
```
425432

433+
## ParseLiveList
434+
ParseLiveList makes implementing a dynamic List as simple as possible.
435+
436+
437+
It ships with the ParseLiveList class itself, this class manages all elements of the list, sorts them,
438+
keeps itself up to date and Notifies you on changes.
439+
440+
ParseLiveListWidget is a widget that handles all the communication with the ParseLiveList for you.
441+
Using ParseLiveListWidget you can create a dynamic List by just providing a QueryBuilder.
442+
443+
```dart
444+
ParseLiveListWidget<ParseObject>(
445+
query: query,
446+
);
447+
```
448+
To customize the List Elements, you can provide a childBuilder.
449+
```dart
450+
ParseLiveListWidget<ParseObject>(
451+
query: query,
452+
reverse: false,
453+
childBuilder:
454+
(BuildContext context, bool failed, ParseObject loadedData) {
455+
if (failed) {
456+
return const Text('something went wrong!');
457+
} else if (loadedData != null) {
458+
return ListTile(
459+
title: Text(
460+
loadedData.get("text"),
461+
),
462+
);
463+
} else {
464+
return const ListTile(
465+
leading: CircularProgressIndicator(),
466+
);
467+
}
468+
},
469+
);
470+
```
471+
Similar to the standard ListView, you can provide arguments like reverse or shrinkWrap.
472+
By providing the listLoadingElement, you can show the user something while the list is loading.
473+
```dart
474+
ParseLiveListWidget<ParseObject>(
475+
query: query,
476+
childBuilder: childBuilder,
477+
listLoadingElement: Center(
478+
child: CircularProgressIndicator(),
479+
),
480+
);
481+
```
482+
By providing the duration argument, you can change the animation speed.
483+
```dart
484+
ParseLiveListWidget<ParseObject>(
485+
query: query,
486+
childBuilder: childBuilder,
487+
duration: Duration(seconds: 1),
488+
);
489+
```
490+
491+
Note: To use this features you have to enable [Live Queries](#live-queries) first.
492+
426493
## Users
427494
You can create and control users just as normal using this SDK.
428495

example/lib/main.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class _MyAppState extends State<MyApp> {
6868
Future<void> initData() async {
6969
// Initialize repository
7070
await initRepository();
71-
final CoreStore coreStore = await initCoreStore();
71+
await initCoreStore();
7272

7373
// Initialize parse
7474
await Parse().initialize(keyParseApplicationId, keyParseServerUrl,
@@ -233,7 +233,7 @@ class _MyAppState extends State<MyApp> {
233233
user = response.result;
234234
}*/
235235

236-
ParseUser user1 = await ParseUser.currentUser();
236+
final ParseUser user1 = await ParseUser.currentUser();
237237
user1.authData;
238238

239239
/// Login

example/lib/pages/home_page.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class _HomePageState extends State<HomePage> {
7474
if (snapshot.data.success) {
7575
if (snapshot.data.results == null ||
7676
snapshot.data.results.isEmpty) {
77-
return Center(
78-
child: const Text('No Data'),
77+
return const Center(
78+
child: Text('No Data'),
7979
);
8080
}
8181
}
@@ -97,7 +97,7 @@ class _HomePageState extends State<HomePage> {
9797
child: ListTile(
9898
title: Text(
9999
name,
100-
style: TextStyle(fontSize: 20.0),
100+
style: const TextStyle(fontSize: 20.0),
101101
),
102102
subtitle: Text(description),
103103
trailing: IconButton(
@@ -118,8 +118,8 @@ class _HomePageState extends State<HomePage> {
118118
);
119119
});
120120
} else {
121-
return Center(
122-
child: const Text('No Data'),
121+
return const Center(
122+
child: Text('No Data'),
123123
);
124124
}
125125
});

example/lib/pages/login_page.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class _LoginPageState extends State<LoginPage> {
114114

115115
Widget _showCircularProgress() {
116116
if (_isLoading) {
117-
return Center(child: const CircularProgressIndicator());
117+
return const Center(child: CircularProgressIndicator());
118118
}
119119
return Container(
120120
height: 0.0,
@@ -179,9 +179,9 @@ class _LoginPageState extends State<LoginPage> {
179179
maxLines: 1,
180180
keyboardType: TextInputType.emailAddress,
181181
autofocus: false,
182-
decoration: InputDecoration(
182+
decoration: const InputDecoration(
183183
hintText: 'Email',
184-
icon: const Icon(
184+
icon: Icon(
185185
Icons.mail,
186186
color: Colors.grey,
187187
)),
@@ -199,9 +199,9 @@ class _LoginPageState extends State<LoginPage> {
199199
maxLines: 1,
200200
obscureText: true,
201201
autofocus: false,
202-
decoration: InputDecoration(
202+
decoration: const InputDecoration(
203203
hintText: 'Password',
204-
icon: const Icon(
204+
icon: Icon(
205205
Icons.lock,
206206
color: Colors.grey,
207207
)),

example/test/data/repository/diet_plan/repository_diet_plan_api_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ void main() {
100100
// When
101101
final ApiResponse baseResponse = await repository.add(dummy);
102102
final ApiResponse responseWithResult = await repository
103-
.getNewerThan(DateTime.now().subtract(Duration(days: 1)));
103+
.getNewerThan(DateTime.now().subtract(const Duration(days: 1)));
104104
final ApiResponse responseWithoutResult =
105-
await repository.getNewerThan(DateTime.now().add(Duration(days: 1)));
105+
await repository.getNewerThan(
106+
DateTime.now().add(const Duration(days: 1)));
106107

107108
// CLEAR FROM DB
108109
await deleteFromApi(baseResponse.results);

example/test/data/repository/diet_plan/repository_diet_plan_db_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void main() {
131131

132132
// When
133133
DateTime dateTime = DateTime.now();
134-
dateTime = dateTime.subtract(Duration(hours: 1));
134+
dateTime = dateTime.subtract(const Duration(hours: 1));
135135
final ApiResponse updateResponse = await repository.getNewerThan(dateTime);
136136
final List<DietPlan> actual = updateResponse.results;
137137

example_livelist/.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
#.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
.dart_tool/
26+
.flutter-plugins
27+
.flutter-plugins-dependencies
28+
.packages
29+
.pub-cache/
30+
.pub/
31+
/build/
32+
33+
# Web related
34+
lib/generated_plugin_registrant.dart
35+
36+
# Exceptions to above rules.
37+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

example_livelist/.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
8+
channel: stable
9+
10+
project_type: app

example_livelist/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# ParesLiveList example
2+
Change application_constants.dart and give it a try.
3+
4+
You need a class "Test" with the fields <String> text, <Boolean> show and <Number> order in your database.
5+
You have to add some data by yourself. (The app is TO simple)
6+
(The class should be Read/Write for public)
7+
8+
It's recommended to use the Parse Dashboard to manipulate the data.
9+
This way, you will be able to hide objects and edit items, while your device is offline.

example_livelist/android/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
def localProperties = new Properties()
2+
def localPropertiesFile = rootProject.file('local.properties')
3+
if (localPropertiesFile.exists()) {
4+
localPropertiesFile.withReader('UTF-8') { reader ->
5+
localProperties.load(reader)
6+
}
7+
}
8+
9+
def flutterRoot = localProperties.getProperty('flutter.sdk')
10+
if (flutterRoot == null) {
11+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12+
}
13+
14+
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15+
if (flutterVersionCode == null) {
16+
flutterVersionCode = '1'
17+
}
18+
19+
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20+
if (flutterVersionName == null) {
21+
flutterVersionName = '1.0'
22+
}
23+
24+
apply plugin: 'com.android.application'
25+
apply plugin: 'kotlin-android'
26+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27+
28+
android {
29+
compileSdkVersion 28
30+
31+
sourceSets {
32+
main.java.srcDirs += 'src/main/kotlin'
33+
}
34+
35+
lintOptions {
36+
disable 'InvalidPackage'
37+
}
38+
39+
defaultConfig {
40+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41+
applicationId "com.example.flutterpluginexample_livelist"
42+
minSdkVersion 16
43+
targetSdkVersion 28
44+
versionCode flutterVersionCode.toInteger()
45+
versionName flutterVersionName
46+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
47+
}
48+
49+
buildTypes {
50+
release {
51+
// TODO: Add your own signing config for the release build.
52+
// Signing with the debug keys for now, so `flutter run --release` works.
53+
signingConfig signingConfigs.debug
54+
}
55+
}
56+
}
57+
58+
flutter {
59+
source '../..'
60+
}
61+
62+
dependencies {
63+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64+
testImplementation 'junit:junit:4.12'
65+
androidTestImplementation 'androidx.test:runner:1.1.1'
66+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
67+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.example.flutterpluginexample_livelist">
3+
<!-- Flutter needs it to communicate with the running application
4+
to allow setting breakpoints, to provide hot reload, etc.
5+
-->
6+
<uses-permission android:name="android.permission.INTERNET"/>
7+
</manifest>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.example.flutterpluginexample_livelist">
3+
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
4+
calls FlutterMain.startInitialization(this); in its onCreate method.
5+
In most cases you can leave this as-is, but you if you want to provide
6+
additional functionality it is fine to subclass or reimplement
7+
FlutterApplication and put your custom class here. -->
8+
<application
9+
android:name="io.flutter.app.FlutterApplication"
10+
android:label="flutterpluginexample_livelist"
11+
android:icon="@mipmap/ic_launcher">
12+
<activity
13+
android:name=".MainActivity"
14+
android:launchMode="singleTop"
15+
android:theme="@style/LaunchTheme"
16+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
17+
android:hardwareAccelerated="true"
18+
android:windowSoftInputMode="adjustResize">
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN"/>
21+
<category android:name="android.intent.category.LAUNCHER"/>
22+
</intent-filter>
23+
</activity>
24+
<!-- Don't delete the meta-data below.
25+
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
26+
<meta-data
27+
android:name="flutterEmbedding"
28+
android:value="2" />
29+
</application>
30+
</manifest>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.example.example_livelist
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity() {
6+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.flutterpluginexample_livelist
2+
3+
import androidx.annotation.NonNull;
4+
import io.flutter.embedding.android.FlutterActivity
5+
import io.flutter.embedding.engine.FlutterEngine
6+
import io.flutter.plugins.GeneratedPluginRegistrant
7+
8+
class MainActivity: FlutterActivity() {
9+
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
10+
GeneratedPluginRegistrant.registerWith(flutterEngine);
11+
}
12+
}

0 commit comments

Comments
 (0)