Giter Club home page Giter Club logo

cantreachme's Introduction

CantReachMe

Custom action for the reachability gesture on jailbroken iOS 13 & 14 devices.

https://www.idownloadblog.com/2020/07/24/cantreachme/
https://www.youtube.com/watch?v=1cBFa8URHs0

Currently supported actions:

  • Notification Center
  • Control Center
  • Screenshot
  • Dark Mode
  • Airplane Mode
  • Flashlight
  • Bluetooth
  • WiFi
  • Lock Device
  • Low Power Mode
  • Recent App (swipe left on bottom edge)
  • Orientation Lock
  • Play/Pause Media

Making your own Strategy

CantReachMe provides an easy way to extend the tweak by your very own custom actions! You only need a few minutes to get started! Let's make an example for a strategy that opens the Notification Center.

Create a strategy

You first have to create a strategy inside WDFReachabilityStrategy/
We will create 2 files:

  • WDFCoversheetStrategy.h (header file)
  • WDFCoversheetStrategy.xm

That's basically all we need to get started.
First we define an interface:

#import  "WDFReachabilityStrategy.h"

@interface WDFCoversheetStrategy : WDFReachabilityStrategy
-(void)run;
@end

The interface WDFCoversheetStrategy inherits from WDFReachabilityStrategy which you have to import.
You basically only need the method "run". There, the code for your custom action will live.

As we want to open the Notification Center, we will have to add another interface to our header file:

@interface SBCoverSheetPresentationManager
+(id)sharedInstance;
-(void)setCoverSheetPresented:(BOOL)arg1 animated:(BOOL)arg2 withCompletion:(id)arg3;
@end

Once we have done this, we will take care of the implementation in WDFCoversheetStrategy.xm

#import  "WDFCoversheetStrategy.h"

@implementation  WDFCoversheetStrategy
-(void)run {
    [[%c(SBCoverSheetPresentationManager) sharedInstance] setCoverSheetPresented:YES animated:YES withCompletion:nil];
}
@end

As you can see, we have now implemented the "run" method.
Now we need to add the headers of our new strategy to the Strategies headers which are imported from the controller later.
It is named WDFReachabilityStrategies.h

Add to preferences

The last thing left is to add the new strategy to our preferences. You can find the plist file in Prefs/Resources/Root.plist
Add a new key (validTitles) and value (validValues) under the crm_action entry:

<dict>
    <key>cell</key>
    <string>PSLinkListCell</string>
    <key>defaults</key>
    <string>0xcc.woodfairy.cantreachme</string>
    <key>detail</key>
    <string>PSListItemsController</string>
    <key>key</key>
    <string>crm_action</string>
    <key>label</key>
    <string>Action</string>
    <key>PostNotification</key>
    <string>0xcc.woodfairy.cantreachme/ReloadPrefs</string>
    <key>validTitles</key>
    <array>
		    ...[more]
        <string>Notification Center</string>
    </array>
    <key>validValues</key>
    <array>
		    ...[more]
        <string>Coversheet</string>
    </array>
</dict>

It is very important that the value entry matches the class name of your strategy
In our case: WDFCoversheetStrategy

So we will use Coversheet as key. That's it! Now you have succesfully added a new action! Feel free to contribute!

cantreachme's People

Contributors

woodfairy avatar icrazeios avatar

Stargazers

lzsxcl avatar  avatar  avatar  avatar Minazuki avatar  avatar Amelia avatar  avatar Hao Nguyen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.