This commit is contained in:
droplet-js
2023-06-08 15:49:15 +08:00
parent 450e49c7d1
commit aa9b388dc7
6 changed files with 22 additions and 15 deletions

View File

@ -5,6 +5,19 @@ java.util.regex.Matcher versionMatcher = java.util.regex.Pattern.compile("^versi
versionMatcher.find()
String library_version = versionMatcher.group(1).replaceAll("\\+", "-")
File flutter_project_dir = rootProject.projectDir.parentFile
def cfg = new org.yaml.snakeyaml.Yaml().load(new File(flutter_project_dir, 'pubspec.yaml').text)
def deep_link = cfg.link_kit?.deep_link?.with { URI.create(it) }
def app_link = cfg.link_kit?.android?.app_link?.with { URI.create(it) }
if (deep_link == null || deep_link.scheme.isEmpty()) {
throw new IllegalArgumentException("link_kit deep link is invalid, add code in pubspec.yaml:\nlink_kit:" +
"\n deep_link: \${your deep link scheme}:///" +
"\n android:" +
"\n app_link: https://\${your applinks domain}/universal_link/\${example_app}/link_kit/ # 可选配置" +
"\n ios:" +
"\n universal_link: universal_link: https://\${your applinks domain}/universal_link/\${example_app}/link_kit/ # 可选配置")
}
group 'io.github.v7lin.link_kit'
version library_version
@ -39,11 +52,6 @@ android {
resourcePrefix 'link_kit'
File flutter_project_dir = rootProject.projectDir.parentFile
def cfg = new org.yaml.snakeyaml.Yaml().load(new File(flutter_project_dir, 'pubspec.yaml').text)
def deep_link = cfg.link_kit?.deep_link?.with { URI.create(it) }
def app_link = cfg.link_kit?.android?.app_link?.with { URI.create(it) }
defaultConfig {
minSdkVersion 16
@ -51,7 +59,7 @@ android {
buildConfigField "String", "LINK_KIT_APP_LINK", "\"${app_link ?: ''}\""
manifestPlaceholders += [
DEEP_LINK_SCHEME: deep_link?.scheme ?: '',
DEEP_LINK_SCHEME: deep_link.scheme,
]
if (app_link != null) {
manifestPlaceholders += [

View File

@ -22,4 +22,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 663715e941f9adb426e33bf9376914006f9ea95b
COCOAPODS: 1.11.3
COCOAPODS: 1.12.1

View File

@ -39,6 +39,8 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
@ -58,7 +60,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>

View File

@ -89,7 +89,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.0.0"
version: "1.0.1"
lints:
dependency: transitive
description:

View File

@ -11,19 +11,17 @@ calling_dir = File.dirname(__FILE__)
project_dir = calling_dir.slice(0..(calling_dir.index('/.symlinks')))
flutter_project_dir = calling_dir.slice(0..(calling_dir.index('/ios/.symlinks')))
cfg = YAML.load_file(File.join(flutter_project_dir, 'pubspec.yaml'))
if cfg['link_kit'] && cfg['link_kit']['deep_link']
if cfg['link_kit'] && cfg['link_kit']['deep_link'] && URI.parse(cfg['link_kit']['deep_link']).scheme
deep_link = cfg['link_kit']['deep_link']
universal_link = nil
options = ""
if cfg['link_kit']['ios']
universal_link = cfg['link_kit']['ios']['universal_link']
end
options = ""
if universal_link
options = "-u #{universal_link}"
end
system("ruby #{current_dir}/link_setup.rb -d #{deep_link} #{options} -p #{project_dir} -n Runner.xcodeproj")
else
abort("link_kit deep_link is null, add code in pubspec.yaml:\nlink_kit:\n deep_link: ${your deep link scheme}:///\n android:\n app_link: https://${your applinks domain}/universal_link/${example_app}/link_kit/ # 可选配置\n ios:\n universal_link: https://${your applinks domain}/universal_link/${example_app}/link_kit/ # 可选配置\n")
abort("link_kit deep link is invalid, add code in pubspec.yaml:\nlink_kit:\n deep_link: ${your deep link scheme}:///\n android:\n app_link: https://${your applinks domain}/universal_link/${example_app}/link_kit/ # 可选配置\n ios:\n universal_link: https://${your applinks domain}/universal_link/${example_app}/link_kit/ # 可选配置\n")
end
Pod::Spec.new do |s|

View File

@ -7,6 +7,7 @@
require 'xcodeproj'
require 'plist'
require 'optparse'
require 'uri'
# Dictionary to hold command line arguments
options_dict = {}