Skip to content

Commit 414d226

Browse files
committed
Merge branch 'plugin'
2 parents 376c95f + b556c49 commit 414d226

File tree

181 files changed

+2441
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+2441
-684
lines changed

api/api.bak

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"plugins": {
2+
"internal": [
3+
{
4+
"name": "me.jbusdriver.plugin.magnet",
5+
"versionCode": 2,
6+
"versionName": "1.0.0",
7+
"url": "https://github.com/Ccixyj/jbusfile/blob/master/plugins/me.jbusdriver.plugin.magnet_1.0.0.apk?raw=true",
8+
"desc": "[内部插件]磁力链接解析插件",
9+
"eTag": "FE950EAAEF74590B8FC59B354F27EB9F"
10+
}
11+
]
12+
}

app/build.gradle

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import java.util.regex.Pattern
33

44
ext.mainApp = true //如果此module为主app module,一直以application方式编译,则启用这一行
55
//ext.alwaysLib = true //如果此module为基础库,一直以library方式编译,则启用这一行
6-
apply from: rootProject.file("cc-settings-2-app.gradle")
6+
apply from: rootProject.file("buildscripts/cc-settings-2-app.gradle")
77
//注意:最好放在build.gradle中代码的第一行
88

99

@@ -135,21 +135,22 @@ dependencies {
135135

136136
// implementation(name: 'bugly_crashreport_upgrade-1.3.5', ext: 'aar')
137137
// 远程依赖集成方式(推荐)
138-
implementation "com.tencent.bugly:crashreport_upgrade:${versions.bugly}"
138+
// implementation "com.tencent.bugly:crashreport_upgrade:${versions.bugly}"
139139
// 指定tinker依赖版本(注:应用升级1.3.5版本起,不再内置tinker)
140-
implementation "com.tencent.tinker:tinker-android-lib:${versions.tinker}"
140+
// implementation "com.tencent.tinker:tinker-android-lib:${versions.tinker}"
141141

142142
//leak
143143
debugImplementation "com.squareup.leakcanary:leakcanary-android:${versions.leakcanary}"
144144
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:${versions.leakcanary}"
145145
// Optional, if you use support library fragments:
146146
debugImplementation "com.squareup.leakcanary:leakcanary-support-fragment:${versions.leakcanary}"
147147

148-
149-
implementation "com.android.support:multidex:1.0.3" // 多dex配置
150-
151148
//components
152149
addComponent "component_magnet"
150+
151+
implementation "com.android.support:multidex:1.0.3" // 多dex配置
152+
implementation "com.wlqq.phantom:phantom-host-lib:${versions.phantom.allVersion}"
153+
implementation "com.wlqq.phantom:phantom-communication-lib:${versions.phantom.allVersion}"
153154
}
154155

155156
configurations.all { config ->
@@ -162,7 +163,7 @@ configurations.all { config ->
162163
}
163164
}
164165

165-
// 依赖插件脚本
166+
/*// 依赖插件脚本
166167
def taskNames = project.gradle.startParameter.taskNames
167168
def currentTaskName = taskNames.isEmpty() ? "" : taskNames.first()
168169
// 开启tinker-support插件,默认值true
@@ -175,7 +176,7 @@ if (checkEnable) {
175176
this.rootProject.extensions.appVerCode = VersionCode()
176177
this.rootProject.extensions.appVerName = VersionName()
177178
apply from: 'tinker.gradle'
178-
}
179+
}*/
179180
repositories {
180181
mavenCentral()
181182
}

app/proguard-rules.pro

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,17 @@
180180

181181

