From 39fb2f59de5c0c64f83cf0cae06caa440ec53f8f Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Fri, 24 May 2024 12:29:29 -0700 Subject: [PATCH 1/4] Add a skeleton package:ok_http --- .github/workflows/okhttp.yaml | 47 +++++++++ pkgs/ok_http/.gitignore | 29 ++++++ pkgs/ok_http/.metadata | 30 ++++++ pkgs/ok_http/CHANGELOG.md | 3 + pkgs/ok_http/LICENSE | 27 +++++ pkgs/ok_http/README.md | 22 ++++ pkgs/ok_http/analysis_options.yaml | 1 + pkgs/ok_http/android/.gitignore | 9 ++ pkgs/ok_http/android/build.gradle | 65 ++++++++++++ pkgs/ok_http/android/settings.gradle | 1 + .../android/src/main/AndroidManifest.xml | 3 + pkgs/ok_http/example/.gitignore | 43 ++++++++ pkgs/ok_http/example/README.md | 16 +++ pkgs/ok_http/example/analysis_options.yaml | 28 +++++ pkgs/ok_http/example/android/.gitignore | 13 +++ pkgs/ok_http/example/android/app/build.gradle | 58 +++++++++++ .../android/app/src/debug/AndroidManifest.xml | 7 ++ .../android/app/src/main/AndroidManifest.xml | 45 ++++++++ .../example/ok_http_example/MainActivity.kt | 5 + .../res/drawable-v21/launch_background.xml | 12 +++ .../main/res/drawable/launch_background.xml | 12 +++ .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 544 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 442 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 721 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 1031 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 1443 bytes .../app/src/main/res/values-night/styles.xml | 18 ++++ .../app/src/main/res/values/styles.xml | 18 ++++ .../app/src/profile/AndroidManifest.xml | 7 ++ pkgs/ok_http/example/android/build.gradle | 18 ++++ .../ok_http/example/android/gradle.properties | 3 + .../gradle/wrapper/gradle-wrapper.properties | 5 + pkgs/ok_http/example/android/settings.gradle | 25 +++++ pkgs/ok_http/example/lib/main.dart | 69 +++++++++++++ pkgs/ok_http/example/pubspec.yaml | 97 ++++++++++++++++++ pkgs/ok_http/lib/ok_http.dart | 3 + pkgs/ok_http/pubspec.yaml | 24 +++++ 37 files changed, 763 insertions(+) create mode 100644 .github/workflows/okhttp.yaml create mode 100644 pkgs/ok_http/.gitignore create mode 100644 pkgs/ok_http/.metadata create mode 100644 pkgs/ok_http/CHANGELOG.md create mode 100644 pkgs/ok_http/LICENSE create mode 100644 pkgs/ok_http/README.md create mode 100644 pkgs/ok_http/analysis_options.yaml create mode 100644 pkgs/ok_http/android/.gitignore create mode 100644 pkgs/ok_http/android/build.gradle create mode 100644 pkgs/ok_http/android/settings.gradle create mode 100644 pkgs/ok_http/android/src/main/AndroidManifest.xml create mode 100644 pkgs/ok_http/example/.gitignore create mode 100644 pkgs/ok_http/example/README.md create mode 100644 pkgs/ok_http/example/analysis_options.yaml create mode 100644 pkgs/ok_http/example/android/.gitignore create mode 100644 pkgs/ok_http/example/android/app/build.gradle create mode 100644 pkgs/ok_http/example/android/app/src/debug/AndroidManifest.xml create mode 100644 pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml create mode 100644 pkgs/ok_http/example/android/app/src/main/kotlin/com/example/ok_http_example/MainActivity.kt create mode 100644 pkgs/ok_http/example/android/app/src/main/res/drawable-v21/launch_background.xml create mode 100644 pkgs/ok_http/example/android/app/src/main/res/drawable/launch_background.xml create mode 100644 pkgs/ok_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 pkgs/ok_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 pkgs/ok_http/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 pkgs/ok_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 pkgs/ok_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 pkgs/ok_http/example/android/app/src/main/res/values-night/styles.xml create mode 100644 pkgs/ok_http/example/android/app/src/main/res/values/styles.xml create mode 100644 pkgs/ok_http/example/android/app/src/profile/AndroidManifest.xml create mode 100644 pkgs/ok_http/example/android/build.gradle create mode 100644 pkgs/ok_http/example/android/gradle.properties create mode 100644 pkgs/ok_http/example/android/gradle/wrapper/gradle-wrapper.properties create mode 100644 pkgs/ok_http/example/android/settings.gradle create mode 100644 pkgs/ok_http/example/lib/main.dart create mode 100644 pkgs/ok_http/example/pubspec.yaml create mode 100644 pkgs/ok_http/lib/ok_http.dart create mode 100644 pkgs/ok_http/pubspec.yaml diff --git a/.github/workflows/okhttp.yaml b/.github/workflows/okhttp.yaml new file mode 100644 index 0000000000..9cf39b5538 --- /dev/null +++ b/.github/workflows/okhttp.yaml @@ -0,0 +1,47 @@ +name: package:ok_http CI + +on: + push: + branches: + - main + - master + paths: + - '.github/workflows/okhttp.yml' + - 'pkgs/ok_http/**' + - 'pkgs/http_client_conformance_tests/**' + pull_request: + paths: + - '.github/workflows/okhttp.yml' + - 'pkgs/ok_http/**' + - 'pkgs/http_client_conformance_tests/**' + schedule: + - cron: "0 0 * * 0" + +env: + PUB_ENVIRONMENT: bot.github + +jobs: + verify: + name: Format & Analyze & Test + runs-on: ubuntu-latest + defaults: + run: + working-directory: pkgs/ok_http + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 + with: + distribution: 'zulu' + java-version: '17' + - uses: subosito/flutter-action@2783a3f08e1baf891508463f8c6653c258246225 + with: + channel: 'stable' + - id: install + name: Install dependencies + run: flutter pub get + - name: Check formatting + if: always() && steps.install.outcome == 'success' + run: dart format --output=none --set-exit-if-changed . + - name: Analyze code + if: always() && steps.install.outcome == 'success' + run: flutter analyze --fatal-infos diff --git a/pkgs/ok_http/.gitignore b/pkgs/ok_http/.gitignore new file mode 100644 index 0000000000..ac5aa9893e --- /dev/null +++ b/pkgs/ok_http/.gitignore @@ -0,0 +1,29 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +build/ diff --git a/pkgs/ok_http/.metadata b/pkgs/ok_http/.metadata new file mode 100644 index 0000000000..f72bdaaaf8 --- /dev/null +++ b/pkgs/ok_http/.metadata @@ -0,0 +1,30 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "a14f74ff3a1cbd521163c5f03d68113d50af93d3" + channel: "stable" + +project_type: plugin_ffi + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + - platform: android + create_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + base_revision: a14f74ff3a1cbd521163c5f03d68113d50af93d3 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/pkgs/ok_http/CHANGELOG.md b/pkgs/ok_http/CHANGELOG.md new file mode 100644 index 0000000000..6073234226 --- /dev/null +++ b/pkgs/ok_http/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 + +* Initial release. diff --git a/pkgs/ok_http/LICENSE b/pkgs/ok_http/LICENSE new file mode 100644 index 0000000000..afd9a64bec --- /dev/null +++ b/pkgs/ok_http/LICENSE @@ -0,0 +1,27 @@ +Copyright 2014, the Dart project authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google LLC nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/pkgs/ok_http/README.md b/pkgs/ok_http/README.md new file mode 100644 index 0000000000..cca48a3079 --- /dev/null +++ b/pkgs/ok_http/README.md @@ -0,0 +1,22 @@ +[![pub package](https://img.shields.io/pub/v/cronet_http.svg)](https://pub.dev/packages/ok_http) +[![package publisher](https://img.shields.io/pub/publisher/ok_http.svg)](https://pub.dev/packages/ok_http/publisher) + +An Android Flutter plugin that provides access to the +[OkHttp][] HTTP client. + +## Status: experimental + +**NOTE**: This package is currently experimental and published under the +[labs.dart.dev](https://dart.dev/dart-team-packages) pub publisher in order to +solicit feedback. + +For packages in the labs.dart.dev publisher we generally plan to either graduate +the package into a supported publisher (dart.dev, tools.dart.dev) after a period +of feedback and iteration, or discontinue the package. These packages have a +much higher expected rate of API and breaking changes. + +Your feedback is valuable and will help us evolve this package. For general +feedback, suggestions, and comments, please file an issue in the +[bug tracker](https://github.com/dart-lang/http/issues). + +[OkHttp]: https://square.github.io/okhttp/ diff --git a/pkgs/ok_http/analysis_options.yaml b/pkgs/ok_http/analysis_options.yaml new file mode 100644 index 0000000000..f04c6cf0f3 --- /dev/null +++ b/pkgs/ok_http/analysis_options.yaml @@ -0,0 +1 @@ +include: ../../analysis_options.yaml diff --git a/pkgs/ok_http/android/.gitignore b/pkgs/ok_http/android/.gitignore new file mode 100644 index 0000000000..161bdcdaf8 --- /dev/null +++ b/pkgs/ok_http/android/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.cxx diff --git a/pkgs/ok_http/android/build.gradle b/pkgs/ok_http/android/build.gradle new file mode 100644 index 0000000000..53858758ae --- /dev/null +++ b/pkgs/ok_http/android/build.gradle @@ -0,0 +1,65 @@ +// The Android Gradle Plugin builds the native code with the Android NDK. + +group = "com.example.ok_http" +version = "1.0" + +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + // The Android Gradle Plugin knows how to build native code with the NDK. + classpath("com.android.tools.build:gradle:7.3.0") + } +} + +rootProject.allprojects { + repositories { + google() + mavenCentral() + } +} + +apply plugin: "com.android.library" + +android { + if (project.android.hasProperty("namespace")) { + namespace = "com.example.ok_http" + } + + // Bumping the plugin compileSdk version requires all clients of this plugin + // to bump the version in their app. + compileSdk = 34 + + // Use the NDK version + // declared in /android/app/build.gradle file of the Flutter project. + // Replace it with a version number if this plugin requires a specific NDK version. + // (e.g. ndkVersion "23.1.7779620") + ndkVersion = android.ndkVersion + + // Invoke the shared CMake build with the Android Gradle Plugin. + externalNativeBuild { + cmake { + path = "../src/CMakeLists.txt" + + // The default CMake version for the Android Gradle Plugin is 3.10.2. + // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake + // + // The Flutter tooling requires that developers have CMake 3.10 or later + // installed. You should not increase this version, as doing so will cause + // the plugin to fail to compile for some customers of the plugin. + // version "3.10.2" + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + defaultConfig { + minSdk = 21 + } +} diff --git a/pkgs/ok_http/android/settings.gradle b/pkgs/ok_http/android/settings.gradle new file mode 100644 index 0000000000..64c0d94b15 --- /dev/null +++ b/pkgs/ok_http/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'ok_http' diff --git a/pkgs/ok_http/android/src/main/AndroidManifest.xml b/pkgs/ok_http/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..c4b185786e --- /dev/null +++ b/pkgs/ok_http/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/pkgs/ok_http/example/.gitignore b/pkgs/ok_http/example/.gitignore new file mode 100644 index 0000000000..29a3a5017f --- /dev/null +++ b/pkgs/ok_http/example/.gitignore @@ -0,0 +1,43 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/pkgs/ok_http/example/README.md b/pkgs/ok_http/example/README.md new file mode 100644 index 0000000000..44f9e18b82 --- /dev/null +++ b/pkgs/ok_http/example/README.md @@ -0,0 +1,16 @@ +# ok_http_example + +Demonstrates how to use the ok_http plugin. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/pkgs/ok_http/example/analysis_options.yaml b/pkgs/ok_http/example/analysis_options.yaml new file mode 100644 index 0000000000..0d2902135c --- /dev/null +++ b/pkgs/ok_http/example/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/pkgs/ok_http/example/android/.gitignore b/pkgs/ok_http/example/android/.gitignore new file mode 100644 index 0000000000..6f568019d3 --- /dev/null +++ b/pkgs/ok_http/example/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties +**/*.keystore +**/*.jks diff --git a/pkgs/ok_http/example/android/app/build.gradle b/pkgs/ok_http/example/android/app/build.gradle new file mode 100644 index 0000000000..77ac8ef7fd --- /dev/null +++ b/pkgs/ok_http/example/android/app/build.gradle @@ -0,0 +1,58 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + +def localProperties = new Properties() +def localPropertiesFile = rootProject.file("local.properties") +if (localPropertiesFile.exists()) { + localPropertiesFile.withReader("UTF-8") { reader -> + localProperties.load(reader) + } +} + +def flutterVersionCode = localProperties.getProperty("flutter.versionCode") +if (flutterVersionCode == null) { + flutterVersionCode = "1" +} + +def flutterVersionName = localProperties.getProperty("flutter.versionName") +if (flutterVersionName == null) { + flutterVersionName = "1.0" +} + +android { + namespace = "com.example.ok_http_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.ok_http_example" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.debug + } + } +} + +flutter { + source = "../.." +} diff --git a/pkgs/ok_http/example/android/app/src/debug/AndroidManifest.xml b/pkgs/ok_http/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000000..399f6981d5 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml b/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..800e9dfaed --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/kotlin/com/example/ok_http_example/MainActivity.kt b/pkgs/ok_http/example/android/app/src/main/kotlin/com/example/ok_http_example/MainActivity.kt new file mode 100644 index 0000000000..7b47f2822b --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/kotlin/com/example/ok_http_example/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.ok_http_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/pkgs/ok_http/example/android/app/src/main/res/drawable-v21/launch_background.xml b/pkgs/ok_http/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000000..f74085f3f6 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/res/drawable/launch_background.xml b/pkgs/ok_http/example/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000000..304732f884 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..db77bb4b7b0906d62b1847e87f15cdcacf6a4f29 GIT binary patch literal 544 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY3?!3`olAj~WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!h8bpbvhu0Wd6uZuB!w&u2PAxD2eNXD>P5D~Wn-+_Wa#27Xc zC?Zj|6r#X(-D3u$NCt}(Ms06KgJ4FxJVv{GM)!I~&n8Bnc94O7-Hd)cjDZswgC;Qs zO=b+9!WcT8F?0rF7!Uys2bs@gozCP?z~o%U|N3vA*22NaGQG zlg@K`O_XuxvZ&Ks^m&R!`&1=spLvfx7oGDKDwpwW`#iqdw@AL`7MR}m`rwr|mZgU`8P7SBkL78fFf!WnuYWm$5Z0 zNXhDbCv&49sM544K|?c)WrFfiZvCi9h0O)B3Pgg&ebxsLQ05GG~ AQ2+n{ literal 0 HcmV?d00001 diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..17987b79bb8a35cc66c3c1fd44f5a5526c1b78be GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xx&nMcT!A!W`0S9QKQy;}1Cl^CgaH=;G9cpY;r$Q>i*pfB zP2drbID<_#qf;rPZx^FqH)F_D#*k@@q03KywUtLX8Ua?`H+NMzkczFPK3lFz@i_kW%1NOn0|D2I9n9wzH8m|-tHjsw|9>@K=iMBhxvkv6m8Y-l zytQ?X=U+MF$@3 zt`~i=@j|6y)RWMK--}M|=T`o&^Ni>IoWKHEbBXz7?A@mgWoL>!*SXo`SZH-*HSdS+ yn*9;$7;m`l>wYBC5bq;=U}IMqLzqbYCidGC!)_gkIk_C@Uy!y&wkt5C($~2D>~)O*cj@FGjOCM)M>_ixfudOh)?xMu#Fs z#}Y=@YDTwOM)x{K_j*Q;dPdJ?Mz0n|pLRx{4n|)f>SXlmV)XB04CrSJn#dS5nK2lM zrZ9#~WelCp7&e13Y$jvaEXHskn$2V!!DN-nWS__6T*l;H&Fopn?A6HZ-6WRLFP=R` zqG+CE#d4|IbyAI+rJJ`&x9*T`+a=p|0O(+s{UBcyZdkhj=yS1>AirP+0R;mf2uMgM zC}@~JfByORAh4SyRgi&!(cja>F(l*O+nd+@4m$|6K6KDn_&uvCpV23&>G9HJp{xgg zoq1^2_p9@|WEo z*X_Uko@K)qYYv~>43eQGMdbiGbo>E~Q& zrYBH{QP^@Sti!`2)uG{irBBq@y*$B zi#&(U-*=fp74j)RyIw49+0MRPMRU)+a2r*PJ$L5roHt2$UjExCTZSbq%V!HeS7J$N zdG@vOZB4v_lF7Plrx+hxo7(fCV&}fHq)$ literal 0 HcmV?d00001 diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..d5f1c8d34e7a88e3f88bea192c3a370d44689c3c GIT binary patch literal 1031 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=BuiW)N`mv#O3D+9QW+dm@{>{( zJaZG%Q-e|yQz{EjrrIztFa`(sgt!6~Yi|1%a`XoT0ojZ}lNrNjb9xjc(B0U1_% zz5^97Xt*%oq$rQy4?0GKNfJ44uvxI)gC`h-NZ|&0-7(qS@?b!5r36oQ}zyZrNO3 zMO=Or+<~>+A&uN&E!^Sl+>xE!QC-|oJv`ApDhqC^EWD|@=#J`=d#Xzxs4ah}w&Jnc z$|q_opQ^2TrnVZ0o~wh<3t%W&flvYGe#$xqda2bR_R zvPYgMcHgjZ5nSA^lJr%;<&0do;O^tDDh~=pIxA#coaCY>&N%M2^tq^U%3DB@ynvKo}b?yu-bFc-u0JHzced$sg7S3zqI(2 z#Km{dPr7I=pQ5>FuK#)QwK?Y`E`B?nP+}U)I#c1+FM*1kNvWG|a(TpksZQ3B@sD~b zpQ2)*V*TdwjFOtHvV|;OsiDqHi=6%)o4b!)x$)%9pGTsE z-JL={-Ffv+T87W(Xpooq<`r*VzWQcgBN$$`u}f>-ZQI1BB8ykN*=e4rIsJx9>z}*o zo~|9I;xof literal 0 HcmV?d00001 diff --git a/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/pkgs/ok_http/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6372eebdb28e45604e46eeda8dd24651419bc0 GIT binary patch literal 1443 zcmb`G{WsKk6vsdJTdFg%tJav9_E4vzrOaqkWF|A724Nly!y+?N9`YV6wZ}5(X(D_N(?!*n3`|_r0Hc?=PQw&*vnU?QTFY zB_MsH|!j$PP;I}?dppoE_gA(4uc!jV&0!l7_;&p2^pxNo>PEcNJv za5_RT$o2Mf!<+r?&EbHH6nMoTsDOa;mN(wv8RNsHpG)`^ymG-S5By8=l9iVXzN_eG%Xg2@Xeq76tTZ*dGh~Lo9vl;Zfs+W#BydUw zCkZ$o1LqWQO$FC9aKlLl*7x9^0q%0}$OMlp@Kk_jHXOjofdePND+j!A{q!8~Jn+s3 z?~~w@4?egS02}8NuulUA=L~QQfm;MzCGd)XhiftT;+zFO&JVyp2mBww?;QByS_1w! zrQlx%{^cMj0|Bo1FjwY@Q8?Hx0cIPF*@-ZRFpPc#bBw{5@tD(5%sClzIfl8WU~V#u zm5Q;_F!wa$BSpqhN>W@2De?TKWR*!ujY;Yylk_X5#~V!L*Gw~;$%4Q8~Mad z@`-kG?yb$a9cHIApZDVZ^U6Xkp<*4rU82O7%}0jjHlK{id@?-wpN*fCHXyXh(bLt* zPc}H-x0e4E&nQ>y%B-(EL=9}RyC%MyX=upHuFhAk&MLbsF0LP-q`XnH78@fT+pKPW zu72MW`|?8ht^tz$iC}ZwLp4tB;Q49K!QCF3@!iB1qOI=?w z7In!}F~ij(18UYUjnbmC!qKhPo%24?8U1x{7o(+?^Zu0Hx81|FuS?bJ0jgBhEMzf< zCgUq7r2OCB(`XkKcN-TL>u5y#dD6D!)5W?`O5)V^>jb)P)GBdy%t$uUMpf$SNV31$ zb||OojAbvMP?T@$h_ZiFLFVHDmbyMhJF|-_)HX3%m=CDI+ID$0^C>kzxprBW)hw(v zr!Gmda);ICoQyhV_oP5+C%?jcG8v+D@9f?Dk*!BxY}dazmrT@64UrP3hlslANK)bq z$67n83eh}OeW&SV@HG95P|bjfqJ7gw$e+`Hxo!4cx`jdK1bJ>YDSpGKLPZ^1cv$ek zIB?0S<#tX?SJCLWdMd{-ME?$hc7A$zBOdIJ)4!KcAwb=VMov)nK;9z>x~rfT1>dS+ zZ6#`2v@`jgbqq)P22H)Tx2CpmM^o1$B+xT6`(v%5xJ(?j#>Q$+rx_R|7TzDZe{J6q zG1*EcU%tE?!kO%^M;3aM6JN*LAKUVb^xz8-Pxo#jR5(-KBeLJvA@-gxNHx0M-ZJLl z;#JwQoh~9V?`UVo#}{6ka@II>++D@%KqGpMdlQ}?9E*wFcf5(#XQnP$Dk5~%iX^>f z%$y;?M0BLp{O3a(-4A?ewryHrrD%cx#Q^%KY1H zNre$ve+vceSLZcNY4U(RBX&)oZn*Py()h)XkE?PL$!bNb{N5FVI2Y%LKEm%yvpyTP z(1P?z~7YxD~Rf<(a@_y` literal 0 HcmV?d00001 diff --git a/pkgs/ok_http/example/android/app/src/main/res/values-night/styles.xml b/pkgs/ok_http/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000000..06952be745 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/main/res/values/styles.xml b/pkgs/ok_http/example/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000000..cb1ef88056 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/pkgs/ok_http/example/android/app/src/profile/AndroidManifest.xml b/pkgs/ok_http/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000000..399f6981d5 --- /dev/null +++ b/pkgs/ok_http/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/pkgs/ok_http/example/android/build.gradle b/pkgs/ok_http/example/android/build.gradle new file mode 100644 index 0000000000..d2ffbffa4c --- /dev/null +++ b/pkgs/ok_http/example/android/build.gradle @@ -0,0 +1,18 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = "../build" +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/pkgs/ok_http/example/android/gradle.properties b/pkgs/ok_http/example/android/gradle.properties new file mode 100644 index 0000000000..3b5b324f6e --- /dev/null +++ b/pkgs/ok_http/example/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/pkgs/ok_http/example/android/gradle/wrapper/gradle-wrapper.properties b/pkgs/ok_http/example/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..e1ca574ef0 --- /dev/null +++ b/pkgs/ok_http/example/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/pkgs/ok_http/example/android/settings.gradle b/pkgs/ok_http/example/android/settings.gradle new file mode 100644 index 0000000000..536165d35a --- /dev/null +++ b/pkgs/ok_http/example/android/settings.gradle @@ -0,0 +1,25 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false +} + +include ":app" diff --git a/pkgs/ok_http/example/lib/main.dart b/pkgs/ok_http/example/lib/main.dart new file mode 100644 index 0000000000..772d29afd0 --- /dev/null +++ b/pkgs/ok_http/example/lib/main.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; +import 'dart:async'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatefulWidget { + const MyApp({super.key}); + + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + late int sumResult; + late Future sumAsyncResult; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + const textStyle = TextStyle(fontSize: 25); + const spacerSmall = SizedBox(height: 10); + return MaterialApp( + home: Scaffold( + appBar: AppBar( + title: const Text('Native Packages'), + ), + body: SingleChildScrollView( + child: Container( + padding: const EdgeInsets.all(10), + child: Column( + children: [ + const Text( + '', + style: textStyle, + textAlign: TextAlign.center, + ), + spacerSmall, + Text( + 'sum(1, 2) = $sumResult', + style: textStyle, + textAlign: TextAlign.center, + ), + spacerSmall, + FutureBuilder( + future: sumAsyncResult, + builder: (BuildContext context, AsyncSnapshot value) { + final displayValue = + (value.hasData) ? value.data : 'loading'; + return Text( + 'await sumAsync(3, 4) = $displayValue', + style: textStyle, + textAlign: TextAlign.center, + ); + }, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/pkgs/ok_http/example/pubspec.yaml b/pkgs/ok_http/example/pubspec.yaml new file mode 100644 index 0000000000..3cf6fc86a8 --- /dev/null +++ b/pkgs/ok_http/example/pubspec.yaml @@ -0,0 +1,97 @@ +name: ok_http_example +description: "Demonstrates how to use the ok_http plugin." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: '>=3.4.1 <4.0.0' + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + ok_http: + # When depending on this package from a real application you should use: + # ok_http: ^x.y.z + # See https://dart.dev/tools/pub/dependencies#version-constraints + # The example app is bundled with the plugin so we use a path dependency on + # the parent directory to use the current plugin's version. + path: ../ + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.6 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^3.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/pkgs/ok_http/lib/ok_http.dart b/pkgs/ok_http/lib/ok_http.dart new file mode 100644 index 0000000000..4b81882abc --- /dev/null +++ b/pkgs/ok_http/lib/ok_http.dart @@ -0,0 +1,3 @@ +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. diff --git a/pkgs/ok_http/pubspec.yaml b/pkgs/ok_http/pubspec.yaml new file mode 100644 index 0000000000..aed4393a8e --- /dev/null +++ b/pkgs/ok_http/pubspec.yaml @@ -0,0 +1,24 @@ +name: ok_http +version: 0.1.0 +description: >- + An Android Flutter plugin that provides access to the OkHttp HTTP client. +repository: https://github.com/dart-lang/http/tree/master/pkgs/ok_http +publish_to: none + +environment: + sdk: ^3.4.0 + flutter: '>=3.22.0' + +dependencies: + flutter: + sdk: flutter + plugin_platform_interface: ^2.0.2 + +dev_dependencies: + dart_flutter_team_lints: ^2.0.0 + +flutter: + plugin: + platforms: + android: + ffiPlugin: true \ No newline at end of file From c87f6a9e3e44eb0517154b8c110d49c34b97c6f2 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Tue, 28 May 2024 13:04:26 -0700 Subject: [PATCH 2/4] Update pkgs/ok_http/pubspec.yaml Co-authored-by: Nate Bosch --- pkgs/ok_http/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/ok_http/pubspec.yaml b/pkgs/ok_http/pubspec.yaml index aed4393a8e..37a9100463 100644 --- a/pkgs/ok_http/pubspec.yaml +++ b/pkgs/ok_http/pubspec.yaml @@ -1,5 +1,5 @@ name: ok_http -version: 0.1.0 +version: 0.1.0-wip description: >- An Android Flutter plugin that provides access to the OkHttp HTTP client. repository: https://github.com/dart-lang/http/tree/master/pkgs/ok_http From b755693959673e623f97b48cde1eb490a7a32912 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Tue, 28 May 2024 13:04:32 -0700 Subject: [PATCH 3/4] Update pkgs/ok_http/CHANGELOG.md Co-authored-by: Nate Bosch --- pkgs/ok_http/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/ok_http/CHANGELOG.md b/pkgs/ok_http/CHANGELOG.md index 6073234226..0cbc61001a 100644 --- a/pkgs/ok_http/CHANGELOG.md +++ b/pkgs/ok_http/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.1.0 +## 0.1.0-wip * Initial release. From 1e3e4de3e8bf230dd84e8c2f8e7374b6107a1ab8 Mon Sep 17 00:00:00 2001 From: Brian Quinlan Date: Tue, 28 May 2024 13:06:07 -0700 Subject: [PATCH 4/4] Newline --- pkgs/ok_http/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/ok_http/pubspec.yaml b/pkgs/ok_http/pubspec.yaml index 37a9100463..2a7a21fc28 100644 --- a/pkgs/ok_http/pubspec.yaml +++ b/pkgs/ok_http/pubspec.yaml @@ -21,4 +21,4 @@ flutter: plugin: platforms: android: - ffiPlugin: true \ No newline at end of file + ffiPlugin: true