mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -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:
|
global:
|
||||||
- ANDROID_TARGET=android-22
|
- ANDROID_TARGET=android-22
|
||||||
- ANDROID_ABI=armeabi-v7a
|
- ANDROID_ABI=armeabi-v7a
|
||||||
-
|
|
||||||
if: type != push OR tag IS present
|
if: type != push OR tag IS present
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
@ -47,13 +47,14 @@ android:
|
|||||||
licenses:
|
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:
|
script:
|
||||||
- ./gradlew lintKiwixDebug jacocoTestKiwixDebugUnitTestReport
|
- ./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
|
- android-wait-for-emulator
|
||||||
- adb shell setprop dalvik.vm.dexopt-flags v=n,o=v
|
- adb shell input keyevent 82 &
|
||||||
- adb shell input keyevent 82 & # unlock screen by pressing menu button
|
|
||||||
- adb -e logcat *:D > logcat.log &
|
- adb -e logcat *:D > logcat.log &
|
||||||
- ./gradlew createKiwixDebugCoverageReport
|
- ./gradlew createKiwixDebugCoverageReport
|
||||||
|
|
||||||
|
@ -11,15 +11,17 @@ import android.widget.CheckBox;
|
|||||||
import androidx.core.content.FileProvider;
|
import androidx.core.content.FileProvider;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.kiwix.kiwixmobile.R;
|
import org.kiwix.kiwixmobile.R;
|
||||||
import org.kiwix.kiwixmobile.base.BaseActivity;
|
import org.kiwix.kiwixmobile.base.BaseActivity;
|
||||||
import org.kiwix.kiwixmobile.data.ZimContentProvider;
|
import org.kiwix.kiwixmobile.data.ZimContentProvider;
|
||||||
import org.kiwix.kiwixmobile.database.newdb.dao.NewBookDao;
|
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.library.entity.LibraryNetworkEntity;
|
||||||
import org.kiwix.kiwixmobile.splash.SplashActivity;
|
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;
|
import static org.kiwix.kiwixmobile.utils.LanguageUtils.getCurrentLocale;
|
||||||
|
|
||||||
@ -77,16 +79,19 @@ public class ErrorActivity extends BaseActivity {
|
|||||||
if (allowLogsCheckbox.isChecked()) {
|
if (allowLogsCheckbox.isChecked()) {
|
||||||
File appDirectory = new File(Environment.getExternalStorageDirectory() + "/Kiwix");
|
File appDirectory = new File(Environment.getExternalStorageDirectory() + "/Kiwix");
|
||||||
File logFile = new File(appDirectory, "logcat.txt");
|
File logFile = new File(appDirectory, "logcat.txt");
|
||||||
|
if(logFile.exists()) {
|
||||||
Uri path =
|
Uri path =
|
||||||
FileProvider.getUriForFile(this, getApplicationContext().getPackageName() + ".provider",
|
FileProvider.getUriForFile(this,
|
||||||
|
getApplicationContext().getPackageName() + ".fileprovider",
|
||||||
logFile);
|
logFile);
|
||||||
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
emailIntent.putExtra(Intent.EXTRA_STREAM, path);
|
emailIntent.putExtra(Intent.EXTRA_STREAM, path);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (allowCrashCheckbox.isChecked()) {
|
if (allowCrashCheckbox.isChecked()) {
|
||||||
body += "Exception Details:\n\n" +
|
body += "Exception Details:\n\n" +
|
||||||
exception.toString() +
|
toStackTraceString(exception) +
|
||||||
"\n\n";
|
"\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,8 +143,14 @@ public class ErrorActivity extends BaseActivity {
|
|||||||
restartButton.setOnClickListener(v -> restartApp());
|
restartButton.setOnClickListener(v -> restartApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String toStackTraceString(Throwable exception) {
|
||||||
|
StringWriter stringWriter = new StringWriter();
|
||||||
|
exception.printStackTrace(new PrintWriter(stringWriter));
|
||||||
|
return stringWriter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
void restartApp() {
|
void restartApp() {
|
||||||
Context context = ErrorActivity.this;
|
Context context = this;
|
||||||
Intent intent = new Intent(context, SplashActivity.class);
|
Intent intent = new Intent(context, SplashActivity.class);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
| Intent.FLAG_ACTIVITY_CLEAR_TASK
|
| Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user