62 lines
2.2 KiB
Objective-C
62 lines
2.2 KiB
Objective-C
//
|
||
// KBConfig.h
|
||
// 主 App 与键盘扩展共用的配置/宏。
|
||
//
|
||
// 在此处修改后,会通过 PCH 被两个 target 同步引用。
|
||
//
|
||
|
||
#ifndef KBConfig_h
|
||
#define KBConfig_h
|
||
|
||
// 基础baseUrl
|
||
#ifndef KB_BASE_URL
|
||
#define KB_BASE_URL @"https://m1.apifoxmock.com/m1/5438099-5113192-default/"
|
||
#endif
|
||
|
||
// Universal Links 通用链接
|
||
#ifndef KB_UL_BASE
|
||
#define KB_UL_BASE @"https://your.domain/ul"
|
||
#endif
|
||
|
||
#define KB_UL_LOGIN KB_UL_BASE @"/login"
|
||
#define KB_UL_SETTINGS KB_UL_BASE @"/settings"
|
||
|
||
#endif /* KBConfig_h */
|
||
|
||
// --- 认证/共享钥匙串 配置 ---
|
||
// 若已在 Capabilities 中启用 Keychain Sharing,并添加访问组:
|
||
// $(AppIdentifierPrefix)com.loveKey.nyx.shared
|
||
// 运行时会展开为:TN6HHV45BB.com.loveKey.nyx.shared
|
||
// KBAuthManager 通过下面的宏定位访问组;如需修改,可在 Build Settings 或前缀头中覆盖该宏。
|
||
#ifndef KB_KEYCHAIN_ACCESS_GROUP
|
||
#define KB_KEYCHAIN_ACCESS_GROUP @"TN6HHV45BB.com.loveKey.nyx.shared"
|
||
#endif
|
||
|
||
// --- 设备特性:是否为带刘海机型(iPhone X 及以后异形屏)---
|
||
// 说明:在 iPhone 12 等机型底部会有 34px 安全区,这里通过安全区来判断是否为“刘海屏”。
|
||
// 注意:使用到 UIKit,这里自行引入,避免依赖 PCH 的包含顺序。
|
||
#import <UIKit/UIKit.h>
|
||
static inline BOOL KBDeviceHasNotchRuntime(void) {
|
||
if (@available(iOS 11.0, *)) {
|
||
UIWindow *window = nil;
|
||
if (@available(iOS 13.0, *)) {
|
||
for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
|
||
if (scene.activationState == UISceneActivationStateForegroundActive && [scene isKindOfClass:[UIWindowScene class]]) {
|
||
UIWindowScene *ws = (UIWindowScene *)scene;
|
||
for (UIWindow *w in ws.windows) { if (w.isKeyWindow) { window = w; break; } }
|
||
if (window) { break; }
|
||
}
|
||
}
|
||
if (!window) { window = UIApplication.sharedApplication.windows.firstObject; }
|
||
} else {
|
||
window = UIApplication.sharedApplication.keyWindow;
|
||
}
|
||
return window.safeAreaInsets.bottom > 0.0;
|
||
}
|
||
return NO;
|
||
}
|
||
|
||
#ifndef KB_DEVICE_HAS_NOTCH
|
||
#define KB_DEVICE_HAS_NOTCH (KBDeviceHasNotchRuntime())
|
||
#endif
|