re-enable and update first launch tip

This commit is contained in:
TrueZhuanjia committed 2025-07-22 21:41:38 +08:00
1 parent 5759c122ed
commit e63ce4d101
3 files changed
+51 -30

No files matched your search

@@ -420,7 +420,6 @@
#endif
- (void)popFirstLaunchTip {
return; // temp disable
// 初始化倒计时秒数
__block NSInteger remainingSeconds = 16;
@@ -428,9 +427,25 @@
NSString* cmdToolEdgeSide = _settings.slideToSettingsScreenEdge.intValue == UIRectEdgeLeft ? [LocalizationHelper localizedStringForKey:@"right"] : [LocalizationHelper localizedStringForKey:@"left"];
uint8_t slideDist = (uint8_t)(_settings.slideToSettingsDistance.floatValue * 100);
// 创建弹窗
UIAlertController *alert = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"First Launch Tips"]
message:[LocalizationHelper localizedStringForKey:@"\n1. From %@ edge, slide %d%% screen width to open settings menu\n\n2. From %@ edge, slide %d%% screen width to open command tool\n\n3. Back to Streaming from settings menu: slide from left edge\n\n4. Slide from upper 40%% of screen edge to avoid sending touch events to PC side", settingsEdgeSide, slideDist, cmdToolEdgeSide, slideDist]
preferredStyle:UIAlertControllerStyleAlert];
NSString* tipText = [LocalizationHelper localizedStringForKey:@"firstLaunchTip", settingsEdgeSide, slideDist, cmdToolEdgeSide, slideDist];
UIAlertController *tipsAlertController = [UIAlertController alertControllerWithTitle: [LocalizationHelper localizedStringForKey:@"First Launch Tips"] message: [LocalizationHelper localizedStringForKey:@"%@", tipText] preferredStyle:UIAlertControllerStyleAlert];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentLeft;
NSDictionary *attributes = @{
NSParagraphStyleAttributeName: paragraphStyle,
NSFontAttributeName: [UIFont systemFontOfSize:14]
};
NSAttributedString *attributedMessage = [[NSAttributedString alloc] initWithString:tipText
attributes:attributes];
// 使用 KVC 设置 attributedMessage(注意审核风险)
[tipsAlertController setValue:attributedMessage forKey:@"attributedMessage"];
// 添加确认按钮(初始禁用)
UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Got it! (15)"]
@@ -438,10 +453,10 @@
handler:^(UIAlertAction * _Nonnull action) {
}];
confirmAction.enabled = NO;
[alert addAction:confirmAction];
[tipsAlertController addAction:confirmAction];
// 显示弹窗
[self presentViewController:alert animated:YES completion:nil];
[self presentViewController:tipsAlertController animated:YES completion:nil];
// 使用dispatch_source_t实现精确倒计时
dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());