mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 18:56:44 -04:00
Merge pull request #1225 from kiwix/feature/macgills/#1224-fix-crash-reporting
#1224 use correct fileProvider suffix
This commit is contained in:
commit
2481ead365
11
.travis.yml
11
.travis.yml
@ -8,7 +8,7 @@ env:
|
||||
global:
|
||||
- ANDROID_TARGET=android-22
|
||||
- ANDROID_ABI=armeabi-v7a
|
||||
-
|
||||
|
||||
if: type != push OR tag IS present
|
||||
|
||||
before_install:
|
||||
@ -47,13 +47,14 @@ android:
|
||||
licenses:
|
||||
- ".+"
|
||||
|
||||
before_script:
|
||||
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 100M
|
||||
- emulator -avd test -no-audio -no-window &
|
||||
|
||||
script:
|
||||
- ./gradlew lintKiwixDebug jacocoTestKiwixDebugUnitTestReport
|
||||
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 100M
|
||||
- emulator -avd test -no-window &
|
||||
- android-wait-for-emulator
|
||||
- adb shell setprop dalvik.vm.dexopt-flags v=n,o=v
|
||||
- adb shell input keyevent 82 & # unlock screen by pressing menu button
|
||||
- adb shell input keyevent 82 &
|
||||
- adb -e logcat *:D > logcat.log &
|
||||
- ./gradlew createKiwixDebugCoverageReport
|
||||
|
||||
|
@ -11,15 +11,17 @@ import android.widget.CheckBox;
|
||||
import androidx.core.content.FileProvider;
|
||||
import butterknife.BindView;
|
||||
import java.io.File;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
import org.kiwix.kiwixmobile.base.BaseActivity;
|
||||
import org.kiwix.kiwixmobile.data.ZimContentProvider;
|
||||
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookDao;
|
||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk;
|
||||
import org.kiwix.kiwixmobile.library.entity.LibraryNetworkEntity;
|
||||
import org.kiwix.kiwixmobile.splash.SplashActivity;
|
||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk;
|
||||
|
||||
import static org.kiwix.kiwixmobile.utils.LanguageUtils.getCurrentLocale;
|
||||
|
||||
@ -77,16 +79,19 @@ public class ErrorActivity extends BaseActivity {
|
||||
if (allowLogsCheckbox.isChecked()) {
|
||||
File appDirectory = new File(Environment.getExternalStorageDirectory() + "/Kiwix");
|
||||
File logFile = new File(appDirectory, "logcat.txt");
|
||||
Uri path =
|
||||
FileProvider.getUriForFile(this, getApplicationContext().getPackageName() + ".provider",
|
||||
logFile);
|
||||
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
emailIntent.putExtra(Intent.EXTRA_STREAM, path);
|
||||
if(logFile.exists()) {
|
||||
Uri path =
|
||||
FileProvider.getUriForFile(this,
|
||||
getApplicationContext().getPackageName() + ".fileprovider",
|
||||
logFile);
|
||||
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
emailIntent.putExtra(Intent.EXTRA_STREAM, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (allowCrashCheckbox.isChecked()) {
|
||||
body += "Exception Details:\n\n" +
|
||||
exception.toString() +
|
||||
toStackTraceString(exception) +
|
||||
"\n\n";
|
||||
}
|
||||
|
||||
@ -138,8 +143,14 @@ public class ErrorActivity extends BaseActivity {
|
||||
restartButton.setOnClickListener(v -> restartApp());
|
||||
}
|
||||
|
||||
private String toStackTraceString(Throwable exception) {
|
||||
StringWriter stringWriter = new StringWriter();
|
||||
exception.printStackTrace(new PrintWriter(stringWriter));
|
||||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
void restartApp() {
|
||||
Context context = ErrorActivity.this;
|
||||
Context context = this;
|
||||
Intent intent = new Intent(context, SplashActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
|
Loading…
x
Reference in New Issue
Block a user