Skip to content

Commit

Permalink
Fix BKDefaults class name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
yury authored and Carlos Cabanero committed Feb 21, 2023
1 parent 4abaa9b commit 232cf6b
Show file tree
Hide file tree
Showing 29 changed files with 161 additions and 139 deletions.
24 changes: 12 additions & 12 deletions Blink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
C989E5571D6CC4A1003E0079 /* BKFontCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C989E5531D6CC4A1003E0079 /* BKFontCreateViewController.m */; };
C989E5581D6CC4A1003E0079 /* BKThemeCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C989E5551D6CC4A1003E0079 /* BKThemeCreateViewController.m */; };
C9B2E02F1D6B612400B89F69 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C9B2E0041D6B612300B89F69 /* Settings.storyboard */; };
C9B2E0311D6B612400B89F69 /* BKDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B2E00A1D6B612300B89F69 /* BKDefaults.m */; };
C9B2E0311D6B612400B89F69 /* BLKDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B2E00A1D6B612300B89F69 /* BLKDefaults.m */; };
C9B2E0321D6B612400B89F69 /* BKFont.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B2E00C1D6B612300B89F69 /* BKFont.m */; };
C9B2E0341D6B612400B89F69 /* BKTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B2E0101D6B612300B89F69 /* BKTheme.m */; };
C9B2E0351D6B612400B89F69 /* BKSettingsFileDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B2E0131D6B612300B89F69 /* BKSettingsFileDownloader.m */; };
Expand Down Expand Up @@ -853,8 +853,8 @@
C989E5541D6CC4A1003E0079 /* BKThemeCreateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKThemeCreateViewController.h; sourceTree = "<group>"; };
C989E5551D6CC4A1003E0079 /* BKThemeCreateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKThemeCreateViewController.m; sourceTree = "<group>"; };
C9B2E0051D6B612300B89F69 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Settings.storyboard; sourceTree = "<group>"; };
C9B2E0091D6B612300B89F69 /* BKDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKDefaults.h; sourceTree = "<group>"; };
C9B2E00A1D6B612300B89F69 /* BKDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKDefaults.m; sourceTree = "<group>"; };
C9B2E0091D6B612300B89F69 /* BLKDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BLKDefaults.h; sourceTree = "<group>"; };
C9B2E00A1D6B612300B89F69 /* BLKDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BLKDefaults.m; sourceTree = "<group>"; };
C9B2E00B1D6B612300B89F69 /* BKFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKFont.h; sourceTree = "<group>"; };
C9B2E00C1D6B612300B89F69 /* BKFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKFont.m; sourceTree = "<group>"; };
C9B2E00F1D6B612300B89F69 /* BKTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKTheme.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1770,8 +1770,8 @@
BD3E1E4F278D190500333C44 /* Archive.swift */,
C94437551D8311960096F84E /* BKResource.h */,
C94437561D8311960096F84E /* BKResource.m */,
C9B2E0091D6B612300B89F69 /* BKDefaults.h */,
C9B2E00A1D6B612300B89F69 /* BKDefaults.m */,
C9B2E0091D6B612300B89F69 /* BLKDefaults.h */,
C9B2E00A1D6B612300B89F69 /* BLKDefaults.m */,
C9B2E00B1D6B612300B89F69 /* BKFont.h */,
C9B2E00C1D6B612300B89F69 /* BKFont.m */,
C9B2E00F1D6B612300B89F69 /* BKTheme.h */,
Expand Down Expand Up @@ -3097,7 +3097,7 @@
D2334D1C21495DAE00D26AC3 /* udptunnel.m in Sources */,
D264D2B628F84724002B1B14 /* whatsnew.m in Sources */,
D277150E287F0C2200D31F4E /* TokioSignals.m in Sources */,
C9B2E0311D6B612400B89F69 /* BKDefaults.m in Sources */,
C9B2E0311D6B612400B89F69 /* BLKDefaults.m in Sources */,
D26A37F026A0AB7000534A4D /* facecam.swift in Sources */,
D21DEE41260C9A3D00D8E640 /* ImportKeyView.swift in Sources */,
D242157822E878950037E5A6 /* UIColor+Codable.swift in Sources */,
Expand Down Expand Up @@ -3669,7 +3669,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 712;
CURRENT_PROJECT_VERSION = 715;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -3714,7 +3714,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 712;
CURRENT_PROJECT_VERSION = 715;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = BlinkFileProvider/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
Expand Down Expand Up @@ -3751,7 +3751,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 712;
CURRENT_PROJECT_VERSION = 715;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -3797,7 +3797,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 712;
CURRENT_PROJECT_VERSION = 715;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = BlinkFileProviderUI/Info.plist;
Expand Down Expand Up @@ -4406,7 +4406,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 712;
CURRENT_PROJECT_VERSION = 715;
DEAD_CODE_STRIPPING = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -4451,7 +4451,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 712;
CURRENT_PROJECT_VERSION = 715;
DEAD_CODE_STRIPPING = NO;
DEFINES_MODULE = YES;
ENABLE_BITCODE = NO;
Expand Down
8 changes: 4 additions & 4 deletions Blink/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#import "AppDelegate.h"
#import "BKiCloudSyncHandler.h"
#import <BlinkConfig/BlinkPaths.h>
#import "BKDefaults.h"
#import "BLKDefaults.h"
#import <BlinkConfig/BKHosts.h>
#import <BlinkConfig/BKPubKey.h>
#import <ios_system/ios_system.h>
Expand Down Expand Up @@ -155,7 +155,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
//}