182182
#hotfix
183-
-dontwarn com.tencent.bugly.**
184-
-keep public class com.tencent.bugly.**{*;}
183+
#-dontwarn com.tencent.bugly.**
184+
#-keep public class com.tencent.bugly.**{*;}
185185
# tinker混淆规则
186-
-dontwarn com.tencent.tinker.**
187-
-keep class com.tencent.tinker.** { *; }
188-
#hotfix end
186+
#-dontwarn com.tencent.tinker.**
187+
#-keep class com.tencent.tinker.** { *; }
188+
#hotfix end
189+
190+
191+
# Phantom Service method
192+
-keepclassmembers class * {
193+
@com.wlqq.phantom.communication.RemoteMethod <methods>;
194+
}
195+
196+
# Phantom Service method for exclude

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
android:roundIcon="@mipmap/ic_launcher"
2121
android:supportsRtl="true"
2222
android:resizeableActivity="true"
23-
android:theme="@style/AppTheme.NoActionBar">
23+
tools:replace="android:allowBackup"
24+
android:theme="@style/AppTheme.NoActionBar" >
2425

2526
<meta-data
2627
android:name="android.max_aspect"
@@ -34,10 +35,6 @@
3435
android:name="UMENG_CHANNEL"
3536
android:value="${CHANNEL}" />
3637

37-
<activity
38-
android:name="com.tencent.bugly.beta.ui.BetaActivity"
39-
android:configChanges="keyboardHidden|orientation|screenSize|locale" />
40-
4138
<activity
4239
android:name="me.jbusdriver.ui.activity.MainActivity"
4340
android:label="@string/app_name" />
@@ -59,10 +56,7 @@
5956
<activity android:name="me.jbusdriver.ui.activity.SettingActivity" />
6057

6158
<service
62-
android:name="me.jbusdriver.ui.task.CollectService"
63-
android:exported="false" />
64-
<service
65-
android:name="me.jbusdriver.ui.task.TrimLikeService"
59+
android:name=".ui.task.LoadCollectService"
6660
android:exported="false" />
6761

6862
<!-- <activity android:name="me.jbusdriver.ui.activity.HotRecommendActivity" />-->
Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,64 @@
11
package me.jbusdriver.common
22

3+
import android.app.Application
34
import android.os.Environment
45
import com.billy.cc.core.component.CC
56
import com.orhanobut.logger.AndroidLogAdapter
67
import com.orhanobut.logger.Logger
78
import com.orhanobut.logger.PrettyFormatStrategy
89
import com.squareup.leakcanary.LeakCanary
9-
import com.tencent.tinker.loader.app.TinkerApplication
10-
import com.tencent.tinker.loader.shareutil.ShareConstants
1110
import com.umeng.analytics.MobclickAgent
11+
import com.wlqq.phantom.library.PhantomCore
12+
import com.wlqq.phantom.library.log.ILogReporter
1213
import io.reactivex.plugins.RxJavaPlugins
1314
import me.jbusdriver.BuildConfig
15+
import me.jbusdriver.base.GSON
1416
import me.jbusdriver.base.JBusManager
1517
import me.jbusdriver.base.arrayMapof
1618
import me.jbusdriver.debug.stetho.initializeStetho
1719
import me.jbusdriver.http.JAVBusService
1820
import java.io.File
21+
import java.util.*
1922

2023

2124
lateinit var JBus: AppContext
2225

2326

