make app_id is not required on iOS #536

This commit is contained in:
JarvanMo
2023-05-16 21:00:28 +08:00
parent d2348fbcc7
commit 583d58bde9
5 changed files with 22 additions and 22 deletions

View File

@ -29,7 +29,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
fluwx: 1cbf0e7cba1a5805ac928cbc3165c88580a7c53f
fluwx: d725e175af372180498ce6daad7be464f48c78b5
integration_test: 13825b8a9334a850581300559b8839134b124670
WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69

View File

@ -11,7 +11,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleGetInfoString</key>
<string/>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
@ -25,23 +25,11 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict/>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>weixin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>123456</string>
</array>
</dict>
</array>
<array/>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSApplicationCategoryType</key>
<string/>
<string></string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>

View File

@ -84,7 +84,7 @@ flutter:
# see https://flutter.dev/custom-fonts/#from-packages
fluwx:
app_id: 123456
# app_id: 123456
# only debug in debug mode
debug_logging: true
android:

View File

@ -27,12 +27,22 @@ else
fluwx_subspec = 'pay'
end
Pod::UI.puts "using sdk with #{fluwx_subspec}"
if cfg['fluwx'] && (cfg['fluwx']['app_id'] && cfg['fluwx']['ios'] && cfg['fluwx']['ios']['universal_link'])
app_id = nil
if cfg['fluwx'] && cfg['fluwx']['app_id']
app_id = cfg['fluwx']['app_id']
end
if cfg['fluwx'] && (cfg['fluwx']['ios'] && cfg['fluwx']['ios']['universal_link'])
universal_link = cfg['fluwx']['ios']['universal_link']
system("ruby #{current_dir}/wechat_setup.rb -a #{app_id} -u #{universal_link} -p #{project_dir} -n Runner.xcodeproj")
if app_id.nil?
system("ruby #{current_dir}/wechat_setup.rb -u #{universal_link} -p #{project_dir} -n Runner.xcodeproj")
else
system("ruby #{current_dir}/wechat_setup.rb -a #{app_id} -u #{universal_link} -p #{project_dir} -n Runner.xcodeproj")
end
else
abort("required values:[app_id, universal_link] are missing. Please add them in pubspec.yaml:\nfluwx:\n app_id: ${app id}\n \nios:\nuniversal_link: https://${applinks domain}/universal_link/${example_app}/wechat/\n")
abort("required values:[auniversal_link] are missing. Please add them in pubspec.yaml:\nfluwx:\n \nios:\nuniversal_link: https://${applinks domain}/universal_link/${example_app}/wechat/\n")
end
Pod::Spec.new do |s|

View File

@ -79,14 +79,16 @@ project.targets.each do |target|
result["CFBundleURLTypes"] = urlTypes
end
isUrlTypeExist = urlTypes.any? { |urlType| urlType["CFBundleURLSchemes"] && (urlType["CFBundleURLSchemes"].include? app_id) }
if !isUrlTypeExist
urlTypes << {
if !app_id.nil? && !app_id.empty? && !isUrlTypeExist
print("writing app id\n ")
urlTypes << {
"CFBundleTypeRole": "Editor",
"CFBundleURLName": "weixin",
"CFBundleURLSchemes": [ app_id ]
}
File.write(infoplistFile, Plist::Emit.dump(result))
end
queriesSchemes = result["LSApplicationQueriesSchemes"]
if !queriesSchemes
queriesSchemes = []