diff --git a/.gitignore b/.gitignore index b75bc42af..e8ac88703 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ pubspec.lock build/ .idea +example/ios/Frameworks/ +example/lib/ui/ diff --git a/example/.vscode/launch.json b/example/.vscode/launch.json new file mode 100644 index 000000000..a33526a17 --- /dev/null +++ b/example/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + + "version": "0.2.0", + "configurations": [ + { + "name": "Flutter Desktop Attach", + "request": "attach", + "observatoryUri": "http://127.0.0.1:52878/UWW_6_X9Y74=/", + "type": "dart" + } + ] +} \ No newline at end of file diff --git a/example/android/.project b/example/android/.project new file mode 100644 index 000000000..3964dd3f5 --- /dev/null +++ b/example/android/.project @@ -0,0 +1,17 @@ + + + android + Project android created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/example/android/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 000000000..e8895216f --- /dev/null +++ b/example/android/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git a/example/android/app/.classpath b/example/android/app/.classpath new file mode 100644 index 000000000..8d8d85f14 --- /dev/null +++ b/example/android/app/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/example/android/app/.project b/example/android/app/.project new file mode 100644 index 000000000..ac485d7c3 --- /dev/null +++ b/example/android/app/.project @@ -0,0 +1,23 @@ + + + app + Project app created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git a/example/android/app/.settings/org.eclipse.buildship.core.prefs b/example/android/app/.settings/org.eclipse.buildship.core.prefs new file mode 100644 index 000000000..b1886adb4 --- /dev/null +++ b/example/android/app/.settings/org.eclipse.buildship.core.prefs @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git a/example/android/app/src/main/gen/com/example/flutterpluginexample/BuildConfig.java b/example/android/app/src/main/gen/com/example/flutterpluginexample/BuildConfig.java new file mode 100644 index 000000000..1888c7a11 --- /dev/null +++ b/example/android/app/src/main/gen/com/example/flutterpluginexample/BuildConfig.java @@ -0,0 +1,8 @@ +/*___Generated_by_IDEA___*/ + +package com.example.flutterpluginexample; + +/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */ +public final class BuildConfig { + public final static boolean DEBUG = Boolean.parseBoolean(null); +} \ No newline at end of file diff --git a/example/android/app/src/main/gen/com/example/flutterpluginexample/Manifest.java b/example/android/app/src/main/gen/com/example/flutterpluginexample/Manifest.java new file mode 100644 index 000000000..22770c8f6 --- /dev/null +++ b/example/android/app/src/main/gen/com/example/flutterpluginexample/Manifest.java @@ -0,0 +1,7 @@ +/*___Generated_by_IDEA___*/ + +package com.example.flutterpluginexample; + +/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */ +public final class Manifest { +} \ No newline at end of file diff --git a/example/android/app/src/main/gen/com/example/flutterpluginexample/R.java b/example/android/app/src/main/gen/com/example/flutterpluginexample/R.java new file mode 100644 index 000000000..7329f17da --- /dev/null +++ b/example/android/app/src/main/gen/com/example/flutterpluginexample/R.java @@ -0,0 +1,7 @@ +/*___Generated_by_IDEA___*/ + +package com.example.flutterpluginexample; + +/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */ +public final class R { +} \ No newline at end of file diff --git a/example/fonts/Roboto/LICENSE.txt b/example/fonts/Roboto/LICENSE.txt new file mode 100755 index 000000000..d64569567 --- /dev/null +++ b/example/fonts/Roboto/LICENSE.txt @@ -0,0 +1,202 @@ + + 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 new file mode 100755 index 000000000..689fe5cb3 Binary files /dev/null and b/example/fonts/Roboto/Roboto-Black.ttf differ diff --git a/example/fonts/Roboto/Roboto-Bold.ttf b/example/fonts/Roboto/Roboto-Bold.ttf new file mode 100755 index 000000000..d3f01ad24 Binary files /dev/null and b/example/fonts/Roboto/Roboto-Bold.ttf differ diff --git a/example/fonts/Roboto/Roboto-Light.ttf b/example/fonts/Roboto/Roboto-Light.ttf new file mode 100755 index 000000000..219063a57 Binary files /dev/null and b/example/fonts/Roboto/Roboto-Light.ttf differ diff --git a/example/fonts/Roboto/Roboto-Medium.ttf b/example/fonts/Roboto/Roboto-Medium.ttf new file mode 100755 index 000000000..1a7f3b0bb Binary files /dev/null and b/example/fonts/Roboto/Roboto-Medium.ttf differ diff --git a/example/fonts/Roboto/Roboto-Regular.ttf b/example/fonts/Roboto/Roboto-Regular.ttf new file mode 100755 index 000000000..2c97eeadf Binary files /dev/null and b/example/fonts/Roboto/Roboto-Regular.ttf differ diff --git a/example/fonts/Roboto/Roboto-Thin.ttf b/example/fonts/Roboto/Roboto-Thin.ttf new file mode 100755 index 000000000..b74a4fd1a Binary files /dev/null and b/example/fonts/Roboto/Roboto-Thin.ttf differ diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 000000000..d077b08bd --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,69 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + pods_ary = [] + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) { |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + pods_ary.push({:name => podname, :path => podpath}); + else + puts "Invalid plugin specification: #{line}" + end + } + return pods_ary +end + +target 'Runner' do + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf .symlinks') + system('mkdir -p .symlinks/plugins') + + # Flutter Pods + generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') + if generated_xcode_build_settings.empty? + puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." + end + generated_xcode_build_settings.map { |p| + if p[:name] == 'FLUTTER_FRAMEWORK_DIR' + symlink = File.join('.symlinks', 'flutter') + File.symlink(File.dirname(p[:path]), symlink) + pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) + end + } + + # Plugin Pods + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.map { |p| + symlink = File.join('.symlinks', 'plugins', p[:name]) + File.symlink(p[:path], symlink) + pod p[:name], :path => File.join(symlink, 'ios') + } +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end + end +end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock new file mode 100644 index 000000000..82fdc71c4 --- /dev/null +++ b/example/ios/Podfile.lock @@ -0,0 +1,46 @@ +PODS: + - devicelocale (0.0.1): + - Flutter + - Flutter (1.0.0) + - flutter_stetho (0.0.1): + - Flutter + - package_info (0.0.1): + - Flutter + - path_provider (0.0.1): + - Flutter + - shared_preferences (0.0.1): + - Flutter + +DEPENDENCIES: + - devicelocale (from `.symlinks/plugins/devicelocale/ios`) + - Flutter (from `.symlinks/flutter/ios`) + - flutter_stetho (from `.symlinks/plugins/flutter_stetho/ios`) + - package_info (from `.symlinks/plugins/package_info/ios`) + - path_provider (from `.symlinks/plugins/path_provider/ios`) + - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + +EXTERNAL SOURCES: + devicelocale: + :path: ".symlinks/plugins/devicelocale/ios" + Flutter: + :path: ".symlinks/flutter/ios" + flutter_stetho: + :path: ".symlinks/plugins/flutter_stetho/ios" + package_info: + :path: ".symlinks/plugins/package_info/ios" + path_provider: + :path: ".symlinks/plugins/path_provider/ios" + shared_preferences: + :path: ".symlinks/plugins/shared_preferences/ios" + +SPEC CHECKSUMS: + devicelocale: c1be0ad8a4bc50c184faf25bf8abe318e9bd69ba + Flutter: 9d0fac939486c9aba2809b7982dfdbb47a7b0296 + flutter_stetho: 21464137ea9bb03914912de8916a7acfdcbfc0a5 + package_info: d7c98b64f60add4c2908b9d94d82a45d3c8827ad + path_provider: 09407919825bfe3c2deae39453b7a5b44f467873 + shared_preferences: 5a1d487c427ee18fcd3ea1f2a131569481834b53 + +PODFILE CHECKSUM: aff02bfeed411c636180d6812254b2daeea14d09 + +COCOAPODS: 1.5.3 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 62cfaee1f..d815bf063 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -8,10 +8,10 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 625C4B9D1DA0D3B17981BD26 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 24DF2572E6AEEB9F7CE180C9 /* libPods-Runner.a */; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; @@ -41,7 +41,7 @@ /* Begin PBXFileReference section */ 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 = ""; }; - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; + 24DF2572E6AEEB9F7CE180C9 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -65,16 +65,31 @@ files = ( 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + 625C4B9D1DA0D3B17981BD26 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 4BCFFDB2D551EB587ABE1DF7 /* Pods */ = { + isa = PBXGroup; + children = ( + ); + name = Pods; + sourceTree = ""; + }; + 954CC7E1BE4CD1A8DB92D3D1 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 24DF2572E6AEEB9F7CE180C9 /* libPods-Runner.a */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 9740EEBA1CF902C7004384FC /* Flutter.framework */, @@ -91,7 +106,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, - CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, + 4BCFFDB2D551EB587ABE1DF7 /* Pods */, + 954CC7E1BE4CD1A8DB92D3D1 /* Frameworks */, ); sourceTree = ""; }; @@ -134,12 +150,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 5460248742F7DA24FCBDE190 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 8FD17E7A6A3934360E74DBF1 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -192,7 +210,6 @@ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -214,6 +231,42 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; }; + 5460248742F7DA24FCBDE190 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + 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; + }; + 8FD17E7A6A3934360E74DBF1 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", + "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a16e..21a3cc14c 100644 --- a/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..949b67898 --- /dev/null +++ b/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Original + + diff --git a/example/lib/ui/main.dart b/example/lib/main.dart similarity index 92% rename from example/lib/ui/main.dart rename to example/lib/main.dart index d1bbf98aa..13b452e2e 100644 --- a/example/lib/ui/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,7 @@ import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_plugin_example/data/base/api_response.dart'; import 'package:flutter_plugin_example/data/model/diet_plan.dart'; @@ -13,9 +15,23 @@ import 'package:parse_server_sdk/parse_server_sdk.dart'; void main() { Stetho.initialize(); + _setTargetPlatformForDesktop(); + runApp(MyApp()); } +void _setTargetPlatformForDesktop() { + TargetPlatform targetPlatform; + if (Platform.isMacOS) { + targetPlatform = TargetPlatform.iOS; + } else if (Platform.isLinux || Platform.isWindows) { + targetPlatform = TargetPlatform.android; + } + if (targetPlatform != null) { + debugDefaultTargetPlatformOverride = targetPlatform; + } +} + class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); @@ -24,11 +40,12 @@ class MyApp extends StatefulWidget { class _MyAppState extends State { DietPlanRepository dietPlanRepo; UserRepository userRepo; + String text = ""; @override void initState() { super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) => initData()); + initData(); } @override @@ -39,7 +56,7 @@ class _MyAppState extends State { title: const Text('Plugin example app'), ), body: Center( - child: const Text('Running Parse init'), + child: Text(text), ), ), ); @@ -47,7 +64,7 @@ class _MyAppState extends State { Future initData() async { // Initialize repository - await initRepository(); + // await initRepository(); // Initialize parse Parse().initialize(keyParseApplicationId, keyParseServerUrl, @@ -55,9 +72,12 @@ class _MyAppState extends State { // Check server is healthy and live - Debug is on in this instance so check logs for result final ParseResponse response = await Parse().healthCheck(); + if (response.success) { await runTestQueries(); + text += 'runTestQueries\n'; } else { + text += 'Server health check failed'; print('Server health check failed'); } } @@ -69,13 +89,16 @@ class _MyAppState extends State { //await repositoryGetAllItems(); //Basic usage - //createItem(); - //getAllItems(); - //getAllItemsByName(); - //getSingleItem(); - //getConfigs(); - //query(); - initUser(); + // createItem(); + // getAllItems(); + // getAllItemsByName(); + // getSingleItem(); + // getConfigs(); + // query(); + // initUser(); + var instalattion = await ParseInstallation.currentInstallation(); + var rees = instalattion.create(); + print(rees); //function(); //functionWithParameters(); // test(); @@ -239,16 +262,11 @@ class _MyAppState extends State { user = response.result; } - /// Remove a user and delete - final ParseResponse destroyResponse = await user.destroy(); - if (destroyResponse.success) { - print('object has been destroyed!'); - } - // Returns type ParseResponse as its a query, not a single result response = await ParseUser.all(); if (response.success) { // We have a list of all users (LIMIT SET VIA SDK) + print(response.results); } final QueryBuilder queryBuilder = diff --git a/example/linux/.gitignore b/example/linux/.gitignore new file mode 100644 index 000000000..ce85570b6 --- /dev/null +++ b/example/linux/.gitignore @@ -0,0 +1 @@ +.generated_flutter_root diff --git a/example/linux/Makefile b/example/linux/Makefile new file mode 100644 index 000000000..2cbe159ea --- /dev/null +++ b/example/linux/Makefile @@ -0,0 +1,143 @@ +# Copyright 2018 Google LLC +# +# 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. + +# Example-specific variables. +# To modify this Makefile for a different application, these are the values +# that are mostly likely to need to be changed. + +# Executable name. +BINARY_NAME=flutter_desktop_example +# The C++ code for the embedder application. +SOURCES=flutter_embedder_example.cc + + +# Default build type. For a release build, set BUILD=release. +# Currently this only sets NDEBUG, which is used to control the flags passed +# to the Flutter engine in the example shell, and not the complation settings +# (e.g., optimization level) of the C++ code. +BUILD=debug + +# Dependency locations +FLUTTER_APP_DIR=$(CURDIR)/.. +FLUTTER_APP_BUILD_DIR=$(FLUTTER_APP_DIR)/build +FLUTTER_ROOT:=$(shell cat $(CURDIR)/.generated_flutter_root) +FLUTTER_ARTIFACT_CACHE_DIR=$(FLUTTER_ROOT)/bin/cache/artifacts/engine/linux-x64 + +OUT_DIR=$(FLUTTER_APP_BUILD_DIR)/linux +CACHE_DIR=$(OUT_DIR)/cache +FLUTTER_LIBRARY_COPY_DIR=$(CACHE_DIR)/flutter_library + +FLUTTER_LIB_NAME=flutter_linux +FLUTTER_LIB=$(FLUTTER_LIBRARY_COPY_DIR)/lib$(FLUTTER_LIB_NAME).so + +# Tools +FLUTTER_BIN=$(FLUTTER_ROOT)/bin/flutter + +# Resources +ICU_DATA_NAME=icudtl.dat +ICU_DATA_SOURCE=$(FLUTTER_ARTIFACT_CACHE_DIR)/$(ICU_DATA_NAME) +FLUTTER_ASSETS_NAME=flutter_assets +FLUTTER_ASSETS_SOURCE=$(FLUTTER_APP_BUILD_DIR)/$(FLUTTER_ASSETS_NAME) + +# Bundle structure +BUNDLE_OUT_DIR=$(OUT_DIR)/$(BUILD) +BUNDLE_DATA_DIR=$(BUNDLE_OUT_DIR)/data +BUNDLE_LIB_DIR=$(BUNDLE_OUT_DIR)/lib + +BIN_OUT=$(BUNDLE_OUT_DIR)/$(BINARY_NAME) +ICU_DATA_OUT=$(BUNDLE_DATA_DIR)/$(ICU_DATA_NAME) +FLUTTER_LIB_OUT=$(BUNDLE_LIB_DIR)/$(notdir $(FLUTTER_LIB)) + +# Add relevant code from the wrapper library, which is intended to be statically +# built into the client. +WRAPPER_ROOT=$(FLUTTER_LIBRARY_COPY_DIR)/cpp_client_wrapper +WRAPPER_SOURCES= \ + $(WRAPPER_ROOT)/flutter_window_controller.cc \ + $(WRAPPER_ROOT)/plugin_registrar.cc \ + $(WRAPPER_ROOT)/engine_method_result.cc +SOURCES+=$(WRAPPER_SOURCES) + +# Headers +WRAPPER_INCLUDE_DIR=$(WRAPPER_ROOT)/include +INCLUDE_DIRS=$(FLUTTER_LIBRARY_COPY_DIR) $(WRAPPER_INCLUDE_DIR) + +# The stamp file created by copy_flutter_files. +FLUTTER_COPY_STAMP_FILE=$(FLUTTER_LIBRARY_COPY_DIR)/.last_copied_flutter_version +# The Flutter engine version file. +FLUTTER_ENGINE_VERSION_FILE=$(FLUTTER_ROOT)/bin/internal/engine.version + +# Build settings +CXX=g++ -std=c++14 +CXXFLAGS.release=-DNDEBUG +CXXFLAGS=-Wall -Werror $(CXXFLAGS.$(BUILD)) +CPPFLAGS=$(patsubst %,-I%,$(INCLUDE_DIRS)) +LDFLAGS=-L$(BUNDLE_LIB_DIR) \ + -l$(FLUTTER_LIB_NAME) \ + -Wl,-rpath=\$$ORIGIN/lib + +# Targets + +.PHONY: all +all: $(BIN_OUT) bundle + +.PHONY: bundle +bundle: $(ICU_DATA_OUT) $(FLUTTER_LIB_OUT) bundleflutterassets + +$(BIN_OUT): $(SOURCES) $(FLUTTER_LIB_OUT) + mkdir -p $(@D) + $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(SOURCES) $(LDFLAGS) -o $@ + +$(WRAPPER_SOURCES) $(FLUTTER_LIB) $(ICU_DATA_SOURCE): $(FLUTTER_COPY_STAMP_FILE) + +# When the Flutter engine version changes, the local copy of engine artifacts +# needs to be updated. +$(FLUTTER_COPY_STAMP_FILE): $(FLUTTER_ENGINE_VERSION_FILE) + $(FLUTTER_BIN) precache --linux --no-android --no-ios + rm -rf $(FLUTTER_LIBRARY_COPY_DIR) + mkdir -p $(FLUTTER_LIBRARY_COPY_DIR) + cp $(FLUTTER_ARTIFACT_CACHE_DIR)/*.h $(FLUTTER_LIBRARY_COPY_DIR)/ + cp $(FLUTTER_ARTIFACT_CACHE_DIR)/*.so $(FLUTTER_LIBRARY_COPY_DIR)/ + cp -r $(FLUTTER_ARTIFACT_CACHE_DIR)/cpp_client_wrapper \ + $(FLUTTER_LIBRARY_COPY_DIR)/ + touch $(FLUTTER_COPY_STAMP_FILE) + +$(FLUTTER_LIB_OUT): $(FLUTTER_LIB) + mkdir -p $(BUNDLE_LIB_DIR) + cp $(FLUTTER_LIB) $(BUNDLE_LIB_DIR) + +$(ICU_DATA_OUT): $(ICU_DATA_SOURCE) + mkdir -p $(dir $(ICU_DATA_OUT)) + cp $(ICU_DATA_SOURCE) $(ICU_DATA_OUT) + +# Fully re-copy the assets directory on each build to avoid having to keep a +# comprehensive list of all asset files here, which would be fragile to changes +# in the Flutter example (e.g., adding a new font to pubspec.yaml would require +# changes here). +.PHONY: bundleflutterassets +bundleflutterassets: $(FLUTTER_ASSETS_SOURCE) + mkdir -p $(BUNDLE_DATA_DIR) + rsync -rpu --delete $(FLUTTER_ASSETS_SOURCE) $(BUNDLE_DATA_DIR) + +# PHONY since the Makefile doesn't have all the dependency information necessary +# to know if 'build bundle' needs to be re-run. +.PHONY: $(FLUTTER_ASSETS_SOURCE) +$(FLUTTER_ASSETS_SOURCE): + cd $(FLUTTER_APP_DIR); \ + $(FLUTTER_BIN) build bundle $(FLUTTER_BUNDLE_FLAGS) + +.PHONY: clean +clean: + rm -rf $(OUT_DIR); \ + cd $(FLUTTER_APP_DIR); \ + $(FLUTTER_BIN) clean diff --git a/example/linux/flutter_embedder_example.cc b/example/linux/flutter_embedder_example.cc new file mode 100644 index 000000000..1272af377 --- /dev/null +++ b/example/linux/flutter_embedder_example.cc @@ -0,0 +1,74 @@ +// Copyright 2018 Google LLC +// +// 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. +#include +#include + +#include +#include +#include +#include + +#include + +namespace { + +// Returns the path of the directory containing this executable, or an empty +// string if the directory cannot be found. +std::string GetExecutableDirectory() { + char buffer[PATH_MAX + 1]; + ssize_t length = readlink("/proc/self/exe", buffer, sizeof(buffer)); + if (length > PATH_MAX) { + std::cerr << "Couldn't locate executable" << std::endl; + return ""; + } + std::string executable_path(buffer, length); + size_t last_separator_position = executable_path.find_last_of('/'); + if (last_separator_position == std::string::npos) { + std::cerr << "Unabled to find parent directory of " << executable_path + << std::endl; + return ""; + } + return executable_path.substr(0, last_separator_position); +} + +} // namespace + +int main(int argc, char **argv) { + // Resources are located relative to the executable. + std::string base_directory = GetExecutableDirectory(); + if (base_directory.empty()) { + base_directory = "."; + } + std::string data_directory = base_directory + "/data"; + std::string assets_path = data_directory + "/flutter_assets"; + std::string icu_data_path = data_directory + "/icudtl.dat"; + + // Arguments for the Flutter Engine. + std::vector arguments; +#ifdef NDEBUG + arguments.push_back("--disable-dart-asserts"); +#endif + + flutter::FlutterWindowController flutter_controller(icu_data_path); + + // Start the engine. + if (!flutter_controller.CreateWindow(800, 600, "Flutter Desktop Example", + assets_path, arguments)) { + return EXIT_FAILURE; + } + + // Run until the window is closed. + flutter_controller.RunEventLoop(); + return EXIT_SUCCESS; +} diff --git a/example/macos/.gitignore b/example/macos/.gitignore new file mode 100644 index 000000000..b283ed7bf --- /dev/null +++ b/example/macos/.gitignore @@ -0,0 +1,4 @@ +xcuserdata + +# Generated by flutter run and flutter build +Generated.xcconfig diff --git a/example/macos/AppDelegate.swift b/example/macos/AppDelegate.swift new file mode 100644 index 000000000..bdcc151bf --- /dev/null +++ b/example/macos/AppDelegate.swift @@ -0,0 +1,25 @@ +// Copyright 2018 Google LLC +// +// 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. + +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + @IBOutlet weak var window: NSWindow! + + func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} + diff --git a/example/macos/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/macos/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..2db2b1c7c --- /dev/null +++ b/example/macos/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/example/macos/Base.lproj/MainMenu.xib b/example/macos/Base.lproj/MainMenu.xib new file mode 100644 index 000000000..16c284883 --- /dev/null +++ b/example/macos/Base.lproj/MainMenu.xib @@ -0,0 +1,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/macos/ExampleWindow.swift b/example/macos/ExampleWindow.swift new file mode 100644 index 000000000..99210d3c2 --- /dev/null +++ b/example/macos/ExampleWindow.swift @@ -0,0 +1,35 @@ +// Copyright 2018 Google LLC +// +// 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. + +import Cocoa + +class ExampleWindow: NSWindow { + @IBOutlet weak var flutterViewController: FLEViewController! + + override func awakeFromNib() { + PluginRegistrant.register(with: flutterViewController) + + let assets = NSURL.fileURL(withPath: "flutter_assets", relativeTo: Bundle.main.resourceURL) + var arguments: [String] = []; +#if !DEBUG + arguments.append("--disable-dart-asserts"); +#endif + flutterViewController.launchEngine( + withAssetsPath: assets, + commandLineArguments: arguments) + + super.awakeFromNib() + } +} + diff --git a/example/macos/Flutter/Debug.xcconfig b/example/macos/Flutter/Debug.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/example/macos/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/macos/Flutter/Release.xcconfig b/example/macos/Flutter/Release.xcconfig new file mode 100644 index 000000000..592ceee85 --- /dev/null +++ b/example/macos/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/macos/Info.plist b/example/macos/Info.plist new file mode 100644 index 000000000..515b4ac7e --- /dev/null +++ b/example/macos/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2018 Google LLC. All rights reserved. + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/example/macos/PluginRegistrant.h b/example/macos/PluginRegistrant.h new file mode 100644 index 000000000..11447afe2 --- /dev/null +++ b/example/macos/PluginRegistrant.h @@ -0,0 +1,19 @@ +// Copyright 2019 Google LLC +// +// 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. + +#import + +@interface PluginRegistrant : NSObject ++ (void)registerWithRegistry:(NSObject*)registry; +@end diff --git a/example/macos/PluginRegistrant.m b/example/macos/PluginRegistrant.m new file mode 100644 index 000000000..9cbe3e1d8 --- /dev/null +++ b/example/macos/PluginRegistrant.m @@ -0,0 +1,27 @@ +// Copyright 2019 Google LLC +// +// 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. + +// This serves the same purpose as GeneratedPluginRegistrant in an iOS +// Flutter project. However, since there is no tooling support for plugins +// yet, adding a new plugin requires manually adding plugin registration. + +#import "PluginRegistrant.h" + +@implementation PluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { + // Add your plugin regitration here. +} + +@end diff --git a/example/macos/Runner-Bridging-Header.h b/example/macos/Runner-Bridging-Header.h new file mode 100644 index 000000000..cef4884bf --- /dev/null +++ b/example/macos/Runner-Bridging-Header.h @@ -0,0 +1,16 @@ +// Copyright 2018 Google LLC +// +// 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. + +#import +#import "PluginRegistrant.h" diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..ae75a3d7c --- /dev/null +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,490 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 48; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Build Flutter Bundle */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Build Flutter Bundle" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + 33D1A0EC22148486006C7A3E /* PBXTargetDependency */, + ); + name = "Build Flutter Bundle"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 33A2DE652267798600914F77 /* PluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 33A2DE642267798600914F77 /* PluginRegistrant.m */; }; + 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 /* ExampleWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* ExampleWindow.swift */; }; + 33CC112F204626C80003C045 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC112C20461AD40003C045 /* flutter_assets */; }; + 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; }; + 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */, + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 33A2DE632267798600914F77 /* PluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginRegistrant.h; sourceTree = ""; }; + 33A2DE642267798600914F77 /* PluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PluginRegistrant.m; sourceTree = ""; }; + 33BA886B226E7BE8003329D5 /* Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* Flutter Desktop Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Flutter Desktop Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* ExampleWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWindow.swift; sourceTree = ""; }; + 33CC11162044C3600003C045 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 33CC112C20461AD40003C045 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = ../build/flutter_assets; sourceTree = ""; }; + 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = ../flutter_framework/FlutterMacOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 33BA886B226E7BE8003329D5 /* Generated.xcconfig */, + ); + name = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* ExampleWindow.swift */, + 33A2DE632267798600914F77 /* PluginRegistrant.h */, + 33A2DE642267798600914F77 /* PluginRegistrant.m */, + 33CC11162044C3600003C045 /* Runner-Bridging-Header.h */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + 33D1A10222148A83006C7A3E /* Frameworks */, + 33CC10EE2044A3C60003C045 /* Products */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* Flutter Desktop Example.app */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + 33CC112C20461AD40003C045 /* flutter_assets */, + ); + name = Resources; + sourceTree = ""; + }; + 33D1A10222148A83006C7A3E /* Frameworks */ = { + isa = PBXGroup; + children = ( + 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + ); + buildRules = ( + ); + dependencies = ( + 33D1A0EA2214847F006C7A3E /* PBXTargetDependency */, + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = "Flutter Desktop Example"; + productReference = 33CC10ED2044A3C60003C045 /* Flutter Desktop Example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 0930; + ORGANIZATIONNAME = "Google LLC"; + TargetAttributes = { + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 0920; + ProvisioningStyle = Manual; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 33CC111A2044C6BA0003C045 /* Build Flutter Bundle */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + 33CC112F204626C80003C045 /* flutter_assets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_build_flutter_assets.sh\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* ExampleWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 33A2DE652267798600914F77 /* PluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Build Flutter Bundle */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = ""; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Manual; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; + FRAMEWORK_SEARCH_PATHS = $SYMROOT/flutter_framework; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.google.FlutterEmbedderMacExample.FlutterDesktopExample; + PRODUCT_NAME = "Flutter Desktop Example"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Manual; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = ""; + FRAMEWORK_SEARCH_PATHS = $SYMROOT/flutter_framework; + INFOPLIST_FILE = Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.google.FlutterEmbedderMacExample.FlutterDesktopExample; + PRODUCT_NAME = "Flutter Desktop Example"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OBJC_BRIDGING_HEADER = "Runner-Bridging-Header.h"; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 33D1A0E622148440006C7A3E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33D1A0E722148440006C7A3E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Build Flutter Bundle" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33D1A0E522148440006C7A3E /* Build configuration list for PBXAggregateTarget "Copy Flutter Framework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33D1A0E622148440006C7A3E /* Debug */, + 33D1A0E722148440006C7A3E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/example/macos/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/macos/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..764c74b8d --- /dev/null +++ b/example/macos/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..57774f080 --- /dev/null +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/macos/name_output.sh b/example/macos/name_output.sh new file mode 100755 index 000000000..6f8e620b0 --- /dev/null +++ b/example/macos/name_output.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# +# Copyright 2019 Google LLC +# +# 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. + +# This script outputs the path to the app bundle that is created by +# build.sh for the given configuration ("debug" or "release"). +# +# Having this file in this location, with this name, enables the current +# experimental 'flutter run' support for desktop. + +# Arguments +readonly flutter_config="$1" + +# Directories +readonly base_dir="$(dirname "$0")" +readonly flutter_app_dir="${base_dir}/.." +# This must match the paths in build.sh. +readonly products_dir="${flutter_app_dir}/build/macos/Build/Products" + +# Xcode configuration +readonly app_name="Flutter Desktop Example" +if [[ "${flutter_config}" == "release" ]]; then + readonly build_config="Release" +else + readonly build_config="Debug" +fi + +echo "${products_dir}/${build_config}/${app_name}.app" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 0c81f9927..ca94b4900 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -10,6 +10,7 @@ dependencies: cupertino_icons: ^0.1.2 flutter_stetho: ^0.2.2 sembast: ^1.13.3+1 + shared_preferences: ^0.5.0 dev_dependencies: parse_server_sdk: @@ -45,17 +46,18 @@ flutter: # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.io/custom-fonts/#from-packages + 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 diff --git a/example/windows/.gitignore b/example/windows/.gitignore new file mode 100644 index 000000000..96ca22ce8 --- /dev/null +++ b/example/windows/.gitignore @@ -0,0 +1,332 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# Local additions, not from the link above +Generated.props + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ diff --git a/example/windows/Runner.sln b/example/windows/Runner.sln new file mode 100644 index 000000000..142477715 --- /dev/null +++ b/example/windows/Runner.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2026 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Runner", "Runner.vcxproj", "{5A827760-CF8B-408A-99A3-B6C0AD2271E7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5A827760-CF8B-408A-99A3-B6C0AD2271E7}.Debug|x64.ActiveCfg = Debug|x64 + {5A827760-CF8B-408A-99A3-B6C0AD2271E7}.Debug|x64.Build.0 = Debug|x64 + {5A827760-CF8B-408A-99A3-B6C0AD2271E7}.Release|x64.ActiveCfg = Release|x64 + {5A827760-CF8B-408A-99A3-B6C0AD2271E7}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6C8A8041-10D8-4BEB-B73D-C02BCE62120B} + EndGlobalSection +EndGlobal diff --git a/example/windows/Runner.vcxproj b/example/windows/Runner.vcxproj new file mode 100644 index 000000000..4028e00ab --- /dev/null +++ b/example/windows/Runner.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {5A827760-CF8B-408A-99A3-B6C0AD2271E7} + GLFWExample + 10.0.17134.0 + + + + Application + true + v141 + MultiByte + + + Application + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + $(ProjectDir)..\build\windows\$(Platform)\$(Configuration)\$(ProjectName)\ + $(ProjectDir)..\build\windows\intermediates\$(Platform)\$(Configuration)\$(ProjectName)\ + $(IntDir)flutter_library\;$(IntDir)flutter_library\cpp_client_wrapper\include\;$(IncludePath) + $(IntDir)flutter_library;$(LibraryPath) + Flutter Desktop Example + + + $(ProjectDir)..\build\windows\$(Platform)\$(Configuration)\$(ProjectName)\ + $(ProjectDir)..\build\windows\intermediates\$(Platform)\$(Configuration)\$(ProjectName)\ + $(IntDir)flutter_library\;$(IntDir)flutter_library\cpp_client_wrapper\include\;$(IncludePath) + $(IntDir)flutter_library;$(LibraryPath) + Flutter Desktop Example + + + + Level3 + Disabled + true + true + + + _MBCS;%(PreprocessorDefinitions) + + + flutter_windows.dll.lib;opengl32.lib;%(AdditionalDependencies) + + + $(ProjectDir)scripts\prepare_dependencies "$(IntDir)" + Sync and build dependencies + + + + + + + + + + + + + + + + + $(ProjectDir)scripts\bundle_assets_and_deps "$(IntDir)flutter_library\" "$(OutputPath)" + + + Bundling dependencies + Dummy_Run_Always + + + + + + + Level3 + MaxSpeed + true + true + true + true + + + _MBCS;%(PreprocessorDefinitions) + + + true + true + flutter_windows.dll.lib;opengl32.lib;%(AdditionalDependencies) + + + $(ProjectDir)scripts\prepare_dependencies "$(IntDir)" + Sync and build dependencies + + + + + + + + + + + + + + + + + $(ProjectDir)scripts\bundle_assets_and_deps "$(IntDir)flutter_library\" "$(OutputPath)" + + + Bundling dependencies + Dummy_Run_Always + + + + + + + + + + + + + + + $(SolutionDir) + + diff --git a/example/windows/Runner.vcxproj.filters b/example/windows/Runner.vcxproj.filters new file mode 100644 index 000000000..c5d7f4a82 --- /dev/null +++ b/example/windows/Runner.vcxproj.filters @@ -0,0 +1,34 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {2761a4b5-57b2-4d50-a677-d20ddc17a7f1} + + + + + Source Files + + + Source Files\Client Wrapper + + + Source Files\Client Wrapper + + + Source Files\Client Wrapper + + + diff --git a/example/windows/build.bat b/example/windows/build.bat new file mode 100644 index 000000000..a6674911f --- /dev/null +++ b/example/windows/build.bat @@ -0,0 +1,61 @@ +:: Copyright 2019 Google LLC +:: +:: 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. + +:: This script does a Windows build using msbuild. +:: +:: Having this file in this location, with this name, enables the current +:: experimental 'flutter build' support for desktop. + +@echo off +SETLOCAL ENABLEDELAYEDEXPANSION + +set FLUTTER_ROOT=%1 +set FLUTTER_CONFIG=%2 +set TRACK_WIDGET_CREATION=%3 + +set SOLUTION_NAME=Runner + +set BASE_DIR=%~dp0 +set FLUTTER_APP_DIR=%BASE_DIR%..\ +set PRODUCTS_DIR=%FLUTTER_APP_DIR%build\windows\x86\ + +if "%FLUTTER_CONFIG%"=="release" ( + set BUILD_CONFIG=Release +) else ( + set BUILD_CONFIG=Debug +) + +if "%TRACK_WIDGET_CREATION%"=="track-widget-creation" ( + set EXTRA_BUNDLE_FLAGS=--track-widget-creation +) + +set DART_BIN_DIR=%FLUTTER_ROOT%\bin\cache\dart-sdk\bin\ + +:: Write build settings to Generated.props +call "%DART_BIN_DIR%dart" "%BASE_DIR%generate_props.dart" "%BASE_DIR%Generated.props" "%FLUTTER_ROOT%" "%EXTRA_BUNDLE_FLAGS%" + +:: Attempt to locate and run vcvars64.bat +for /f "delims=" %%i in ('%DART_BIN_DIR%dart %BASE_DIR%.\find_vcvars.dart') do set VCVARS_PATH=%%i +if "%VCVARS_PATH%" == "" ( + echo ####################################################################### + echo # Warning: Unable to find vcvars64.bat. Proceeding anyway; if it fails, + echo # run vcvars64.bat manually in this console then try again. + echo ####################################################################### +) else ( + call "%VCVARS_PATH%" + if %errorlevel% neq 0 exit /b %errorlevel% +) + +:: Build the project. +msbuild "%BASE_DIR%%SOLUTION_NAME%.sln" /p:Configuration=%BUILD_CONFIG% diff --git a/example/windows/find_vcvars.dart b/example/windows/find_vcvars.dart new file mode 100644 index 000000000..375651e0a --- /dev/null +++ b/example/windows/find_vcvars.dart @@ -0,0 +1,35 @@ +// Copyright 2018 Google LLC +// +// 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. + +// This script attempts to find vcvars64.bat, and if successful outputs its +// path and returns 0. Otherwise, it prints nothing and returns 1. +import 'dart:io'; + +int main() { + final programDir = Platform.environment['PROGRAMFILES(X86)']; + final pathPrefix = '$programDir\\Microsoft Visual Studio'; + const pathSuffix = 'VC\\Auxiliary\\Build\\vcvars64.bat'; + final years = ['2017', '2019']; + final flavors = ['Community', 'Professional', 'Enterprise', 'Preview']; + for (final year in years) { + for (final flavor in flavors) { + final testPath = '$pathPrefix\\$year\\$flavor\\$pathSuffix'; + if (File(testPath).existsSync()) { + print(testPath); + return 0; + } + } + } + return 1; +} diff --git a/example/windows/flutter_embedder_example.cpp b/example/windows/flutter_embedder_example.cpp new file mode 100644 index 000000000..9d6235725 --- /dev/null +++ b/example/windows/flutter_embedder_example.cpp @@ -0,0 +1,75 @@ +// Copyright 2018 Google LLC +// +// 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. + +#include +#include +#include + +#include "flutter/flutter_window_controller.h" + +// Include windows.h last, to minimize potential conflicts. The CreateWindow +// macro needs to be undefined because it prevents calling +// FlutterWindowController's method. +#include +#undef CreateWindow + +namespace { + +// Returns the path of the directory containing this executable, or an empty +// string if the directory cannot be found. +std::string GetExecutableDirectory() { + char buffer[MAX_PATH]; + if (GetModuleFileName(nullptr, buffer, MAX_PATH) == 0) { + std::cerr << "Couldn't locate executable" << std::endl; + return ""; + } + std::string executable_path(buffer); + size_t last_separator_position = executable_path.find_last_of('\\'); + if (last_separator_position == std::string::npos) { + std::cerr << "Unabled to find parent directory of " << executable_path + << std::endl; + return ""; + } + return executable_path.substr(0, last_separator_position); +} + +} // namespace + +int main(int argc, char **argv) { + // Resources are located relative to the executable. + std::string base_directory = GetExecutableDirectory(); + if (base_directory.empty()) { + base_directory = "."; + } + std::string data_directory = base_directory + "\\data"; + std::string assets_path = data_directory + "\\flutter_assets"; + std::string icu_data_path = data_directory + "\\icudtl.dat"; + + // Arguments for the Flutter Engine. + std::vector arguments; +#ifndef _DEBUG + arguments.push_back("--disable-dart-asserts"); +#endif + flutter::FlutterWindowController flutter_controller(icu_data_path); + + // Start the engine. + if (!flutter_controller.CreateWindow(800, 600, "Flutter Desktop Example", + assets_path, arguments)) { + return EXIT_FAILURE; + } + + // Run until the window is closed. + flutter_controller.RunEventLoop(); + return EXIT_SUCCESS; +} diff --git a/example/windows/generate_props.dart b/example/windows/generate_props.dart new file mode 100644 index 000000000..5a918942e --- /dev/null +++ b/example/windows/generate_props.dart @@ -0,0 +1,58 @@ +// Copyright 2018 Google LLC +// +// 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. + +// This script creates a generated .props file containing various user +// macros needed by the Visual Studio build, adding all of them to the +// build environment for use in build scripts. +import 'dart:io'; + +void main(List arguments) { + final outputPath = arguments[0]; + final settings = { + 'FLUTTER_ROOT': arguments[1], + 'EXTRA_BUNDLE_FLAGS': arguments[2], + }; + + File(outputPath).writeAsStringSync(''' + + + +${getUserMacrosContent(settings)} + + + + +${getItemGroupContent(settings)} + +'''); +} + +String getUserMacrosContent(Map settings) { + final macroList = StringBuffer(); + for (final setting in settings.entries) { + macroList.writeln(' <${setting.key}>${setting.value}'); + } + return macroList.toString(); +} + +String getItemGroupContent(Map settings) { + final macroList = StringBuffer(); + for (final name in settings.keys) { + macroList.writeln(''' + \$($name) + true + '''); + } + return macroList.toString(); +} diff --git a/example/windows/name_output.bat b/example/windows/name_output.bat new file mode 100644 index 000000000..b5812e365 --- /dev/null +++ b/example/windows/name_output.bat @@ -0,0 +1,38 @@ +:: Copyright 2019 Google LLC +:: +:: 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. + +:: This script outputs the path to the executable that is created by +:: build.bat for the given configuration ("debug" or "release"). +:: +:: Having this file in this location, with this name, enables the current +:: experimental 'flutter run' support for desktop. +@echo off +SETLOCAL ENABLEDELAYEDEXPANSION + +set FLUTTER_CONFIG=%1 + +set PROJECT_NAME=Runner +set EXE_NAME=Flutter Desktop Example + +set BASE_DIR=%~dp0 +set FLUTTER_APP_DIR=%BASE_DIR%..\ +set PRODUCTS_DIR=%FLUTTER_APP_DIR%build\windows\x64\ + +if "%FLUTTER_CONFIG%"=="release" ( + set BUILD_CONFIG=Release +) else ( + set BUILD_CONFIG=Debug +) + +echo %PRODUCTS_DIR%%BUILD_CONFIG%\%PROJECT_NAME%\%EXE_NAME%.exe diff --git a/example/windows/scripts/bundle_assets_and_deps.bat b/example/windows/scripts/bundle_assets_and_deps.bat new file mode 100644 index 000000000..cbf055202 --- /dev/null +++ b/example/windows/scripts/bundle_assets_and_deps.bat @@ -0,0 +1,44 @@ +:: Copyright 2018 Google LLC +:: +:: 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. +@echo off + +set FLUTTER_APP_DIR=%~dp0..\.. +set ICU_DATA_SOURCE=%FLUTTER_ROOT%\bin\cache\artifacts\engine\windows-x64\icudtl.dat +set ASSET_DIR_NAME=flutter_assets + +set FLUTTER_LIBRARY_DIR=%~1 +set BUNDLE_DIR=%~2 +set DATA_DIR=%BUNDLE_DIR%data +set TARGET_ASSET_DIR=%DATA_DIR%\%ASSET_DIR_NAME% + +if not exist "%DATA_DIR%" call mkdir "%DATA_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% + +:: Build the Flutter assets. +cd "%FLUTTER_APP_DIR%" +call %FLUTTER_ROOT%\bin\flutter build bundle %EXTRA_BUNDLE_FLAGS% +if %errorlevel% neq 0 exit /b %errorlevel% +:: Copy them to the data directory. +if exist "%TARGET_ASSET_DIR%" call rmdir /s /q "%TARGET_ASSET_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% +call xcopy /s /e /i /q "%FLUTTER_APP_DIR%\build\%ASSET_DIR_NAME%" "%TARGET_ASSET_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% + +:: Copy the icudtl.dat file from the Flutter tree to the data directory. +call xcopy /y /d /q "%ICU_DATA_SOURCE%" "%DATA_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% + +:: Copy the Flutter DLL to the target location. +call xcopy /y /d /q "%FLUTTER_LIBRARY_DIR%flutter_windows.dll" "%BUNDLE_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/example/windows/scripts/prepare_dependencies.bat b/example/windows/scripts/prepare_dependencies.bat new file mode 100644 index 000000000..94f520de5 --- /dev/null +++ b/example/windows/scripts/prepare_dependencies.bat @@ -0,0 +1,35 @@ +:: Copyright 2018 Google LLC +:: +:: 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. +@echo off + +set INTERMEDIATE_DIR=%~1 +set LOCAL_COPY_DIR=%INTERMEDIATE_DIR%flutter_library\ +set FLUTTER_CACHE_DIR=%FLUTTER_ROOT%\bin\cache\artifacts\engine\windows-x64\ + +:: Sync the Flutter library, removing previous copies to ensure +:: that stale files don't stay in the copy. +call %FLUTTER_ROOT%\bin\flutter precache --windows --no-android --no-ios +if %errorlevel% neq 0 exit /b %errorlevel% +echo rmdir /s /q "%LOCAL_COPY_DIR%" +rmdir /s /q "%LOCAL_COPY_DIR%" +echo mkdir "%LOCAL_COPY_DIR%" +mkdir "%LOCAL_COPY_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% + +xcopy /q /i "%FLUTTER_CACHE_DIR%"flutter_windows.* "%LOCAL_COPY_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% +xcopy /q /i "%FLUTTER_CACHE_DIR%"flutter_*.h "%LOCAL_COPY_DIR%" +if %errorlevel% neq 0 exit /b %errorlevel% +xcopy /q /i /s "%FLUTTER_CACHE_DIR%"cpp_client_wrapper "%LOCAL_COPY_DIR%"cpp_client_wrapper +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart new file mode 100644 index 000000000..db983ef03 --- /dev/null +++ b/lib/generated/i18n.dart @@ -0,0 +1,78 @@ + +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +// ignore_for_file: non_constant_identifier_names +// ignore_for_file: camel_case_types +// ignore_for_file: prefer_single_quotes + +//This file is automatically generated. DO NOT EDIT, all your changes would be lost. + +class S implements WidgetsLocalizations { + const S(); + + static const GeneratedLocalizationsDelegate delegate = + const GeneratedLocalizationsDelegate(); + + static S of(BuildContext context) => + Localizations.of(context, WidgetsLocalizations); + + @override + TextDirection get textDirection => TextDirection.ltr; + +} + +class en extends S { + const en(); +} + + +class GeneratedLocalizationsDelegate extends LocalizationsDelegate { + const GeneratedLocalizationsDelegate(); + + List get supportedLocales { + return const [ + + const Locale("en", ""), + + ]; + } + + LocaleResolutionCallback resolution({Locale fallback}) { + return (Locale locale, Iterable supported) { + final Locale languageLocale = new Locale(locale.languageCode, ""); + if (supported.contains(locale)) + return locale; + else if (supported.contains(languageLocale)) + return languageLocale; + else { + final Locale fallbackLocale = fallback ?? supported.first; + return fallbackLocale; + } + }; + } + + @override + Future load(Locale locale) { + final String lang = getLang(locale); + switch (lang) { + + case "en": + return new SynchronousFuture(const en()); + + default: + return new SynchronousFuture(const S()); + } + } + + @override + bool isSupported(Locale locale) => supportedLocales.contains(locale); + + @override + bool shouldReload(GeneratedLocalizationsDelegate old) => false; +} + +String getLang(Locale l) => l.countryCode != null && l.countryCode.isEmpty + ? l.languageCode + : l.toString(); diff --git a/lib/parse_server_sdk.dart b/lib/parse_server_sdk.dart index 5541d9a94..cc7908429 100644 --- a/lib/parse_server_sdk.dart +++ b/lib/parse_server_sdk.dart @@ -4,7 +4,8 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; - +import 'package:sembast/sembast.dart'; +import 'package:sembast/sembast_io.dart'; import 'package:devicelocale/devicelocale.dart'; import 'package:http/http.dart'; import 'package:http/io_client.dart'; @@ -12,9 +13,9 @@ import 'package:meta/meta.dart'; import 'package:package_info/package_info.dart'; import 'package:path/path.dart' as path; import 'package:path_provider/path_provider.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:uuid/uuid.dart'; import 'package:web_socket_channel/io.dart'; +import 'package:xxtea/xxtea.dart'; part 'package:parse_server_sdk/src/objects/response/parse_response_utils.dart'; @@ -76,6 +77,10 @@ part 'src/utils/parse_utils.dart'; part 'src/utils/parse_date_format.dart'; +part 'src/data/core_store.dart'; +part 'src/data/core_store_impl.dart'; +part 'src/data/xxtea_codec.dart'; + class Parse { ParseCoreData data; bool _hasBeenInitialized = false; @@ -100,13 +105,11 @@ class Parse { String masterKey, String sessionId, bool autoSendSessionId, - SecurityContext securityContext}) { - + SecurityContext securityContext, + CoreStore coreStore}) { final String url = removeTrailingSlash(serverUrl); - ParseCoreData.init( - appId, - url, + ParseCoreData.init(appId, url, debug: debug, appName: appName, liveQueryUrl: liveQueryUrl, @@ -114,7 +117,8 @@ class Parse { clientKey: clientKey, sessionId: sessionId, autoSendSessionId: autoSendSessionId, - securityContext: securityContext); + securityContext: securityContext, + store: coreStore); _hasBeenInitialized = true; @@ -141,7 +145,8 @@ class Parse { final Response response = await _client.get('${ParseCoreData().serverUrl}$keyEndPointHealth'); - parseResponse = handleResponse(null, response, type, _debug, className); + parseResponse = + handleResponse(null, response, type, _debug, className); } on Exception catch (e) { parseResponse = handleException(e, type, _debug, className); } diff --git a/lib/src/data/app_info.dart b/lib/src/data/app_info.dart new file mode 100644 index 000000000..434f588d7 --- /dev/null +++ b/lib/src/data/app_info.dart @@ -0,0 +1,9 @@ +part of flutter_parse_sdk; + +abstract class AppInfo { + Future getLanguage(); + Future getAppName(); + Future getPackageName(); + Future getVersion(); + Future getBuildNumber(); +} diff --git a/lib/src/data/core_store.dart b/lib/src/data/core_store.dart new file mode 100644 index 000000000..13a1c6fd5 --- /dev/null +++ b/lib/src/data/core_store.dart @@ -0,0 +1,31 @@ +part of flutter_parse_sdk; + +abstract class CoreStore { + Future containsKey(String key); + + Future get(String key); + + Future getBool(String key); + + Future getInt(String key); + + Future getDouble(String key); + + Future getString(String key); + + Future> getStringList(String key); + + Future setBool(String key, bool value); + + Future setInt(String key, int value); + + Future setDouble(String key, double value); + + Future setString(String key, String value); + + Future setStringList(String key, List values); + + Future remove(String key); + + Future clear(); +} diff --git a/lib/src/data/core_store_impl.dart b/lib/src/data/core_store_impl.dart new file mode 100644 index 000000000..3a65c7eb4 --- /dev/null +++ b/lib/src/data/core_store_impl.dart @@ -0,0 +1,92 @@ +part of flutter_parse_sdk; + +class CoreStoreImp implements CoreStore { + CoreStoreImp._internal(this._store); + static CoreStoreImp _instance; + static Future getInstance( + {DatabaseFactory factory, String password = 'flutter_sdk'}) async { + if (_instance == null) { + factory ??= databaseFactoryIo; + final SembastCodec codec = getXXTeaSembastCodec(password: password); + String dbDirectory = ''; + if (Platform.isIOS || Platform.isAndroid) + dbDirectory = (await getApplicationDocumentsDirectory()).path; + final String dbPath = path.join('$dbDirectory+/parse', 'parse.db'); + final Database db = await factory.openDatabase(dbPath, codec: codec); + _instance = CoreStoreImp._internal(db); + } + return _instance; + } + + Database _store; + + @override + Future clear() { + return _store.clear(); + } + + @override + Future containsKey(String key) { + return _store.containsKey(key); + } + + @override + Future get(String key) { + return _store.get(key); + } + + @override + Future getBool(String key) async { + return await _store.get(key) as bool; + } + + @override + Future getDouble(String key) async { + return await _store.get(key) as double; + } + + @override + Future getInt(String key) async { + return await _store.get(key) as int; + } + + @override + Future getString(String key) async { + return await _store.get(key) as String; + } + + @override + Future> getStringList(String key) async { + return await _store.get(key) as List; + } + + @override + Future remove(String key) { + return _store.delete(key); + } + + @override + Future setBool(String key, bool value) { + return _store.put(value, key); + } + + @override + Future setDouble(String key, double value) { + return _store.put(value, key); + } + + @override + Future setInt(String key, int value) { + return _store.put(value, key); + } + + @override + Future setString(String key, String value) { + return _store.put(value, key); + } + + @override + Future setStringList(String key, List values) { + return _store.put(values, key); + } +} diff --git a/lib/src/data/parse_core_data.dart b/lib/src/data/parse_core_data.dart index 7a9429216..4c234e985 100644 --- a/lib/src/data/parse_core_data.dart +++ b/lib/src/data/parse_core_data.dart @@ -2,7 +2,6 @@ part of flutter_parse_sdk; /// Singleton class that defines all user keys and data class ParseCoreData { - factory ParseCoreData() => _instance; ParseCoreData._init(this.applicationId, this.serverUrl); @@ -23,25 +22,20 @@ class ParseCoreData { String clientKey, String sessionId, bool autoSendSessionId, - SecurityContext securityContext}) { + SecurityContext securityContext, + CoreStore store}) { _instance = ParseCoreData._init(appId, serverUrl); - - if (debug != null) - _instance.debug = debug; - if (appName != null) - _instance.appName = appName; - if (liveQueryUrl != null) - _instance.liveQueryURL = liveQueryUrl; - if (clientKey != null) - _instance.clientKey = clientKey; - if (masterKey != null) - _instance.masterKey = masterKey; - if (sessionId != null) - _instance.sessionId = sessionId; + _instance.storage ??= + store ?? CoreStoreImp.getInstance(password: masterKey); + if (debug != null) _instance.debug = debug; + if (appName != null) _instance.appName = appName; + if (liveQueryUrl != null) _instance.liveQueryURL = liveQueryUrl; + if (clientKey != null) _instance.clientKey = clientKey; + if (masterKey != null) _instance.masterKey = masterKey; + if (sessionId != null) _instance.sessionId = sessionId; if (autoSendSessionId != null) _instance.autoSendSessionId = autoSendSessionId; - if (securityContext != null) - _instance.securityContext = securityContext; + if (securityContext != null) _instance.securityContext = securityContext; } String appName; @@ -54,7 +48,7 @@ class ParseCoreData { bool autoSendSessionId; SecurityContext securityContext; bool debug; - SharedPreferences storage; + Future storage; /// Sets the current sessionId. /// @@ -64,8 +58,8 @@ class ParseCoreData { this.sessionId = sessionId; } - Future getStore() async { - return storage ?? (storage = await SharedPreferences.getInstance()); + Future getStore() { + return storage; } @override diff --git a/lib/src/data/xxtea_codec.dart b/lib/src/data/xxtea_codec.dart new file mode 100644 index 000000000..863bb063f --- /dev/null +++ b/lib/src/data/xxtea_codec.dart @@ -0,0 +1,60 @@ +part of flutter_parse_sdk; + +class _XXTeaEncoder extends Converter, String> { + _XXTeaEncoder(this.key); + + final String key; + + @override + String convert(Map input) => + xxtea.encryptToString(json.encode(input), key); +} + +class _XXTeaDecoder extends Converter> { + _XXTeaDecoder(this.key); + + final String key; + + @override + Map convert(String input) { + final dynamic result = json.decode(xxtea.decryptToString(input, key)); + if (result is Map) { + return result.cast(); + } + throw FormatException('invalid input $input'); + } +} + +/// Simple encryption codec using xxtea +/// It requires a password to encrypt/decrypt the data +class _XXTeaCodec extends Codec, String> { + /// A non null [password] to use for the encryption/decryption + _XXTeaCodec(String password) { + _encoder = _XXTeaEncoder(password); + _decoder = _XXTeaDecoder(password); + } + + _XXTeaEncoder _encoder; + _XXTeaDecoder _decoder; + + @override + Converter> get decoder => _decoder; + + @override + Converter, String> get encoder => _encoder; +} + +/// Create a codec to use when opening an encrypted sembast database +/// +/// The usage is then +/// +/// ```dart +/// // Initialize the encryption codec with a user password +/// var codec = getXXTeaSembastCodec(password: '[your_user_password]'); +/// // Open the database with the codec +/// Database db = await factory.openDatabase(dbPath, codec: codec); +/// +/// // ...your database is ready to use as encrypted +/// ``` +SembastCodec getXXTeaSembastCodec({@required String password}) => + SembastCodec(signature: 'xxtea', codec: _XXTeaCodec(password)); diff --git a/lib/src/network/parse_live_query.dart b/lib/src/network/parse_live_query.dart index 71a5d7cdc..066920f8b 100644 --- a/lib/src/network/parse_live_query.dart +++ b/lib/src/network/parse_live_query.dart @@ -98,7 +98,7 @@ class LiveQuery { if (_debug) { print('$_printConstLiveQuery: Done'); } - }, onError: (error) { + }, onError: (Error error) { if (_debug) { print( '$_printConstLiveQuery: Error: ${error.runtimeType.toString()}'); diff --git a/lib/src/objects/parse_base.dart b/lib/src/objects/parse_base.dart index 906f40ee2..71e01e0c0 100644 --- a/lib/src/objects/parse_base.dart +++ b/lib/src/objects/parse_base.dart @@ -184,8 +184,8 @@ abstract class ParseBase { await unpin(); final Map objectMap = parseEncode(this, full: true); final String json = jsonEncode(objectMap); - final SharedPreferences store = await ParseCoreData().getStore(); - store.setString(objectId, json); + await ParseCoreData().getStore() + ..setString(objectId, json); return true; } else { return false; @@ -210,8 +210,8 @@ abstract class ParseBase { /// Replicates Android SDK pin process and saves object to storage dynamic fromPin(String objectId) async { if (objectId != null) { - final String itemFromStore = - (await ParseCoreData().getStore()).getString(objectId); + final CoreStore coreStore = await ParseCoreData().getStore(); + final String itemFromStore = await coreStore.getString(objectId); if (itemFromStore != null) { return fromJson(json.decode(itemFromStore)); diff --git a/lib/src/objects/parse_installation.dart b/lib/src/objects/parse_installation.dart index e4ed0df9f..008ed79f6 100644 --- a/lib/src/objects/parse_installation.dart +++ b/lib/src/objects/parse_installation.dart @@ -1,7 +1,6 @@ part of flutter_parse_sdk; class ParseInstallation extends ParseObject { - /// Creates an instance of ParseInstallation ParseInstallation( {bool debug, ParseHTTPClient client, bool autoSendSessionId}) @@ -10,7 +9,7 @@ class ParseInstallation extends ParseObject { _client = client ?? ParseHTTPClient( sendSessionId: - autoSendSessionId ?? ParseCoreData().autoSendSessionId, + autoSendSessionId ?? ParseCoreData().autoSendSessionId, securityContext: ParseCoreData().securityContext); } @@ -27,7 +26,8 @@ class ParseInstallation extends ParseObject { Map get acl => super.get>(keyVarAcl); - set acl(Map acl) => set>(keyVarAcl, acl); + set acl(Map acl) => + set>(keyVarAcl, acl); String get deviceToken => super.get(keyDeviceToken); @@ -69,8 +69,11 @@ class ParseInstallation extends ParseObject { set(keyDeviceType, 'android'); else if (Platform.isIOS) set(keyDeviceType, 'ios'); - else - throw Exception('Unsupported platform/operating system'); + else if (Platform.isLinux) + set(keyDeviceType, 'Linux'); + else if (Platform.isMacOS) + set(keyDeviceType, 'MacOS'); + else if (Platform.isWindows) set(keyDeviceType, 'Windows'); //Locale final String locale = await Devicelocale.currentLocale; @@ -92,8 +95,7 @@ class ParseInstallation extends ParseObject { @override Future create() async { final bool isCurrent = await ParseInstallation.isCurrent(this); - if (isCurrent) - await _updateInstallation(); + if (isCurrent) await _updateInstallation(); //ParseResponse parseResponse = await super.create(); final ParseResponse parseResponse = await _create(); if (parseResponse.success && isCurrent) { @@ -119,11 +121,14 @@ class ParseInstallation extends ParseObject { /// Gets the locally stored installation static Future _getFromLocalStore() async { + final CoreStore coreStore = await ParseCoreData().getStore(); + final String installationJson = - (await ParseCoreData().getStore()).getString(keyParseStoreInstallation); + await coreStore.getString(keyParseStoreInstallation); if (installationJson != null) { - final Map installationMap = json.decode(installationJson); + final Map installationMap = + json.decode(installationJson); if (installationMap != null) { return ParseInstallation()..fromJson(installationMap); @@ -162,7 +167,8 @@ class ParseInstallation extends ParseObject { objectId = map['objectId'].toString(); } - return handleResponse(this, result, ParseApiRQ.create, _debug, className); + return handleResponse( + this, result, ParseApiRQ.create, _debug, className); } on Exception catch (e) { return handleException(e, ParseApiRQ.create, _debug, className); } @@ -182,7 +188,8 @@ class ParseInstallation extends ParseObject { ParseApiRQ.save.toString(), uri, body); } final Response result = await _client.put(uri, body: body); - return handleResponse(this, result, ParseApiRQ.save, _debug, className); + return handleResponse( + this, result, ParseApiRQ.save, _debug, className); } on Exception catch (e) { return handleException(e, ParseApiRQ.save, _debug, className); } diff --git a/lib/src/objects/parse_user.dart b/lib/src/objects/parse_user.dart index 825bd8fd2..b3cb50e87 100644 --- a/lib/src/objects/parse_user.dart +++ b/lib/src/objects/parse_user.dart @@ -330,8 +330,8 @@ class ParseUser extends ParseObject implements ParseCloneable { static Future _getUserFromLocalStore( {ParseCloneable cloneable}) async { - final String userJson = - (await ParseCoreData().getStore()).getString(keyParseStoreUser); + final CoreStore coreStore = await ParseCoreData().getStore(); + final String userJson = await coreStore.getString(keyParseStoreUser); if (userJson != null) { final Map userMap = json.decode(userJson); diff --git a/parse_android.iml b/parse_android.iml deleted file mode 100644 index 20363e904..000000000 --- a/parse_android.iml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/parse_server_sdk.iml b/parse_server_sdk.iml deleted file mode 100644 index 501965f05..000000000 --- a/parse_server_sdk.iml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 178d36fe9..c92768445 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,9 +14,13 @@ dependencies: # Networking web_socket_channel: ^1.0.9 http: ^0.12.0 - + + #Database + sembast: ^1.15.1 + xxtea: ^2.0.2 + + # Utils - shared_preferences: ^0.5.0 path_provider: ^0.5.0+1 uuid: ^2.0.0 package_info: ^0.4.0 diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/res/values/strings_en.arb @@ -0,0 +1 @@ +{} \ No newline at end of file