import{_ as l,r as p,o as c,c as t,b as s,d as e,a as o,e as n}from"./app.f643a53b.js";const i={},r=o(`<h1 id="use-as-hook-api-configs" tabindex="-1"><a class="header-anchor" href="#use-as-hook-api-configs" aria-hidden="true">#</a> Use as Hook API Configs</h1><blockquote><p>As a Hook API, it is usually used for Hook operations for hot updates or functional needs of its own app and product testing.</p></blockquote><h2 id="dependency-configs" tabindex="-1"><a class="header-anchor" href="#dependency-configs" aria-hidden="true">#</a> Dependency Configs</h2><p>You just need to integrate the <code>com.highcapable.yukihookapi:api</code> dependency.</p><p>Then please integrate the <code>Hook Framework</code> dependencies used by your target.</p><h2 id="entry-configs" tabindex="-1"><a class="header-anchor" href="#entry-configs" aria-hidden="true">#</a> Entry Configs</h2><p>Create your custom <code>Application</code>.</p><p>Add <code>YukiHookAPI.encase</code> method to <code>attachBaseContext</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">MyApplication</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">Application</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">attachBaseContext</span><span style="color:#ADBAC7;">(base</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Context?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Load Hook Framework</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">//</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">//</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Configure YukiHookAPI</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#F69D50;">YukiHookApi</span><span style="color:#ADBAC7;">.configs {</span></span>
<span class="line"><span style="color:#ADBAC7;">            </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">        }</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Load YukiHookAPI</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase(base) {</span></span>
<span class="line"><span style="color:#ADBAC7;">            </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">        }</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.attachBaseContext(base)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>In this way, you have completed the relevant configuration of the API.</p><p>You can <a href="../config/api-example#precautions-when-using-as-hook-api">click here</a> to see the similarities, differences and caveats.</p><div class="custom-container warning"><p class="custom-container-title">Notice</p><p>You can no longer wrap with <strong>loadApp</strong> and start writing your Hook code directly.</p></div><h2 id="hook-framework" tabindex="-1"><a class="header-anchor" href="#hook-framework" aria-hidden="true">#</a> Hook Framework</h2><blockquote><p>Here are some related ways of how to connect the <code>Hook Framework</code> with the <code>YukiHookAPI</code>, which is widely used.</p></blockquote>`,15),d={id:"pine",tabindex:"-1"},A=s("a",{class:"header-anchor",href:"#pine","aria-hidden":"true"},"#",-1),y=n(),u={href:"https://github.com/canyie/pine",target:"_blank",rel:"noopener noreferrer"},h=n("Pine"),C=o(`<blockquote><p><strong>Required Xposed API dependencies</strong> <code>top.canyie.pine:xposed</code></p></blockquote><blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">attachBaseContext</span><span style="color:#ADBAC7;">(base</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Context?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Load Pine</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">PineConfig</span><span style="color:#ADBAC7;">.debug </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">true</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">PineConfig</span><span style="color:#ADBAC7;">.debuggable </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">BuildConfig</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">DEBUG</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Load YukiHookAPI</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase(base) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.attachBaseContext(base)</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,3),D={id:"sandhook",tabindex:"-1"},v=s("a",{class:"header-anchor",href:"#sandhook","aria-hidden":"true"},"#",-1),B=n(),b={href:"https://github.com/asLody/SandHook",target:"_blank",rel:"noopener noreferrer"},m=n("SandHook"),k=o(`<blockquote><p><strong>Required Xposed API dependencies</strong> <code>com.swift.sandhook:xposedcompat</code> or <code>com.swift.sandhook:xposedcompat_new</code></p></blockquote><blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">attachBaseContext</span><span style="color:#ADBAC7;">(base</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Context?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Load SandHook</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">SandHookConfig</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">DEBUG</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">BuildConfig</span><span style="color:#ADBAC7;">.</span><span style="color:#F69D50;">DEBUG</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">XposedCompat</span><span style="color:#ADBAC7;">.cacheDir </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> base?.cacheDir</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">XposedCompat</span><span style="color:#ADBAC7;">.context </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> base</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">XposedCompat</span><span style="color:#ADBAC7;">.classLoader </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> javaClass.classLoader</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">XposedCompat</span><span style="color:#ADBAC7;">.isFirstApplication </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> base?.processName </span><span style="color:#F47067;">==</span><span style="color:#ADBAC7;"> base?.packageName</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Load YukiHookAPI</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase(base) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.attachBaseContext(base)</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,3),_={id:"whale",tabindex:"-1"},g=s("a",{class:"header-anchor",href:"#whale","aria-hidden":"true"},"#",-1),F=n(),f={href:"https://github.com/asLody/whale",target:"_blank",rel:"noopener noreferrer"},x=n("Whale"),w=s("blockquote",null,[s("p",null,[s("strong",null,"Required Xposed API dependencies"),n(),s("code",null,"com.wind.xposed:xposed-on-whale")])],-1),H=n("Please refer to "),P={href:"https://github.com/WindySha/xposed-hook-based-on-whale",target:"_blank",rel:"noopener noreferrer"},q=n("xposed-hook-based-on-whale"),Y=n("."),I=o(`<blockquote><p>The following example</p></blockquote><div class="language-kotlin ext-kt line-numbers-mode"><pre class="shiki" style="background-color:#22272e;"><code><span class="line"><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">attachBaseContext</span><span style="color:#ADBAC7;">(base</span><span style="color:#F47067;">:</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Context?</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Loading Whale does not require any configuration</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Load YukiHookAPI</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F69D50;">YukiHookAPI</span><span style="color:#ADBAC7;">.encase(base) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Your code here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.attachBaseContext(base)</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,2);function L(E,N){const a=p("ExternalLinkIcon");return c(),t("div",null,[r,s("h3",d,[A,y,s("a",u,[h,e(a)])]),C,s("h3",D,[v,B,s("a",b,[m,e(a)])]),k,s("h3",_,[g,F,s("a",f,[x,e(a)])]),w,s("p",null,[H,s("a",P,[q,e(a)]),Y]),I])}const S=l(i,[["render",L],["__file","api-using.html.vue"]]);export{S as default};
