Skip to content

Commit

Permalink
ios patches
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Cabanero committed Oct 4, 2024
1 parent 1043296 commit e4f5cff
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Blink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
BD11E9E6270CD0FD003EA5AE /* openssl.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D2F64C9425CA99AD00F2225D /* openssl.xcframework */; };
BD1758AC26EA8C5400AEC545 /* MenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD1758AB26EA8C5400AEC545 /* MenuController.swift */; };
BD19DB412B056E9C003A4367 /* SSHCommandTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD19DB402B056E9C003A4367 /* SSHCommandTest.swift */; };
BD23B6E12CB0585B0041C38D /* ios_patches.m in Sources */ = {isa = PBXBuildFile; fileRef = BD23B6E02CB0585B0041C38D /* ios_patches.m */; };
BD2E27B529BAA8DA003AF1DA /* ReplaySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD2E27B429BAA8DA003AF1DA /* ReplaySubject.swift */; };
BD33F7822AAA426D00CD16EE /* MoshBootstrap.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD33F7802AAA426D00CD16EE /* MoshBootstrap.swift */; };
BD33F7872AAA7C4300CD16EE /* MoshBootstrapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD33F7862AAA7C4300CD16EE /* MoshBootstrapTests.swift */; };
Expand Down Expand Up @@ -827,6 +828,8 @@
BD028AF22A8EC509002F5F54 /* TrialSupportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrialSupportView.swift; sourceTree = "<group>"; };
BD1758AB26EA8C5400AEC545 /* MenuController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuController.swift; sourceTree = "<group>"; };
BD19DB402B056E9C003A4367 /* SSHCommandTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSHCommandTest.swift; sourceTree = "<group>"; };
BD23B6DF2CB058550041C38D /* ios_patches.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ios_patches.h; sourceTree = "<group>"; };
BD23B6E02CB0585B0041C38D /* ios_patches.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ios_patches.m; sourceTree = "<group>"; };
BD2E27B429BAA8DA003AF1DA /* ReplaySubject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReplaySubject.swift; sourceTree = "<group>"; };
BD33F7802AAA426D00CD16EE /* MoshBootstrap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoshBootstrap.swift; sourceTree = "<group>"; };
BD33F7862AAA7C4300CD16EE /* MoshBootstrapTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoshBootstrapTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2332,6 +2335,8 @@
0732F04F1D062BB300AB5438 /* Frameworks */,
0732F0481D062B9A00AB5438 /* Resources */,
074F30781D062A2800A73445 /* main.m */,
BD23B6E02CB0585B0041C38D /* ios_patches.m */,
BD23B6DF2CB058550041C38D /* ios_patches.h */,
07E4C5201C935E28000C571A /* Media.xcassets */,
07F670621D05EEE200C0A53C /* Sessions */,
0716B5231CFFAB9300268B5B /* Blink */,
Expand Down Expand Up @@ -3257,6 +3262,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BD23B6E12CB0585B0041C38D /* ios_patches.m in Sources */,
D2AD8E7D27A2BAFA00DED28D /* CheckmarkRow.swift in Sources */,
D2AD8E7527A2BAFA00DED28D /* PurchasesUserModel.swift in Sources */,
BD9EA212271F824900874007 /* Publisher.swift in Sources */,
Expand Down
38 changes: 38 additions & 0 deletions ios_patches.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//////////////////////////////////////////////////////////////////////////////////
//
// B L I N K
//
// Copyright (C) 2016-2024 Blink Mobile Shell Project
//
// This file is part of Blink.
//
// Blink is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Blink is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Blink. If not, see <http://www.gnu.org/licenses/>.
//
// In addition, Blink is also subject to certain additional terms under
// GNU GPL version 3 section 7.
//
// You should have received a copy of these additional terms immediately
// following the terms and conditions of the GNU General Public License
// which accompanied the Blink Source Code. If not, see
// <http://www.github.com/blinksh/blink>.
//
////////////////////////////////////////////////////////////////////////////////


#ifndef ios_patch_h
#define ios_patch_h

void __blink_ios_patches(void);

#endif /* ios_patch_h */
50 changes: 50 additions & 0 deletions ios_patches.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//////////////////////////////////////////////////////////////////////////////////
//
// B L I N K
//
// Copyright (C) 2016-2024 Blink Mobile Shell Project
//
// This file is part of Blink.
//
// Blink is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Blink is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Blink. If not, see <http://www.gnu.org/licenses/>.
//
// In addition, Blink is also subject to certain additional terms under
// GNU GPL version 3 section 7.
//
// You should have received a copy of these additional terms immediately
// following the terms and conditions of the GNU General Public License
// which accompanied the Blink Source Code. If not, see
// <http://www.github.com/blinksh/blink>.
//
////////////////////////////////////////////////////////////////////////////////


#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#include "ios_patches.h"

void __blink_ios_patches(void) {
// Check to class method of UIPressAndHoldPopoverController
// Opened Radar so this can be fixed or exposed.
// We won't implement a different fix because plan is to move away from Hterm.
// Also an issue on macOS: https://apple.stackexchange.com/questions/332769/macos-disable-popup-showing-accented-characters-when-holding-down-a-key
Class cls = NSClassFromString(@"UIPressAndHoldPopoverController");

SEL selector = sel_getUid("canPresentPressAndHoldPopoverForEvent:");
Method method = class_getClassMethod(cls, selector);
IMP override = imp_implementationWithBlock(^BOOL(id me, void* arg0) {
return NO;
});
method_setImplementation(method, override);
}
5 changes: 3 additions & 2 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
#import <Blink-Swift.h>

#include "ios_patches.h"

int main(int argc, char * argv[]) {
@autoreleasepool {
@autoreleasepool {
__blink_ios_patches();
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

0 comments on commit e4f5cff

Please sign in to comment.