This commit is contained in:
2025-10-30 20:23:34 +08:00
parent 9af91cc4bc
commit 247a87891e
8 changed files with 302 additions and 17 deletions

View File

@@ -10,6 +10,7 @@
#import "KBFunctionPasteView.h"
#import "KBFunctionTagCell.h"
#import "Masonry.h"
#import <MBProgressHUD.h>
static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId";
@@ -160,6 +161,26 @@ static NSString * const kKBFunctionTagCellId = @"KBFunctionTagCellId";
return 12.0;
}
// App App
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
UIInputViewController *ivc = [self findInputViewController];
if (!ivc) return;
NSString *title = (indexPath.item < self.itemsInternal.count) ? self.itemsInternal[indexPath.item] : @"";
NSString *encodedTitle = [title stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]] ?: @"";
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"kbkeyboard://login?src=functionView&index=%ld&title=%@", (long)indexPath.item, encodedTitle]];
if (!url) return;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[ivc.extensionContext openURL:url completionHandler:^(BOOL success) {
if (!success) {
NSLog(@"[KB] openURL failed. Likely Full Access is OFF. 请到 设置>通用>键盘>键盘>你的键盘 开启“允许完全访问”。");
}
}];
});
}
#pragma mark - Button Actions
- (void)onTapPaste {