Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why we forgot the Nuke of Harsh #86

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ applicationId "com.yourname.themename"
```

Change Package Name in the project structure (optional):
- Just follow the instructions listed brilliantly here http://stackoverflow.com/a/29092698
- Just follow the instructions listed brilliantly [here](http://stackoverflow.com/a/29092698)

NOTE: If you change your project structure name, the AndroidManifest AND the build.gradle package names must match, or else encrypted assets will break.

Expand Down Expand Up @@ -147,7 +147,7 @@ Then you would need to go to Play Developer Console. Then access to your app ->

Third, if you would like to change where it checks for various things such as Amazon App Store Enforcement or Play Store Enforcement, you have options listed on line 16 and lines below it, simply change from `true` to `false` and vice versa to make your desired configuration.

Finally, if you would like to enable intensive mode anti-piracy (App package blacklist), add as many package names as you want under [BLACKLISTED_APPLICATIONS](app/src/main/kotlin/substratum/theme/template/AdvancedConstants.kt#L21) line 21. Then make sure to enable [ENABLE_APP_BLACKLIST_CHECK](app/ThemerConstants.gradle#L16) on line 16.
Finally, if you would like to enable intensive mode anti-piracy (App package blacklist), add as many package names as you want under [BLACKLISTED_APPLICATIONS](app/src/main/kotlin/substratum/theme/template/AdvancedConstants.kt#L12) on line 12. Then make sure to enable [ENABLE_APP_BLACKLIST_CHECK](app/ThemerConstants.gradle#L16) on line 16.

**Under no circumstances should you share your ThemerConstants.gradle file, unless specifically asked by an [official substratum developer](https://github.com/substratum/documentation#team-info-and-responsibilities)**!

Expand All @@ -166,7 +166,7 @@ As of template version 11.0.0, themes have an additional check on the build of s

What this means is that themes can ensure their themes ONLY function with our full release cycle with debug and Play Store releases.

If you would like to enable this feature (only allow your theme to be used with official substratum builds), all you have to do is to flip `true` to `false` [here](app/ThemerConstants.gradle#L22)!
If you would like to enable this feature (only allow your theme to be used with official substratum builds), all you have to do is to flip `true` to `false` [here](app/ThemerConstants.gradle#L20)!

### Now what?
Nothing. Now you're set to publish your theme!
Expand Down
2 changes: 0 additions & 2 deletions app/ThemerConstants.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ ext {

// Piracy library configurations
ENABLE_APP_BLACKLIST_CHECK = false
ENFORCE_INTERNET_CHECK = false
ENFORCE_GOOGLE_PLAY_INSTALL = false
ENFORCE_AMAZON_APP_STORE_INSTALL = false

// Allow third party substratum builds
ALLOW_THIRD_PARTY_SUBSTRATUM_BUILDS = true
Expand Down
39 changes: 21 additions & 18 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ import javax.crypto.SecretKey
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec

tasks.whenTaskAdded { task ->
if (task.name.startsWith("lint")) {
task.enabled = false
}
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: 'ThemerConstants.gradle'

ext {
// Encryption values, do not touch as we generate a random key every time you compile!
// Themers: DO NOT MODIFY
byte[] key = new byte[16]
new Random().nextBytes(key)
KEY = key
Expand All @@ -30,36 +36,37 @@ android {
// We are only supporting Nougat and above, all new changes will incorporate Nougat changes
// to the substratum repo rather than anything lower. Keep targetSdkVersion the same.
minSdkVersion 24
targetSdkVersion 28
// Both versions must be changed to increment on Play Store/user's devices
versionCode 2
versionName "2.0"

// Themers: Do not touch this, they will only formulate integrity structure of the core
// template
// Themers: DO NOT MODIFY
buildConfigField "boolean", "SUPPORTS_THIRD_PARTY_SYSTEMS", "" + SUPPORTS_THIRD_PARTY_SYSTEMS
buildConfigField "String", "BASE_64_LICENSE_KEY", "\"" + BASE_64_LICENSE_KEY + "\""
buildConfigField "String", "APK_SIGNATURE_PRODUCTION", "\"" + APK_SIGNATURE_PRODUCTION + "\""
buildConfigField "boolean", "ENABLE_APP_BLACKLIST_CHECK", "" + ENABLE_APP_BLACKLIST_CHECK
buildConfigField "boolean", "ENFORCE_INTERNET_CHECK", "" + ENFORCE_INTERNET_CHECK
buildConfigField "boolean", "ENFORCE_GOOGLE_PLAY_INSTALL", "" + ENFORCE_GOOGLE_PLAY_INSTALL
buildConfigField "boolean", "ENFORCE_AMAZON_APP_STORE_INSTALL", "" + ENFORCE_AMAZON_APP_STORE_INSTALL
buildConfigField "boolean", "ALLOW_THIRD_PARTY_SUBSTRATUM_BUILDS", "" + ALLOW_THIRD_PARTY_SUBSTRATUM_BUILDS
resValue "string", "encryption_status", (shouldEncrypt() ? "onCompileVerify" : "false")

buildConfigField "String", "IV_KEY", "\"" + IV_KEY + "\""
buildConfigField "byte[]", "DECRYPTION_KEY", String.valueOf("\"" + KEY + "\"").replace("\"", "").replace("[", "{").replace("]", "}")
buildConfigField "byte[]", "IV_KEY", String.valueOf("\"" + IV_KEY + "\"").replace("\"", "").replace("[", "{").replace("]", "}")
resValue "string", "encryption_status", (shouldEncrypt() ? "onCompileVerify" : "false")
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

// Themers: DO NOT MODIFY
buildConfigField "boolean", "ENFORCE_GOOGLE_PLAY_INSTALL", "false"
buildConfigField "String", "BASE_64_LICENSE_KEY", "\"\""
buildConfigField "String", "APK_SIGNATURE_PRODUCTION", "\"\""
}
release {
// When you compile an APK as release, your resources and IV keys will be safeguarded
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

// Themers: DO NOT MODIFY
buildConfigField "boolean", "ENFORCE_GOOGLE_PLAY_INSTALL", "" + ENFORCE_GOOGLE_PLAY_INSTALL
buildConfigField "String", "BASE_64_LICENSE_KEY", "\"" + BASE_64_LICENSE_KEY + "\""
buildConfigField "String", "APK_SIGNATURE_PRODUCTION", "\"" + APK_SIGNATURE_PRODUCTION + "\""
}
}
sourceSets {
Expand All @@ -69,13 +76,13 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.github.javiersantos:PiracyChecker:1.2.3'
implementation 'com.github.javiersantos:PiracyChecker:1.2.4'
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") {
transitive = true
}
}

// Themers, do not touch this! This is our function to help us encrypt your assets!
// Themers: DO NOT MODIFY ANYTHING BELOW
task encryptAssets {
if (!shouldEncrypt()) {
println("Skipping assets encryption...")
Expand Down Expand Up @@ -169,7 +176,3 @@ boolean shouldEncrypt() {
ArrayList<String> tasks = project.gradle.startParameter.taskNames
return SHOULD_ENCRYPT_ASSETS && Arrays.toString(tasks).toLowerCase().contains("release")
}

repositories {
mavenCentral()
}
6 changes: 5 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<action android:name="projekt.substratum.THEME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="projekt.substratum.lite.THEME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="projekt.substratum.GET_KEYS" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down Expand Up @@ -60,7 +64,7 @@
<!-- SUBSTRATUM INTERNAL USE: DO NOT TOUCH -->
<meta-data
android:name="Substratum_Plugin"
android:value="14.0.1"/>
android:value="14.0.2"/>
<meta-data
android:name="Substratum_Encryption"
android:value="@string/encryption_status"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ package substratum.theme.template

object AdvancedConstants {

// Dynamic filter that only works on Substratum 627+
// WARNING: Only enable if you are sure you want certification status to pass on Substratum
// before launching the theme, or else it will throw an unauthorized toast!
const internal val SUBSTRATUM_FILTER_CHECK = false

// Miscellaneous Checks
const val ENFORCE_MINIMUM_SUBSTRATUM_VERSION = true
const val MINIMUM_SUBSTRATUM_VERSION = 712 // 510 is the final MM build

// Custom message on theme launch, see theme_strings.xml for changing the dialog content
// Set SHOW_DIALOG_REPEATEDLY to true if you want the dialog to be showed on every theme launch
const val SHOW_LAUNCH_DIALOG = false
Expand Down
Loading