1+ /*
2+ * YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin.
3+ * Copyright (C) 2019-2023 HighCapable
4+ * https://github.com/fankes/YukiHookAPI
5+ *
6+ * MIT License
7+ *
8+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9+ * of this software and associated documentation files (the "Software"), to deal
10+ * in the Software without restriction, including without limitation the rights
11+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+ * copies of the Software, and to permit persons to whom the Software is
13+ * furnished to do so, subject to the following conditions:
14+ *
15+ * The above copyright notice and this permission notice shall be included in all
16+ * copies or substantial portions of the Software.
17+ *
18+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+ * SOFTWARE.
25+ *
26+ * This file is Created by fankes on 2023/4/16.
27+ */
28+ package com.highcapable.yukihookapi.hook.xposed.bridge.delegate
29+
30+ import de.robv.android.xposed.XSharedPreferences
31+
32+ /* *
33+ * [XSharedPreferences] 代理类
34+ * @param packageName APP 包名
35+ * @param prefFileName 存储文件名
36+ */
37+ internal class XSharedPreferencesDelegate private constructor(private val packageName : String , private val prefFileName : String ) {
38+
39+ internal companion object {
40+
41+ /* *
42+ * 创建代理类
43+ * @param packageName APP 包名
44+ * @param prefFileName 存储文件名
45+ * @return [XSharedPreferencesDelegate]
46+ */
47+ fun from (packageName : String , prefFileName : String ) = XSharedPreferencesDelegate (packageName, prefFileName)
48+ }
49+
50+ /* *
51+ * 获取实例
52+ * @return [XSharedPreferences]
53+ */
54+ internal val instance by lazy { XSharedPreferences (packageName, prefFileName) }
55+ }
0 commit comments