处理上架的问题
1:处理了openurl 拉起问题 2:去掉了http 3 隐私等等
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
#import "KBFunctionPasteView.h"
|
||||
#import "KBFunctionTagCell.h"
|
||||
#import "KBFunctionTagListView.h"
|
||||
#import "KBHostAppLauncher.h"
|
||||
#import "KBExtensionAppLauncher.h"
|
||||
#import "KBInputBufferManager.h"
|
||||
#import "KBResponderUtils.h" // 统一查找 UIInputViewController 的工具
|
||||
#import "KBSignUtils.h"
|
||||
@@ -142,76 +142,26 @@
|
||||
|
||||
/// 整体背景色:暗黑 #323232,浅色 #D0D3DA
|
||||
+ (UIColor *)kb_backgroundColor {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||
UITraitCollection *_Nonnull traitCollection) {
|
||||
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||
return [UIColor colorWithHex:0x2B2B2B];
|
||||
} else {
|
||||
return [UIColor colorWithHex:0xD0D3DA];
|
||||
}
|
||||
}];
|
||||
}
|
||||
return [UIColor colorWithHex:0xD0D3DA];
|
||||
}
|
||||
|
||||
/// Cell 背景色:暗黑 #707070,浅色 白色90%透明度
|
||||
+ (UIColor *)kb_cellBackgroundColor {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||
UITraitCollection *_Nonnull traitCollection) {
|
||||
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||
return [UIColor colorWithHex:0x707070];
|
||||
} else {
|
||||
return [UIColor colorWithWhite:1 alpha:0.9];
|
||||
}
|
||||
}];
|
||||
}
|
||||
return [UIColor colorWithWhite:1 alpha:0.9];
|
||||
}
|
||||
|
||||
/// Cell 文字颜色:暗黑 #FFFFFF,浅色 #1B1F1A
|
||||
+ (UIColor *)kb_cellTextColor {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||
UITraitCollection *_Nonnull traitCollection) {
|
||||
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||
return [UIColor whiteColor];
|
||||
} else {
|
||||
return [UIColor colorWithHex:0x1B1F1A];
|
||||
}
|
||||
}];
|
||||
}
|
||||
return [UIColor colorWithHex:0x1B1F1A];
|
||||
}
|
||||
|
||||
/// Clear 按钮文字颜色:暗黑白色,浅色黑色
|
||||
+ (UIColor *)kb_clearButtonTextColor {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||
UITraitCollection *_Nonnull traitCollection) {
|
||||
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||
return [UIColor whiteColor];
|
||||
} else {
|
||||
return [UIColor blackColor];
|
||||
}
|
||||
}];
|
||||
}
|
||||
return [UIColor blackColor];
|
||||
}
|
||||
|
||||
/// 删除按钮背景色:暗黑 #707070,浅色 #B9BDC8
|
||||
+ (UIColor *)kb_deleteButtonBackgroundColor {
|
||||
if (@available(iOS 13.0, *)) {
|
||||
return [UIColor colorWithDynamicProvider:^UIColor *_Nonnull(
|
||||
UITraitCollection *_Nonnull traitCollection) {
|
||||
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
|
||||
return [UIColor colorWithHex:0x707070];
|
||||
} else {
|
||||
return [UIColor colorWithHex:0xB9BDC8];
|
||||
}
|
||||
}];
|
||||
}
|
||||
return [UIColor colorWithHex:0xB9BDC8];
|
||||
}
|
||||
|
||||
@@ -505,7 +455,10 @@
|
||||
if (event.data.length == 0) {
|
||||
return;
|
||||
}
|
||||
NSLog(@"[KBStream] SSE raw payload: %@", event.data);
|
||||
#if DEBUG
|
||||
NSLog(@"[KBStream] SSE raw payload len=%lu",
|
||||
(unsigned long)(event.data ?: @"").length);
|
||||
#endif
|
||||
NSData *jsonData = [event.data dataUsingEncoding:NSUTF8StringEncoding];
|
||||
if (!jsonData) {
|
||||
return;
|
||||
@@ -778,12 +731,27 @@
|
||||
if (!KBAuthManager.shared.isLoggedIn) {
|
||||
|
||||
UIInputViewController *ivc = KBFindInputViewController(self);
|
||||
if (!ivc) {
|
||||
[KBHUD showInfo:KBLocalized(@"请回到桌面手动打开App登录")];
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *schemeStr =
|
||||
[NSString stringWithFormat:@"%@://login?src=keyboard", KB_APP_SCHEME];
|
||||
NSURL *scheme = [NSURL URLWithString:schemeStr];
|
||||
// 从当前视图作为起点,通过响应链找到 UIApplication 再调起主 App
|
||||
BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:ivc.view];
|
||||
NSURL *ul = [NSURL URLWithString:[NSString stringWithFormat:@"%@?src=keyboard", KB_UL_LOGIN]];
|
||||
NSURL *scheme =
|
||||
[NSURL URLWithString:[NSString stringWithFormat:@"%@://login?src=keyboard", KB_APP_SCHEME]];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[KBExtensionAppLauncher openPrimaryURL:ul
|
||||
fallbackURL:scheme
|
||||
usingInputController:ivc
|
||||
source:(ivc.view ?: (UIResponder *)weakSelf)
|
||||
completion:^(BOOL success) {
|
||||
if (success) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[KBHUD showInfo:KBLocalized(@"请回到桌面手动打开App登录")];
|
||||
});
|
||||
}];
|
||||
return;
|
||||
// if (!ivc) return;
|
||||
// NSString *encodedTitle = [title
|
||||
@@ -881,37 +849,34 @@ static void KBULDarwinCallback(CFNotificationCenterRef center, void *observer,
|
||||
if (!ul)
|
||||
return;
|
||||
|
||||
dispatch_after(
|
||||
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)),
|
||||
dispatch_get_main_queue(), ^{
|
||||
// 先尝试通过 extensionContext 打开 UL
|
||||
[ivc.extensionContext
|
||||
openURL:ul
|
||||
completionHandler:^(BOOL ok) {
|
||||
if (ok) {
|
||||
return;
|
||||
}
|
||||
// UL 失败时,再通过宿主 UIApplication + 自定义 Scheme 兜底
|
||||
NSURL *scheme = [NSURL
|
||||
URLWithString:
|
||||
[NSString
|
||||
stringWithFormat:
|
||||
@"%@@//login?src=functionView&index=%ld&title=%@",
|
||||
KB_APP_SCHEME, (long)indexPath.item,
|
||||
encodedTitle]];
|
||||
UIResponder *start = ivc.view ?: (UIResponder *)self;
|
||||
BOOL ok2 = [KBHostAppLauncher openHostAppURL:scheme
|
||||
fromResponder:start];
|
||||
if (!ok2) {
|
||||
// 两条路都失败:大概率未开完全访问或宿主拦截。统一交由 Manager
|
||||
// 引导。
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[KBFullAccessManager shared]
|
||||
ensureFullAccessOrGuideInView:self];
|
||||
});
|
||||
}
|
||||
}];
|
||||
});
|
||||
NSURL *scheme = [NSURL
|
||||
URLWithString:
|
||||
[NSString stringWithFormat:
|
||||
@"%@://login?src=functionView&index=%ld&title=%@",
|
||||
KB_APP_SCHEME, (long)indexPath.item, encodedTitle]];
|
||||
|
||||
__weak typeof(self) weakSelf = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)),
|
||||
dispatch_get_main_queue(), ^{
|
||||
__strong typeof(weakSelf) self = weakSelf;
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
[KBExtensionAppLauncher
|
||||
openPrimaryURL:ul
|
||||
fallbackURL:scheme
|
||||
usingInputController:ivc
|
||||
source:(ivc.view ?: (UIResponder *)self)
|
||||
completion:^(BOOL success) {
|
||||
if (success) {
|
||||
return;
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[KBFullAccessManager shared]
|
||||
ensureFullAccessOrGuideInView:self];
|
||||
});
|
||||
}];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - Button Actions
|
||||
|
||||
Reference in New Issue
Block a user