mirror of
https://github.com/RxReader/tencent_kit.git
synced 2025-07-04 20:30:12 +08:00
feature 5.0.0
This commit is contained in:
@ -115,7 +115,7 @@ dependencies:
|
||||
|
||||
tencent_kit:
|
||||
app_id: ${your tencent app id}
|
||||
universal_link: https://${your applinks domain}/universal_link/${example_app}/qq_conn/${your tencent app id}/
|
||||
universal_link: https://${your applinks domain}/universal_link/${example_app}/qq_conn/${your tencent app id}/ # 可选项目
|
||||
```
|
||||
|
||||
## 示例
|
||||
|
@ -8,8 +8,8 @@ import 'package:tencent_kit_example/api/model/tencent_api_resp.dart';
|
||||
import 'package:tencent_kit_example/api/model/tencent_unionid_resp.dart';
|
||||
import 'package:tencent_kit_example/api/tencent_api.dart';
|
||||
|
||||
const String _TENCENT_APPID = 'your tencent app id';
|
||||
const String _UNIVERSAL_LINK = 'your tencent universal link';
|
||||
const String _kTencentAppID = 'your tencent app id';
|
||||
const String _kUniversalLink = 'your tencent universal link'; // 可选项目
|
||||
|
||||
void main() {
|
||||
runApp(MyApp());
|
||||
@ -85,7 +85,7 @@ class _HomeState extends State<Home> {
|
||||
ListTile(
|
||||
title: Text('注册APP'),
|
||||
onTap: () async {
|
||||
await TencentKitPlatform.instance.registerApp(appId: _TENCENT_APPID, universalLink: _UNIVERSAL_LINK);
|
||||
await TencentKitPlatform.instance.registerApp(appId: _kTencentAppID, universalLink: _kUniversalLink);
|
||||
_showTips('注册APP', '注册成功');
|
||||
},
|
||||
),
|
||||
@ -112,7 +112,7 @@ class _HomeState extends State<Home> {
|
||||
!(_loginResp!.isExpired ?? true)) {
|
||||
final TencentUserInfoResp userInfo =
|
||||
await TencentApi.getUserInfo(
|
||||
appId: _TENCENT_APPID,
|
||||
appId: _kTencentAppID,
|
||||
openid: _loginResp!.openid!,
|
||||
accessToken: _loginResp!.accessToken!,
|
||||
);
|
||||
|
@ -94,4 +94,4 @@ flutter:
|
||||
|
||||
tencent_kit:
|
||||
app_id: 123456789
|
||||
universal_link: https://www.yourdomain.com/universal_link/example_app/qq_conn/123456789/
|
||||
universal_link: https://www.yourdomain.com/universal_link/example_app/qq_conn/123456789/ # 可选项目
|
||||
|
@ -11,10 +11,14 @@ calling_dir = File.dirname(__FILE__)
|
||||
project_dir = calling_dir.slice(0..(calling_dir.index('/.symlinks')))
|
||||
root_project_dir = calling_dir.slice(0..(calling_dir.index('/ios/.symlinks')))
|
||||
cfg = YAML.load_file(File.join(root_project_dir, 'pubspec.yaml'))
|
||||
if cfg['tencent_kit'] && (cfg['tencent_kit']['app_id'] && cfg['tencent_kit']['universal_link'])
|
||||
if cfg['tencent_kit'] && (cfg['tencent_kit']['app_id'] || cfg['tencent_kit']['universal_link'])
|
||||
app_id = cfg['tencent_kit']['app_id']
|
||||
universal_link = cfg['tencent_kit']['universal_link']
|
||||
system("ruby #{current_dir}/tencent_setup.rb -a #{app_id} -u #{universal_link} -p #{project_dir} -n Runner.xcodeproj")
|
||||
options = ""
|
||||
if (universal_link)
|
||||
options = "-u #{universal_link}"
|
||||
end
|
||||
system("ruby #{current_dir}/tencent_setup.rb -a #{app_id} #{options} -p #{project_dir} -n Runner.xcodeproj")
|
||||
end
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
|
@ -50,7 +50,6 @@ project.targets.each do |target|
|
||||
if (target.name == "Runner")
|
||||
app_id = options_dict[:app_id]
|
||||
universal_link = options_dict[:universal_link]
|
||||
applinks = "applinks:#{URI.parse(universal_link).host}"
|
||||
|
||||
sectionObject = {}
|
||||
project.objects.each do |object|
|
||||
@ -132,37 +131,40 @@ project.targets.each do |target|
|
||||
File.write(infoplistFile, Plist::Emit.dump(result))
|
||||
end
|
||||
end
|
||||
sectionObject.build_configurations.each do |config|
|
||||
codeSignEntitlements = config.build_settings["CODE_SIGN_ENTITLEMENTS"]
|
||||
if (!codeSignEntitlements)
|
||||
codeSignEntitlements = "Runner/Runner.entitlements"
|
||||
config.build_settings["CODE_SIGN_ENTITLEMENTS"] = codeSignEntitlements
|
||||
project.save()
|
||||
end
|
||||
codeSignEntitlementsFile = File.join(options_dict[:project_dir], codeSignEntitlements)
|
||||
if !File.exist?(codeSignEntitlementsFile)
|
||||
content = Plist::Emit.dump({})
|
||||
File.write(codeSignEntitlementsFile, content)
|
||||
end
|
||||
runnerTargetMainGroup = project.main_group.find_subpath('Runner', false)
|
||||
isRefExist = runnerTargetMainGroup.files.any? { |file| file.path.include? File.basename(codeSignEntitlementsFile) }
|
||||
if !isRefExist
|
||||
runnerTargetMainGroup.new_reference(File.basename(codeSignEntitlementsFile))
|
||||
project.save()
|
||||
end
|
||||
result = Plist.parse_xml(codeSignEntitlementsFile, marshal: false)
|
||||
if (!result)
|
||||
result = {}
|
||||
end
|
||||
domains = result["com.apple.developer.associated-domains"]
|
||||
if (!domains)
|
||||
domains = []
|
||||
result["com.apple.developer.associated-domains"] = domains
|
||||
end
|
||||
isApplinksExist = domains.include? applinks
|
||||
if (!isApplinksExist)
|
||||
domains << applinks
|
||||
File.write(codeSignEntitlementsFile, Plist::Emit.dump(result))
|
||||
if (universal_link)
|
||||
applinks = "applinks:#{URI.parse(universal_link).host}"
|
||||
sectionObject.build_configurations.each do |config|
|
||||
codeSignEntitlements = config.build_settings["CODE_SIGN_ENTITLEMENTS"]
|
||||
if (!codeSignEntitlements)
|
||||
codeSignEntitlements = "Runner/Runner.entitlements"
|
||||
config.build_settings["CODE_SIGN_ENTITLEMENTS"] = codeSignEntitlements
|
||||
project.save()
|
||||
end
|
||||
codeSignEntitlementsFile = File.join(options_dict[:project_dir], codeSignEntitlements)
|
||||
if !File.exist?(codeSignEntitlementsFile)
|
||||
content = Plist::Emit.dump({})
|
||||
File.write(codeSignEntitlementsFile, content)
|
||||
end
|
||||
runnerTargetMainGroup = project.main_group.find_subpath('Runner', false)
|
||||
isRefExist = runnerTargetMainGroup.files.any? { |file| file.path.include? File.basename(codeSignEntitlementsFile) }
|
||||
if !isRefExist
|
||||
runnerTargetMainGroup.new_reference(File.basename(codeSignEntitlementsFile))
|
||||
project.save()
|
||||
end
|
||||
result = Plist.parse_xml(codeSignEntitlementsFile, marshal: false)
|
||||
if (!result)
|
||||
result = {}
|
||||
end
|
||||
domains = result["com.apple.developer.associated-domains"]
|
||||
if (!domains)
|
||||
domains = []
|
||||
result["com.apple.developer.associated-domains"] = domains
|
||||
end
|
||||
isApplinksExist = domains.include? applinks
|
||||
if (!isApplinksExist)
|
||||
domains << applinks
|
||||
File.write(codeSignEntitlementsFile, Plist::Emit.dump(result))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user