diff --git a/app/build.gradle b/app/build.gradle
index d0e39783..5732a905 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -163,8 +163,6 @@ dependencies {
implementation "com.afollestad.material-dialogs:core:${MATERIAL_DIALOG_VERSION}"
implementation "com.afollestad.material-dialogs:commons:${MATERIAL_DIALOG_VERSION}"
- implementation (name: 'bugly_crashreport_upgrade-1.3.4', ext: 'aar')
- implementation "com.tencent.bugly:nativecrashreport:${BUGGLY_NATIVE_VERSION}"
implementation "com.zzhoujay.richtext:richtext:${RICKTEXT_VERSION}"
implementation 'com.zzhoujay.glideimagegetter:glideimagegetter:1.0.5'
diff --git a/app/libs/bugly_crashreport_upgrade-1.3.4.aar b/app/libs/bugly_crashreport_upgrade-1.3.4.aar
deleted file mode 100644
index e7b17f21..00000000
Binary files a/app/libs/bugly_crashreport_upgrade-1.3.4.aar and /dev/null differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8e10190f..ea688db0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,7 +7,6 @@
-
@@ -21,9 +20,6 @@
android:theme="@style/SplashTheme"
tools:replace="android:supportsRtl">
-
diff --git a/app/src/main/java/com/thirtydegreesray/openhub/AppApplication.java b/app/src/main/java/com/thirtydegreesray/openhub/AppApplication.java
index e58a9fac..a10842b2 100644
--- a/app/src/main/java/com/thirtydegreesray/openhub/AppApplication.java
+++ b/app/src/main/java/com/thirtydegreesray/openhub/AppApplication.java
@@ -13,17 +13,10 @@
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;
-import com.tencent.bugly.Bugly;
-import com.tencent.bugly.beta.Beta;
-import com.tencent.bugly.crashreport.CrashReport;
import com.thirtydegreesray.openhub.inject.component.AppComponent;
import com.thirtydegreesray.openhub.inject.component.DaggerAppComponent;
import com.thirtydegreesray.openhub.inject.module.AppModule;
import com.thirtydegreesray.openhub.service.NetBroadcastReceiver;
-import com.thirtydegreesray.openhub.ui.activity.AboutActivity;
-import com.thirtydegreesray.openhub.ui.activity.LoginActivity;
-import com.thirtydegreesray.openhub.ui.activity.MainActivity;
-import com.thirtydegreesray.openhub.ui.widget.UpgradeDialog;
import com.thirtydegreesray.openhub.util.AppUtils;
import com.thirtydegreesray.openhub.util.NetHelper;
@@ -59,7 +52,6 @@ public void onCreate() {
.appModule(new AppModule(this))
.build();
initNetwork();
- initBugly();
startTime = System.currentTimeMillis();
Logger.t(TAG).i("application ok:" + (System.currentTimeMillis() - startTime));
@@ -86,24 +78,6 @@ public void log(int priority, String tag, String message) {
});
}
- private void initBugly(){
-
- Beta.initDelay = 6 * 1000;
- Beta.enableHotfix = false;
- Beta.canShowUpgradeActs.add(LoginActivity.class);
- Beta.canShowUpgradeActs.add(MainActivity.class);
- Beta.canShowUpgradeActs.add(AboutActivity.class);
- Beta.upgradeListener = UpgradeDialog.INSTANCE;
-
- CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(getApplicationContext());
- strategy.setAppVersion(BuildConfig.VERSION_NAME);
- strategy.setAppChannel(getAppChannel());
- strategy.setAppReportDelay(10 * 1000);
- Bugly.init(getApplicationContext(), AppConfig.BUGLY_APPID, BuildConfig.DEBUG, strategy);
- CrashReport.setIsDevelopmentDevice(getApplicationContext(), BuildConfig.DEBUG);
-
- }
-
private void initNetwork(){
NetBroadcastReceiver receiver = new NetBroadcastReceiver();
IntentFilter filter;
diff --git a/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/AboutActivity.java b/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/AboutActivity.java
index e6647dc4..949e1967 100644
--- a/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/AboutActivity.java
+++ b/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/AboutActivity.java
@@ -14,10 +14,8 @@
import com.danielstone.materialaboutlibrary.items.MaterialAboutTitleItem;
import com.danielstone.materialaboutlibrary.model.MaterialAboutCard;
import com.danielstone.materialaboutlibrary.model.MaterialAboutList;
-import com.tencent.bugly.beta.Beta;
import com.thirtydegreesray.openhub.BuildConfig;
import com.thirtydegreesray.openhub.R;
-import com.thirtydegreesray.openhub.ui.widget.UpgradeDialog;
import com.thirtydegreesray.openhub.util.AppOpener;
import com.thirtydegreesray.openhub.util.AppUtils;
import com.thirtydegreesray.openhub.util.ThemeHelper;
@@ -40,7 +38,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
isAlive = true;
ThemeHelper.applyForAboutActivity(this);
super.onCreate(savedInstanceState);
- UpgradeDialog.INSTANCE.setShowDialogActivity(this);
}
@NonNull
@@ -71,12 +68,6 @@ private void buildApp(MaterialAboutCard.Builder appBuilder, final Context contex
.text(R.string.version)
.subText(BuildConfig.VERSION_NAME)
.icon(R.drawable.ic_menu_about)
- .setOnClickAction(new MaterialAboutItemOnClickAction() {
- @Override
- public void onClick() {
- Beta.checkUpgrade(true, true);
- }
- })
.build());
appBuilder.addItem(new MaterialAboutActionItem.Builder()
.text(R.string.source_code)
@@ -173,7 +164,6 @@ public void onClick() {
@Override
protected void onDestroy() {
isAlive = false;
- UpgradeDialog.INSTANCE.setShowDialogActivity(null);
super.onDestroy();
}
diff --git a/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/MainActivity.java b/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/MainActivity.java
index 582cf75d..7360b579 100644
--- a/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/MainActivity.java
+++ b/app/src/main/java/com/thirtydegreesray/openhub/ui/activity/MainActivity.java
@@ -19,7 +19,6 @@
import android.widget.ImageView;
import android.widget.TextView;
-import com.tencent.bugly.crashreport.CrashReport;
import com.thirtydegreesray.dataautoaccess.annotation.AutoAccess;
import com.thirtydegreesray.openhub.AppData;
import com.thirtydegreesray.openhub.R;
@@ -114,8 +113,6 @@ protected void setupActivityComponent(AppComponent appComponent) {
protected void initActivity() {
super.initActivity();
if (AppData.INSTANCE.getLoggedUser() != null)
- CrashReport.putUserData(getApplicationContext(),
- "GitHubId", AppData.INSTANCE.getLoggedUser().getLogin());
setStartDrawerEnable(true);
setEndDrawerEnable(true);
diff --git a/app/src/main/java/com/thirtydegreesray/openhub/ui/widget/UpgradeDialog.java b/app/src/main/java/com/thirtydegreesray/openhub/ui/widget/UpgradeDialog.java
deleted file mode 100644
index e7f91515..00000000
--- a/app/src/main/java/com/thirtydegreesray/openhub/ui/widget/UpgradeDialog.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package com.thirtydegreesray.openhub.ui.widget;
-
-import android.annotation.SuppressLint;
-import android.app.Activity;
-import android.content.DialogInterface;
-import android.support.v7.app.AlertDialog;
-import android.view.View;
-import android.widget.TextView;
-
-import com.tencent.bugly.beta.Beta;
-import com.tencent.bugly.beta.UpgradeInfo;
-import com.tencent.bugly.beta.download.DownloadTask;
-import com.tencent.bugly.beta.upgrade.UpgradeListener;
-import com.thirtydegreesray.openhub.AppApplication;
-import com.thirtydegreesray.openhub.R;
-import com.thirtydegreesray.openhub.ui.activity.base.BaseActivity;
-import com.thirtydegreesray.openhub.util.PrefUtils;
-import com.thirtydegreesray.openhub.util.StringUtils;
-
-import java.util.Date;
-
-import es.dmoral.toasty.Toasty;
-
-/**
- * Created by ThirtyDegreesRay on 2017/8/30 14:27:27
- */
-
-public enum UpgradeDialog implements UpgradeListener {
- @SuppressLint("StaticFieldLeak")INSTANCE;
-
- private Activity activity;
-
- public void setShowDialogActivity(Activity activity) {
- this.activity = activity;
- }
-
- @Override
- public void onUpgrade(int i, UpgradeInfo upgradeInfo, boolean isManual, boolean isSilence) {
- if (upgradeInfo != null) {
- showUpgradeDialog(upgradeInfo, isManual);
- } else if (isManual) {
- Toasty.success(AppApplication.get().getApplicationContext(),
- getTempActivity().getString(R.string.no_upgrade_tip)).show();
- }
- }
-
- private void showUpgradeDialog(UpgradeInfo upgradeInfo, boolean isManual) {
- if (BaseActivity.getCurActivity() == null) return;
- if (!checkPop(upgradeInfo, isManual)) return;
-
- Activity tempActivity = getTempActivity();
- if(tempActivity == null) return;
-
- String title = tempActivity.getString(R.string.upgrade)
- .concat("(").concat(upgradeInfo.versionName).concat(")");
- View content = tempActivity.getLayoutInflater().inflate(R.layout.layout_update_dialog, null);
- TextView versionText = findView(content, R.id.version_text);
- TextView sizeText = findView(content, R.id.size_text);
- TextView timeText = findView(content, R.id.time_text);
- TextView infoText = findView(content, R.id.upgrade_info);
-
- String publishTime = StringUtils.getDateStr(new Date(Beta.getUpgradeInfo().publishTime));
- String fileSize = StringUtils.getSizeString(Beta.getUpgradeInfo().fileSize);
- String infoTextStr = Beta.getUpgradeInfo().newFeature;
- versionText.setText(versionText.getText().toString().concat(" ").concat(Beta.getUpgradeInfo().versionName));
- sizeText.setText(sizeText.getText().toString().concat(" ").concat(fileSize));
- timeText.setText(timeText.getText().toString().concat(" ").concat(publishTime));
- infoText.setText(infoTextStr);
-
- int confirmTextId = Beta.getStrategyTask().getStatus() == DownloadTask.COMPLETE ?
- R.string.install : R.string.upgrade;
-
- new AlertDialog.Builder(tempActivity)
- .setCancelable(true)
- .setTitle(title)
- .setView(content)
- .setNegativeButton(R.string.next_time, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- Beta.cancelDownload();
- dialog.dismiss();
- }
- })
- .setPositiveButton(confirmTextId, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- DownloadTask task = Beta.startDownload();
- dialog.dismiss();
- }
- })
- .show();
- }
-
- private Activity getTempActivity() {
- return this.activity == null ? BaseActivity.getCurActivity() : this.activity;
- }
-
- private T findView(View parent, int id) {
- return (T) parent.findViewById(id);
- }
-
- private boolean checkPop(UpgradeInfo upgradeInfo, boolean isManual) {
- if(isManual) return true;
-
- int localPopTimes = PrefUtils.getPopTimes();
- long localPopVersionTime = PrefUtils.getPopVersionTime();
- long localLastPopTime = PrefUtils.getLastPopTime();
-
- int serverMaxPopTimes = upgradeInfo.popTimes;
- long serverPopVersionTime = upgradeInfo.publishTime;
- long serverPopInterval = upgradeInfo.popInterval;
-
- if(serverPopVersionTime != localPopVersionTime){
- localPopVersionTime = serverPopVersionTime;
- localPopTimes = 0;
- localLastPopTime = 0;
- }
-
- if(localPopTimes < serverMaxPopTimes &&
- System.currentTimeMillis() - localLastPopTime >= serverPopInterval){
- localPopTimes++;
- localLastPopTime = System.currentTimeMillis();
- PrefUtils.set(PrefUtils.POP_TIMES, localPopTimes);
- PrefUtils.set(PrefUtils.POP_VERSION_TIME, localPopVersionTime);
- PrefUtils.set(PrefUtils.LAST_POP_TIME, localLastPopTime);
- return true;
- }
-
- return false;
- }
-
-}
diff --git a/app/src/main/res/xml/provider_paths.xml b/app/src/main/res/xml/provider_paths.xml
new file mode 100644
index 00000000..72710971
--- /dev/null
+++ b/app/src/main/res/xml/provider_paths.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 6fe1d4f3..cd727eef 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -22,8 +22,8 @@ BUILD_TOOLS_VERSION = 29.0.3
MIN_SDK_VERSION = 21
TARGET_SDK_VERSION = 29
-VERSION_CODE = 33
-VERSION_NAME = 3.2.0
+VERSION_CODE = 34
+VERSION_NAME = 3.2.1
#library
ANDROID_SUPPORT_VERSION = 25.4.0