24-
class AppContext : TinkerApplication(ShareConstants.TINKER_ENABLE_ALL, "me.jbusdriver.common.JBusApplicationLike",
25-
"com.tencent.tinker.loader.TinkerLoader", false) {
27+
class AppContext : Application() {
2628

2729
val JBusServices by lazy { arrayMapof<String, JAVBusService>() }
30+
private val isDebug by lazy {
31+
BuildConfig.DEBUG || File(Environment.getExternalStorageDirectory().absolutePath + File.separator +
32+
packageName
33+
+ File.separator + "debug"
34+
35+
).exists()
36+
}
37+
38+
private val phantomHostConfig by lazy {
39+
PhantomCore.Config()
40+
.setCheckSignature(!isDebug)
41+
.setCheckVersion(!BuildConfig.DEBUG)
42+
.setDebug(isDebug)
43+
.setLogLevel(if (isDebug) android.util.Log.VERBOSE else android.util.Log.WARN)
44+
.setLogReporter(LogReporterImpl())
45+
}
46+
2847

2948
override fun onCreate() {
3049
super.onCreate()
50+
JBusManager.setContext(this)
51+
JBus = this
3152

3253
if (LeakCanary.isInAnalyzerProcess(this)) {
3354
// This process is dedicated to LeakCanary for heap analysis.
3455
// You should not init your app in this process.
3556
return
3657
}
58+
//插件系统尽早初始化
59+
PhantomCore.getInstance().init(this, phantomHostConfig)
3760

38-
if (BuildConfig.DEBUG) {
61+
if (isDebug) {
3962
LeakCanary.install(this)
4063

4164
initializeStetho(this) //chrome://inspect/#devices
@@ -49,31 +72,27 @@ class AppContext : TinkerApplication(ShareConstants.TINKER_ENABLE_ALL, "me.jbusd
4972
.build()
5073

5174
Logger.addLogAdapter(object : AndroidLogAdapter(formatStrategy) {
52-
override fun isLoggable(priority: Int, tag: String?) = BuildConfig.DEBUG || File(Environment.getExternalStorageDirectory().absolutePath + File.separator +
53-
packageName
54-
+ File.separator + "debug"
55-
56-
).exists()
75+
override fun isLoggable(priority: Int, tag: String?) = isDebug
5776
})
5877

5978

60-
CC.enableVerboseLog(true)
61-
CC.enableDebug(true)
62-
CC.enableRemoteCC(true)
79+
CC.enableVerboseLog(isDebug)
80+
CC.enableDebug(isDebug)
81+
CC.enableRemoteCC(isDebug)
6382
}
6483

65-
MobclickAgent.setDebugMode(BuildConfig.DEBUG)
84+
85+
MobclickAgent.setDebugMode(isDebug)
6686

6787
RxJavaPlugins.setErrorHandler {
6888
try {
69-
if (!BuildConfig.DEBUG) MobclickAgent.reportError(this, it)
89+
if (!isDebug) MobclickAgent.reportError(this, it)
7090
} catch (e: Exception) {
7191
//ignore report error
7292
}
7393
}
7494

75-
JBus = this
76-
JBusManager.setContext(this)
95+
7796
this.registerActivityLifecycleCallbacks(JBusManager)
7897
}
7998

@@ -89,4 +108,23 @@ class AppContext : TinkerApplication(ShareConstants.TINKER_ENABLE_ALL, "me.jbusd
89108
}
90109

91110

111+
companion object {
112+
113+
private class LogReporterImpl : ILogReporter {
114+
115+
override fun reportException(throwable: Throwable, message: HashMap<String, Any>) {
116+
// 使用 Bugly 或其它异常监控平台上报 Phantom 内部捕获的异常
117+
MobclickAgent.reportError(JBus, throwable)
118+
MobclickAgent.reportError(JBus, GSON.toJson(message))
119+
}
120+
121+
override fun reportEvent(eventId: String, label: String, params: HashMap<String, Any>) {
122+
// 使用 talkingdata 或其它移动统计平台上报 Phantom 内部自定义事件
123+
}
124+
125+
override fun reportLog(tag: String, message: String) {
126+
// 使用 Bugly 或其它异常监控平台上报 Phantom 内部输出的上下文相关日志
127+
}
128+
}
129+
}
92130
}

app/src/main/java/me/jbusdriver/common/JBusApplicationLike.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*
12
package me.jbusdriver.common;
23
34
import android.annotation.TargetApi;
@@ -15,9 +16,16 @@
1516
1617
import java.io.File;
1718
19+
import kotlin.Deprecated;
1820
import me.jbusdriver.base.JBusManager;
1921
2022
@SuppressWarnings("unused")
23+
@Deprecated(message = "not use tinker any more")
24+
25+
}
26+
*/
27+
28+
/*
2129
public class JBusApplicationLike extends DefaultApplicationLike {
2230
2331
public static final String TAG = "Tinker.JBusApplicationLike";
@@ -72,4 +80,4 @@ public void registerActivityLifecycleCallback(Application.ActivityLifecycleCallb
7280
getApplication().registerActivityLifecycleCallbacks(callbacks);
7381
}
7482
75-
}
83+
*/

app/src/main/java/me/jbusdriver/db/AppDBOPenHelper.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import android.arch.persistence.db.SupportSQLiteDatabase
44
import android.arch.persistence.db.SupportSQLiteOpenHelper
55
import android.database.sqlite.SQLiteDatabase
66
import me.jbusdriver.base.KLog
7-
import me.jbusdriver.commen.bean.db.CategoryTable
8-
import me.jbusdriver.commen.bean.db.AllFirstParentDBCategoryGroup
7+
import me.jbusdriver.common.bean.db.CategoryTable
8+
import me.jbusdriver.common.bean.db.AllFirstParentDBCategoryGroup
99

1010

1111
//region history

app/src/main/java/me/jbusdriver/db/bean/DBBean.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package me.jbusdriver.db.bean
22

33
import android.content.Context
4-
import me.jbusdriver.base.*
4+
import me.jbusdriver.base.GSON
5+
import me.jbusdriver.base.fromJson
56
import me.jbusdriver.base.mvp.bean.PageInfo
6-
import me.jbusdriver.commen.bean.ICollectCategory
7-
import me.jbusdriver.commen.bean.ILink
8-
import me.jbusdriver.common.JBus
7+
import me.jbusdriver.base.toast
8+
import me.jbusdriver.base.urlHost
9+
import me.jbusdriver.common.bean.ICollectCategory
10+
import me.jbusdriver.common.bean.ILink
911
import me.jbusdriver.common.isEndWithXyzHost
1012
import me.jbusdriver.http.JAVBusService
1113
import me.jbusdriver.mvp.bean.*
@@ -32,7 +34,7 @@ data class History(val type: Int, val createTime: Date, val jsonStr: String, var
3234
when (type) {
3335
1 -> MovieDetailActivity.start(context, getLinkItem() as Movie, true)
3436
in 2..6 -> MovieListActivity.reloadFromHistory(context, this)
35-
else -> JBus.toast("没有可以跳转的界面")
37+
else -> toast("没有可以跳转的界面")
3638
}
3739

3840
}

app/src/main/java/me/jbusdriver/db/dao/CategoryDao.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import com.squareup.sqlbrite3.BriteDatabase
66
import me.jbusdriver.base.KLog
77
import me.jbusdriver.base.getIntByColumn
88
import me.jbusdriver.base.getStringByColumn
9-
import me.jbusdriver.commen.bean.db.CategoryTable
10-
import me.jbusdriver.commen.bean.db.Category
9+
import me.jbusdriver.common.bean.db.CategoryTable
10+
import me.jbusdriver.common.bean.db.Category
1111
import java.util.concurrent.TimeUnit
1212

1313
/**

app/src/main/java/me/jbusdriver/db/service/Service.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import io.reactivex.Flowable
55
import io.reactivex.Observable
66
import me.jbusdriver.base.KLog
77
import me.jbusdriver.db.DB
8-
import me.jbusdriver.commen.bean.db.Category
8+
import me.jbusdriver.common.bean.db.Category
99
import me.jbusdriver.db.bean.DBPage
1010
import me.jbusdriver.db.bean.History
1111
import me.jbusdriver.db.bean.LinkItem
1212
import me.jbusdriver.mvp.bean.ActressInfo
13-
import me.jbusdriver.commen.bean.ILink
13+
import me.jbusdriver.common.bean.ILink
1414
import me.jbusdriver.mvp.bean.Movie
1515
import me.jbusdriver.mvp.bean.convertDBItem
1616
import me.jbusdriver.ui.data.AppConfiguration

0 commit comments

Comments
 (0)