diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee..e8efba1 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee..399e934 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..e9286cb --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,74 @@ +# 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 + use_frameworks! + + # 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 pub 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 + +# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. +install! 'cocoapods', :disable_input_output_paths => true + +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/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..fe7e9ee --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,79 @@ +PODS: + - Flutter (1.0.0) + - FMDB (2.7.5): + - FMDB/standard (= 2.7.5) + - FMDB/standard (2.7.5) + - package_info (0.0.1): + - Flutter + - path_provider (0.0.1): + - Flutter + - permission_handler (3.3.0): + - Flutter + - screen (0.0.1): + - Flutter + - shared_preferences (0.0.1): + - Flutter + - sqflite (0.0.1): + - Flutter + - FMDB (~> 2.7.2) + - url_launcher (0.0.1): + - Flutter + - video_player (0.0.1): + - Flutter + - webview_flutter (0.0.1): + - Flutter + +DEPENDENCIES: + - Flutter (from `.symlinks/flutter/ios-release`) + - package_info (from `.symlinks/plugins/package_info/ios`) + - path_provider (from `.symlinks/plugins/path_provider/ios`) + - permission_handler (from `.symlinks/plugins/permission_handler/ios`) + - screen (from `.symlinks/plugins/screen/ios`) + - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - sqflite (from `.symlinks/plugins/sqflite/ios`) + - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - video_player (from `.symlinks/plugins/video_player/ios`) + - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) + +SPEC REPOS: + trunk: + - FMDB + +EXTERNAL SOURCES: + Flutter: + :path: ".symlinks/flutter/ios-release" + package_info: + :path: ".symlinks/plugins/package_info/ios" + path_provider: + :path: ".symlinks/plugins/path_provider/ios" + permission_handler: + :path: ".symlinks/plugins/permission_handler/ios" + screen: + :path: ".symlinks/plugins/screen/ios" + shared_preferences: + :path: ".symlinks/plugins/shared_preferences/ios" + sqflite: + :path: ".symlinks/plugins/sqflite/ios" + url_launcher: + :path: ".symlinks/plugins/url_launcher/ios" + video_player: + :path: ".symlinks/plugins/video_player/ios" + webview_flutter: + :path: ".symlinks/plugins/webview_flutter/ios" + +SPEC CHECKSUMS: + Flutter: 0e3d915762c693b495b44d77113d4970485de6ec + FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a + package_info: 48b108e75b8802c2d5e126f208ef540561c98aef + path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d + permission_handler: 67637977b227d62d46bfbf524f335f8568de5a73 + screen: abd91ca7bf3426e1cc3646d27e9b2358d6bf07b0 + shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01 + sqflite: ff1d9da63c06588cc8d1faf7256d741f16989d5a + url_launcher: a1c0cc845906122c4784c542523d8cacbded5626 + video_player: 69c5f029fac4ffe4fc8a85ea7f7b793709661549 + webview_flutter: db3aba222b23e4dc432e0c5882834123dc50ff9f + +PODFILE CHECKSUM: b6a0a141693093b304368d08511b46cf3d1d0ac5 + +COCOAPODS: 1.8.4 diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 4d7919e..4a3b3fa 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -11,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - notable + Notable CFBundlePackageType APPL CFBundleShortVersionString @@ -41,5 +41,7 @@ UIViewControllerBasedStatusBarAppearance +io.flutter.embedded_views_preview + diff --git a/lib/page/edit.dart b/lib/page/edit.dart index f46d247..dc9bc2e 100644 --- a/lib/page/edit.dart +++ b/lib/page/edit.dart @@ -206,6 +206,7 @@ class _EditPageState extends State { + ''' + (Provider.of(context).currentTheme == ThemeType.light @@ -286,47 +287,50 @@ class _EditPageState extends State { appBar: AppBar( title: Text('Preview'), ), - body: WebView( - initialUrl: 'file://' + previewFile.path, - javascriptMode: JavascriptMode.unrestricted, - onWebViewCreated: (ctrl) {}, - navigationDelegate: (request) { - print(request.url); - - if (request.url.startsWith('file://')) { - String link = Uri.decodeFull( - RegExp(r'@.*').stringMatch(request.url)); - print(link); - - String type = - RegExp(r'(?<=@).*(?=/)').stringMatch(link); - - String data = - RegExp(r'(?<=/).*').stringMatch(link); - print(type); - print(data); - print(Theme.of(context).brightness); - switch (type) { - case 'note': - _navigateToNote(data); - - break; - case 'tag': - _navigateToTag(data); - break; - case 'search': - _navigateToSearch(data); - break; - case 'attachment': - break; + body: Padding( + padding: const EdgeInsets.symmetric(horizontal:8.0), + child: WebView( + initialUrl: 'file://' + previewFile.path, + javascriptMode: JavascriptMode.unrestricted, + onWebViewCreated: (ctrl) {}, + navigationDelegate: (request) { + print(request.url); + + if (request.url.startsWith('file://')) { + String link = Uri.decodeFull( + RegExp(r'@.*').stringMatch(request.url)); + print(link); + + String type = + RegExp(r'(?<=@).*(?=/)').stringMatch(link); + + String data = + RegExp(r'(?<=/).*').stringMatch(link); + print(type); + print(data); + print(Theme.of(context).brightness); + switch (type) { + case 'note': + _navigateToNote(data); + + break; + case 'tag': + _navigateToTag(data); + break; + case 'search': + _navigateToSearch(data); + break; + case 'attachment': + break; + } + } else { + launch( + request.url, + ); } - } else { - launch( - request.url, - ); - } - return NavigationDecision.prevent; - }, + return NavigationDecision.prevent; + }, + ), )))); }, ),