+ (void)reloadDefaults {
[BKDefaults loadDefaults];
[BLKDefaults loadDefaults];
[BKPubKey loadIDS];
[BKHosts loadHosts];
[AppDelegate _loadProfileVars];
Expand Down Expand Up @@ -213,7 +213,7 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserAct

- (BOOL)application:(UIApplication *)application shouldAllowExtensionPointIdentifier:(NSString *)extensionPointIdentifier {
if ([extensionPointIdentifier isEqualToString: UIApplicationKeyboardExtensionPointIdentifier]) {
return ![BKDefaults disableCustomKeyboards];
return ![BLKDefaults disableCustomKeyboards];
}
return YES;
}
Expand Down Expand Up @@ -358,7 +358,7 @@ - (void)_onSceneDidActiveNotification:(NSNotification *)notification {
}

- (void)_onScreenConnect {
[BKDefaults applyExternalScreenCompensation:BKDefaults.overscanCompensation];
[BLKDefaults applyExternalScreenCompensation:BLKDefaults.overscanCompensation];
}

#pragma mark - UNUserNotificationCenterDelegate
Expand Down
2 changes: 1 addition & 1 deletion Blink/Blink-bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extern void __thread_ssh_execute_command(const char *command, socket_t in, socke
extern int ios_dup2(int fd1, int fd2);
extern void ios_exit(int errorCode) __dead2; // set error code and exits from the thread.

#import "BKDefaults.h"
#import "BLKDefaults.h"
#import "UIDevice+DeviceName.h"
#import "BKHosts.h"
#import "BlinkPaths.h"
Expand Down
2 changes: 1 addition & 1 deletion Blink/Commands/help.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//
////////////////////////////////////////////////////////////////////////////////

#import "BKDefaults.h"
#import "BLKDefaults.h"
#import "BKUserConfigurationManager.h"

#include "ios_system/ios_system.h"
Expand Down
2 changes: 1 addition & 1 deletion Blink/LayoutManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BKDefaults.h"
#import "BLKDefaults.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
6 changes: 3 additions & 3 deletions Blink/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
if session.role == .windowExternalDisplay,
let mainScene = UIApplication.shared.connectedScenes.activeAppScene() {

if BKDefaults.overscanCompensation() == .BKBKOverscanCompensationMirror {
if BLKDefaults.overscanCompensation() == .BKBKOverscanCompensationMirror {
return
}

Expand Down Expand Up @@ -653,7 +653,7 @@ extension SceneDelegate {
return
}

guard BKDefaults.isXCallBackURLEnabled() else {
guard BLKDefaults.isXCallBackURLEnabled() else {
if let xCancelURL = xCancelURL {
blink_openurl(xCancelURL)
}
Expand All @@ -674,7 +674,7 @@ extension SceneDelegate {
// Cancel the execution of the command as x-callback-url are not
// enabled for the user's or the x-callback-url does not have
// the correct key set
guard keyItem == BKDefaults.xCallBackURLKey() else {
guard keyItem == BLKDefaults.xCallBackURLKey() else {

if let xErrorURL = xErrorURL {
blink_openurl(xErrorURL)
Expand Down
2 changes: 1 addition & 1 deletion Blink/SmarterKeys/CommandsHUDView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CommandsHUGView: UIView {
}

var colors: Colors {
switch BKDefaults.keyboardStyle() {
switch BLKDefaults.keyboardStyle() {
case .dark: return .dark
case .light: return .light
default:
Expand Down
6 changes: 3 additions & 3 deletions Blink/SpaceController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class SpaceController: UIViewController {

@objc private func _setupAppearance() {
self.view.tintColor = .cyan
switch BKDefaults.keyboardStyle() {
switch BLKDefaults.keyboardStyle() {
case .light:
overrideUserInterfaceStyle = .light
case .dark:
Expand Down Expand Up @@ -868,8 +868,8 @@ extension SpaceController {
}

func _toggleKeyCast() {
BKDefaults.setKeycasts(!BKDefaults.isKeyCastsOn())
BKDefaults.save()
BLKDefaults.setKeycasts(!BLKDefaults.isKeyCastsOn())
BLKDefaults.save()
}

func _activeSessions() -> [UISceneSession] {
Expand Down
5 changes: 5 additions & 0 deletions Blink/Subscriptions/PurchasesUserModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class PurchasesUserModel: ObservableObject {
return
}

guard PublishingOptions.current.contains(.appStore) else {
self.alertErrorMessage = "Available only in App Store"
return
}

withAnimation {
self.purchaseInProgress = true
}
Expand Down
22 changes: 11 additions & 11 deletions Blink/TermController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ class TermController: UIViewController {
private var _sessionParams: MCPParams = {
let params = MCPParams()

params.fontSize = BKDefaults.selectedFontSize()?.intValue ?? 16
params.fontName = BKDefaults.selectedFontName()
params.themeName = BKDefaults.selectedThemeName()
params.enableBold = BKDefaults.enableBold()
params.boldAsBright = BKDefaults.isBoldAsBright()
params.fontSize = BLKDefaults.selectedFontSize()?.intValue ?? 16
params.fontName = BLKDefaults.selectedFontName()
params.themeName = BLKDefaults.selectedThemeName()
params.enableBold = BLKDefaults.enableBold()
params.boldAsBright = BLKDefaults.isBoldAsBright()
params.viewSize = .zero
params.layoutMode = BKDefaults.layoutMode().rawValue
params.layoutMode = BLKDefaults.layoutMode().rawValue

return params
}()
Expand Down Expand Up @@ -164,7 +164,7 @@ class TermController: UIViewController {
convenience init(sceneRole: UISceneSession.Role? = nil) {
self.init(meta: nil)
if sceneRole == .windowExternalDisplay {
_sessionParams.fontSize = BKDefaults.selectedExternalDisplayFontSize()?.intValue ?? 24
_sessionParams.fontSize = BLKDefaults.selectedExternalDisplayFontSize()?.intValue ?? 24
}
}

Expand Down Expand Up @@ -338,14 +338,14 @@ extension TermController: TermDeviceDelegate {
*/
func viewDidReceiveBellRing() {

if BKDefaults.isPlaySoundOnBellOn() && _termView.isFocused() {
if BLKDefaults.isPlaySoundOnBellOn() && _termView.isFocused() {
AudioServicesPlaySystemSound(1103);
}

viewNotify(["title": "🔔 \(_termView.title ?? "")", "type": BKNotificationType.bell.rawValue])

// Haptic feedback is only visible from iPhones
if UIDevice.current.userInterfaceIdiom == .phone && !BKDefaults.hapticFeedbackOnBellOff() {
if UIDevice.current.userInterfaceIdiom == .phone && !BLKDefaults.hapticFeedbackOnBellOff() {
UINotificationFeedbackGenerator().notificationOccurred(.warning)
}
}
Expand All @@ -362,8 +362,8 @@ extension TermController: TermDeviceDelegate {
return
}

if notificationType == .bell && (_termView.isFocused() || !BKDefaults.isNotificationOnBellUnfocusedOn())
|| notificationType == .osc && !BKDefaults.isOscNotificationsOn() {
if notificationType == .bell && (_termView.isFocused() || !BLKDefaults.isNotificationOnBellUnfocusedOn())
|| notificationType == .osc && !BLKDefaults.isOscNotificationsOn() {
return
}

Expand Down
14 changes: 7 additions & 7 deletions Blink/TermView.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#import "TermView.h"
#import "TermDevice.h"
#import "BKDefaults.h"
#import "BLKDefaults.h"
#import "BKFont.h"
#import "BKTheme.h"
#import "TermJS.h"
Expand Down Expand Up @@ -482,7 +482,7 @@ - (void)processKB:(NSString *)str {
}

- (void)displayInput:(NSString *)input {
[self _evalJSScript: term_displayInput(input, BKDefaults.isKeyCastsOn)];
[self _evalJSScript: term_displayInput(input, BLKDefaults.isKeyCastsOn)];
}

// Write data to terminal control
Expand Down Expand Up @@ -826,7 +826,7 @@ - (WKUserScript *)_termInitScriptWith:(MCPParams *)params;
{
NSMutableArray *script = [[NSMutableArray alloc] init];
BOOL lockdownMode = [[NSUserDefaults.standardUserDefaults objectForKey:@"LDMGlobalEnabled"] boolValue];
BKFont *font = lockdownMode ? nil : [BKFont withName: params.fontName ?: [BKDefaults selectedFontName]];
BKFont *font = lockdownMode ? nil : [BKFont withName: params.fontName ?: [BLKDefaults selectedFontName]];
NSString *fontFamily = font.name;
NSString *content = font.content;
if (font && font.isCustom && content) {
Expand All @@ -843,14 +843,14 @@ - (WKUserScript *)_termInitScriptWith:(MCPParams *)params;
[script addObject:term_setBoldEnabled(params.enableBold)];
[script addObject:term_setBoldAsBright(params.boldAsBright)];

NSString *themeContent = [[BKTheme withName: params.themeName ?: [BKDefaults selectedThemeName]] content];
NSString *themeContent = [[BKTheme withName: params.themeName ?: [BLKDefaults selectedThemeName]] content];
if (themeContent) {
[script addObject:themeContent];
}

[script addObject:term_setFontSize(params.fontSize == 0 ? [BKDefaults selectedFontSize] : @(params.fontSize))];
[script addObject:term_setFontSize(params.fontSize == 0 ? [BLKDefaults selectedFontSize] : @(params.fontSize))];

[script addObject: term_setCursorBlink([BKDefaults isCursorBlink])];
[script addObject: term_setCursorBlink([BLKDefaults isCursorBlink])];
}
[script addObject:@"};"];

Expand All @@ -863,7 +863,7 @@ - (WKUserScript *)_termInitScriptWith:(MCPParams *)params;
}

- (void)applyTheme:(NSString *)themeName {
NSString *themeContent = [[BKTheme withName: themeName ?: [BKDefaults selectedThemeName]] content];
NSString *themeContent = [[BKTheme withName: themeName ?: [BLKDefaults selectedThemeName]] content];
if (themeContent) {
NSString *script = [NSString stringWithFormat:@"(function(){%@})();", themeContent];
[_webView evaluateJavaScript:script completionHandler:nil];
Expand Down
6 changes: 3 additions & 3 deletions Blink/WebKit/WKWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class UIScrollViewWithoutHitTest: UIScrollView {
case .recognized:

if focused {
_wkWebView?.evaluateJavaScript("term_reportMouseClick(\(point.x), \(point.y), 1, \(BKDefaults.isKeyCastsOn() ? "true" : "false"));", completionHandler: nil)
_wkWebView?.evaluateJavaScript("term_reportMouseClick(\(point.x), \(point.y), 1, \(BLKDefaults.isKeyCastsOn() ? "true" : "false"));", completionHandler: nil)
}
if let target = _wkWebView?.target(forAction: #selector(focusOnShellAction), withSender: self) as? UIResponder {
target.perform(#selector(focusOnShellAction), with: self)
Expand Down Expand Up @@ -337,7 +337,7 @@ extension WKWebViewGesturesInteraction: UIScrollViewDelegate {

let defaultFontSize = 20
if _characterSize == .none || _characterSize == .zero {
var size = BKDefaults.selectedFontSize().intValue
var size = BLKDefaults.selectedFontSize().intValue
if size == 0 {
size = defaultFontSize
}
Expand All @@ -359,7 +359,7 @@ extension WKWebViewGesturesInteraction: UIScrollViewDelegate {

let point = _scrollPoint ?? _scrollPointTrackpad ?? CGPoint(x: scrollView.bounds.size.width * 0.5, y: scrollView.bounds.size.height * 0.5)

if BKDefaults.doInvertVerticalScroll() {
if BLKDefaults.doInvertVerticalScroll() {
dY *= -1.0;
}

Expand Down
2 changes: 1 addition & 1 deletion Frameworks/ios_system
12 changes: 6 additions & 6 deletions KB/Native/Views/KBConfigView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private func _bindingRow(_ binding: KeyBinding, title: String, last: String) ->

struct KBConfigView: View {
@ObservedObject var config: KBConfig
@State private var _enableCustomKeyboards = !BKDefaults.disableCustomKeyboards()
@State private var _enableCustomKeyboards = !BLKDefaults.disableCustomKeyboards()
// @State private var _keyboardConnectPublisher = KBConfigView.keyboardPublisher
// @State private var _connectedKeyboardVendorName: String? = GCKeyboard.coalesced?.vendorName

Expand All @@ -74,8 +74,8 @@ struct KBConfigView: View {
return self._enableCustomKeyboards
}, set: { value in
self._enableCustomKeyboards = value
BKDefaults.setDisableCustomKeyboards(!value)
BKDefaults.save()
BLKDefaults.setDisableCustomKeyboards(!value)
BLKDefaults.save()
})
return List {
Section(
Expand Down Expand Up @@ -117,9 +117,9 @@ struct KBConfigView: View {
.navigationBarItems(trailing:
Button(
action: {
BKDefaults.setDisableCustomKeyboards(false)
BKDefaults.save()
self._enableCustomKeyboards = !BKDefaults.disableCustomKeyboards()
BLKDefaults.setDisableCustomKeyboards(false)
BLKDefaults.save()
self._enableCustomKeyboards = !BLKDefaults.disableCustomKeyboards()
self.config.reset()
},
label: { Text("Reset") }
Expand Down
Loading

0 comments on commit 232cf6b

Please sign in to comment.