Revert replacing Firebase with ACRA
This commit is contained in:
parent
decb4d76ff
commit
306e642d43
10 changed files with 57 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,4 +14,3 @@ app/samsung
|
|||
*~
|
||||
*.log
|
||||
app/acra.properties
|
||||
google-services.json
|
||||
|
|
|
@ -24,9 +24,9 @@ Using Android Studio is the preferred way to build the project. To build from th
|
|||
|
||||
./gradlew assembleDebug
|
||||
|
||||
### Firebase
|
||||
### ACRA
|
||||
|
||||
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.
|
||||
SimpleMarkdown makes use of [ACRA](https://github.com/ACRA/acra) for crash reports. This requires the presence of the `app/acra.properties` file for building. For your convenience, a `app/acra.properties.sample` file has been provided.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
3
app/acra.properties.sample
Normal file
3
app/acra.properties.sample
Normal file
|
@ -0,0 +1,3 @@
|
|||
acraUrl=ACRA_URL
|
||||
acraUser=ACRA_USER
|
||||
acraPass=ACRA_PASS
|
|
@ -1,5 +1,8 @@
|
|||
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'
|
||||
|
@ -24,6 +27,9 @@ android {
|
|||
versionCode 14
|
||||
versionName "0.4.8"
|
||||
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 {
|
||||
|
@ -50,7 +56,7 @@ android {
|
|||
}
|
||||
|
||||
ext {
|
||||
firebase_version = '16.1.0'
|
||||
acraVersion = '5.1.3'
|
||||
support_version = "28.0.0"
|
||||
}
|
||||
|
||||
|
@ -83,10 +89,8 @@ dependencies {
|
|||
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.2'
|
||||
implementation "com.google.firebase:firebase-core:16.0.3"
|
||||
implementation "com.google.firebase:firebase-perf:$firebase_version"
|
||||
|
||||
implementation "ch.acra:acra-http:$acraVersion"
|
||||
|
||||
samsungImplementation project(":IAP5Helper")
|
||||
}
|
||||
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.firebase-perf'
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
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;
|
||||
|
@ -17,4 +33,12 @@ 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,6 +2,8 @@ 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;
|
||||
|
@ -110,6 +112,7 @@ public class MarkdownFile {
|
|||
this.content = sb.toString();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
return false;
|
||||
} finally {
|
||||
Utils.closeQuietly(reader);
|
||||
|
@ -130,6 +133,7 @@ public class MarkdownFile {
|
|||
this.path = markdownFile.getParentFile().getAbsolutePath();
|
||||
return load(new FileInputStream(markdownFile));
|
||||
} catch (FileNotFoundException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -155,6 +159,7 @@ public class MarkdownFile {
|
|||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -170,12 +175,14 @@ 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,6 +12,8 @@ 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;
|
||||
|
@ -51,7 +53,8 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
try {
|
||||
InputStream in = new FileInputStream(file);
|
||||
loadMarkdown(file.getName(), in);
|
||||
} catch (FileNotFoundException ignored) {
|
||||
} catch (FileNotFoundException e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,6 +207,7 @@ public class MarkdownPresenterImpl implements MarkdownPresenter {
|
|||
}
|
||||
loadMarkdown(fileName, in);
|
||||
} catch (Exception e) {
|
||||
ACRA.getErrorReporter().handleException(e, false);
|
||||
if (editView != null) {
|
||||
editView.onFileLoaded(false);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ 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;
|
||||
|
@ -117,6 +119,7 @@ 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,6 +24,8 @@ 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;
|
||||
|
||||
|
@ -172,6 +174,7 @@ 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ buildscript {
|
|||
classpath 'com.android.tools.build:gradle:3.2.0'
|
||||
// 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