Skip to content

Commit

Permalink
Sunbird mobile app.
Browse files Browse the repository at this point in the history
  • Loading branch information
anilguptatarento committed Sep 21, 2017
1 parent 6f29a75 commit 6f39c57
Show file tree
Hide file tree
Showing 214 changed files with 92,721 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
dui-demo/gradle.properties
.gradle
/local.properties
.idea/libraries/
.idea/gradle.xml
.idea/misc.xml
.idea/runConfigurations.xml
.idea/workspace.xml
.idea/vcs.xml
build/
*.iml
3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
}
}
2 changes: 2 additions & 0 deletions dui-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
fabric.properties
205 changes: 205 additions & 0 deletions dui-demo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
import java.security.SecureRandom
import java.util.zip.GZIPOutputStream

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}

repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://platform.ekstep.in/downloads/content/repositories/production" }
maven { url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2' }

flatDir {
dirs 'libs'
}
}

android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
useLibrary 'org.apache.http.legacy'

defaultConfig {
ext.buildNumber = System.getenv("BUILD_NUMBER") ?: "local"

applicationId "org.sunbird.app"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0.$buildNumber"
vectorDrawables.useSupportLibrary = true
}
signingConfigs {
release {
storeFile file("${keystore}")
storePassword "${keystore_password}"
keyAlias "${key_alias}"
keyPassword "${key_password}"
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "boolean", "USE_CRASHLYTICS", "true"
ext.enableCrashlytics = true
resValue 'string', 'index_base_url', "file:///android_asset/index.html"
}
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "USE_CRASHLYTICS", "false"
ext.enableCrashlytics = false
jackOptions {
enabled false
}
resValue 'string', 'index_base_url', "file:///android_asset/index.html"
}
}
productFlavors {
def host = InetAddress.getLocalHost().getHostAddress()
staging {
resValue 'string', 'local_ip', host
resValue 'string', 'api_url', "staging.open-sunbird.org"
buildConfigField 'String', 'REDIRECT_BASE_URL', '"https://staging.open-sunbird.org"'
buildConfigField 'String', 'TELEMETRY_BASE_URL', '"https://staging.open-sunbird.org/api/data/v1"'
buildConfigField 'String', 'TERMS_BASE_URL', '"https://staging.open-sunbird.org/api/domain/v1"'
buildConfigField 'String', 'CONFIG_BASE_URL', '"https://staging.open-sunbird.org/api/meta/v1"'
buildConfigField 'String', 'SEARCH_BASE_URL', '"https://staging.open-sunbird.org/api/composite/v1"'
buildConfigField 'String', 'CONTENT_LISTING_BASE_URL', '"https://staging.open-sunbird.org/api/data/v1"'
buildConfigField 'String', 'CONTENT_BASE_URL', '"https://staging.open-sunbird.org/api/content/v1"'
buildConfigField 'String', 'APIGATEWAY_BASE_URL', '"https://staging.open-sunbird.org/api/api-manager/v1"'
buildConfigField 'String', 'PLAYER_CONFIG', '"org.sunbird.utils.PlayerConfig"'
buildConfigField 'String', 'PRODUCER_ID', '"sunbird"'
buildConfigField 'String', 'CHANNEL_ID', '"$CHANNEL_ID$"'
buildConfigField 'int', 'MIN_COMPATIBILITY_LEVEL', "1"
buildConfigField 'int', 'MAX_COMPATIBILITY_LEVEL', "4"
buildConfigField 'String', 'LOG_LEVEL', '"INFO"'
buildConfigField 'String', 'APP_QUALIFIER', '"org.sunbird.app"'
buildConfigField 'String', 'MOBILE_APP_CONSUMER', '"mobile_device"'
buildConfigField 'String', 'MOBILE_APP_KEY', '"$MOBILE_APP_KEY$"'
buildConfigField 'String', 'MOBILE_APP_SECRET', '"$MOBILE_APP_SECRET$"'
}
}

