This repository has been archived by the owner on Oct 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
103 changed files
with
2,500 additions
and
2,970 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,125 @@ | ||
buildscript { | ||
repositories { | ||
maven { url 'https://maven.fabric.io/public' } | ||
} | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'com.bugsnag.android.gradle' | ||
|
||
dependencies { | ||
classpath 'io.fabric.tools:gradle:1.21.2' | ||
} | ||
def gitSha() { | ||
def p = 'git rev-parse --short HEAD'.execute([], project.rootDir) | ||
p.waitFor() | ||
if (p.exitValue() != 0) return "" | ||
return p.text.trim() | ||
} | ||
apply plugin: 'com.android.application' | ||
apply plugin: 'io.fabric' | ||
|
||
repositories { | ||
maven { url 'https://maven.fabric.io/public' } | ||
bugsnag { | ||
overwrite true | ||
} | ||
|
||
def versionMajor = 3 | ||
def versionMinor = 0 | ||
def versionTag = "" | ||
|
||
def gitSha() { | ||
return 'git rev-parse --short HEAD'.execute().text.trim() | ||
} | ||
android { | ||
def signingPropFile = new File(System.properties['user.home'], ".appconfig/rootvalidator/signing.properties") | ||
if (signingPropFile.canRead()) { | ||
Properties signingProps = new Properties() | ||
signingProps.load(new FileInputStream(signingPropFile)) | ||
|
||
/* | ||
* Project Root Validator | ||
* | ||
* @link https://github.com/d4rken/rootvalidator | ||
* @license https://github.com/d4rken/rootvalidator/blob/master/LICENSE GPLv3 | ||
*/ | ||
signingConfigs { | ||
release { | ||
storeFile new File(signingProps['release.storePath']) | ||
keyAlias signingProps['release.keyAlias'] | ||
storePassword signingProps['release.storePassword'] | ||
keyPassword signingProps['release.keyPassword'] | ||
} | ||
} | ||
android { | ||
buildTypes { | ||
release { | ||
signingConfig signingConfigs.release | ||
} | ||
} | ||
} | ||
} | ||
|
||
//def buildTime() { | ||
// def df = new SimpleDateFormat("yyyy-MM-dd'T'HH-mm-ss'Z'") | ||
// df.setTimeZone(TimeZone.getTimeZone("GMT+1")) | ||
// return df.format(new Date()) | ||
//} | ||
compileSdkVersion 27 | ||
buildToolsVersion "27.0.3" | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion '23.0.2' | ||
Properties bugsnagProps = new Properties() | ||
def bugsnagPropsFile = new File(System.properties['user.home'], ".appconfig/rootvalidator/bugsnag.properties") | ||
if (bugsnagPropsFile.canRead()) bugsnagProps.load(new FileInputStream(bugsnagPropsFile)) | ||
|
||
defaultConfig { | ||
applicationId "eu.thedarken.rootvalidator" | ||
minSdkVersion 10 | ||
targetSdkVersion 23 | ||
versionCode 26 | ||
versionName "2.1.2" | ||
minSdkVersion 16 | ||
targetSdkVersion 27 | ||
versionCode versionMajor * 10000 + versionMinor | ||
versionName "${versionMajor}.${versionMinor}${versionTag}" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
manifestPlaceholders = [apikey_bugsnag: ""] | ||
} | ||
|
||
lintOptions { | ||
abortOnError false | ||
} | ||
|
||
buildTypes { | ||
debug { | ||
minifyEnabled false | ||
useProguard false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
release { | ||
minifyEnabled true | ||
shrinkResources true | ||
useProguard false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
|
||
manifestPlaceholders = [apikey_bugsnag: bugsnagProps.getProperty("bugsnag.apikey", "")] | ||
} | ||
applicationVariants.all { variant -> | ||
if (variant.buildType.name == "release") { | ||
if (variant.buildType.name != "debug") { | ||
variant.outputs.each { output -> | ||
def file = output.outputFile | ||
output.outputFile = new File(file.parent, "RootValidator-v" + defaultConfig.versionName + "-" + defaultConfig.versionCode + "-" + gitSha() + ".apk") | ||
output.outputFileName = applicationId + "-v" + defaultConfig.versionName + "(" + defaultConfig.versionCode + ")-" + variant.buildType.name.toUpperCase() + "-" + gitSha() + ".apk" | ||
} | ||
} | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
} | ||
ext { | ||
supportLibVersion = '23.1.1' | ||
supportLibVersion = '27.1.1' | ||
daggerVersion = '2.13' | ||
} | ||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile "com.android.support:support-annotations:${supportLibVersion}" | ||
compile "com.android.support:appcompat-v7:${supportLibVersion}" | ||
compile "com.android.support:recyclerview-v7:${supportLibVersion}" | ||
compile "com.android.support:cardview-v7:${supportLibVersion}" | ||
compile 'com.melnykov:floatingactionbutton:1.3.0' | ||
compile 'de.hdodenhof:circleimageview:2.0.0' | ||
compile 'com.google.android.gms:play-services-ads:8.4.0' | ||
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { | ||
transitive = true; | ||
} | ||
implementation "com.android.support:support-annotations:${supportLibVersion}" | ||
implementation "com.android.support:appcompat-v7:${supportLibVersion}" | ||
implementation "com.android.support:recyclerview-v7:${supportLibVersion}" | ||
implementation "com.android.support:cardview-v7:${supportLibVersion}" | ||
implementation "com.android.support:design:${supportLibVersion}" | ||
|
||
implementation 'eu.darken.rxshell:core:1.0.4' | ||
implementation 'eu.darken.rxshell:root:1.0.4' | ||
implementation 'eu.darken.mvpbakery:library:0.4.0' | ||
|
||
implementation 'com.bugsnag:bugsnag-android:4.3.1' | ||
|
||
implementation 'com.jakewharton.timber:timber:4.6.1' | ||
compileOnly 'org.jetbrains:annotations:15.0' | ||
|
||
//Dagger | ||
implementation "com.google.dagger:dagger:${daggerVersion}" | ||
annotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}" | ||
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}" | ||
implementation "com.google.dagger:dagger-android:${daggerVersion}" | ||
implementation "com.google.dagger:dagger-android-support:${daggerVersion}" | ||
|
||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' | ||
implementation 'io.reactivex.rxjava2:rxjava:2.1.9' | ||
|
||
implementation 'com.android.billingclient:billing:1.0' | ||
|
||
implementation 'com.jakewharton:butterknife:8.8.1' | ||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/main/java/eu/thedarken/rootvalidator/ActivityBinderModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package eu.thedarken.rootvalidator; | ||
|
||
import android.app.Activity; | ||
|
||
import dagger.Binds; | ||
import dagger.Module; | ||
import dagger.android.ActivityKey; | ||
import dagger.android.AndroidInjector; | ||
import dagger.multibindings.IntoMap; | ||
import eu.thedarken.rootvalidator.main.ui.MainActivity; | ||
import eu.thedarken.rootvalidator.main.ui.MainActivityComponent; | ||
|
||
@Module(subcomponents = { | ||
MainActivityComponent.class | ||
}) | ||
abstract class ActivityBinderModule { | ||
|
||
@Binds | ||
@IntoMap | ||
@ActivityKey(MainActivity.class) | ||
abstract AndroidInjector.Factory<? extends Activity> main(MainActivityComponent.Builder impl); | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
app/src/main/java/eu/thedarken/rootvalidator/AndroidModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package eu.thedarken.rootvalidator; | ||
|
||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.preference.PreferenceManager; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
|
||
@Module | ||
class AndroidModule { | ||
private final App app; | ||
|
||
AndroidModule(App app) {this.app = app;} | ||
|
||
@Provides | ||
@AppComponent.Scope | ||
Context context() { | ||
return app.getApplicationContext(); | ||
} | ||
|
||
@Provides | ||
@AppComponent.Scope | ||
SharedPreferences defaultPreferences(Context context) { | ||
return PreferenceManager.getDefaultSharedPreferences(context); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package eu.thedarken.rootvalidator; | ||
|
||
import android.app.Activity; | ||
import android.app.Application; | ||
|
||
import com.bugsnag.android.Bugsnag; | ||
import com.bugsnag.android.Client; | ||
|
||
import javax.inject.Inject; | ||
|
||
import eu.darken.mvpbakery.injection.ComponentSource; | ||
import eu.darken.mvpbakery.injection.ManualInjector; | ||
import eu.darken.mvpbakery.injection.activity.HasManualActivityInjector; | ||
import eu.thedarken.rootvalidator.tools.BugsnagErrorHandler; | ||
import eu.thedarken.rootvalidator.tools.BugsnagTree; | ||
import timber.log.Timber; | ||
|
||
public class App extends Application implements HasManualActivityInjector { | ||
|
||
@Inject BugsnagTree bugsnagTree; | ||
@Inject BugsnagErrorHandler errorHandler; | ||
@Inject AppComponent appComponent; | ||
@Inject ComponentSource<Activity> activityInjector; | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
if (BuildConfig.DEBUG) Timber.plant(new Timber.DebugTree()); | ||
DaggerAppComponent.builder() | ||
.androidModule(new AndroidModule(this)) | ||
.build() | ||
.injectMembers(this); | ||
|
||
Timber.plant(bugsnagTree); | ||
Client bugsnagClient = Bugsnag.init(this); | ||
bugsnagClient.beforeNotify(errorHandler); | ||
|
||
Timber.d("Bugsnag setup done!"); | ||
} | ||
|
||
@Override | ||
public ManualInjector<Activity> activityInjector() { | ||
return activityInjector; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/eu/thedarken/rootvalidator/AppComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package eu.thedarken.rootvalidator; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
import dagger.Component; | ||
import dagger.MembersInjector; | ||
|
||
|
||
@AppComponent.Scope | ||
@Component(modules = { | ||
ActivityBinderModule.class, | ||
AndroidModule.class, | ||
AppModule.class | ||
}) | ||
public interface AppComponent extends MembersInjector<App> { | ||
void inject(App app); | ||
|
||
@Component.Builder | ||
interface Builder { | ||
Builder androidModule(AndroidModule module); | ||
|
||
AppComponent build(); | ||
} | ||
|
||
@Documented | ||
@javax.inject.Scope | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@interface Scope { | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/main/java/eu/thedarken/rootvalidator/AppModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package eu.thedarken.rootvalidator; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
import eu.thedarken.rootvalidator.main.core.TestSuite; | ||
import eu.thedarken.rootvalidator.main.core.applets.AppletBinaryTestSuite; | ||
import eu.thedarken.rootvalidator.main.core.root.RootTestSuite; | ||
import eu.thedarken.rootvalidator.main.core.selinux.SELinuxTestSuite; | ||
import eu.thedarken.rootvalidator.main.core.suapp.SuperUserAppTestSuite; | ||
|
||
@Module | ||
public class AppModule { | ||
@Provides | ||
List<TestSuite> actionModules( | ||
AppletBinaryTestSuite boxTest, | ||
RootTestSuite rootTest, | ||
SuperUserAppTestSuite suAppTest, | ||
SELinuxTestSuite seLinuxTest | ||
) { | ||
return Arrays.asList(rootTest, suAppTest, boxTest, seLinuxTest); | ||
} | ||
|
||
} |
Oops, something went wrong.