Skip to content

Commit c792d38

Browse files
authored
Revert "Support Relation. (#178)" (#180)
This reverts commit 6ed26e1.
1 parent 6ed26e1 commit c792d38

36 files changed

+190
-327
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,3 @@ build/
1010
.idea
1111
example/ios/Frameworks/
1212
example/lib/ui/
13-
14-
.vscode/

CHANGELOG.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
## 1.0.22
2-
31
## 1.0.21
42
LiveQuery fix
53
Logout fix

README.md

+1-16
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.22
16+
parse_server_sdk: ^1.0.21
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
@@ -537,21 +537,6 @@ final Map<String, String> params = <String, String>{'plan': 'paid'};
537537
function.execute(parameters: params);
538538
```
539539

540-
## Relation
541-
The SDK supports Relation.
542-
543-
To Retrive a relation instance for user, call:
544-
```dart
545-
final relation = user.getRelation('dietPlans');
546-
```
547-
548-
and then you can add a relation to the passed in object.
549-
550-
```dart
551-
relation.add(dietPlan);
552-
final result = await user.save();
553-
```
554-
555540
## Other Features of this library
556541
Main:
557542
* Installation (View the example application)

example/ios/Runner.xcodeproj/project.pbxproj

-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,9 @@
4444
24DF2572E6AEEB9F7CE180C9 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4545
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4646
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
47-
5804EFBD11740E02FC51BC3E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
4847
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
4948
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
5049
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
51-
96499D95196B10F296043703 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
5250
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
5351
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
5452
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };

example/lib/data/repositories/user/provider_db_user.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class UserProviderDB implements UserProviderContract {
7979

8080
Map<String, dynamic> convertItemToStorageMap(User item) {
8181
final Map<String, dynamic> values = Map<String, dynamic>();
82-
// ignore: invalid_use_of_protected_member
8382
values['value'] = json.jsonEncode(item.toJson(full: true));
8483
values[keyVarObjectId] = item.objectId;
8584
item.updatedAt != null
@@ -91,7 +90,8 @@ class UserProviderDB implements UserProviderContract {
9190
User convertRecordToItem({Record record, Map<String, dynamic> values}) {
9291
try {
9392
values ??= record.value;
94-
final User item = User.clone().fromJson(json.jsonDecode(values['value']));
93+
final User item =
94+
User.clone().fromJson(json.jsonDecode(values['value']));
9595
return item;
9696
} catch (e) {
9797
return null;

example/lib/main.dart

+41-45
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'package:flutter_plugin_example/data/repositories/diet_plan/repository_di
1010
import 'package:flutter_plugin_example/data/repositories/user/repository_user.dart';
1111
import 'package:flutter_plugin_example/domain/constants/application_constants.dart';
1212
import 'package:flutter_plugin_example/domain/utils/db_utils.dart';
13+
import 'package:flutter_plugin_example/pages/decision_page.dart';
1314
import 'package:flutter_stetho/flutter_stetho.dart';
1415
import 'package:parse_server_sdk/parse_server_sdk.dart';
1516

@@ -40,74 +41,69 @@ class MyApp extends StatefulWidget {
4041
class _MyAppState extends State<MyApp> {
4142
DietPlanRepository dietPlanRepo;
4243
UserRepository userRepo;
43-
44-
String text = '';
45-
4644
@override
4745
void initState() {
4846
super.initState();
49-
initData();
47+
// initData();
5048
}
5149

5250
@override
5351
Widget build(BuildContext context) {
5452
return MaterialApp(
55-
home: Scaffold(
56-
appBar: AppBar(
57-
title: const Text('Plugin example app'),
58-
),
59-
body: Center(
60-
child: Text(text),
53+
debugShowCheckedModeBanner: false,
54+
theme: ThemeData(
55+
primarySwatch: Colors.blue,
6156
),
62-
),
63-
);
57+
title: 'Parse Server Example',
58+
home: DecisionPage());
6459
}
6560

6661
Future<void> initData() async {
6762
// Initialize repository
68-
await initRepository();
63+
// await initRepository();
6964

7065
// Initialize parse
7166
Parse().initialize(keyParseApplicationId, keyParseServerUrl,
7267
masterKey: keyParseMasterKey, debug: true);
7368

69+
//parse serve with secure store and desktop support
70+
71+
// Parse().initialize(keyParseApplicationId, keyParseServerUrl,
72+
// masterKey: keyParseMasterKey,
73+
// debug: true,
74+
// coreStore: CoreStoreImp.getInstance());
75+
7476
// Check server is healthy and live - Debug is on in this instance so check logs for result
7577
final ParseResponse response = await Parse().healthCheck();
7678

7779
if (response.success) {
7880
await runTestQueries();
79-
text += 'runTestQueries\n';
81+
print('runTestQueries');
8082
} else {
81-
text += 'Server health check failed';
8283
print('Server health check failed');
8384
}
8485
}
8586

8687
Future<void> runTestQueries() async {
8788
// Basic repository example
88-
await repositoryAddUser();
89-
await repositoryAddItems();
90-
await repositoryGetAllItems();
89+
//await repositoryAddUser();
90+
//await repositoryAddItems();
91+
//await repositoryGetAllItems();
9192

9293
//Basic usage
93-
await createItem();
94-
await getAllItems();
95-
await getAllItemsByName();
96-
await getSingleItem();
97-
await getConfigs();
98-
await query();
99-
await initUser();
100-
await initInstallation();
101-
await function();
102-
await functionWithParameters();
103-
await test();
104-
}
105-
106-
Future<void> initInstallation() async {
107-
final ParseInstallation installation =
108-
await ParseInstallation.currentInstallation();
109-
final ParseResponse response = await installation.create();
110-
print(response);
94+
// createItem();
95+
// getAllItems();
96+
// getAllItemsByName();
97+
// getSingleItem();
98+
// getConfigs();
99+
// query();
100+
// initUser();
101+
// var instalattion = await ParseInstallation.currentInstallation();
102+
// var rees = instalattion.create();
103+
// print(rees);
104+
//function();
105+
//functionWithParameters();
106+
// test();
111107
}
112108

113109
Future<void> test() async {
@@ -363,13 +359,13 @@ class _MyAppState extends State<MyApp> {
363359
dietPlanRepo ??= DietPlanRepository.init(await getDB());
364360
userRepo ??= UserRepository.init(await getDB());
365361
}
366-
}
367362

368-
const String dietPlansToAdd =
369-
'[{"className":"Diet_Plans","Name":"Textbook","Description":"For an active lifestyle and a straight forward macro plan, we suggest this plan.","Fat":25,"Carbs":50,"Protein":25,"Status":0},'
370-
'{"className":"Diet_Plans","Name":"Body Builder","Description":"Default Body Builders Diet","Fat":20,"Carbs":40,"Protein":40,"Status":0},'
371-
'{"className":"Diet_Plans","Name":"Zone Diet","Description":"Popular with CrossFit users. Zone Diet targets similar macros.","Fat":30,"Carbs":40,"Protein":30,"Status":0},'
372-
'{"className":"Diet_Plans","Name":"Low Fat","Description":"Low fat diet.","Fat":15,"Carbs":60,"Protein":25,"Status":0},'
373-
'{"className":"Diet_Plans","Name":"Low Carb","Description":"Low Carb diet, main focus on quality fats and protein.","Fat":35,"Carbs":25,"Protein":40,"Status":0},'
374-
'{"className":"Diet_Plans","Name":"Paleo","Description":"Paleo diet.","Fat":60,"Carbs":25,"Protein":10,"Status":0},'
375-
'{"className":"Diet_Plans","Name":"Ketogenic","Description":"High quality fats, low carbs.","Fat":65,"Carbs":5,"Protein":30,"Status":0}]';
363+
String dietPlansToAdd =
364+
'[{"className":"Diet_Plans","Name":"Textbook","Description":"For an active lifestyle and a straight forward macro plan, we suggest this plan.","Fat":25,"Carbs":50,"Protein":25,"Status":0},'
365+
'{"className":"Diet_Plans","Name":"Body Builder","Description":"Default Body Builders Diet","Fat":20,"Carbs":40,"Protein":40,"Status":0},'
366+
'{"className":"Diet_Plans","Name":"Zone Diet","Description":"Popular with CrossFit users. Zone Diet targets similar macros.","Fat":30,"Carbs":40,"Protein":30,"Status":0},'
367+
'{"className":"Diet_Plans","Name":"Low Fat","Description":"Low fat diet.","Fat":15,"Carbs":60,"Protein":25,"Status":0},'
368+
'{"className":"Diet_Plans","Name":"Low Carb","Description":"Low Carb diet, main focus on quality fats and protein.","Fat":35,"Carbs":25,"Protein":40,"Status":0},'
369+
'{"className":"Diet_Plans","Name":"Paleo","Description":"Paleo diet.","Fat":60,"Carbs":25,"Protein":10,"Status":0},'
370+
'{"className":"Diet_Plans","Name":"Ketogenic","Description":"High quality fats, low carbs.","Fat":65,"Carbs":5,"Protein":30,"Status":0}]';
371+
}

example/windows/find_vcvars.dart

+8-9
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
import 'dart:io';
1818

1919
int main() {
20-
final String programDir = Platform.environment['PROGRAMFILES(X86)'];
21-
final String pathPrefix = '$programDir\\Microsoft Visual Studio';
22-
const String pathSuffix = 'VC\\Auxiliary\\Build\\vcvars64.bat';
23-
final List<String> years = <String>['2017', '2019'];
24-
final List<String> flavors = <String>[
25-
'Community', 'Professional', 'Enterprise', 'Preview'];
26-
for (final String year in years) {
27-
for (final String flavor in flavors) {
28-
final String testPath = '$pathPrefix\\$year\\$flavor\\$pathSuffix';
20+
final programDir = Platform.environment['PROGRAMFILES(X86)'];
21+
final pathPrefix = '$programDir\\Microsoft Visual Studio';
22+
const pathSuffix = 'VC\\Auxiliary\\Build\\vcvars64.bat';
23+
final years = ['2017', '2019'];
24+
final flavors = ['Community', 'Professional', 'Enterprise', 'Preview'];
25+
for (final year in years) {
26+
for (final flavor in flavors) {
27+
final testPath = '$pathPrefix\\$year\\$flavor\\$pathSuffix';
2928
if (File(testPath).existsSync()) {
3029
print(testPath);
3130
return 0;

example/windows/generate_props.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
import 'dart:io';
1919

2020
void main(List<String> arguments) {
21-
final String outputPath = arguments[0];
22-
final Map<String, String> settings = <String, String>{
21+
final outputPath = arguments[0];
22+
final settings = {
2323
'FLUTTER_ROOT': arguments[1],
2424
'EXTRA_BUNDLE_FLAGS': arguments[2],
2525
};
@@ -39,16 +39,16 @@ ${getItemGroupContent(settings)}
3939
}
4040

4141
String getUserMacrosContent(Map<String, String> settings) {
42-
final StringBuffer macroList = StringBuffer();
43-
for (final MapEntry<dynamic, dynamic> setting in settings.entries) {
42+
final macroList = StringBuffer();
43+
for (final setting in settings.entries) {
4444
macroList.writeln(' <${setting.key}>${setting.value}</${setting.key}>');
4545
}
4646
return macroList.toString();
4747
}
4848

4949
String getItemGroupContent(Map<String, String> settings) {
50-
final StringBuffer macroList = StringBuffer();
51-
for (final String name in settings.keys) {
50+
final macroList = StringBuffer();
51+
for (final name in settings.keys) {
5252
macroList.writeln(''' <BuildMacro Include="$name">
5353
<Value>\$($name)</Value>
5454
<EnvironmentVariable>true</EnvironmentVariable>

lib/generated/i18n.dart

+12-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import 'dart:async';
23

34
import 'package:flutter/foundation.dart';
@@ -12,32 +13,35 @@ class S implements WidgetsLocalizations {
1213
const S();
1314

1415
static const GeneratedLocalizationsDelegate delegate =
15-
GeneratedLocalizationsDelegate();
16+
const GeneratedLocalizationsDelegate();
1617

1718
static S of(BuildContext context) =>
1819
Localizations.of<S>(context, WidgetsLocalizations);
1920

2021
@override
2122
TextDirection get textDirection => TextDirection.ltr;
23+
2224
}
2325

2426
class en extends S {
2527
const en();
2628
}
2729

28-
class GeneratedLocalizationsDelegate
29-
extends LocalizationsDelegate<WidgetsLocalizations> {
30+
31+
class GeneratedLocalizationsDelegate extends LocalizationsDelegate<WidgetsLocalizations> {
3032
const GeneratedLocalizationsDelegate();
3133

3234
List<Locale> get supportedLocales {
3335
return const <Locale>[
34-
Locale("en", ""),
36+
37+
const Locale("en", ""),
38+
3539
];
3640
}
3741

3842
LocaleResolutionCallback resolution({Locale fallback}) {
3943
return (Locale locale, Iterable<Locale> supported) {
40-
final Locale languageLocale = Locale(locale.languageCode, "");
44+
final Locale languageLocale = new Locale(locale.languageCode, "");
4145
if (supported.contains(locale))
4246
return locale;
4347
else if (supported.contains(languageLocale))
@@ -53,11 +57,12 @@ class GeneratedLocalizationsDelegate
5357
Future<WidgetsLocalizations> load(Locale locale) {
5458
final String lang = getLang(locale);
5559
switch (lang) {
60+
5661
case "en":
57-
return SynchronousFuture<WidgetsLocalizations>(const en());
62+
return new SynchronousFuture<WidgetsLocalizations>(const en());
5863

5964
default:
60-
return SynchronousFuture<WidgetsLocalizations>(const S());
65+
return new SynchronousFuture<WidgetsLocalizations>(const S());
6166
}
6267
}
6368

0 commit comments

Comments
 (0)