Skip to content

Commit e4f5cff

Browse files
author
Carlos Cabanero
committed
ios patches
1 parent 1043296 commit e4f5cff

File tree

4 files changed

+97
-2
lines changed

4 files changed

+97
-2
lines changed

Blink.xcodeproj/project.pbxproj

+6
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
BD11E9E6270CD0FD003EA5AE /* openssl.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2F64C9425CA99AD00F2225D /* openssl.xcframework */; };
9494
BD1758AC26EA8C5400AEC545 /* MenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1758AB26EA8C5400AEC545 /* MenuController.swift */; };
9595
BD19DB412B056E9C003A4367 /* SSHCommandTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD19DB402B056E9C003A4367 /* SSHCommandTest.swift */; };
96+
BD23B6E12CB0585B0041C38D /* ios_patches.m in Sources */ = {isa = PBXBuildFile; fileRef = BD23B6E02CB0585B0041C38D /* ios_patches.m */; };
9697
BD2E27B529BAA8DA003AF1DA /* ReplaySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD2E27B429BAA8DA003AF1DA /* ReplaySubject.swift */; };
9798
BD33F7822AAA426D00CD16EE /* MoshBootstrap.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD33F7802AAA426D00CD16EE /* MoshBootstrap.swift */; };
9899
BD33F7872AAA7C4300CD16EE /* MoshBootstrapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD33F7862AAA7C4300CD16EE /* MoshBootstrapTests.swift */; };
@@ -827,6 +828,8 @@
827828
BD028AF22A8EC509002F5F54 /* TrialSupportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrialSupportView.swift; sourceTree = "<group>"; };
828829
BD1758AB26EA8C5400AEC545 /* MenuController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuController.swift; sourceTree = "<group>"; };
829830
BD19DB402B056E9C003A4367 /* SSHCommandTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSHCommandTest.swift; sourceTree = "<group>"; };
831+
BD23B6DF2CB058550041C38D /* ios_patches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_patches.h; sourceTree = "<group>"; };
832+
BD23B6E02CB0585B0041C38D /* ios_patches.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ios_patches.m; sourceTree = "<group>"; };
830833
BD2E27B429BAA8DA003AF1DA /* ReplaySubject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReplaySubject.swift; sourceTree = "<group>"; };
831834
BD33F7802AAA426D00CD16EE /* MoshBootstrap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoshBootstrap.swift; sourceTree = "<group>"; };
832835
BD33F7862AAA7C4300CD16EE /* MoshBootstrapTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoshBootstrapTests.swift; sourceTree = "<group>"; };
@@ -2332,6 +2335,8 @@
23322335
0732F04F1D062BB300AB5438 /* Frameworks */,
23332336
0732F0481D062B9A00AB5438 /* Resources */,
23342337
074F30781D062A2800A73445 /* main.m */,
2338+
BD23B6E02CB0585B0041C38D /* ios_patches.m */,
2339+
BD23B6DF2CB058550041C38D /* ios_patches.h */,
23352340
07E4C5201C935E28000C571A /* Media.xcassets */,
23362341
07F670621D05EEE200C0A53C /* Sessions */,
23372342
0716B5231CFFAB9300268B5B /* Blink */,
@@ -3257,6 +3262,7 @@
32573262
isa = PBXSourcesBuildPhase;
32583263
buildActionMask = 2147483647;
32593264
files = (
3265+
BD23B6E12CB0585B0041C38D /* ios_patches.m in Sources */,
32603266
D2AD8E7D27A2BAFA00DED28D /* CheckmarkRow.swift in Sources */,
32613267
D2AD8E7527A2BAFA00DED28D /* PurchasesUserModel.swift in Sources */,
32623268
BD9EA212271F824900874007 /* Publisher.swift in Sources */,

ios_patches.h

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// B L I N K
4+
//
5+
// Copyright (C) 2016-2024 Blink Mobile Shell Project
6+
//
7+
// This file is part of Blink.
8+
//
9+
// Blink is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// Blink is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU General Public License
20+
// along with Blink. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
// In addition, Blink is also subject to certain additional terms under
23+
// GNU GPL version 3 section 7.
24+
//
25+
// You should have received a copy of these additional terms immediately
26+
// following the terms and conditions of the GNU General Public License
27+
// which accompanied the Blink Source Code. If not, see
28+
// <http://www.github.com/blinksh/blink>.
29+
//
30+
////////////////////////////////////////////////////////////////////////////////
31+
32+
33+
#ifndef ios_patch_h
34+
#define ios_patch_h
35+
36+
void __blink_ios_patches(void);
37+
38+
#endif /* ios_patch_h */

ios_patches.m

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// B L I N K
4+
//
5+
// Copyright (C) 2016-2024 Blink Mobile Shell Project
6+
//
7+
// This file is part of Blink.
8+
//
9+
// Blink is free software: you can redistribute it and/or modify
10+
// it under the terms of the GNU General Public License as published by
11+
// the Free Software Foundation, either version 3 of the License, or
12+
// (at your option) any later version.
13+
//
14+
// Blink is distributed in the hope that it will be useful,
15+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
// GNU General Public License for more details.
18+
//
19+
// You should have received a copy of the GNU General Public License
20+
// along with Blink. If not, see <http://www.gnu.org/licenses/>.
21+
//
22+
// In addition, Blink is also subject to certain additional terms under
23+
// GNU GPL version 3 section 7.
24+
//
25+
// You should have received a copy of these additional terms immediately
26+
// following the terms and conditions of the GNU General Public License
27+
// which accompanied the Blink Source Code. If not, see
28+
// <http://www.github.com/blinksh/blink>.
29+
//
30+
////////////////////////////////////////////////////////////////////////////////
31+
32+
33+
#import <Foundation/Foundation.h>
34+
#import <objc/runtime.h>
35+
#include "ios_patches.h"
36+
37+
void __blink_ios_patches(void) {
38+
// Check to class method of UIPressAndHoldPopoverController
39+
// Opened Radar so this can be fixed or exposed.
40+
// We won't implement a different fix because plan is to move away from Hterm.
41+
// Also an issue on macOS: https://apple.stackexchange.com/questions/332769/macos-disable-popup-showing-accented-characters-when-holding-down-a-key
42+
Class cls = NSClassFromString(@"UIPressAndHoldPopoverController");
43+
44+
SEL selector = sel_getUid("canPresentPressAndHoldPopoverForEvent:");
45+
Method method = class_getClassMethod(cls, selector);
46+
IMP override = imp_implementationWithBlock(^BOOL(id me, void* arg0) {
47+
return NO;
48+
});
49+
method_setImplementation(method, override);
50+
}

main.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131

3232
#import <UIKit/UIKit.h>
3333
#import "AppDelegate.h"
34-
#import <objc/runtime.h>
3534
#import <Foundation/Foundation.h>
3635
#import <Blink-Swift.h>
3736

37+
#include "ios_patches.h"
3838

3939
int main(int argc, char * argv[]) {
40-
@autoreleasepool {
40+
@autoreleasepool {
41+
__blink_ios_patches();
4142
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
4243
}
4344
}

0 commit comments

Comments
 (0)