处理通用链接宏控制

This commit is contained in:
2025-10-30 20:53:44 +08:00
parent 6993bfd682
commit 10dfe9b1d6
4 changed files with 15 additions and 5 deletions

View File

@@ -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 */

View File

@@ -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) {

View File

@@ -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 () <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, KBFunctionBarViewDelegate>
// 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(), ^{

View File

@@ -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)