applicationVariants.all { variant ->
def flavor = variant.mergedFlavor
def name = flavor.getVersionName()
def flavorName = variant.properties.get('flavorName')
def versionName = name

if (!flavorName.equals("staging")) {
versionName += flavorName;
}
if (variant.buildType.isDebuggable()) {
versionName += '-debug';
}
flavor.versionName = versionName;
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parent, "sunbird-" + versionName + ".apk")
}
}
packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/ASL-2.0.txt'
exclude 'META-INF/LGPL-3.0.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
pickFirst 'draftv3/schema'
pickFirst 'draftv4/schema'
}
}

dependencies {
final SUPPORT_LIBRARY_VERSION = '25.3.1'
final GENIE_SDK_VERSION = "1.0.35"
final X_WALK_VERSION = '22.52.561.4'

compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name: 'CordovaLib', ext: 'aar')
compile(name: 'geniecanvas', ext: 'aar')
compile project(':mystique')

compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:support-v4:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:design:$SUPPORT_LIBRARY_VERSION"
compile "com.android.support:customtabs:$SUPPORT_LIBRARY_VERSION"
compile "org.java-websocket:Java-WebSocket:1.3.0"
compile "org.ekstep.genieservices:genie-providers:$GENIE_SDK_VERSION"
compile "org.ekstep.genieservices:genie-integration:$GENIE_SDK_VERSION"
compile "org.xwalk:xwalk_shared_library:$X_WALK_VERSION"
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
compile group: 'com.squareup.okhttp', name: 'okhttp', version: '2.3.0'
}

tasks.create(name: 'createJsaFiles') {
ext.inputFiles = ["${projectDir}/src/main/js/config.js", "${projectDir}/src/main/js/index_bundle.js"]
ext.jsaFiles = ["${projectDir}/src/main/assets/sunbird/config.jsa", "${projectDir}/src/main/assets/sunbird/index_bundle.jsa"]

doLast {
inputFiles.eachWithIndex { filePath, index ->
println("Processing File - " + filePath)

int FRAME_SIZE = 8;
int KEY_SIZE = 8;
SecureRandom sr = new SecureRandom();
byte[] randomKey = new byte[8];
sr.nextBytes(randomKey);

byte[] input = file(filePath).getBytes();
byte[] compressed = gzipByteArray(input)

int totalBytes = compressed.length;
byte[] encodedBytes = new byte[totalBytes + KEY_SIZE];
int hiddenCounter = 0;
int encodedCounter = 0;
for (int compressedCounter = 0; compressedCounter < totalBytes && encodedCounter < totalBytes + KEY_SIZE; encodedCounter++) {
if (encodedCounter > 0 && encodedCounter % 10 == 9 && hiddenCounter < KEY_SIZE) {
encodedBytes[encodedCounter] = randomKey[hiddenCounter];
hiddenCounter++;
} else {
encodedBytes[encodedCounter] = (byte) ((int) compressed[compressedCounter] ^ (int) randomKey[compressedCounter % FRAME_SIZE]);
compressedCounter++;
}
}

writeByteArray(jsaFiles[index], encodedBytes)
}
}
}

private byte[] gzipByteArray(byte[] uncompressed) {
ByteArrayOutputStream gzippedBOS = new ByteArrayOutputStream();
GZIPOutputStream gzipOutputStream = new GZIPOutputStream(gzippedBOS);
gzipOutputStream.write(uncompressed);
gzippedBOS.close();
gzipOutputStream.close();
byte[] compressed = gzippedBOS.toByteArray();
compressed
}

private void writeByteArray(String filePath, byte[] encrypted) {
println("Packaging File - " + filePath)
FileOutputStream encryptedOS = new FileOutputStream(file(filePath));
encryptedOS.write(encrypted);
encryptedOS.close();
}
Binary file added dui-demo/gk.jks
Binary file not shown.
22 changes: 22 additions & 0 deletions dui-demo/gradle.properties.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
keystore = gk.jks
keystore_password = changeit
key_alias = gkbrowser
key_password = changeit
Binary file added dui-demo/libs/CordovaLib.aar
Binary file not shown.
Binary file added dui-demo/libs/geniecanvas.aar
Binary file not shown.
Loading

0 comments on commit 6f39c57

Please sign in to comment.