Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS changes #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
74 changes: 74 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -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
79 changes: 79 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions ios/Runner.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 3 additions & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>notable</string>
<string>Notable</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down Expand Up @@ -41,5 +41,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>io.flutter.embedded_views_preview</key>
<true/>
</dict>
</plist>
84 changes: 44 additions & 40 deletions lib/page/edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class _EditPageState extends State<EditPage> {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
''' +
(Provider.of<ThemeNotifier>(context).currentTheme ==
ThemeType.light
Expand Down Expand Up @@ -286,47 +287,50 @@ class _EditPageState extends State<EditPage> {
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;
},
),
))));
},
),
Expand Down