diff --git a/.github/workflows/example-docker.yml b/.github/workflows/example-docker.yml index 5f5624b..712863d 100644 --- a/.github/workflows/example-docker.yml +++ b/.github/workflows/example-docker.yml @@ -10,15 +10,15 @@ jobs: web: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.CR_PAT }} - - uses: docker/build-push-action@v2 + - uses: docker/build-push-action@v6 with: context: . file: ./example/Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8185064..bbdb906 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: scottbrenner/generate-changelog-action@master diff --git a/.github/workflows/tests_android.yml b/.github/workflows/tests_android.yml index 916b3ee..2fbdcb5 100644 --- a/.github/workflows/tests_android.yml +++ b/.github/workflows/tests_android.yml @@ -11,12 +11,12 @@ jobs: e2e: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' - - uses: android-actions/setup-android@v2 + - uses: android-actions/setup-android@v3 - uses: subosito/flutter-action@main with: flutter-version: '3.x' diff --git a/.github/workflows/tests_browser.yml b/.github/workflows/tests_browser.yml index 55c65dd..ca2d6a2 100644 --- a/.github/workflows/tests_browser.yml +++ b/.github/workflows/tests_browser.yml @@ -12,7 +12,7 @@ jobs: e2e: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: subosito/flutter-action@main with: flutter-version: '3.x' diff --git a/.github/workflows/tests_ios.yml b/.github/workflows/tests_ios.yml index 61ec319..9bc1045 100644 --- a/.github/workflows/tests_ios.yml +++ b/.github/workflows/tests_ios.yml @@ -14,7 +14,7 @@ jobs: - uses: futureware-tech/simulator-action@v1 with: os: iOS - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: subosito/flutter-action@main with: flutter-version: '3.x' diff --git a/.github/workflows/tests_linux.yml b/.github/workflows/tests_linux.yml index a1f4cda..5c047cf 100644 --- a/.github/workflows/tests_linux.yml +++ b/.github/workflows/tests_linux.yml @@ -11,7 +11,7 @@ jobs: e2e: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: subosito/flutter-action@main with: flutter-version: '3.x' @@ -23,4 +23,4 @@ jobs: flutter pub get - run: sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & - run: "cd example && DISPLAY=:99 flutter test -d linux integration_test/app_test.dart" - - run: "cd example && flutter test test/app_test.dart" + - run: "cd example && flutter test test/app_test.dart" \ No newline at end of file diff --git a/.github/workflows/tests_macos.yml b/.github/workflows/tests_macos.yml index fbbc3a0..34a9a76 100644 --- a/.github/workflows/tests_macos.yml +++ b/.github/workflows/tests_macos.yml @@ -11,7 +11,7 @@ jobs: e2e: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: subosito/flutter-action@main with: flutter-version: '3.x' diff --git a/.github/workflows/tests_windows.yml b/.github/workflows/tests_windows.yml index 263fa2f..2473546 100644 --- a/.github/workflows/tests_windows.yml +++ b/.github/workflows/tests_windows.yml @@ -11,7 +11,7 @@ jobs: e2e: runs-on: windows-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: subosito/flutter-action@main with: flutter-version: '3.x' diff --git a/CHANGELOG.md b/CHANGELOG.md index 3790f30..4102037 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.9.0 +- Updates binaries +- Add XCFramework for ios + ## 3.8.3 - Migrate to package:web diff --git a/Makefile b/Makefile index 133400c..3363b3c 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,10 @@ default: test test: cd example && flutter test integration_test/app_test.dart +fmt: + dart format . && dart fix --apply + cd example && dart format . && dart fix --apply + upgrade: upgrade-libs upgrade-flatbuffers upgrade-libs: @@ -12,4 +16,4 @@ upgrade-flatbuffers: ./scripts/upgrade_bridge_flatbuffers.sh example-web: - docker build -t flutter-openpgp-web -f example/Dockerfile . + docker build -t flutter-openpgp-web -f example/Dockerfile . \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml index 5879e0c..f40a850 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,3 +1,5 @@ +include: package:flutter_lints/flutter.yaml + analyzer: exclude: - example/** diff --git a/android/.gitignore b/android/.gitignore old mode 100755 new mode 100644 index c6cbe56..161bdcd --- a/android/.gitignore +++ b/android/.gitignore @@ -6,3 +6,4 @@ .DS_Store /build /captures +.cxx diff --git a/android/build.gradle b/android/build.gradle old mode 100755 new mode 100644 index e5d5592..b22b6fd --- a/android/build.gradle +++ b/android/build.gradle @@ -1,54 +1,73 @@ -group 'dev.jerson.openpgp' -version '1.0' +group = "dev.jerson.openpgp" +version = "1.0-SNAPSHOT" buildscript { + ext.kotlin_version = "1.8.22" repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.0' + classpath("com.android.tools.build:gradle:8.1.0") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") } } -rootProject.allprojects { +allprojects { repositories { google() mavenCentral() } } -apply plugin: 'com.android.library' +apply plugin: "com.android.library" +apply plugin: "kotlin-android" android { - // Conditional for compatibility with AGP <4.2. if (project.android.hasProperty("namespace")) { - namespace 'dev.jerson.openpgp' + namespace = "dev.jerson.openpgp" + } + + compileSdk = 34 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 } - compileSdkVersion 31 + sourceSets { + main { + java.srcDirs += "src/main/kotlin" + jniLibs.srcDirs = ['src/main/jniLibs'] + } + test { + java.srcDirs += "src/test/kotlin" + } + } defaultConfig { - minSdkVersion 19 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - lintOptions { - disable 'InvalidPackage' + minSdk = 21 } -} -task nativeLibsToJar(type: Jar, description: 'create a jar archive of the native libs') { - destinationDirectory.set(file("$buildDir/native-libs")) - archiveBaseName = 'native-libs' - from fileTree(dir: 'libs', include: '**/*.so') - into 'lib/' -} + dependencies { + testImplementation("org.jetbrains.kotlin:kotlin-test") + testImplementation("org.mockito:mockito-core:5.0.0") + } -tasks.withType(JavaCompile) { - compileTask -> compileTask.dependsOn(nativeLibsToJar) -} + testOptions { + unitTests.all { + useJUnitPlatform() -dependencies { - api fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar') + testLogging { + events "passed", "skipped", "failed", "standardOut", "standardError" + outputs.upToDateWhen {false} + showStandardStreams = true + } + } + } } diff --git a/android/gradle.properties b/android/gradle.properties deleted file mode 100755 index 38c8d45..0000000 --- a/android/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.enableR8=true -android.useAndroidX=true -android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100755 index 5699c42..0000000 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip diff --git a/android/settings.gradle b/android/settings.gradle old mode 100755 new mode 100644 diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml old mode 100755 new mode 100644 diff --git a/android/src/main/java/dev/jerson/openpgp/OpenpgpPlugin.java b/android/src/main/java/dev/jerson/openpgp/OpenpgpPlugin.java deleted file mode 100755 index ade7a62..0000000 --- a/android/src/main/java/dev/jerson/openpgp/OpenpgpPlugin.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.jerson.openpgp; - -import androidx.annotation.NonNull; - -import io.flutter.embedding.engine.plugins.FlutterPlugin; -import io.flutter.plugin.common.MethodCall; -import io.flutter.plugin.common.MethodChannel; -import io.flutter.plugin.common.MethodChannel.MethodCallHandler; -import io.flutter.plugin.common.MethodChannel.Result; - -/** - * OpenpgpPlugin - */ -public class OpenpgpPlugin implements FlutterPlugin, MethodCallHandler { - /// The MethodChannel that will the communication between Flutter and native Android - /// - /// This local reference serves to register the plugin with the Flutter Engine and unregister it - /// when the Flutter Engine is detached from the Activity - private MethodChannel channel; - - @Override - public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) { - channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "openpgp"); - channel.setMethodCallHandler(this); - } - - @Override - public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) { - result.notImplemented(); - } - - @Override - public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { - channel.setMethodCallHandler(null); - } -} \ No newline at end of file diff --git a/android/src/main/jniLibs/arm64-v8a/libopenpgp_bridge.so b/android/src/main/jniLibs/arm64-v8a/libopenpgp_bridge.so index 3c6fa19..f7f3c27 100644 Binary files a/android/src/main/jniLibs/arm64-v8a/libopenpgp_bridge.so and b/android/src/main/jniLibs/arm64-v8a/libopenpgp_bridge.so differ diff --git a/android/src/main/jniLibs/armeabi-v7a/libopenpgp_bridge.so b/android/src/main/jniLibs/armeabi-v7a/libopenpgp_bridge.so index f346b2f..538d637 100644 Binary files a/android/src/main/jniLibs/armeabi-v7a/libopenpgp_bridge.so and b/android/src/main/jniLibs/armeabi-v7a/libopenpgp_bridge.so differ diff --git a/android/src/main/jniLibs/x86/libopenpgp_bridge.so b/android/src/main/jniLibs/x86/libopenpgp_bridge.so index dc9fbfd..927f708 100644 Binary files a/android/src/main/jniLibs/x86/libopenpgp_bridge.so and b/android/src/main/jniLibs/x86/libopenpgp_bridge.so differ diff --git a/android/src/main/jniLibs/x86_64/libopenpgp_bridge.so b/android/src/main/jniLibs/x86_64/libopenpgp_bridge.so index ab1be5c..bf6b1c3 100644 Binary files a/android/src/main/jniLibs/x86_64/libopenpgp_bridge.so and b/android/src/main/jniLibs/x86_64/libopenpgp_bridge.so differ diff --git a/android/src/main/kotlin/dev/jerson/openpgp/OpenpgpPlugin.kt b/android/src/main/kotlin/dev/jerson/openpgp/OpenpgpPlugin.kt new file mode 100644 index 0000000..8074336 --- /dev/null +++ b/android/src/main/kotlin/dev/jerson/openpgp/OpenpgpPlugin.kt @@ -0,0 +1,35 @@ +package dev.jerson.openpgp + +import androidx.annotation.NonNull + +import io.flutter.embedding.engine.plugins.FlutterPlugin +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugin.common.MethodChannel.MethodCallHandler +import io.flutter.plugin.common.MethodChannel.Result + +/** OpenpgpPlugin */ +class OpenpgpPlugin: FlutterPlugin, MethodCallHandler { + /// The MethodChannel that will the communication between Flutter and native Android + /// + /// This local reference serves to register the plugin with the Flutter Engine and unregister it + /// when the Flutter Engine is detached from the Activity + private lateinit var channel : MethodChannel + + override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { + channel = MethodChannel(flutterPluginBinding.binaryMessenger, "openpgp") + channel.setMethodCallHandler(this) + } + + override fun onMethodCall(call: MethodCall, result: Result) { + if (call.method == "getPlatformVersion") { + result.success("Android ${android.os.Build.VERSION.RELEASE}") + } else { + result.notImplemented() + } + } + + override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { + channel.setMethodCallHandler(null) + } +} diff --git a/example/android/.gitignore b/example/android/.gitignore index 6f56801..55afd91 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -7,7 +7,7 @@ gradle-wrapper.jar GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties **/*.keystore **/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 118ee1d..fe3cf37 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,67 +1,44 @@ 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.example" - compileSdkVersion flutter.compileSdkVersion - ndkVersion flutter.ndkVersion + namespace = "dev.jerson.openpgp_example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + jvmTarget = JavaVersion.VERSION_1_8 } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.example" + applicationId = "dev.jerson.openpgp_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. - minSdkVersion flutter.minSdkVersion - targetSdkVersion flutter.targetSdkVersion - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName } 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 + signingConfig = signingConfigs.debug } } } flutter { - source '../..' + source = "../.." } - -dependencies {} diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 19b862e..fa09cdc 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,12 +1,13 @@ + + + + + + + diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt deleted file mode 100644 index e793a00..0000000 --- a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.example.example - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/example/android/app/src/main/kotlin/dev/jerson/openpgp_example/MainActivity.kt b/example/android/app/src/main/kotlin/dev/jerson/openpgp_example/MainActivity.kt new file mode 100644 index 0000000..5dedc97 --- /dev/null +++ b/example/android/app/src/main/kotlin/dev/jerson/openpgp_example/MainActivity.kt @@ -0,0 +1,5 @@ +package dev.jerson.openpgp_example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/example/android/build.gradle b/example/android/build.gradle index f7eb7f6..d2ffbff 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.3.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() @@ -18,12 +5,12 @@ allprojects { } } -rootProject.buildDir = '../build' +rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { - project.evaluationDependsOn(':app') + project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 94adc3a..2597170 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 3c472b9..7bb2df6 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/example/android/settings.gradle b/example/android/settings.gradle index 55c4ca8..b9e43bd 100644 --- a/example/android/settings.gradle +++ b/example/android/settings.gradle @@ -5,16 +5,21 @@ pluginManagement { def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath - } - settings.ext.flutterSdkPath = flutterSdkPath() + }() - includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - plugins { - id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false + repositories { + google() + mavenCentral() + gradlePluginPortal() } } -include ":app" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.0" apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false +} -apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" +include ":app" diff --git a/example/fonts/Roboto/LICENSE.txt b/example/fonts/Roboto/LICENSE.txt deleted file mode 100755 index d645695..0000000 --- a/example/fonts/Roboto/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/example/fonts/Roboto/Roboto-Black.ttf b/example/fonts/Roboto/Roboto-Black.ttf deleted file mode 100755 index 689fe5c..0000000 Binary files a/example/fonts/Roboto/Roboto-Black.ttf and /dev/null differ diff --git a/example/fonts/Roboto/Roboto-Bold.ttf b/example/fonts/Roboto/Roboto-Bold.ttf deleted file mode 100755 index d3f01ad..0000000 Binary files a/example/fonts/Roboto/Roboto-Bold.ttf and /dev/null differ diff --git a/example/fonts/Roboto/Roboto-Light.ttf b/example/fonts/Roboto/Roboto-Light.ttf deleted file mode 100755 index 219063a..0000000 Binary files a/example/fonts/Roboto/Roboto-Light.ttf and /dev/null differ diff --git a/example/fonts/Roboto/Roboto-Medium.ttf b/example/fonts/Roboto/Roboto-Medium.ttf deleted file mode 100755 index 1a7f3b0..0000000 Binary files a/example/fonts/Roboto/Roboto-Medium.ttf and /dev/null differ diff --git a/example/fonts/Roboto/Roboto-Regular.ttf b/example/fonts/Roboto/Roboto-Regular.ttf deleted file mode 100755 index 2c97eea..0000000 Binary files a/example/fonts/Roboto/Roboto-Regular.ttf and /dev/null differ diff --git a/example/fonts/Roboto/Roboto-Thin.ttf b/example/fonts/Roboto/Roboto-Thin.ttf deleted file mode 100755 index b74a4fd..0000000 Binary files a/example/fonts/Roboto/Roboto-Thin.ttf and /dev/null differ diff --git a/example/integration_test/app_test.dart b/example/integration_test/app_test.dart index 3916e84..5583fee 100644 --- a/example/integration_test/app_test.dart +++ b/example/integration_test/app_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/example/ios/.gitignore b/example/ios/.gitignore index 0f854a1..7a7f987 100644 --- a/example/ios/.gitignore +++ b/example/ios/.gitignore @@ -1,3 +1,4 @@ +**/dgph *.mode1v3 *.mode2v3 *.moved-aside @@ -18,6 +19,7 @@ Flutter/App.framework Flutter/Flutter.framework Flutter/Flutter.podspec Flutter/Generated.xcconfig +Flutter/ephemeral/ Flutter/app.flx Flutter/app.zip Flutter/flutter_assets/ @@ -30,4 +32,3 @@ Runner/GeneratedPluginRegistrant.* !default.mode2v3 !default.pbxuser !default.perspectivev3 -.last_build_id \ No newline at end of file diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 8c6e561..7c56964 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -3,7 +3,7 @@ CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) + en CFBundleExecutable App CFBundleIdentifier diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index b2f5fae..ec97fc6 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1,3 +1,2 @@ #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 88c2914..c4855bf 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1,3 +1,2 @@ #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Podfile b/example/ios/Podfile index 414ba51..d97f17e 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -28,7 +28,13 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe flutter_ios_podfile_setup target 'Runner' do + use_frameworks! + use_modular_headers! + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end end post_install do |installer| diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index dde8de1..686e84a 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -20,9 +20,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4 - openpgp: 8925c86ba4a2663e345e3e6e133d8c4e6f6754a3 + integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 + openpgp: ce9352861c10d155d698d2b3bf78f8b6e04fb43a -PODFILE CHECKSUM: 1a782344d33c12ced0182eeab11e8668d253eb48 +PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 -COCOAPODS: 1.14.3 +COCOAPODS: 1.16.2 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 4fb7fe4..2bdbb17 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -8,14 +8,26 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 224AC4E90EBB98F36C4B6F74 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D703D257F6C633227979CD64 /* libPods-Runner.a */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 6CAD7C6E237AA21DD943BF19 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B19B94CD59DACEBCA1814FA /* Pods_RunnerTests.framework */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + EE23BE48D54FAF9EDCCCF234 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47010D5010976A2A89BB99C1 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -30,15 +42,19 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 111AFE5D6CBBCD6285479291 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 2E5B434D74D82A7E8456183A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 47010D5010976A2A89BB99C1 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6B19B94CD59DACEBCA1814FA /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 84569860251EF230008F865E /* libopenpgp_bridge.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libopenpgp_bridge.a; path = ../../ios/libopenpgp_bridge.a; sourceTree = ""; }; - 84569864251EFC3B008F865E /* libopenpgp_bridge.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libopenpgp_bridge.a; path = ../../ios/Libraries/libopenpgp_bridge.a; sourceTree = ""; }; - 8FC23C67F68E45A85F8937CC /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 94F4809D90F43C780487AB44 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -46,9 +62,9 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - D2D671EF95449FE1325023D6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - D703D257F6C633227979CD64 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - EE0EE6524FEF177972F9B07E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + A0CE472C2D720F3ED64FE7FD /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + AADB6564C7A3B79ADC53A7BA /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + D1E136AE4AC4E44CF41C286C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,13 +72,52 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 224AC4E90EBB98F36C4B6F74 /* libPods-Runner.a in Frameworks */, + EE23BE48D54FAF9EDCCCF234 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B11AF202CB1370278EF374F1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 6CAD7C6E237AA21DD943BF19 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1E3C5E0CB916B4ADED380EB0 /* Pods */ = { + isa = PBXGroup; + children = ( + AADB6564C7A3B79ADC53A7BA /* Pods-Runner.debug.xcconfig */, + 2E5B434D74D82A7E8456183A /* Pods-Runner.release.xcconfig */, + 111AFE5D6CBBCD6285479291 /* Pods-Runner.profile.xcconfig */, + 94F4809D90F43C780487AB44 /* Pods-RunnerTests.debug.xcconfig */, + D1E136AE4AC4E44CF41C286C /* Pods-RunnerTests.release.xcconfig */, + A0CE472C2D720F3ED64FE7FD /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 8415340A9FA87ED257F83607 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 47010D5010976A2A89BB99C1 /* Pods_Runner.framework */, + 6B19B94CD59DACEBCA1814FA /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -80,8 +135,9 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - AFAD6D7E9CBB537063D23E92 /* Pods */, - BC1BD9616282E8E2323DBFD0 /* Frameworks */, + 331C8082294A63A400263BE5 /* RunnerTests */, + 1E3C5E0CB916B4ADED380EB0 /* Pods */, + 8415340A9FA87ED257F83607 /* Frameworks */, ); sourceTree = ""; }; @@ -89,6 +145,7 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, ); name = Products; sourceTree = ""; @@ -108,40 +165,40 @@ path = Runner; sourceTree = ""; }; - AFAD6D7E9CBB537063D23E92 /* Pods */ = { - isa = PBXGroup; - children = ( - 8FC23C67F68E45A85F8937CC /* Pods-Runner.debug.xcconfig */, - EE0EE6524FEF177972F9B07E /* Pods-Runner.release.xcconfig */, - D2D671EF95449FE1325023D6 /* Pods-Runner.profile.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; - BC1BD9616282E8E2323DBFD0 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 84569860251EF230008F865E /* libopenpgp_bridge.a */, - 84569864251EFC3B008F865E /* libopenpgp_bridge.a */, - D703D257F6C633227979CD64 /* libPods-Runner.a */, - ); - name = Frameworks; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 744DD5B306146EDCFCA606DD /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + B11AF202CB1370278EF374F1 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 5A91633C8F73FD868CC4597D /* [CP] Check Pods Manifest.lock */, + B41AA2756943C3368E663739 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 6664A8B132362F3E30904596 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -158,9 +215,14 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; LastSwiftMigration = 1100; @@ -181,11 +243,19 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EC1CF9000F007C117D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -216,7 +286,24 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 5A91633C8F73FD868CC4597D /* [CP] Check Pods Manifest.lock */ = { + 6664A8B132362F3E30904596 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 744DD5B306146EDCFCA606DD /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -231,7 +318,7 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -253,9 +340,39 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + B41AA2756943C3368E663739 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -267,6 +384,14 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -291,6 +416,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -320,6 +446,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -346,19 +473,11 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = EKR687JWFU; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -367,10 +486,61 @@ }; name = Profile; }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 94F4809D90F43C780487AB44 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D1E136AE4AC4E44CF41C286C /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = A0CE472C2D720F3ED64FE7FD /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -400,6 +570,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -426,6 +597,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -455,6 +627,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -483,19 +656,11 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = EKR687JWFU; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -514,19 +679,11 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; DEVELOPMENT_TEAM = EKR687JWFU; ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -538,6 +695,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index e67b280..8e3ca5d 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -27,8 +27,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + + + + + + - - CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Openpgp CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -39,8 +41,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIViewControllerBasedStatusBarAppearance - CADisableMinimumFrameDurationOnPhone UIApplicationSupportsIndirectInputEvents diff --git a/example/ios/RunnerTests/RunnerTests.swift b/example/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..67267a1 --- /dev/null +++ b/example/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,27 @@ +import Flutter +import UIKit +import XCTest + + +@testable import openpgp + +// This demonstrates a simple unit test of the Swift portion of this plugin's implementation. +// +// See https://developer.apple.com/documentation/xctest for more information about using XCTest. + +class RunnerTests: XCTestCase { + + func testGetPlatformVersion() { + let plugin = OpenpgpPlugin() + + let call = FlutterMethodCall(methodName: "getPlatformVersion", arguments: []) + + let resultExpectation = expectation(description: "result block must be called.") + plugin.handle(call) { result in + XCTAssertEqual(result as! String, "iOS " + UIDevice.current.systemVersion) + resultExpectation.fulfill() + } + waitForExpectations(timeout: 1) + } + +} diff --git a/example/lib/armor.dart b/example/lib/armor.dart index e5e7bf2..0931e50 100644 --- a/example/lib/armor.dart +++ b/example/lib/armor.dart @@ -1,9 +1,7 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/shared/button_widget.dart'; @@ -12,9 +10,9 @@ import 'package:openpgp_example/shared/input_widget.dart'; class Armor extends StatefulWidget { const Armor({ - Key? key, + super.key, required this.title, - }) : super(key: key); + }); final String title; diff --git a/example/lib/convert.dart b/example/lib/convert.dart index 65e964f..c724669 100644 --- a/example/lib/convert.dart +++ b/example/lib/convert.dart @@ -1,8 +1,4 @@ -import 'dart:convert'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/shared/button_widget.dart'; @@ -10,10 +6,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class Convert extends StatefulWidget { const Convert({ - Key? key, + super.key, required this.title, - required KeyPair? this.keyPair, - }) : super(key: key); + required this.keyPair, + }); final String title; final KeyPair? keyPair; diff --git a/example/lib/encrypt_decrypt.dart b/example/lib/encrypt_decrypt.dart index 71d1091..d42b084 100644 --- a/example/lib/encrypt_decrypt.dart +++ b/example/lib/encrypt_decrypt.dart @@ -1,6 +1,4 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -10,11 +8,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class EncryptAndDecrypt extends StatefulWidget { const EncryptAndDecrypt({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/encrypt_decrypt_bytes.dart b/example/lib/encrypt_decrypt_bytes.dart index a6970e9..09cac0c 100644 --- a/example/lib/encrypt_decrypt_bytes.dart +++ b/example/lib/encrypt_decrypt_bytes.dart @@ -1,9 +1,7 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -13,11 +11,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class EncryptAndDecryptBytes extends StatefulWidget { const EncryptAndDecryptBytes({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/encrypt_decrypt_file.dart b/example/lib/encrypt_decrypt_file.dart index a175e8c..30cc65d 100644 --- a/example/lib/encrypt_decrypt_file.dart +++ b/example/lib/encrypt_decrypt_file.dart @@ -1,8 +1,6 @@ import 'dart:io'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -11,11 +9,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class EncryptAndDecryptFile extends StatefulWidget { const EncryptAndDecryptFile({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; @@ -38,13 +35,13 @@ class _EncryptAndDecryptFileState extends State { fileHints: FileHints()..isBinary = true, ); print("end"); - String outputPath = inputPath + ".encrypted"; + String outputPath = "$inputPath.encrypted"; print("output $outputPath"); File output = File(outputPath); await output.writeAsBytes(encrypted); - await File(inputPath + ".pub").writeAsString(widget.keyPair!.publicKey); - await File(inputPath + ".key").writeAsString(widget.keyPair!.privateKey); + await File("$inputPath.pub").writeAsString(widget.keyPair!.publicKey); + await File("$inputPath.key").writeAsString(widget.keyPair!.privateKey); print("saved"); setState(() { @@ -63,7 +60,7 @@ class _EncryptAndDecryptFileState extends State { passphrase, ); print("end"); - String outputPath = inputPath + ".decrypted.zip"; + String outputPath = "$inputPath.decrypted.zip"; print("output $outputPath"); File output = File(outputPath); await output.writeAsBytes(decrypted); diff --git a/example/lib/encrypt_decrypt_symmetric.dart b/example/lib/encrypt_decrypt_symmetric.dart index 688df41..56ee730 100644 --- a/example/lib/encrypt_decrypt_symmetric.dart +++ b/example/lib/encrypt_decrypt_symmetric.dart @@ -1,9 +1,4 @@ -import 'dart:convert'; -import 'dart:typed_data'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -13,11 +8,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class EncryptAndDecryptSymmetric extends StatefulWidget { const EncryptAndDecryptSymmetric({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/encrypt_decrypt_symmetric_bytes.dart b/example/lib/encrypt_decrypt_symmetric_bytes.dart index 9f74cf9..ecf7e1d 100644 --- a/example/lib/encrypt_decrypt_symmetric_bytes.dart +++ b/example/lib/encrypt_decrypt_symmetric_bytes.dart @@ -1,9 +1,7 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -13,11 +11,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class EncryptAndDecryptSymmetricBytes extends StatefulWidget { const EncryptAndDecryptSymmetricBytes({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/encrypt_sign_decrypt_verify.dart b/example/lib/encrypt_sign_decrypt_verify.dart index 042e8a8..7c8ea93 100644 --- a/example/lib/encrypt_sign_decrypt_verify.dart +++ b/example/lib/encrypt_sign_decrypt_verify.dart @@ -1,6 +1,4 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -10,11 +8,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class EncryptSignAndDecryptVerify extends StatefulWidget { const EncryptSignAndDecryptVerify({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/generate.dart b/example/lib/generate.dart index 0693385..c01ffa4 100644 --- a/example/lib/generate.dart +++ b/example/lib/generate.dart @@ -1,8 +1,4 @@ -import 'dart:convert'; - -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart' as OpenPGP; import 'package:openpgp_example/shared/button_widget.dart'; @@ -10,9 +6,9 @@ import 'package:openpgp_example/shared/title_widget.dart'; class Generate extends StatefulWidget { const Generate({ - Key? key, + super.key, required this.title, - }) : super(key: key); + }); final String title; diff --git a/example/lib/main.dart b/example/lib/main.dart index 56cb087..abbe4cd 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,9 +1,7 @@ -import 'dart:async'; import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/encrypt_sign_decrypt_verify.dart'; @@ -28,10 +26,12 @@ void main() { debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; } - runApp(new MyApp()); + runApp(MyApp()); } class MyApp extends StatefulWidget { + const MyApp({super.key}); + @override _MyAppState createState() => _MyAppState(); } @@ -95,7 +95,7 @@ XZxlM93SyqyGkXiHgVaRjpH4d/aLg0aH8COQRSVR/65Qe7mRc8pPHFHegxf5EsYF '''; class _MyAppState extends State { - KeyPair _defaultKeyPair = KeyPair(publicKey, privateKey); + final KeyPair _defaultKeyPair = KeyPair(publicKey, privateKey); @override void initState() { @@ -109,10 +109,6 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { - if (_defaultKeyPair == null) { - return Container(); - } - return MaterialApp( home: Scaffold( appBar: AppBar( diff --git a/example/lib/metadata.dart b/example/lib/metadata.dart index 26cebcb..5b203bf 100644 --- a/example/lib/metadata.dart +++ b/example/lib/metadata.dart @@ -1,23 +1,17 @@ import 'dart:convert'; -import 'dart:typed_data'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; -import 'package:openpgp_example/main.dart'; import 'package:openpgp_example/shared/button_widget.dart'; -import 'package:openpgp_example/shared/input_widget.dart'; import 'package:openpgp_example/shared/title_widget.dart'; class Metadata extends StatefulWidget { const Metadata({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/shared/button_widget.dart b/example/lib/shared/button_widget.dart index 5104479..2e740c9 100644 --- a/example/lib/shared/button_widget.dart +++ b/example/lib/shared/button_widget.dart @@ -1,15 +1,13 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ButtonWidget extends StatefulWidget { const ButtonWidget({ - Key? key, + super.key, required this.result, required String title, required Function onPressed, }) : onPressed = onPressed, - title = title, - super(key: key); + title = title; final Function onPressed; final String title; @@ -29,7 +27,6 @@ class _ButtonWidgetState extends State { child: Column( children: [ ElevatedButton( - child: Text(widget.title), onPressed: () async { await widget.onPressed(); setState(() { @@ -37,6 +34,7 @@ class _ButtonWidgetState extends State { }); }, key: Key("button"), + child: Text(widget.title), ), (_loading) ? Text( diff --git a/example/lib/shared/input_widget.dart b/example/lib/shared/input_widget.dart index 8db71cb..0ec5071 100644 --- a/example/lib/shared/input_widget.dart +++ b/example/lib/shared/input_widget.dart @@ -1,14 +1,13 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class InputWidget extends StatefulWidget { const InputWidget({ - Key? key, + super.key, required this.result, required this.title, this.subtitle, - required Function(TextEditingController) this.onPressed, - }) : super(key: key); + required this.onPressed, + }); final Function(TextEditingController) onPressed; final String title; @@ -53,7 +52,6 @@ class _InputWidgetState extends State { key: Key("message"), ), ElevatedButton( - child: Text(widget.title), onPressed: () async { _focusNode!.unfocus(); await widget.onPressed(_controller); @@ -62,6 +60,7 @@ class _InputWidgetState extends State { }); }, key: Key("button"), + child: Text(widget.title), ), (_loading) ? Text( diff --git a/example/lib/shared/title_widget.dart b/example/lib/shared/title_widget.dart index b9bd8da..7b16dd9 100644 --- a/example/lib/shared/title_widget.dart +++ b/example/lib/shared/title_widget.dart @@ -3,8 +3,8 @@ import 'package:flutter/cupertino.dart'; class TitleWidget extends StatelessWidget { const TitleWidget( this.title, { - Key? key, - }) : super(key: key); + super.key, + }); final String title; diff --git a/example/lib/sign_verify.dart b/example/lib/sign_verify.dart index cb72dc3..38daa7d 100644 --- a/example/lib/sign_verify.dart +++ b/example/lib/sign_verify.dart @@ -1,6 +1,4 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -10,11 +8,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class SignAndVerify extends StatefulWidget { const SignAndVerify({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/sign_verify_bytes.dart b/example/lib/sign_verify_bytes.dart index c2f0715..3ce4399 100644 --- a/example/lib/sign_verify_bytes.dart +++ b/example/lib/sign_verify_bytes.dart @@ -1,9 +1,7 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -13,11 +11,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class SignAndVerifyBytes extends StatefulWidget { const SignAndVerifyBytes({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/sign_verify_data.dart b/example/lib/sign_verify_data.dart index 9eb3d62..7aea337 100644 --- a/example/lib/sign_verify_data.dart +++ b/example/lib/sign_verify_data.dart @@ -1,6 +1,4 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -10,11 +8,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class SignAndVerifyData extends StatefulWidget { const SignAndVerifyData({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; diff --git a/example/lib/sign_verify_data_bytes.dart b/example/lib/sign_verify_data_bytes.dart index f709cc4..3c850c8 100644 --- a/example/lib/sign_verify_data_bytes.dart +++ b/example/lib/sign_verify_data_bytes.dart @@ -1,9 +1,7 @@ import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/widgets.dart'; import 'package:openpgp/openpgp.dart'; import 'package:openpgp_example/main.dart'; @@ -13,11 +11,10 @@ import 'package:openpgp_example/shared/title_widget.dart'; class SignAndVerifyDataBytes extends StatefulWidget { const SignAndVerifyDataBytes({ - Key? key, + super.key, required this.title, required KeyPair? keyPair, - }) : keyPair = keyPair, - super(key: key); + }) : keyPair = keyPair; final KeyPair? keyPair; final String title; @@ -28,7 +25,7 @@ class SignAndVerifyDataBytes extends StatefulWidget { class _SignAndVerifyDataBytesState extends State { String _signed = ""; - String _signedBytes = ""; + final String _signedBytes = ""; String _verify = ""; @override diff --git a/example/linux/.gitignore b/example/linux/.gitignore index b11f5d1..d3896c9 100644 --- a/example/linux/.gitignore +++ b/example/linux/.gitignore @@ -1,2 +1 @@ flutter/ephemeral -cmake-build-debug \ No newline at end of file diff --git a/example/linux/CMakeLists.txt b/example/linux/CMakeLists.txt index 7a1cbb9..46d6ac5 100644 --- a/example/linux/CMakeLists.txt +++ b/example/linux/CMakeLists.txt @@ -1,14 +1,32 @@ +# Project-level configuration. cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. set(BINARY_NAME "openpgp_example") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "dev.jerson.openpgp") +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. cmake_policy(SET CMP0063 NEW) +# Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") -# Configure build options. +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) @@ -17,6 +35,10 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() # Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) @@ -24,9 +46,8 @@ function(APPLY_STANDARD_SETTINGS TARGET) target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") endfunction() -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") - # Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. @@ -35,16 +56,27 @@ pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") -# Application build +# Define the application target. To change its name, change BINARY_NAME above, +# not the value here, or `flutter run` will no longer work. +# +# Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. apply_standard_settings(${BINARY_NAME}) + +# Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +# Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) + # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of @@ -54,6 +86,9 @@ set_target_properties(${BINARY_NAME} RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) +# Enable the test target. +set(include_openpgp_tests TRUE) + # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) @@ -84,11 +119,17 @@ install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR} install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) -endif() +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. diff --git a/example/linux/flutter/CMakeLists.txt b/example/linux/flutter/CMakeLists.txt index 5b465c7..d5bd016 100644 --- a/example/linux/flutter/CMakeLists.txt +++ b/example/linux/flutter/CMakeLists.txt @@ -1,3 +1,4 @@ +# This file controls Flutter-level build steps. It should not be edited. cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") @@ -24,7 +25,6 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) -pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid) set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") @@ -66,7 +66,6 @@ target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO - PkgConfig::BLKID ) add_dependencies(flutter flutter_assemble) diff --git a/example/linux/main.cc b/example/linux/main.cc index 058e617..e7c5c54 100644 --- a/example/linux/main.cc +++ b/example/linux/main.cc @@ -1,10 +1,6 @@ #include "my_application.h" int main(int argc, char** argv) { - // Only X11 is currently supported. - // Wayland support is being developed: https://github.com/flutter/flutter/issues/57932. - gdk_set_allowed_backends("x11"); - g_autoptr(MyApplication) app = my_application_new(); return g_application_run(G_APPLICATION(app), argc, argv); } diff --git a/example/linux/my_application.cc b/example/linux/my_application.cc index 967d028..7cfe7f8 100644 --- a/example/linux/my_application.cc +++ b/example/linux/my_application.cc @@ -1,28 +1,57 @@ #include "my_application.h" #include +#ifdef GDK_WINDOWING_X11 +#include +#endif #include "flutter/generated_plugin_registrant.h" struct _MyApplication { GtkApplication parent_instance; + char** dart_entrypoint_arguments; }; G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) // Implements GApplication::activate. static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); GtkWindow* window = GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); - GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); - gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "openpgp_example"); - gtk_header_bar_set_show_close_button(header_bar, TRUE); - gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "openpgp_example"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "openpgp_example"); + } + gtk_window_set_default_size(window, 1280, 720); gtk_widget_show(GTK_WIDGET(window)); g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); FlView* view = fl_view_new(project); gtk_widget_show(GTK_WIDGET(view)); @@ -33,8 +62,56 @@ static void my_application_activate(GApplication* application) { gtk_widget_grab_focus(GTK_WIDGET(view)); } +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + static void my_application_class_init(MyApplicationClass* klass) { G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; } static void my_application_init(MyApplication* self) {} @@ -42,5 +119,6 @@ static void my_application_init(MyApplication* self) {} MyApplication* my_application_new() { return MY_APPLICATION(g_object_new(my_application_get_type(), "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, nullptr)); } diff --git a/example/macos/.gitignore b/example/macos/.gitignore index d2fd377..746adbb 100644 --- a/example/macos/.gitignore +++ b/example/macos/.gitignore @@ -3,4 +3,5 @@ **/Pods/ # Xcode-related +**/dgph **/xcuserdata/ diff --git a/example/macos/Flutter/Flutter-Debug.xcconfig b/example/macos/Flutter/Flutter-Debug.xcconfig index 6064f7d..4b81f9b 100644 --- a/example/macos/Flutter/Flutter-Debug.xcconfig +++ b/example/macos/Flutter/Flutter-Debug.xcconfig @@ -1,3 +1,2 @@ #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Flutter/Flutter-Release.xcconfig b/example/macos/Flutter/Flutter-Release.xcconfig index d583bc1..5caa9d1 100644 --- a/example/macos/Flutter/Flutter-Release.xcconfig +++ b/example/macos/Flutter/Flutter-Release.xcconfig @@ -1,3 +1,2 @@ #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/example/macos/Podfile b/example/macos/Podfile index 049abe2..c795730 100644 --- a/example/macos/Podfile +++ b/example/macos/Podfile @@ -31,6 +31,9 @@ target 'Runner' do use_modular_headers! flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end end post_install do |installer| diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 506acdb..416ad53 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -17,6 +17,6 @@ SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 openpgp: 74f1193a4edb7b732b71576beca8d5bd3783a1b8 -PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 +PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 -COCOAPODS: 1.14.3 +COCOAPODS: 1.16.2 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 3de4242..94c5a8c 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -21,15 +21,24 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - C95BAB3FC7E65510EB56FA4A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC6F804D9929494F93A5572C /* Pods_Runner.framework */; }; + 6368BD721C2252CB9C516C44 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 20425A47D14CB18A6C5225A5 /* Pods_Runner.framework */; }; + 727813C05CBB35454D8FF823 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 098ABD3D80F8CB401901C523 /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 33CC10E52044A3C60003C045 /* Project object */; @@ -53,7 +62,12 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 1367B2F32CC7B24DE3B4C52F /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 098ABD3D80F8CB401901C523 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 20425A47D14CB18A6C5225A5 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 30892E4E1B80600E33999A3B /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 30F8B2D28894D0DDDEC816C4 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 33CC10ED2044A3C60003C045 /* openpgp_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = openpgp_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -68,25 +82,42 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 4EC5240CBF06D0B92E947C37 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9131D663D8EBC4ECB524A93E /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - BC6F804D9929494F93A5572C /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E35D42A88A18247E18A354D3 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + AFC742D2ECCD1462768C57E2 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + BB19E1493CDAC889D5B3C095 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + F6E479F7A933796B0BD76A24 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 727813C05CBB35454D8FF823 /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 33CC10EA2044A3C60003C045 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C95BAB3FC7E65510EB56FA4A /* Pods_Runner.framework in Frameworks */, + 6368BD721C2252CB9C516C44 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; 33BA886A226E78AF003329D5 /* Configs */ = { isa = PBXGroup; children = ( @@ -103,9 +134,10 @@ children = ( 33FAB671232836740065AC1E /* Runner */, 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, - AEA32E950ABFFF5C26BE245E /* Pods */, + CBD59D0C486F95E6A41770E2 /* Pods */, ); sourceTree = ""; }; @@ -113,6 +145,7 @@ isa = PBXGroup; children = ( 33CC10ED2044A3C60003C045 /* openpgp_example.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, ); name = Products; sourceTree = ""; @@ -152,12 +185,15 @@ path = Runner; sourceTree = ""; }; - AEA32E950ABFFF5C26BE245E /* Pods */ = { + CBD59D0C486F95E6A41770E2 /* Pods */ = { isa = PBXGroup; children = ( - E35D42A88A18247E18A354D3 /* Pods-Runner.debug.xcconfig */, - 1367B2F32CC7B24DE3B4C52F /* Pods-Runner.release.xcconfig */, - 4EC5240CBF06D0B92E947C37 /* Pods-Runner.profile.xcconfig */, + 30892E4E1B80600E33999A3B /* Pods-Runner.debug.xcconfig */, + F6E479F7A933796B0BD76A24 /* Pods-Runner.release.xcconfig */, + 9131D663D8EBC4ECB524A93E /* Pods-Runner.profile.xcconfig */, + BB19E1493CDAC889D5B3C095 /* Pods-RunnerTests.debug.xcconfig */, + 30F8B2D28894D0DDDEC816C4 /* Pods-RunnerTests.release.xcconfig */, + AFC742D2ECCD1462768C57E2 /* Pods-RunnerTests.profile.xcconfig */, ); name = Pods; path = Pods; @@ -166,7 +202,8 @@ D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( - BC6F804D9929494F93A5572C /* Pods_Runner.framework */, + 20425A47D14CB18A6C5225A5 /* Pods_Runner.framework */, + 098ABD3D80F8CB401901C523 /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -174,17 +211,36 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + E7E2A5518C549060D92FE3E7 /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 33CC10EC2044A3C60003C045 /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 3E3D6CBC8D3DC303829A34EA /* [CP] Check Pods Manifest.lock */, + 9F1B7078F5444FF429024FF4 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - 0DCA0B08DF86B3940D34CD79 /* [CP] Embed Pods Frameworks */, + 7AD61BFE7C0D6699BE3E9481 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -202,10 +258,15 @@ 33CC10E52044A3C60003C045 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 0920; LastUpgradeCheck = 1510; - ORGANIZATIONNAME = "The Flutter Authors"; + ORGANIZATIONNAME = ""; TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; 33CC10EC2044A3C60003C045 = { CreatedOnToolsVersion = 9.2; LastSwiftMigration = 1100; @@ -223,7 +284,7 @@ }; }; buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 8.0"; + compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -236,12 +297,20 @@ projectRoot = ""; targets = ( 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, 33CC111A2044C6BA0003C045 /* Flutter Assemble */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 33CC10EB2044A3C60003C045 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -254,65 +323,84 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 0DCA0B08DF86B3940D34CD79 /* [CP] Embed Pods Frameworks */ = { + 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${PODS_ROOT}/../Flutter/ephemeral/.symlinks/plugins/openpgp/macos/libopenpgp_bridge.dylib", - "${BUILT_PRODUCTS_DIR}/openpgp/openpgp.framework", ); - name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + ); outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libopenpgp_bridge.dylib", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openpgp.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; }; - 3399D490228B24CF009A79C7 /* ShellScript */ = { + 33CC111E2044C6BF0003C045 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, ); inputPaths = ( + Flutter/ephemeral/tripwire, ); outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - 33CC111E2044C6BF0003C045 /* ShellScript */ = { + 7AD61BFE7C0D6699BE3E9481 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 9F1B7078F5444FF429024FF4 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - Flutter/ephemeral/FlutterInputs.xcfilelist, ); inputPaths = ( - Flutter/ephemeral/tripwire, + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - Flutter/ephemeral/FlutterOutputs.xcfilelist, ); outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh\ntouch Flutter/ephemeral/tripwire\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; }; - 3E3D6CBC8D3DC303829A34EA /* [CP] Check Pods Manifest.lock */ = { + E7E2A5518C549060D92FE3E7 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -327,7 +415,7 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -337,6 +425,14 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 33CC10E92044A3C60003C045 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -350,6 +446,11 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; @@ -370,11 +471,57 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BB19E1493CDAC889D5B3C095 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/openpgp_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/openpgp_example"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 30F8B2D28894D0DDDEC816C4 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/openpgp_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/openpgp_example"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AFC742D2ECCD1462768C57E2 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/openpgp_example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/openpgp_example"; + }; + name = Profile; + }; 338D0CE9231458BD00FA5F75 /* Profile */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -398,9 +545,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -425,10 +574,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -452,6 +597,7 @@ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -475,9 +621,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -505,6 +653,7 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -528,9 +677,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -555,10 +706,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -579,10 +726,6 @@ CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter/ephemeral", - ); INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -612,6 +755,16 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 24aca0b..31e4c4e 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -27,18 +27,6 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - - - - - + + + + + + - - Bool { return true diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png index 3c4935a..82b6f9d 100644 Binary files a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png index ed4cc16..13b35eb 100644 Binary files a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png index 483be61..0a3f5fa 100644 Binary files a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png index bcbf36d..bdb5722 100644 Binary files a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png index 9c0a652..f083318 100644 Binary files a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png index e71a726..326c0e7 100644 Binary files a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png index 8a31fe2..2f1632c 100644 Binary files a/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and b/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/example/macos/Runner/Base.lproj/MainMenu.xib b/example/macos/Runner/Base.lproj/MainMenu.xib index 537341a..80e867a 100644 --- a/example/macos/Runner/Base.lproj/MainMenu.xib +++ b/example/macos/Runner/Base.lproj/MainMenu.xib @@ -323,6 +323,10 @@ + + + + diff --git a/example/macos/Runner/Configs/AppInfo.xcconfig b/example/macos/Runner/Configs/AppInfo.xcconfig index 4e53f58..46301b2 100644 --- a/example/macos/Runner/Configs/AppInfo.xcconfig +++ b/example/macos/Runner/Configs/AppInfo.xcconfig @@ -11,4 +11,4 @@ PRODUCT_NAME = openpgp_example PRODUCT_BUNDLE_IDENTIFIER = dev.jerson.openpgpExample // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2020 dev.jerson. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2024 dev.jerson. All rights reserved. diff --git a/example/macos/Runner/MainFlutterWindow.swift b/example/macos/Runner/MainFlutterWindow.swift index 2722837..3cc05eb 100644 --- a/example/macos/Runner/MainFlutterWindow.swift +++ b/example/macos/Runner/MainFlutterWindow.swift @@ -3,7 +3,7 @@ import FlutterMacOS class MainFlutterWindow: NSWindow { override func awakeFromNib() { - let flutterViewController = FlutterViewController.init() + let flutterViewController = FlutterViewController() let windowFrame = self.frame self.contentViewController = flutterViewController self.setFrame(windowFrame, display: true) diff --git a/example/macos/RunnerTests/RunnerTests.swift b/example/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..a4cc168 --- /dev/null +++ b/example/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,28 @@ +import Cocoa +import FlutterMacOS +import XCTest + + +@testable import openpgp + +// This demonstrates a simple unit test of the Swift portion of this plugin's implementation. +// +// See https://developer.apple.com/documentation/xctest for more information about using XCTest. + +class RunnerTests: XCTestCase { + + func testGetPlatformVersion() { + let plugin = OpenpgpPlugin() + + let call = FlutterMethodCall(methodName: "getPlatformVersion", arguments: []) + + let resultExpectation = expectation(description: "result block must be called.") + plugin.handle(call) { result in + XCTAssertEqual(result as! String, + "macOS " + ProcessInfo.processInfo.operatingSystemVersionString) + resultExpectation.fulfill() + } + waitForExpectations(timeout: 1) + } + +} diff --git a/example/pubspec.lock b/example/pubspec.lock index 91aacfd..fff1eec 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,26 +5,31 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" + sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 url: "https://pub.dev" source: hosted - version: "67.0.0" + version: "72.0.0" + _macros: + dependency: transitive + description: dart + source: sdk + version: "0.3.2" analyzer: dependency: transitive description: name: analyzer - sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" + sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 url: "https://pub.dev" source: hosted - version: "6.4.1" + version: "6.7.0" args: dependency: transitive description: name: args - sha256: ad180a697bf97dd54ab519a4665c57683bf4f70649a18671cea661cf0397c055 + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.6.0" async: dependency: transitive description: @@ -49,14 +54,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" - charcode: - dependency: transitive - description: - name: charcode - sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 - url: "https://pub.dev" - source: hosted - version: "1.3.1" clock: dependency: transitive description: @@ -77,34 +74,34 @@ packages: dependency: transitive description: name: convert - sha256: df567b950053d83b4dba3e8c5799c411895d146f82b2147114b666a4fd9a80dd + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.2" coverage: dependency: transitive description: name: coverage - sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" + sha256: "4b03e11f6d5b8f6e5bb5e9f7889a56fe6c5cbe942da5378ea4d4d7f73ef9dfe5" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.11.0" crypto: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.6" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - sha256: "486b7bc707424572cdf7bd7e812a0c146de3fd47ecadf070254cc60383f21dd8" + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.8" fake_async: dependency: transitive description: @@ -117,10 +114,10 @@ packages: dependency: transitive description: name: ffi - sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.3" file: dependency: transitive description: @@ -133,10 +130,10 @@ packages: dependency: transitive description: name: flat_buffers - sha256: "23e2ced0d8e8ecdffbd9f267f49a668c74438393b9acaeac1c724123e3764263" + sha256: "380bdcba5664a718bfd4ea20a45d39e13684f5318fcd8883066a55e21f37f4c3" url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "23.5.26" flutter: dependency: "direct main" description: flutter @@ -147,6 +144,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -161,10 +166,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "4.0.0" fuchsia_remote_debug_protocol: dependency: transitive description: flutter @@ -182,18 +187,18 @@ packages: dependency: transitive description: name: http_multi_server - sha256: bfb651625e251a88804ad6d596af01ea903544757906addcb2dcdf088b5ea185 + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - sha256: e362d639ba3bc07d5a71faebb98cde68c05bfbcfbbb444b60b6f60bb67719185 + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.2" integration_test: dependency: "direct dev" description: flutter @@ -203,18 +208,18 @@ packages: dependency: transitive description: name: io - sha256: "15a5436d2a02dc60e6dc2fb5d7dfaac08b7b137cff3d4bf3158d38ecab656b69" + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.4" js: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.7.1" leak_tracker: dependency: transitive description: @@ -239,14 +244,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413" + url: "https://pub.dev" + source: hosted + version: "5.0.0" logging: dependency: transitive description: name: logging - sha256: "0520a4826042a8a5d09ddd4755623a50d37ee536d79a70452aff8c8ad7bb6c27" + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + macros: + dependency: transitive + description: + name: macros + sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "0.1.2-main.4" matcher: dependency: transitive description: @@ -275,33 +296,33 @@ packages: dependency: transitive description: name: mime - sha256: a7a98ea7f366e2cc9d2b20873815aebec5e2bc124fe0da9d3f7f59b0625ea180 + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.0" node_preamble: dependency: transitive description: name: node_preamble - sha256: c133f761a6a790d0b000efa4f74eae9700bb6e9e9f5e996f0e8d6fe92703ced6 + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.2" openpgp: dependency: "direct main" description: path: ".." relative: true source: path - version: "3.8.3" + version: "3.9.0" package_config: dependency: transitive description: name: package_config - sha256: "20e7154d701fedaeb219dad732815ecb66677667871127998a9a6581c2aba4ba" + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" path: dependency: transitive description: @@ -322,10 +343,10 @@ packages: dependency: transitive description: name: pool - sha256: "05955e3de2683e1746222efd14b775df7131139e07695dc8e24650f6b4204504" + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "1.5.1" process: dependency: transitive description: @@ -346,34 +367,34 @@ packages: dependency: transitive description: name: shelf - sha256: "26d22c68cf9c349fb1adb4a830da3e014cb5f7ed9cc57f721d9d9e20cf8d6de5" + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 url: "https://pub.dev" source: hosted - version: "1.1.4" + version: "1.4.1" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - sha256: e0b44ebddec91e70a713e13adf93c1b2100821303b86a18e1ef1d082bd8bd9b8 + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.0.2" shelf_static: dependency: transitive description: name: shelf_static - sha256: "8584c0aa0f5756a61519b1a2fc2cd22ddbc518e9396bd33ebf06b9836bb23d13" + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.3" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: fd84910bf7d58db109082edf7326b75322b8f186162028482f53dc892f00332d + sha256: cc36c297b52866d203dbf9332263c94becc2fe0ceaa9681d07b6ef9807023b67 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.1" sky_engine: dependency: transitive description: flutter @@ -383,18 +404,18 @@ packages: dependency: transitive description: name: source_map_stack_trace - sha256: "8c463326277f68a628abab20580047b419c2ff66756fd0affd451f73f9508c11" + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" source_maps: dependency: transitive description: name: source_maps - sha256: "52de2200bb098de739794c82d09c41ac27b2e42fd7e23cce7b9c74bf653c7296" + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" url: "https://pub.dev" source: hosted - version: "0.10.10" + version: "0.10.12" source_span: dependency: transitive description: @@ -471,10 +492,10 @@ packages: dependency: transitive description: name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.4.0" vector_math: dependency: transitive description: @@ -487,10 +508,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "14.2.5" watcher: dependency: transitive description: @@ -507,14 +528,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" + url: "https://pub.dev" + source: hosted + version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "0c2ada1b1aeb2ad031ca81872add6be049b8cb479262c6ad3c4b0f9c24eaab2f" + sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "3.0.1" webdriver: dependency: transitive description: @@ -527,18 +556,18 @@ packages: dependency: transitive description: name: webkit_inspection_protocol - sha256: "5adb6ab8ed14e22bb907aae7338f0c206ea21e7a27004e97664b16c120306f00" + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.2.1" yaml: dependency: transitive description: name: yaml - sha256: "3cee79b1715110341012d27756d9bae38e650588acd38d3f3c610822e1337ace" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" + dart: ">=3.5.4 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f13e502..3fd251f 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,35 +1,53 @@ name: openpgp_example -description: Demonstrates how to use the openpgp plugin. - +description: "Demonstrates how to use the openpgp plugin." # The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. +# 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 environment: - sdk: '>=2.17.0 <3.0.0' + sdk: ^3.5.4 +# 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 openpgp: + # When depending on this package from a real application you should use: + # openpgp: ^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.2 + cupertino_icons: ^1.0.8 dev_dependencies: integration_test: sdk: flutter 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: ^5.0.0 + test: any # 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. +# The following section is specific to Flutter packages. flutter: # The following line ensures that the Material Icons font is @@ -43,26 +61,11 @@ flutter: - packages/openpgp/web/assets/wasm_exec.js - packages/openpgp/web/assets/openpgp.wasm - fonts: - - family: Roboto - fonts: - - asset: fonts/Roboto/Roboto-Thin.ttf - weight: 100 - - asset: fonts/Roboto/Roboto-Light.ttf - weight: 300 - - asset: fonts/Roboto/Roboto-Regular.ttf - weight: 400 - - asset: fonts/Roboto/Roboto-Medium.ttf - weight: 500 - - asset: fonts/Roboto/Roboto-Bold.ttf - weight: 700 - - asset: fonts/Roboto/Roboto-Black.ttf - weight: 900 # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. + # https://flutter.dev/to/resolution-aware-images # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages + # https://flutter.dev/to/asset-from-package # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a @@ -82,4 +85,4 @@ flutter: # weight: 700 # # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + # see https://flutter.dev/to/font-from-package diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart deleted file mode 100644 index 092d222..0000000 --- a/example/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility in the flutter_test package. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:example/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} diff --git a/example/web/icons/Icon-maskable-192.png b/example/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/example/web/icons/Icon-maskable-192.png differ diff --git a/example/web/icons/Icon-maskable-512.png b/example/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/example/web/icons/Icon-maskable-512.png differ diff --git a/example/web/index.html b/example/web/index.html index bf16092..5a88688 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -1,6 +1,21 @@ + + + @@ -12,7 +27,7 @@ - + openpgp_example diff --git a/example/web/manifest.json b/example/web/manifest.json index d1287d9..f498b8d 100644 --- a/example/web/manifest.json +++ b/example/web/manifest.json @@ -18,6 +18,18 @@ "src": "icons/Icon-512.png", "sizes": "512x512", "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" } ] } diff --git a/example/windows/.gitignore b/example/windows/.gitignore index 9ce2009..d492d0d 100644 --- a/example/windows/.gitignore +++ b/example/windows/.gitignore @@ -15,4 +15,3 @@ x86/ *.[Cc]ache # but keep track of directories ending in .cache !*.[Cc]ache/ -cmake-build-debug \ No newline at end of file diff --git a/example/windows/CMakeLists.txt b/example/windows/CMakeLists.txt index 90a0d92..22e32bd 100644 --- a/example/windows/CMakeLists.txt +++ b/example/windows/CMakeLists.txt @@ -1,13 +1,16 @@ -cmake_minimum_required(VERSION 3.15) +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) project(openpgp_example LANGUAGES CXX) +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. set(BINARY_NAME "openpgp_example") -cmake_policy(SET CMP0063 NEW) +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") - -# Configure build options. +# Define build configuration option. get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" @@ -20,7 +23,7 @@ else() "Debug" "Profile" "Release") endif() endif() - +# Define settings for the Profile build mode. set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") @@ -30,6 +33,10 @@ set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") add_definitions(-DUNICODE -D_UNICODE) # Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") @@ -38,14 +45,16 @@ function(APPLY_STANDARD_SETTINGS TARGET) target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") - # Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) -# Application build +# Application build; see runner/CMakeLists.txt. add_subdirectory("runner") +# Enable the test target. +set(include_openpgp_tests TRUE) + # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) @@ -80,6 +89,12 @@ if(PLUGIN_BUNDLED_LIBRARIES) COMPONENT Runtime) endif() +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") diff --git a/example/windows/flutter/CMakeLists.txt b/example/windows/flutter/CMakeLists.txt index 744f08a..903f489 100644 --- a/example/windows/flutter/CMakeLists.txt +++ b/example/windows/flutter/CMakeLists.txt @@ -1,4 +1,5 @@ -cmake_minimum_required(VERSION 3.15) +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") @@ -9,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -23,6 +29,7 @@ list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) @@ -90,7 +97,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS diff --git a/example/windows/runner/CMakeLists.txt b/example/windows/runner/CMakeLists.txt index 977e38b..394917c 100644 --- a/example/windows/runner/CMakeLists.txt +++ b/example/windows/runner/CMakeLists.txt @@ -1,18 +1,40 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" - "run_loop.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/example/windows/runner/Runner.rc b/example/windows/runner/Runner.rc index 05ecb19..3e36944 100644 --- a/example/windows/runner/Runner.rc +++ b/example/windows/runner/Runner.rc @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" // Version // -#ifdef FLUTTER_BUILD_NUMBER -#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD #else -#define VERSION_AS_NUMBER 1,0,0 +#define VERSION_AS_NUMBER 1,0,0,0 #endif -#ifdef FLUTTER_BUILD_NAME -#define VERSION_AS_STRING #FLUTTER_BUILD_NAME +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION #else #define VERSION_AS_STRING "1.0.0" #endif @@ -90,10 +90,10 @@ BEGIN BLOCK "040904e4" BEGIN VALUE "CompanyName", "dev.jerson" "\0" - VALUE "FileDescription", "Demonstrates how to use the openpgp plugin." "\0" + VALUE "FileDescription", "openpgp_example" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "InternalName", "openpgp_example" "\0" - VALUE "LegalCopyright", "Copyright (C) 2020 dev.jerson. All rights reserved." "\0" + VALUE "LegalCopyright", "Copyright (C) 2024 dev.jerson. All rights reserved." "\0" VALUE "OriginalFilename", "openpgp_example.exe" "\0" VALUE "ProductName", "openpgp_example" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" diff --git a/example/windows/runner/flutter_window.cpp b/example/windows/runner/flutter_window.cpp index c422723..955ee30 100644 --- a/example/windows/runner/flutter_window.cpp +++ b/example/windows/runner/flutter_window.cpp @@ -4,9 +4,8 @@ #include "flutter/generated_plugin_registrant.h" -FlutterWindow::FlutterWindow(RunLoop* run_loop, - const flutter::DartProject& project) - : run_loop_(run_loop), project_(project) {} +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} FlutterWindow::~FlutterWindow() {} @@ -26,14 +25,22 @@ bool FlutterWindow::OnCreate() { return false; } RegisterPlugins(flutter_controller_->engine()); - run_loop_->RegisterFlutterInstance(flutter_controller_->engine()); SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + return true; } void FlutterWindow::OnDestroy() { if (flutter_controller_) { - run_loop_->UnregisterFlutterInstance(flutter_controller_->engine()); flutter_controller_ = nullptr; } @@ -44,7 +51,7 @@ LRESULT FlutterWindow::MessageHandler(HWND hwnd, UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept { - // Give Flutter, including plugins, an opporutunity to handle window messages. + // Give Flutter, including plugins, an opportunity to handle window messages. if (flutter_controller_) { std::optional result = flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, diff --git a/example/windows/runner/flutter_window.h b/example/windows/runner/flutter_window.h index b663ddd..6da0652 100644 --- a/example/windows/runner/flutter_window.h +++ b/example/windows/runner/flutter_window.h @@ -6,16 +6,13 @@ #include -#include "run_loop.h" #include "win32_window.h" // A window that does nothing but host a Flutter view. class FlutterWindow : public Win32Window { public: - // Creates a new FlutterWindow driven by the |run_loop|, hosting a - // Flutter view running |project|. - explicit FlutterWindow(RunLoop* run_loop, - const flutter::DartProject& project); + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); virtual ~FlutterWindow(); protected: @@ -26,9 +23,6 @@ class FlutterWindow : public Win32Window { LPARAM const lparam) noexcept override; private: - // The run loop driving events for this window. - RunLoop* run_loop_; - // The project to run. flutter::DartProject project_; diff --git a/example/windows/runner/main.cpp b/example/windows/runner/main.cpp index 0bfe8cb..fcfba57 100644 --- a/example/windows/runner/main.cpp +++ b/example/windows/runner/main.cpp @@ -3,7 +3,6 @@ #include #include "flutter_window.h" -#include "run_loop.h" #include "utils.h" int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, @@ -18,18 +17,26 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, // plugins. ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); - RunLoop run_loop; - flutter::DartProject project(L"data"); - FlutterWindow window(&run_loop, project); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); Win32Window::Point origin(10, 10); Win32Window::Size size(1280, 720); - if (!window.CreateAndShow(L"openpgp_example", origin, size)) { + if (!window.Create(L"openpgp_example", origin, size)) { return EXIT_FAILURE; } window.SetQuitOnClose(true); - run_loop.Run(); + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } ::CoUninitialize(); return EXIT_SUCCESS; diff --git a/example/windows/runner/run_loop.cpp b/example/windows/runner/run_loop.cpp deleted file mode 100644 index 2d6636a..0000000 --- a/example/windows/runner/run_loop.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "run_loop.h" - -#include - -#include - -RunLoop::RunLoop() {} - -RunLoop::~RunLoop() {} - -void RunLoop::Run() { - bool keep_running = true; - TimePoint next_flutter_event_time = TimePoint::clock::now(); - while (keep_running) { - std::chrono::nanoseconds wait_duration = - std::max(std::chrono::nanoseconds(0), - next_flutter_event_time - TimePoint::clock::now()); - ::MsgWaitForMultipleObjects( - 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000), - QS_ALLINPUT); - bool processed_events = false; - MSG message; - // All pending Windows messages must be processed; MsgWaitForMultipleObjects - // won't return again for items left in the queue after PeekMessage. - while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) { - processed_events = true; - if (message.message == WM_QUIT) { - keep_running = false; - break; - } - ::TranslateMessage(&message); - ::DispatchMessage(&message); - // Allow Flutter to process messages each time a Windows message is - // processed, to prevent starvation. - next_flutter_event_time = - std::min(next_flutter_event_time, ProcessFlutterMessages()); - } - // If the PeekMessage loop didn't run, process Flutter messages. - if (!processed_events) { - next_flutter_event_time = - std::min(next_flutter_event_time, ProcessFlutterMessages()); - } - } -} - -void RunLoop::RegisterFlutterInstance( - flutter::FlutterEngine* flutter_instance) { - flutter_instances_.insert(flutter_instance); -} - -void RunLoop::UnregisterFlutterInstance( - flutter::FlutterEngine* flutter_instance) { - flutter_instances_.erase(flutter_instance); -} - -RunLoop::TimePoint RunLoop::ProcessFlutterMessages() { - TimePoint next_event_time = TimePoint::max(); - for (auto instance : flutter_instances_) { - std::chrono::nanoseconds wait_duration = instance->ProcessMessages(); - if (wait_duration != std::chrono::nanoseconds::max()) { - next_event_time = - std::min(next_event_time, TimePoint::clock::now() + wait_duration); - } - } - return next_event_time; -} diff --git a/example/windows/runner/run_loop.h b/example/windows/runner/run_loop.h deleted file mode 100644 index 000d362..0000000 --- a/example/windows/runner/run_loop.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef RUNNER_RUN_LOOP_H_ -#define RUNNER_RUN_LOOP_H_ - -#include - -#include -#include - -// A runloop that will service events for Flutter instances as well -// as native messages. -class RunLoop { - public: - RunLoop(); - ~RunLoop(); - - // Prevent copying - RunLoop(RunLoop const&) = delete; - RunLoop& operator=(RunLoop const&) = delete; - - // Runs the run loop until the application quits. - void Run(); - - // Registers the given Flutter instance for event servicing. - void RegisterFlutterInstance( - flutter::FlutterEngine* flutter_instance); - - // Unregisters the given Flutter instance from event servicing. - void UnregisterFlutterInstance( - flutter::FlutterEngine* flutter_instance); - - private: - using TimePoint = std::chrono::steady_clock::time_point; - - // Processes all currently pending messages for registered Flutter instances. - TimePoint ProcessFlutterMessages(); - - std::set flutter_instances_; -}; - -#endif // RUNNER_RUN_LOOP_H_ diff --git a/example/windows/runner/runner.exe.manifest b/example/windows/runner/runner.exe.manifest index c977c4a..153653e 100644 --- a/example/windows/runner/runner.exe.manifest +++ b/example/windows/runner/runner.exe.manifest @@ -7,14 +7,8 @@ - + - - - - - - diff --git a/example/windows/runner/utils.cpp b/example/windows/runner/utils.cpp index 37501e5..3a0b465 100644 --- a/example/windows/runner/utils.cpp +++ b/example/windows/runner/utils.cpp @@ -20,3 +20,46 @@ void CreateAndAttachConsole() { FlutterDesktopResyncOutputStreams(); } } + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + unsigned int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length == 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/example/windows/runner/utils.h b/example/windows/runner/utils.h index d792603..3879d54 100644 --- a/example/windows/runner/utils.h +++ b/example/windows/runner/utils.h @@ -1,8 +1,19 @@ #ifndef RUNNER_UTILS_H_ #define RUNNER_UTILS_H_ +#include +#include + // Creates a console for the process, and redirects stdout and stderr to // it for both the runner and the Flutter library. void CreateAndAttachConsole(); +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + #endif // RUNNER_UTILS_H_ diff --git a/example/windows/runner/win32_window.cpp b/example/windows/runner/win32_window.cpp index efc3eb9..60608d0 100644 --- a/example/windows/runner/win32_window.cpp +++ b/example/windows/runner/win32_window.cpp @@ -1,13 +1,31 @@ #include "win32_window.h" +#include #include #include "resource.h" namespace { +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + // The number of Win32Window objects that currently exist. static int g_active_window_count = 0; @@ -31,8 +49,8 @@ void EnableFullDpiSupportIfAvailable(HWND hwnd) { GetProcAddress(user32_module, "EnableNonClientDpiScaling")); if (enable_non_client_dpi_scaling != nullptr) { enable_non_client_dpi_scaling(hwnd); - FreeLibrary(user32_module); } + FreeLibrary(user32_module); } } // namespace @@ -42,7 +60,7 @@ class WindowClassRegistrar { public: ~WindowClassRegistrar() = default; - // Returns the singleton registar instance. + // Returns the singleton registrar instance. static WindowClassRegistrar* GetInstance() { if (!instance_) { instance_ = new WindowClassRegistrar(); @@ -102,9 +120,9 @@ Win32Window::~Win32Window() { Destroy(); } -bool Win32Window::CreateAndShow(const std::wstring& title, - const Point& origin, - const Size& size) { +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { Destroy(); const wchar_t* window_class = @@ -117,7 +135,7 @@ bool Win32Window::CreateAndShow(const std::wstring& title, double scale_factor = dpi / 96.0; HWND window = CreateWindow( - window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), Scale(size.width, scale_factor), Scale(size.height, scale_factor), nullptr, nullptr, GetModuleHandle(nullptr), this); @@ -126,9 +144,15 @@ bool Win32Window::CreateAndShow(const std::wstring& title, return false; } + UpdateTheme(window); + return OnCreate(); } +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + // static LRESULT CALLBACK Win32Window::WndProc(HWND const window, UINT const message, @@ -173,7 +197,7 @@ Win32Window::MessageHandler(HWND hwnd, return 0; } - case WM_SIZE: + case WM_SIZE: { RECT rect = GetClientArea(); if (child_content_ != nullptr) { // Size and position the child window. @@ -181,12 +205,17 @@ Win32Window::MessageHandler(HWND hwnd, rect.bottom - rect.top, TRUE); } return 0; + } case WM_ACTIVATE: if (child_content_ != nullptr) { SetFocus(child_content_); } return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; } return DefWindowProc(window_handle_, message, wparam, lparam); @@ -242,3 +271,18 @@ bool Win32Window::OnCreate() { void Win32Window::OnDestroy() { // No-op; provided for subclasses. } + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/example/windows/runner/win32_window.h b/example/windows/runner/win32_window.h index 17ba431..e901dde 100644 --- a/example/windows/runner/win32_window.h +++ b/example/windows/runner/win32_window.h @@ -28,15 +28,16 @@ class Win32Window { Win32Window(); virtual ~Win32Window(); - // Creates and shows a win32 window with |title| and position and size using + // Creates a win32 window with |title| that is positioned and sized using // |origin| and |size|. New windows are created on the default monitor. Window // sizes are specified to the OS in physical pixels, hence to ensure a - // consistent size to will treat the width height passed in to this function - // as logical pixels and scale to appropriate for the default monitor. Returns - // true if the window was created successfully. - bool CreateAndShow(const std::wstring& title, - const Point& origin, - const Size& size); + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); // Release OS resources associated with window. void Destroy(); @@ -76,7 +77,7 @@ class Win32Window { // OS callback called by message pump. Handles the WM_NCCREATE message which // is passed when the non-client area is being created and enables automatic // non-client DPI scaling so that the non-client area automatically - // responsponds to changes in DPI. All other messages are handled by + // responds to changes in DPI. All other messages are handled by // MessageHandler. static LRESULT CALLBACK WndProc(HWND const window, UINT const message, @@ -86,6 +87,9 @@ class Win32Window { // Retrieves a class instance pointer for |window| static Win32Window* GetThisFromHandle(HWND const window) noexcept; + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + bool quit_on_close_ = false; // window handle for top level window. diff --git a/ios/Classes/OpenpgpPlugin.h b/ios/Classes/OpenpgpPlugin.h deleted file mode 100755 index 46ac0e9..0000000 --- a/ios/Classes/OpenpgpPlugin.h +++ /dev/null @@ -1,4 +0,0 @@ -#import - -@interface OpenpgpPlugin : NSObject -@end diff --git a/ios/Classes/OpenpgpPlugin.m b/ios/Classes/OpenpgpPlugin.m deleted file mode 100755 index ffb4ae8..0000000 --- a/ios/Classes/OpenpgpPlugin.m +++ /dev/null @@ -1,17 +0,0 @@ -#import "OpenpgpPlugin.h" - -@implementation OpenpgpPlugin -+ (void)registerWithRegistrar:(NSObject*)registrar { - FlutterMethodChannel* channel = [FlutterMethodChannel - methodChannelWithName:@"openpgp" - binaryMessenger:[registrar messenger]]; - OpenpgpPlugin* instance = [[OpenpgpPlugin alloc] init]; - [registrar addMethodCallDelegate:instance channel:channel]; -} - -- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { - result(FlutterMethodNotImplemented); - -} - -@end diff --git a/ios/Classes/OpenpgpPlugin.swift b/ios/Classes/OpenpgpPlugin.swift new file mode 100644 index 0000000..e27205c --- /dev/null +++ b/ios/Classes/OpenpgpPlugin.swift @@ -0,0 +1,19 @@ +import Flutter +import UIKit + +public class OpenpgpPlugin: NSObject, FlutterPlugin { + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel(name: "openpgp", binaryMessenger: registrar.messenger()) + let instance = OpenpgpPlugin() + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + switch call.method { + case "getPlatformVersion": + result("iOS " + UIDevice.current.systemVersion) + default: + result(FlutterMethodNotImplemented) + } + } +} diff --git a/ios/Openpgp.xcframework/Info.plist b/ios/Openpgp.xcframework/Info.plist new file mode 100644 index 0000000..88921e1 --- /dev/null +++ b/ios/Openpgp.xcframework/Info.plist @@ -0,0 +1,67 @@ + + + + + AvailableLibraries + + + BinaryPath + libopenpgp_bridge.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64 + LibraryPath + libopenpgp_bridge.a + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + BinaryPath + libopenpgp_bridge.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64_x86_64-simulator + LibraryPath + libopenpgp_bridge.a + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + BinaryPath + libopenpgp_bridge.a + HeadersPath + Headers + LibraryIdentifier + ios-arm64_x86_64-maccatalyst + LibraryPath + libopenpgp_bridge.a + SupportedArchitectures + + arm64 + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + maccatalyst + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/ios/libopenpgp_bridge.h b/ios/Openpgp.xcframework/ios-arm64/Headers/libopenpgp_bridge.h similarity index 100% rename from ios/libopenpgp_bridge.h rename to ios/Openpgp.xcframework/ios-arm64/Headers/libopenpgp_bridge.h diff --git a/ios/Openpgp.xcframework/ios-arm64/libopenpgp_bridge.a b/ios/Openpgp.xcframework/ios-arm64/libopenpgp_bridge.a new file mode 100644 index 0000000..23c6c8d Binary files /dev/null and b/ios/Openpgp.xcframework/ios-arm64/libopenpgp_bridge.a differ diff --git a/ios/Openpgp.xcframework/ios-arm64_x86_64-maccatalyst/Headers/libopenpgp_bridge.h b/ios/Openpgp.xcframework/ios-arm64_x86_64-maccatalyst/Headers/libopenpgp_bridge.h new file mode 100644 index 0000000..9b3d2bd --- /dev/null +++ b/ios/Openpgp.xcframework/ios-arm64_x86_64-maccatalyst/Headers/libopenpgp_bridge.h @@ -0,0 +1,87 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package command-line-arguments */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 3 "main.go" +#include +#include +typedef struct { void* message; int size; char* error; } BytesReturn; + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern BytesReturn* OpenPGPBridgeCall(char* name, void* payload, int payloadSize); + +#ifdef __cplusplus +} +#endif diff --git a/ios/Openpgp.xcframework/ios-arm64_x86_64-maccatalyst/libopenpgp_bridge.a b/ios/Openpgp.xcframework/ios-arm64_x86_64-maccatalyst/libopenpgp_bridge.a new file mode 100644 index 0000000..19f3692 Binary files /dev/null and b/ios/Openpgp.xcframework/ios-arm64_x86_64-maccatalyst/libopenpgp_bridge.a differ diff --git a/ios/Openpgp.xcframework/ios-arm64_x86_64-simulator/Headers/libopenpgp_bridge.h b/ios/Openpgp.xcframework/ios-arm64_x86_64-simulator/Headers/libopenpgp_bridge.h new file mode 100644 index 0000000..9b3d2bd --- /dev/null +++ b/ios/Openpgp.xcframework/ios-arm64_x86_64-simulator/Headers/libopenpgp_bridge.h @@ -0,0 +1,87 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package command-line-arguments */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 3 "main.go" +#include +#include +typedef struct { void* message; int size; char* error; } BytesReturn; + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern BytesReturn* OpenPGPBridgeCall(char* name, void* payload, int payloadSize); + +#ifdef __cplusplus +} +#endif diff --git a/ios/libopenpgp_bridge.a b/ios/Openpgp.xcframework/ios-arm64_x86_64-simulator/libopenpgp_bridge.a similarity index 50% rename from ios/libopenpgp_bridge.a rename to ios/Openpgp.xcframework/ios-arm64_x86_64-simulator/libopenpgp_bridge.a index 622d189..ab57b29 100644 Binary files a/ios/libopenpgp_bridge.a and b/ios/Openpgp.xcframework/ios-arm64_x86_64-simulator/libopenpgp_bridge.a differ diff --git a/ios/openpgp.podspec b/ios/openpgp.podspec index ebe7da0..2f5890c 100755 --- a/ios/openpgp.podspec +++ b/ios/openpgp.podspec @@ -2,7 +2,7 @@ # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. # Run `pod lib lint openpgp.podspec' to validate before publishing. # -shared_lib = File.join(__dir__, "libopenpgp_bridge.a").gsub(/ /, '\ ') +framework_path = File.join(__dir__, "Openpgp.xcframework").gsub(/ /, '\ ') Pod::Spec.new do |s| s.name = 'openpgp' @@ -16,14 +16,18 @@ Pod::Spec.new do |s| s.author = { 'Gerson Alexander Pardo Gamez' => 'jeral17@gmail.com' } s.source = { :path => '.' } s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' - s.vendored_libraries = '*.a' + s.dependency 'Flutter' - s.platform = :ios, '8.0' - s.xcconfig = { 'OTHER_LDFLAGS' => "-force_load '#{shared_lib}'"} + s.platform = :ios, '12.0' + s.vendored_frameworks = 'Openpgp.xcframework' # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. - s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } - s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } + s.pod_target_xcconfig = { + 'DEFINES_MODULE' => 'YES', + 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386', + 'OTHER_LDFLAGS[sdk=iphoneos*]' => "-force_load #{framework_path}/ios-arm64/libopenpgp_bridge.a", + 'OTHER_LDFLAGS[sdk=iphonesimulator*]' => "-force_load #{framework_path}/ios-arm64_x86_64-simulator/libopenpgp_bridge.a", + 'OTHER_LDFLAGS[sdk=maccatalyst*]' => "-force_load #{framework_path}/ios-arm64_x86_64-maccatalyst/libopenpgp_bridge.a" + } s.swift_version = '5.0' end diff --git a/lib/model/bridge_model_generated.dart b/lib/model/bridge_model_generated.dart index eb48542..481102f 100644 --- a/lib/model/bridge_model_generated.dart +++ b/lib/model/bridge_model_generated.dart @@ -52,7 +52,7 @@ class _AlgorithmReader extends fb.Reader { const _AlgorithmReader(); @override - int get size => 1; + int get size => 4; @override Algorithm read(fb.BufferContext bc, int offset) => @@ -111,7 +111,7 @@ class _CurveReader extends fb.Reader { const _CurveReader(); @override - int get size => 1; + int get size => 4; @override Curve read(fb.BufferContext bc, int offset) => @@ -160,7 +160,7 @@ class _HashReader extends fb.Reader { const _HashReader(); @override - int get size => 1; + int get size => 4; @override Hash read(fb.BufferContext bc, int offset) => @@ -203,7 +203,7 @@ class _CompressionReader extends fb.Reader { const _CompressionReader(); @override - int get size => 1; + int get size => 4; @override Compression read(fb.BufferContext bc, int offset) => @@ -254,7 +254,7 @@ class _CipherReader extends fb.Reader { const _CipherReader(); @override - int get size => 1; + int get size => 4; @override Cipher read(fb.BufferContext bc, int offset) => @@ -285,7 +285,7 @@ class EncryptRequest { @override String toString() { - return 'EncryptRequest{message: $message, publicKey: $publicKey, options: $options, signed: $signed, fileHints: $fileHints}'; + return 'EncryptRequest{message: ${message}, publicKey: ${publicKey}, options: ${options}, signed: ${signed}, fileHints: ${fileHints}}'; } } @@ -410,7 +410,7 @@ class EncryptFileRequest { @override String toString() { - return 'EncryptFileRequest{input: $input, output: $output, publicKey: $publicKey, options: $options, signed: $signed, fileHints: $fileHints}'; + return 'EncryptFileRequest{input: ${input}, output: ${output}, publicKey: ${publicKey}, options: ${options}, signed: ${signed}, fileHints: ${fileHints}}'; } } @@ -544,7 +544,7 @@ class EncryptBytesRequest { @override String toString() { - return 'EncryptBytesRequest{message: $message, publicKey: $publicKey, options: $options, signed: $signed, fileHints: $fileHints}'; + return 'EncryptBytesRequest{message: ${message}, publicKey: ${publicKey}, options: ${options}, signed: ${signed}, fileHints: ${fileHints}}'; } } @@ -666,7 +666,7 @@ class DecryptRequest { @override String toString() { - return 'DecryptRequest{message: $message, privateKey: $privateKey, passphrase: $passphrase, options: $options, signed: $signed}'; + return 'DecryptRequest{message: ${message}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}, signed: ${signed}}'; } } @@ -792,7 +792,7 @@ class DecryptFileRequest { @override String toString() { - return 'DecryptFileRequest{input: $input, output: $output, privateKey: $privateKey, passphrase: $passphrase, options: $options, signed: $signed}'; + return 'DecryptFileRequest{input: ${input}, output: ${output}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}, signed: ${signed}}'; } } @@ -927,7 +927,7 @@ class DecryptBytesRequest { @override String toString() { - return 'DecryptBytesRequest{message: $message, privateKey: $privateKey, passphrase: $passphrase, options: $options, signed: $signed}'; + return 'DecryptBytesRequest{message: ${message}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}, signed: ${signed}}'; } } @@ -1049,7 +1049,7 @@ class SignRequest { @override String toString() { - return 'SignRequest{message: $message, privateKey: $privateKey, passphrase: $passphrase, options: $options}'; + return 'SignRequest{message: ${message}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -1067,7 +1067,7 @@ class SignRequestBuilder { final fb.Builder fbBuilder; void begin() { - fbBuilder.startTable(4); + fbBuilder.startTable(5); } int addMessageOffset(int? offset) { @@ -1121,7 +1121,7 @@ class SignRequestObjectBuilder extends fb.ObjectBuilder { final int? passphraseOffset = _passphrase == null ? null : fbBuilder.writeString(_passphrase!); final int? optionsOffset = _options?.getOrCreateOffset(fbBuilder); - fbBuilder.startTable(4); + fbBuilder.startTable(5); fbBuilder.addOffset(0, messageOffset); fbBuilder.addOffset(2, privateKeyOffset); fbBuilder.addOffset(3, passphraseOffset); @@ -1161,7 +1161,7 @@ class SignFileRequest { @override String toString() { - return 'SignFileRequest{input: $input, privateKey: $privateKey, passphrase: $passphrase, options: $options}'; + return 'SignFileRequest{input: ${input}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -1179,7 +1179,7 @@ class SignFileRequestBuilder { final fb.Builder fbBuilder; void begin() { - fbBuilder.startTable(4); + fbBuilder.startTable(5); } int addInputOffset(int? offset) { @@ -1233,7 +1233,7 @@ class SignFileRequestObjectBuilder extends fb.ObjectBuilder { final int? passphraseOffset = _passphrase == null ? null : fbBuilder.writeString(_passphrase!); final int? optionsOffset = _options?.getOrCreateOffset(fbBuilder); - fbBuilder.startTable(4); + fbBuilder.startTable(5); fbBuilder.addOffset(0, inputOffset); fbBuilder.addOffset(2, privateKeyOffset); fbBuilder.addOffset(3, passphraseOffset); @@ -1273,7 +1273,7 @@ class SignBytesRequest { @override String toString() { - return 'SignBytesRequest{message: $message, privateKey: $privateKey, passphrase: $passphrase, options: $options}'; + return 'SignBytesRequest{message: ${message}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -1291,7 +1291,7 @@ class SignBytesRequestBuilder { final fb.Builder fbBuilder; void begin() { - fbBuilder.startTable(4); + fbBuilder.startTable(5); } int addMessageOffset(int? offset) { @@ -1345,7 +1345,7 @@ class SignBytesRequestObjectBuilder extends fb.ObjectBuilder { final int? passphraseOffset = _passphrase == null ? null : fbBuilder.writeString(_passphrase!); final int? optionsOffset = _options?.getOrCreateOffset(fbBuilder); - fbBuilder.startTable(4); + fbBuilder.startTable(5); fbBuilder.addOffset(0, messageOffset); fbBuilder.addOffset(2, privateKeyOffset); fbBuilder.addOffset(3, passphraseOffset); @@ -1385,7 +1385,7 @@ class SignDataRequest { @override String toString() { - return 'SignDataRequest{message: $message, privateKey: $privateKey, passphrase: $passphrase, options: $options}'; + return 'SignDataRequest{message: ${message}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -1498,7 +1498,7 @@ class SignDataBytesRequest { @override String toString() { - return 'SignDataBytesRequest{message: $message, privateKey: $privateKey, passphrase: $passphrase, options: $options}'; + return 'SignDataBytesRequest{message: ${message}, privateKey: ${privateKey}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -1608,7 +1608,7 @@ class VerifyRequest { @override String toString() { - return 'VerifyRequest{signature: $signature, message: $message, publicKey: $publicKey}'; + return 'VerifyRequest{signature: ${signature}, message: ${message}, publicKey: ${publicKey}}'; } } @@ -1708,7 +1708,7 @@ class VerifyFileRequest { @override String toString() { - return 'VerifyFileRequest{signature: $signature, input: $input, publicKey: $publicKey}'; + return 'VerifyFileRequest{signature: ${signature}, input: ${input}, publicKey: ${publicKey}}'; } } @@ -1809,7 +1809,7 @@ class VerifyBytesRequest { @override String toString() { - return 'VerifyBytesRequest{signature: $signature, message: $message, publicKey: $publicKey}'; + return 'VerifyBytesRequest{signature: ${signature}, message: ${message}, publicKey: ${publicKey}}'; } } @@ -1907,7 +1907,7 @@ class VerifyDataRequest { @override String toString() { - return 'VerifyDataRequest{signature: $signature, publicKey: $publicKey}'; + return 'VerifyDataRequest{signature: ${signature}, publicKey: ${publicKey}}'; } } @@ -1995,7 +1995,7 @@ class VerifyDataBytesRequest { @override String toString() { - return 'VerifyDataBytesRequest{signature: $signature, publicKey: $publicKey}'; + return 'VerifyDataBytesRequest{signature: ${signature}, publicKey: ${publicKey}}'; } } @@ -2088,7 +2088,7 @@ class EncryptSymmetricRequest { @override String toString() { - return 'EncryptSymmetricRequest{message: $message, passphrase: $passphrase, options: $options, fileHints: $fileHints}'; + return 'EncryptSymmetricRequest{message: ${message}, passphrase: ${passphrase}, options: ${options}, fileHints: ${fileHints}}'; } } @@ -2203,7 +2203,7 @@ class EncryptSymmetricFileRequest { @override String toString() { - return 'EncryptSymmetricFileRequest{input: $input, output: $output, passphrase: $passphrase, options: $options, fileHints: $fileHints}'; + return 'EncryptSymmetricFileRequest{input: ${input}, output: ${output}, passphrase: ${passphrase}, options: ${options}, fileHints: ${fileHints}}'; } } @@ -2327,7 +2327,7 @@ class EncryptSymmetricBytesRequest { @override String toString() { - return 'EncryptSymmetricBytesRequest{message: $message, passphrase: $passphrase, options: $options, fileHints: $fileHints}'; + return 'EncryptSymmetricBytesRequest{message: ${message}, passphrase: ${passphrase}, options: ${options}, fileHints: ${fileHints}}'; } } @@ -2438,7 +2438,7 @@ class DecryptSymmetricRequest { @override String toString() { - return 'DecryptSymmetricRequest{message: $message, passphrase: $passphrase, options: $options}'; + return 'DecryptSymmetricRequest{message: ${message}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -2541,7 +2541,7 @@ class DecryptSymmetricFileRequest { @override String toString() { - return 'DecryptSymmetricFileRequest{input: $input, output: $output, passphrase: $passphrase, options: $options}'; + return 'DecryptSymmetricFileRequest{input: ${input}, output: ${output}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -2653,7 +2653,7 @@ class DecryptSymmetricBytesRequest { @override String toString() { - return 'DecryptSymmetricBytesRequest{message: $message, passphrase: $passphrase, options: $options}'; + return 'DecryptSymmetricBytesRequest{message: ${message}, passphrase: ${passphrase}, options: ${options}}'; } } @@ -2748,7 +2748,7 @@ class GenerateRequest { @override String toString() { - return 'GenerateRequest{options: $options}'; + return 'GenerateRequest{options: ${options}}'; } } @@ -2824,7 +2824,7 @@ class ArmorEncodeRequest { @override String toString() { - return 'ArmorEncodeRequest{packet: $packet, type: $type}'; + return 'ArmorEncodeRequest{packet: ${packet}, type: ${type}}'; } } @@ -2910,7 +2910,7 @@ class ArmorDecodeRequest { @override String toString() { - return 'ArmorDecodeRequest{message: $message}'; + return 'ArmorDecodeRequest{message: ${message}}'; } } @@ -2985,7 +2985,7 @@ class GetPublicKeyMetadataRequest { @override String toString() { - return 'GetPublicKeyMetadataRequest{publicKey: $publicKey}'; + return 'GetPublicKeyMetadataRequest{publicKey: ${publicKey}}'; } } @@ -3061,7 +3061,7 @@ class GetPrivateKeyMetadataRequest { @override String toString() { - return 'GetPrivateKeyMetadataRequest{privateKey: $privateKey}'; + return 'GetPrivateKeyMetadataRequest{privateKey: ${privateKey}}'; } } @@ -3137,7 +3137,7 @@ class ConvertPrivateKeyToPublicKeyRequest { @override String toString() { - return 'ConvertPrivateKeyToPublicKeyRequest{privateKey: $privateKey}'; + return 'ConvertPrivateKeyToPublicKeyRequest{privateKey: ${privateKey}}'; } } @@ -3253,7 +3253,7 @@ class KeyOptions { @override String toString() { - return 'KeyOptions{algorithm: $algorithm, curve: $curve, hash: $hash, cipher: $cipher, compression: $compression, compressionLevel: $compressionLevel, rsaBits: $rsaBits}'; + return 'KeyOptions{algorithm: ${algorithm}, curve: ${curve}, hash: ${hash}, cipher: ${cipher}, compression: ${compression}, compressionLevel: ${compressionLevel}, rsaBits: ${rsaBits}}'; } } @@ -3387,7 +3387,7 @@ class Options { @override String toString() { - return 'Options{name: $name, comment: $comment, email: $email, passphrase: $passphrase, keyOptions: $keyOptions}'; + return 'Options{name: ${name}, comment: ${comment}, email: ${email}, passphrase: ${passphrase}, keyOptions: ${keyOptions}}'; } } @@ -3516,7 +3516,7 @@ class FileHints { @override String toString() { - return 'FileHints{isBinary: $isBinary, fileName: $fileName, modTime: $modTime}'; + return 'FileHints{isBinary: ${isBinary}, fileName: ${fileName}, modTime: ${modTime}}'; } } @@ -3617,7 +3617,7 @@ class Entity { @override String toString() { - return 'Entity{publicKey: $publicKey, privateKey: $privateKey, passphrase: $passphrase}'; + return 'Entity{publicKey: ${publicKey}, privateKey: ${privateKey}, passphrase: ${passphrase}}'; } } @@ -3714,7 +3714,7 @@ class StringResponse { @override String toString() { - return 'StringResponse{output: $output, error: $error}'; + return 'StringResponse{output: ${output}, error: ${error}}'; } } @@ -3801,7 +3801,7 @@ class BytesResponse { @override String toString() { - return 'BytesResponse{output: $output, error: $error}'; + return 'BytesResponse{output: ${output}, error: ${error}}'; } } @@ -3887,7 +3887,7 @@ class BoolResponse { @override String toString() { - return 'BoolResponse{output: $output, error: $error}'; + return 'BoolResponse{output: ${output}, error: ${error}}'; } } @@ -3971,7 +3971,7 @@ class IntResponse { @override String toString() { - return 'IntResponse{output: $output, error: $error}'; + return 'IntResponse{output: ${output}, error: ${error}}'; } } @@ -4057,7 +4057,7 @@ class ArmorDecodeResponse { @override String toString() { - return 'ArmorDecodeResponse{output: $output, error: $error}'; + return 'ArmorDecodeResponse{output: ${output}, error: ${error}}'; } } @@ -4143,7 +4143,7 @@ class ArmorMetadata { @override String toString() { - return 'ArmorMetadata{body: $body, type: $type}'; + return 'ArmorMetadata{body: ${body}, type: ${type}}'; } } @@ -4229,7 +4229,7 @@ class KeyPairResponse { @override String toString() { - return 'KeyPairResponse{output: $output, error: $error}'; + return 'KeyPairResponse{output: ${output}, error: ${error}}'; } } @@ -4315,7 +4315,7 @@ class KeyPair { @override String toString() { - return 'KeyPair{publicKey: $publicKey, privateKey: $privateKey}'; + return 'KeyPair{publicKey: ${publicKey}, privateKey: ${privateKey}}'; } } @@ -4403,7 +4403,7 @@ class PublicKeyMetadataResponse { @override String toString() { - return 'PublicKeyMetadataResponse{output: $output, error: $error}'; + return 'PublicKeyMetadataResponse{output: ${output}, error: ${error}}'; } } @@ -4491,7 +4491,7 @@ class PrivateKeyMetadataResponse { @override String toString() { - return 'PrivateKeyMetadataResponse{output: $output, error: $error}'; + return 'PrivateKeyMetadataResponse{output: ${output}, error: ${error}}'; } } @@ -4582,7 +4582,7 @@ class Identity { @override String toString() { - return 'Identity{id: $id, comment: $comment, email: $email, name: $name}'; + return 'Identity{id: ${id}, comment: ${comment}, email: ${email}, name: ${name}}'; } } @@ -4710,7 +4710,7 @@ class PublicKeyMetadata { @override String toString() { - return 'PublicKeyMetadata{algorithm: $algorithm, keyId: $keyId, keyIdShort: $keyIdShort, creationTime: $creationTime, fingerprint: $fingerprint, keyIdNumeric: $keyIdNumeric, isSubKey: $isSubKey, canSign: $canSign, canEncrypt: $canEncrypt, identities: $identities, subKeys: $subKeys}'; + return 'PublicKeyMetadata{algorithm: ${algorithm}, keyId: ${keyId}, keyIdShort: ${keyIdShort}, creationTime: ${creationTime}, fingerprint: ${fingerprint}, keyIdNumeric: ${keyIdNumeric}, isSubKey: ${isSubKey}, canSign: ${canSign}, canEncrypt: ${canEncrypt}, identities: ${identities}, subKeys: ${subKeys}}'; } } @@ -4913,7 +4913,7 @@ class PrivateKeyMetadata { @override String toString() { - return 'PrivateKeyMetadata{keyId: $keyId, keyIdShort: $keyIdShort, creationTime: $creationTime, fingerprint: $fingerprint, keyIdNumeric: $keyIdNumeric, isSubKey: $isSubKey, encrypted: $encrypted, canSign: $canSign, identities: $identities, subKeys: $subKeys}'; + return 'PrivateKeyMetadata{keyId: ${keyId}, keyIdShort: ${keyIdShort}, creationTime: ${creationTime}, fingerprint: ${fingerprint}, keyIdNumeric: ${keyIdNumeric}, isSubKey: ${isSubKey}, encrypted: ${encrypted}, canSign: ${canSign}, identities: ${identities}, subKeys: ${subKeys}}'; } } diff --git a/lib/openpgp.dart b/lib/openpgp.dart index 66346de..4c6bcc3 100755 --- a/lib/openpgp.dart +++ b/lib/openpgp.dart @@ -171,7 +171,7 @@ class ArmorMetadata { } class OpenPGP { - static const MethodChannel _channel = const MethodChannel('openpgp'); + static const MethodChannel _channel = MethodChannel('openpgp'); static bool bindingEnabled = Binding().isSupported(); static Future _call(String name, Uint8List payload) async { @@ -186,7 +186,7 @@ class OpenPGP { var data = await _call(name, payload); var response = model.BytesResponse(data); if (response.error != null && response.error != "") { - throw new OpenPGPException(response.error!); + throw OpenPGPException(response.error!); } return Uint8List.fromList(response.output!); } @@ -195,7 +195,7 @@ class OpenPGP { var data = await _call(name, payload); var response = model.StringResponse(data); if (response.error != null && response.error != "") { - throw new OpenPGPException(response.error!); + throw OpenPGPException(response.error!); } return response.output!; } @@ -204,7 +204,7 @@ class OpenPGP { var data = await _call(name, payload); var response = model.BoolResponse(data); if (response.error != null && response.error != "") { - throw new OpenPGPException(response.error!); + throw OpenPGPException(response.error!); } return response.output; } @@ -214,7 +214,7 @@ class OpenPGP { var data = await _call(name, payload); var response = model.PublicKeyMetadataResponse(data); if (response.error != null && response.error != "") { - throw new OpenPGPException(response.error!); + throw OpenPGPException(response.error!); } var metadata = response.output!; return PublicKeyMetadata( @@ -236,7 +236,7 @@ class OpenPGP { var data = await _call(name, payload); var response = model.PrivateKeyMetadataResponse(data); if (response.error != null && response.error != "") { - throw new OpenPGPException(response.error!); + throw OpenPGPException(response.error!); } var metadata = response.output!; return PrivateKeyMetadata( @@ -257,7 +257,7 @@ class OpenPGP { var data = await _call(name, payload); var response = model.ArmorDecodeResponse(data); if (response.error != null && response.error != "") { - throw new OpenPGPException(response.error!); + throw OpenPGPException(response.error!); } var metadata = response.output!; return ArmorMetadata( @@ -272,14 +272,14 @@ class OpenPGP { return list; } - identities.forEach((element) { + for (var element in identities) { list.add(Identity( element.id!, element.name!, element.comment!, element.email!, )); - }); + } return list; } @@ -289,7 +289,7 @@ class OpenPGP { var data = await _call(name, payload); var response = model.KeyPairResponse(data); if (response.error != null && response.error != "") { - throw new OpenPGPException(response.error!); + throw OpenPGPException(response.error!); } var keyPair = response.output!; return KeyPair(keyPair.publicKey!, keyPair.privateKey!); diff --git a/lib/web/assets/openpgp.wasm b/lib/web/assets/openpgp.wasm index b058a4c..b3e08f0 100755 Binary files a/lib/web/assets/openpgp.wasm and b/lib/web/assets/openpgp.wasm differ diff --git a/lib/web/openpgp_web.dart b/lib/web/openpgp_web.dart index e0668bf..ba83ff1 100644 --- a/lib/web/openpgp_web.dart +++ b/lib/web/openpgp_web.dart @@ -7,8 +7,7 @@ import 'package:web/web.dart'; class OpenpgpPlugin { var _counter = 0; - Worker worker = - new Worker('assets/packages/openpgp/web/assets/worker.js'.toJS); + Worker worker = Worker('assets/packages/openpgp/web/assets/worker.js'.toJS); Map> completers = {}; static void registerWith(Registrar registrar) { @@ -27,7 +26,7 @@ class OpenpgpPlugin { } void listen() async { - void _onMessage(Event event) { + void onMessage(Event event) { final msgEvent = event as MessageEvent; final data = msgEvent.data as OpenpgpResponse; var completer = completers[data.id]; @@ -42,13 +41,13 @@ class OpenpgpPlugin { completers.remove(data.id); } - worker.onmessage = _onMessage.toJS; + worker.onmessage = onMessage.toJS; } Future bridgeCall(String name, Uint8List? /*!*/ request) async { _counter++; var id = _counter.toString(); - var completer = new Completer(); + var completer = Completer(); completers[id] = completer; worker.postMessage(OpenpgpRequest( id: id, diff --git a/linux/shared/aarch64/libopenpgp_bridge.so b/linux/shared/aarch64/libopenpgp_bridge.so index 6760bf6..59878a1 100644 Binary files a/linux/shared/aarch64/libopenpgp_bridge.so and b/linux/shared/aarch64/libopenpgp_bridge.so differ diff --git a/linux/shared/x86_64/libopenpgp_bridge.so b/linux/shared/x86_64/libopenpgp_bridge.so index bcd7b69..7fa31a2 100644 Binary files a/linux/shared/x86_64/libopenpgp_bridge.so and b/linux/shared/x86_64/libopenpgp_bridge.so differ diff --git a/macos/libopenpgp_bridge.dylib b/macos/libopenpgp_bridge.dylib index 0c9f6f7..d8a4ee9 100644 Binary files a/macos/libopenpgp_bridge.dylib and b/macos/libopenpgp_bridge.dylib differ diff --git a/openpgp.iml b/openpgp.iml index 9a198d2..27686dd 100755 --- a/openpgp.iml +++ b/openpgp.iml @@ -6,15 +6,12 @@ - - - - + - \ No newline at end of file + diff --git a/pubspec.yaml b/pubspec.yaml index 349641d..cfdd4be 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: openpgp description: library for use OpenPGP with support for android and ios, macOS, linux, windows and web -version: 3.8.3 +version: 3.9.0 homepage: https://github.com/jerson/flutter-openpgp environment: - sdk: '>=3.3.0 <4.0.0' - flutter: ">=1.10.0" + sdk: ^3.5.4 + flutter: ">=1.17.0" false_secrets: - /example/lib/*.dart @@ -15,10 +15,12 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter - ffi: ^2.0.1 - flat_buffers: ^2.0.5 - path: ^1.8.2 + ffi: ^2.1.3 + flat_buffers: ^23.5.26 + path: ^1.9.0 web: ">=0.5.0 <2.0.0" + plugin_platform_interface: ^2.0.2 + flutter_lints: ^5.0.0 dev_dependencies: flutter_test: diff --git a/scripts/upgrade_bridge_libs.sh b/scripts/upgrade_bridge_libs.sh index 4b1839a..a300b8e 100755 --- a/scripts/upgrade_bridge_libs.sh +++ b/scripts/upgrade_bridge_libs.sh @@ -9,7 +9,7 @@ REPO="jerson/openpgp-mobile" NAME="libopenpgp_bridge" -PLATFORMS=("android" "darwin" "ios" "wasm" "linux" "linux" "windows") +PLATFORMS=("android" "darwin" "ios_xcframework" "wasm" "linux" "linux" "windows") OUTPUT_DIRS=("android/src/main" "macos" "ios" "lib/web/assets" "linux/shared/x86_64" "linux/shared/aarch64" "windows/shared") OUTPUT_SUB_DIRS=("" "" "" "" "./amd64" "./arm64" "./amd64") OUTPUT_STRIP_DIRS=(1 1 1 1 2 2 2) diff --git a/windows/shared/libopenpgp_bridge.dll b/windows/shared/libopenpgp_bridge.dll index f5577c7..bc4dd73 100644 Binary files a/windows/shared/libopenpgp_bridge.dll and b/windows/shared/libopenpgp_bridge.dll differ