Replace ACRA with Firebase Crashlytics
This commit is contained in:
parent
6dd7cb80a1
commit
0e2841a0e2
11 changed files with 30 additions and 57 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,3 +14,4 @@ app/samsung
|
|||
*~
|
||||
*.log
|
||||
app/acra.properties
|
||||
google-services.json
|
||||
|
|
10
README.md
10
README.md
|
@ -18,6 +18,16 @@ creating Android apps and have a little something to put into my portfolio.
|
|||
* [ ] Better insert for tables/images/links
|
||||
* [ ] Quick-insert toolbar for common Markdown syntax characters
|
||||
|
||||
## Building
|
||||
|
||||
Using Android Studio is the preferred way to build the project. To build from the command line, you can run
|
||||
|
||||
./gradlew assembleDebug
|
||||
|
||||
### Firebase
|
||||
|
||||
SimpleMarkdown makes use of Firebase for crash reports. To integrate with your own project, create a project from the [Firebase Console](https://console.firebase.google.com/) and enable Crashlytics support. Download the `google-services.json` file and place it in the `app/` directory. Additionally, you'll need another `google-services.json` file enabled for the `app.package.name.samsung` version of the app, placed in the `app/src/samsung/` directory.
|
||||
|
||||
## Contributing
|
||||
|
||||
I'd love any contributions, particularly in improving the existing code. Please just fork the
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
Properties acra = new Properties()
|
||||
acra.load(new FileInputStream("app/acra.properties"))
|
||||
|
||||
android {
|
||||
configurations.all {
|
||||
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
|
||||
|
@ -27,9 +24,6 @@ android {
|
|||
versionCode 12
|
||||
versionName "0.4.6"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
buildConfigField "String", "ACRA_URL", "\"${acra.getProperty("url")}\""
|
||||
buildConfigField "String", "ACRA_USER", "\"${acra.getProperty("user")}\""
|
||||
buildConfigField "String", "ACRA_PASS", "\"${acra.getProperty("pass")}\""
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -56,7 +50,7 @@ android {
|
|||
}
|
||||
|
||||
ext {
|
||||
acraVersion = '5.1.3'
|
||||
firebase_version = '16.1.0'
|
||||
support_version = "27.1.0"
|
||||
}
|
||||
|
||||
|
@ -89,8 +83,10 @@ dependencies {
|
|||
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
|
||||
|
||||
implementation "ch.acra:acra-http:$acraVersion"
|
||||
|
||||
implementation "com.google.firebase:firebase-core:16.0.3"
|
||||
implementation "com.google.firebase:firebase-perf:$firebase_version"
|
||||
samsungImplementation project(":IAP5Helper")
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.firebase-perf'
|
||||
|
|
|
@ -1,23 +1,7 @@
|
|||
package com.wbrawner.simplemarkdown;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.annotation.AcraCore;
|
||||
import org.acra.annotation.AcraHttpSender;
|
||||
import org.acra.data.StringFormat;
|
||||
import org.acra.sender.HttpSender;
|
||||
|
||||
import static com.wbrawner.simplemarkdown.BuildConfig.ACRA_PASS;
|
||||
import static com.wbrawner.simplemarkdown.BuildConfig.ACRA_URL;
|
||||
import static com.wbrawner.simplemarkdown.BuildConfig.ACRA_USER;
|
||||
|
||||
@AcraCore(buildConfigClass = BuildConfig.class, reportFormat = StringFormat.JSON)
|
||||
@AcraHttpSender(uri = ACRA_URL,
|
||||
basicAuthLogin = ACRA_USER,
|
||||
basicAuthPassword = ACRA_PASS,
|
||||
httpMethod = HttpSender.Method.POST)
|
||||
public class MarkdownApplication extends Application {
|
||||
|
||||
private AppComponent component;
|
||||
|
@ -33,12 +17,4 @@ public class MarkdownApplication extends Application {
|
|||
public AppComponent getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
|
||||
// The following line triggers the initialization of ACRA
|
||||
ACRA.init(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ package com.wbrawner.simplemarkdown.model;
|
|||
|
||||
import com.wbrawner.simplemarkdown.utility.Utils;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -112,7 +110,6 @@ public class MarkdownFile {
|
|||
this.content = sb.toString();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
return false;
|
||||
} finally {
|
||||
Utils.closeQuietly(reader);
|
||||
|
@ -133,7 +130,6 @@ public class MarkdownFile {
|
|||
this.path = markdownFile.getParentFile().getAbsolutePath();
|
||||
return load(new FileInputStream(markdownFile));
|
||||
} catch (FileNotFoundException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +155,6 @@ public class MarkdownFile {
|
|||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -175,14 +170,12 @@ public class MarkdownFile {
|
|||
);
|
||||
writer.write(this.content);
|
||||
} catch (IOException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
return false;
|
||||
} finally {
|
||||
if (writer != null) {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
// closing the reader failed
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,6 @@ import com.wbrawner.simplemarkdown.utility.Utils;
|
|||
import com.wbrawner.simplemarkdown.view.MarkdownEditView;
|
||||
import com.wbrawner.simplemarkdown.view.MarkdownPreviewView;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -53,8 +51,7 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
try {
|
||||
InputStream in = new FileInputStream(file);
|
||||
loadMarkdown(file.getName(), in);
|
||||
} catch (FileNotFoundException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +204,6 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
}
|
||||
loadMarkdown(fileName, in);
|
||||
} catch (Exception e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
if (editView != null) {
|
||||
editView.onFileLoaded(false);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ import com.wbrawner.simplemarkdown.R;
|
|||
import com.wbrawner.simplemarkdown.utility.Constants;
|
||||
import com.wbrawner.simplemarkdown.utility.Utils;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -119,7 +117,6 @@ public class ExplorerActivity extends AppCompatActivity {
|
|||
try {
|
||||
sdcardSelected = filePath.get().contains(mounts[1].getAbsolutePath());
|
||||
} catch (NullPointerException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
updateListView();
|
||||
menu.findItem(R.id.action_use_sdcard).setVisible(false);
|
||||
// TODO: Report this?
|
||||
|
|
|
@ -24,8 +24,6 @@ import com.wbrawner.simplemarkdown.utility.Utils;
|
|||
import com.wbrawner.simplemarkdown.view.DisableableViewPager;
|
||||
import com.wbrawner.simplemarkdown.view.adapter.EditPagerAdapter;
|
||||
|
||||
import org.acra.ACRA;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
|
@ -167,7 +165,6 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
Toast.makeText(MainActivity.this, R.string.file_load_error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,17 +7,17 @@
|
|||
android:title="@string/action_share"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_save"
|
||||
android:icon="@drawable/ic_action_save"
|
||||
android:title="@string/action_save"
|
||||
android:id="@+id/action_new"
|
||||
android:title="@string/action_new"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_load"
|
||||
android:title="@string/action_open"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_new"
|
||||
android:title="@string/action_new"
|
||||
android:id="@+id/action_save"
|
||||
android:icon="@drawable/ic_action_save"
|
||||
android:title="@string/action_save"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_lock_swipe"
|
||||
|
@ -36,4 +36,8 @@
|
|||
android:id="@+id/action_libraries"
|
||||
android:title="@string/action_libraries"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_privacy"
|
||||
android:title="@string/action_privacy"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
|
@ -41,6 +41,7 @@
|
|||
<string name="pref_description_default_root">Default Root Directory</string>
|
||||
<string name="action_select">Select</string>
|
||||
<string name="directory_up">\u2191 Go up</string>
|
||||
<string name="action_privacy">Privacy</string>
|
||||
<string-array name="pref_entries_default_view">
|
||||
<item>@string/value_edit_view</item>
|
||||
<item>@string/value_explorer_view</item>
|
||||
|
|
|
@ -9,6 +9,8 @@ buildscript {
|
|||
classpath 'com.android.tools.build:gradle:3.1.4'
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
classpath 'com.google.gms:google-services:4.0.1'
|
||||
classpath 'com.google.firebase:firebase-plugins:1.1.5'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue