From 7608870dab00688b5951c8d61d29b2fff55f9297 Mon Sep 17 00:00:00 2001 From: Mohammad Bagher Fakouri Date: Sun, 28 May 2023 14:16:31 +0330 Subject: [PATCH] feat: Update Dart, Flutter API links and improve document structure (#931) --- _config.yml | 5 +- _includes/{flutter => dart}/cloud-code.md | 0 _includes/{flutter => dart}/config.md | 0 _includes/{flutter => dart}/files.md | 0 _includes/dart/getting-started.md | 73 +++++++++++++++++++ _includes/{flutter => dart}/objects.md | 0 _includes/{flutter => dart}/other-features.md | 0 _includes/{flutter => dart}/queries.md | 0 _includes/{flutter => dart}/storage.md | 0 _includes/{flutter => dart}/users.md | 0 _includes/flutter/getting-started.md | 1 - assets/symbols.svg | 8 +- css/lib/docs/components/_docs-platform.scss | 5 ++ css/lib/docs/components/_docsearch.scss | 3 + css/lib/marketing/components/_herosDocs.scss | 3 + css/lib/multisite/_variables.scss | 1 + dart-api.md | 7 ++ dart.md | 21 ++++++ flutter-api.md | 4 +- flutter.md | 18 ++--- img/dart.svg | 1 + index.md | 14 ++++ 22 files changed, 146 insertions(+), 18 deletions(-) rename _includes/{flutter => dart}/cloud-code.md (100%) rename _includes/{flutter => dart}/config.md (100%) rename _includes/{flutter => dart}/files.md (100%) create mode 100644 _includes/dart/getting-started.md rename _includes/{flutter => dart}/objects.md (100%) rename _includes/{flutter => dart}/other-features.md (100%) rename _includes/{flutter => dart}/queries.md (100%) rename _includes/{flutter => dart}/storage.md (100%) rename _includes/{flutter => dart}/users.md (100%) create mode 100644 dart-api.md create mode 100644 dart.md create mode 100644 img/dart.svg diff --git a/_config.yml b/_config.yml index 447a8a36..6493c1f9 100644 --- a/_config.yml +++ b/_config.yml @@ -20,10 +20,11 @@ support_url: https://community.parseplatform.org apis: osx: https://parseplatform.org/Parse-SDK-iOS-OSX/api/ android: https://parseplatform.org/Parse-SDK-Android/api/ - js: https://parseplatform.org/Parse-SDK-JS/api/master/ + js: https://parseplatform.org/Parse-SDK-JS/api/ php: https://parseplatform.org/parse-php-sdk/ dotnet: https://parseplatform.org/Parse-SDK-dotNET/api/ - flutter: flutter/api/ + flutter: https://parseplatform.org/Parse-SDK-Flutter/flutter/flutter_parse_sdk_flutter/flutter_parse_sdk_flutter-library.html + dart: https://parseplatform.org/Parse-SDK-Flutter/dart/flutter_parse_sdk/flutter_parse_sdk-library.html parse-server: https://parseplatform.org/parse-server/api/ # Build settings diff --git a/_includes/flutter/cloud-code.md b/_includes/dart/cloud-code.md similarity index 100% rename from _includes/flutter/cloud-code.md rename to _includes/dart/cloud-code.md diff --git a/_includes/flutter/config.md b/_includes/dart/config.md similarity index 100% rename from _includes/flutter/config.md rename to _includes/dart/config.md diff --git a/_includes/flutter/files.md b/_includes/dart/files.md similarity index 100% rename from _includes/flutter/files.md rename to _includes/dart/files.md diff --git a/_includes/dart/getting-started.md b/_includes/dart/getting-started.md new file mode 100644 index 00000000..733a9859 --- /dev/null +++ b/_includes/dart/getting-started.md @@ -0,0 +1,73 @@ +# Getting Started + +- To install the Parse Dart SDK add it to your app as a dependency via the [pub.dev](https://pub.dev/packages/parse_server_sdk/install) registry. + +Once you have the SDK added as a dependency, initialize the SDK as early as possible in your application (e.g. in your application class) like this: + +```dart +await Parse().initialize( + keyApplicationId, + keyParseServerUrl, +); +``` + +If you want to use secure storage or use the Flutter web/desktop SDK, please change to the below instance of `CoreStorage` as it has no dependencies on Flutter. `CoreStoreSembastImp` does not encrypt the data on the web and Web is not safe anyway. Encrypt fields manually as needed. + +```dart +await Parse().initialize( + keyParseApplicationId, + keyParseServerUrl, + coreStore: await CoreStoreSembastImp.getInstance("/data")); +``` + +It's possible to add other parameters to work with your instance of Parse Server: + +```dart +await Parse().initialize( + keyApplicationId, + keyParseServerUrl, + clientKey: keyParseClientKey, // Required for some setups + debug: true, // When enabled, prints logs to console + liveQueryUrl: keyLiveQueryUrl, // Required if using LiveQuery + autoSendSessionId: true, // Required for authentication and ACL + securityContext: securityContext, // Again, required for some setups + coreStore: CoreStoreMemoryImp()); // Non persistent mode (default): Sdk will store everything in memory instead of using Sembast as an internal DB. +``` + +⚠️ The master key should only be used in safe environments and never on client side. Using this package on a server should be fine. + +## Early Web Support + +Due to Cross-Origin Resource Sharing (CORS) restrictions, web support requires adding `X-Parse-Installation-Id` as an allowed header in the Parse Server configuration: + +- When running directly via docker, set the env var `PARSE_SERVER_ALLOW_HEADERS=X-Parse-Installation-Id`. +- When running via express, set the [Parse Server option](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) `allowHeaders: ['X-Parse-Installation-Id']`. + +## Desktop Support (macOS) + +The security entitlements posed by the macOS framework require that your app is granted permission to open outgoing network connections, so that the Parse Flutter SDK can communicate with Parse Server. To grant this permission, add the following code: + +```swift +com.apple.security.network.client + +``` + +to the following files: + +``` +/macOS/Runner/Release.entitlements +/macOS/Runner/DebugProfile.entitlements +``` + +## Network client + +By default, this SDK uses the `ParseHTTPClient`. Another option is use `ParseDioClient`. This client supports the most features (for example a progress callback at the file upload), but a benchmark has shown that dio is slower than http on web. + +If you want to use the `ParseDioClient`, which uses the dio network library, you can provide a custom `ParseClientCreator` at the initialization of the SDK: + +```dart +await Parse().initialize( + //... + clientCreator: ({bool? sendSessionId, SecurityContext? securityContext}) => ParseDioClient(sendSessionId: sendSessionId, securityContext: securityContext), +); +``` \ No newline at end of file diff --git a/_includes/flutter/objects.md b/_includes/dart/objects.md similarity index 100% rename from _includes/flutter/objects.md rename to _includes/dart/objects.md diff --git a/_includes/flutter/other-features.md b/_includes/dart/other-features.md similarity index 100% rename from _includes/flutter/other-features.md rename to _includes/dart/other-features.md diff --git a/_includes/flutter/queries.md b/_includes/dart/queries.md similarity index 100% rename from _includes/flutter/queries.md rename to _includes/dart/queries.md diff --git a/_includes/flutter/storage.md b/_includes/dart/storage.md similarity index 100% rename from _includes/flutter/storage.md rename to _includes/dart/storage.md diff --git a/_includes/flutter/users.md b/_includes/dart/users.md similarity index 100% rename from _includes/flutter/users.md rename to _includes/dart/users.md diff --git a/_includes/flutter/getting-started.md b/_includes/flutter/getting-started.md index 25875cbb..965cde54 100644 --- a/_includes/flutter/getting-started.md +++ b/_includes/flutter/getting-started.md @@ -1,6 +1,5 @@ # Getting Started -- To install the Parse Dart SDK add it to your app as a dependency via the [pub.dev](https://pub.dev/packages/parse_server_sdk/install) registry. - To install the Parse Flutter SDK add it to your app as a dependency via the [pub.dev](https://pub.dev/packages/parse_server_sdk_flutter/install) registry. Once you have the SDK added as a dependency, initialize the SDK as early as possible in your application (e.g. in your application class) like this: diff --git a/assets/symbols.svg b/assets/symbols.svg index a2d10728..14bb6239 100755 --- a/assets/symbols.svg +++ b/assets/symbols.svg @@ -12,10 +12,10 @@ - - - - + + + + diff --git a/css/lib/docs/components/_docs-platform.scss b/css/lib/docs/components/_docs-platform.scss index 84a3c0f1..5392fbf4 100644 --- a/css/lib/docs/components/_docs-platform.scss +++ b/css/lib/docs/components/_docs-platform.scss @@ -185,6 +185,11 @@ width: 23px; height: 24px; } + svg.icon-dart{ + fill: $dartPlatform; + width: 23px; + height: 24px; + } svg.icon-js{ fill: $jsPlatform; width: 33px; diff --git a/css/lib/docs/components/_docsearch.scss b/css/lib/docs/components/_docsearch.scss index 8d0ebd4c..650e635a 100644 --- a/css/lib/docs/components/_docsearch.scss +++ b/css/lib/docs/components/_docsearch.scss @@ -75,6 +75,9 @@ input { &.flutter_docs_header{ background-color: $flutterPlatform; } + &.dart_docs_header{ + background-color: $dartPlatform; + } &.php_docs_docsearch{ background-color: $phpPlatform; } diff --git a/css/lib/marketing/components/_herosDocs.scss b/css/lib/marketing/components/_herosDocs.scss index 17e75210..06285632 100644 --- a/css/lib/marketing/components/_herosDocs.scss +++ b/css/lib/marketing/components/_herosDocs.scss @@ -34,6 +34,9 @@ &.flutter_docs_header{ background-color: $flutterPlatform; } + &.dart_docs_header{ + background-color: $dartPlatform; + } &.php_docs_header{ background-color: $phpPlatform; } diff --git a/css/lib/multisite/_variables.scss b/css/lib/multisite/_variables.scss index 6f36b0d9..9ba7e509 100644 --- a/css/lib/multisite/_variables.scss +++ b/css/lib/multisite/_variables.scss @@ -97,6 +97,7 @@ $osxPlatform: #9CAFBA; $androidPlatform: #00C26E; $jsPlatform: #F5A623; $flutterPlatform: #47c5fb; +$dartPlatform: #227ee6; $dotnetPlatform: #922ADD; $unityPlatform: #11A4BA; $phpPlatform: #0E69A1; diff --git a/dart-api.md b/dart-api.md new file mode 100644 index 00000000..dbd716a1 --- /dev/null +++ b/dart-api.md @@ -0,0 +1,7 @@ +--- +layout: redirected +sitemap: false +permalink: /dart/api/ +redirect_to: +- https://parseplatform.org/Parse-SDK-Flutter/dart/flutter_parse_sdk/flutter_parse_sdk-library.html +--- \ No newline at end of file diff --git a/dart.md b/dart.md new file mode 100644 index 00000000..a2a920ae --- /dev/null +++ b/dart.md @@ -0,0 +1,21 @@ +--- +title: Dart Guide | Parse +permalink: /dart/guide/ +layout: guide +platform: dart +language: dart +display_platform: Dart +api_reference: /dart/api + +sections: +- "dart/getting-started.md" +- "dart/objects.md" +- "dart/queries.md" +- "dart/cloud-code.md" +- "dart/config.md" +- "dart/files.md" +- "dart/other-features.md" +- "dart/storage.md" +- "dart/users.md" + +--- diff --git a/flutter-api.md b/flutter-api.md index 9ad64874..c0731a3d 100644 --- a/flutter-api.md +++ b/flutter-api.md @@ -3,5 +3,5 @@ layout: redirected sitemap: false permalink: /flutter/api/ redirect_to: - - https://pub.dev/documentation/parse_server_sdk_flutter/latest/ ---- +- https://parseplatform.org/Parse-SDK-Flutter/flutter/flutter_parse_sdk_flutter/flutter_parse_sdk_flutter-library.html +--- \ No newline at end of file diff --git a/flutter.md b/flutter.md index fda7af03..b6e6aed0 100644 --- a/flutter.md +++ b/flutter.md @@ -5,18 +5,18 @@ layout: guide platform: flutter language: dart display_platform: Flutter -api_reference: https://parse-community.github.io/Parse-SDK-Flutter/api +api_reference: /flutter/api sections: - "flutter/getting-started.md" -- "flutter/objects.md" -- "flutter/queries.md" -- "flutter/cloud-code.md" -- "flutter/config.md" -- "flutter/files.md" +- "dart/objects.md" +- "dart/queries.md" +- "dart/cloud-code.md" +- "dart/config.md" +- "dart/files.md" - "flutter/push-notifications.md" -- "flutter/other-features.md" -- "flutter/storage.md" -- "flutter/users.md" +- "dart/other-features.md" +- "dart/storage.md" +- "dart/users.md" --- diff --git a/img/dart.svg b/img/dart.svg new file mode 100644 index 00000000..b3c4aa82 --- /dev/null +++ b/img/dart.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.md b/index.md index 892c6806..9978afad 100644 --- a/index.md +++ b/index.md @@ -79,6 +79,20 @@ layout: docs +
+
+ Dart + +
+ + +
+
JavaScript