From 10dfe9b1d6e4a2cfe3f3994df2b99d483d68a3eb Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Thu, 30 Oct 2025 20:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=9A=E7=94=A8=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E5=AE=8F=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CustomKeyboard/PrefixHeader.pch | 6 ++++++ CustomKeyboard/View/KBFullAccessGuideView.m | 4 ++-- CustomKeyboard/View/KBFunctionView.m | 4 +--- keyBoard/KeyBoardPrefixHeader.pch | 6 ++++++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CustomKeyboard/PrefixHeader.pch b/CustomKeyboard/PrefixHeader.pch index 6db6558..a12705a 100644 --- a/CustomKeyboard/PrefixHeader.pch +++ b/CustomKeyboard/PrefixHeader.pch @@ -20,5 +20,11 @@ // 网络基地址(Mock环境) #define KB_BASE_URL @"https://m1.apifoxmock.com/m1/5438099-5113192-default/" +// 通用链接(Universal Links)统一配置 +// 配置好 AASA 与 Associated Domains 后,只需修改这里即可切换域名/path。 +#define KB_UL_BASE @"https://your.domain/ul" // 替换为你的真实域名与前缀路径 +#define KB_UL_LOGIN KB_UL_BASE @"/login" +#define KB_UL_SETTINGS KB_UL_BASE @"/settings" + #endif /* PrefixHeader_pch */ diff --git a/CustomKeyboard/View/KBFullAccessGuideView.m b/CustomKeyboard/View/KBFullAccessGuideView.m index ad10716..6b7b49e 100644 --- a/CustomKeyboard/View/KBFullAccessGuideView.m +++ b/CustomKeyboard/View/KBFullAccessGuideView.m @@ -1,7 +1,7 @@ // // KBFullAccessGuideView.m // CustomKeyboard -// +// 没有开启完全访问的提示框 #import "KBFullAccessGuideView.h" #import "Masonry.h" @@ -164,7 +164,7 @@ if (!ivc) { [self dismiss]; return; } // 先尝试 Universal Link(如未配置可改为你的域名),失败再用自定义 scheme。 - NSURL *ul = [NSURL URLWithString:@"https://your.domain/ul/settings?src=kb_extension"]; + NSURL *ul = [NSURL URLWithString:[NSString stringWithFormat:@"%@?src=kb_extension", KB_UL_SETTINGS]]; void (^fallback)(void) = ^{ NSURL *scheme = [NSURL URLWithString:@"kbkeyboard://settings?src=kb_extension"]; // 主App在 openURL 中处理 [ivc.extensionContext openURL:scheme completionHandler:^(__unused BOOL ok2) { diff --git a/CustomKeyboard/View/KBFunctionView.m b/CustomKeyboard/View/KBFunctionView.m index 08f50a0..9df1ef0 100644 --- a/CustomKeyboard/View/KBFunctionView.m +++ b/CustomKeyboard/View/KBFunctionView.m @@ -14,8 +14,6 @@ #import "KBFullAccessGuideView.h" static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId"; -// 通用链接(替换为你的真实域名 + 路径,并在主App配置 Associated Domains 与 AASA) -static NSString * const kKBUniversalLinkLogin = @"https://your.domain/ul/login"; @interface KBFunctionView () // UI @@ -172,7 +170,7 @@ static NSString * const kKBUniversalLinkLogin = @"https://your.domain/ul/login"; NSString *title = (indexPath.item < self.itemsInternal.count) ? self.itemsInternal[indexPath.item] : @""; NSString *encodedTitle = [title stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] ?: @""; - NSURL *ul = [NSURL URLWithString:[NSString stringWithFormat:@"%@?src=functionView&index=%ld&title=%@", kKBUniversalLinkLogin, (long)indexPath.item, encodedTitle]]; + NSURL *ul = [NSURL URLWithString:[NSString stringWithFormat:@"%@?src=functionView&index=%ld&title=%@", KB_UL_LOGIN, (long)indexPath.item, encodedTitle]]; if (!ul) return; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ diff --git a/keyBoard/KeyBoardPrefixHeader.pch b/keyBoard/KeyBoardPrefixHeader.pch index 1477a34..46847cf 100644 --- a/keyBoard/KeyBoardPrefixHeader.pch +++ b/keyBoard/KeyBoardPrefixHeader.pch @@ -32,6 +32,12 @@ // 网络基地址(Mock环境) #define KB_BASE_URL @"https://m1.apifoxmock.com/m1/5438099-5113192-default/" +// 通用链接(Universal Links)统一配置 +// 仅需修改这里的域名/前缀,工程内所有使用 UL 的地方都会同步。 +#define KB_UL_BASE @"https://your.domain/ul" // 替换为你的真实域名与前缀路径 +#define KB_UL_LOGIN KB_UL_BASE @"/login" +#define KB_UL_SETTINGS KB_UL_BASE @"/settings" + /// UI 尺寸/设备宏 // 屏幕尺寸 #define KB_SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)