aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml33
-rw-r--r--app/build.gradle25
-rw-r--r--app/src/main/assets/facebook.compact.css3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt5
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--generate-apk-release.sh49
6 files changed, 112 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..98f20a4d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,33 @@
+language: android
+jdk:
+- oraclejdk8
+android:
+ components:
+ - tools
+ - platform-tools
+ - build-tools-25.0.2
+ - android-25
+ - extra-google-m2repository
+ - extra-android-m2repository
+before_install:
+- chmod +x gradlew
+- export JAVA8_HOME=/usr/lib/jvm/java-8-oracle
+- export JAVA_HOME=$JAVA8_HOME
+- mkdir "$ANDROID_HOME/licenses" || true
+- echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
+- echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
+after_success:
+- chmod +x ./generate-apk-release.sh
+- "./generate-apk-release.sh"
+script:
+- cd $TRAVIS_BUILD_DIR/
+- "./gradlew assembleReleaseTest"
+notifications:
+ email: false
+sudo: false
+cache:
+ directories:
+ - "$HOME/.m2"
+env:
+ global:
+ secure: Sob0b0PXhJ5uq+quf74Vl/jWaJ0RVGqTcn83p45iQI/OCEvCLyLk4FojDrtEuu1wUrWNYnv4EpX2WcAUO8+93e93Y3XIfSltXOWnXtM6usSMm7/2iiT1nR0Q6L1mC0rFLvkkhnm1mlq1DGOZKB3eI6WJKx0+/oX3gWUWgmeTsTln7YjQl/QHIk4tJFt3K+DE0fDJfo561OawC2UUPESULv5O/fd4fbnVIcJYJDBciPqT/PNJ+Rx3DqKO3BKam6+ulv5fByCcPaDXiJ7NfWw+ggpgEBZaIoGy/UL6/it1LiDXRE2yHE1kRTjMOmiCd71pL26J0n4c+o2ldTSMz0dScmbA4c+elQDwCjtnXw21B/pNavRvhGX6iqRl2A3z5/ivVf6foSpCSzLm6FZSizAnMBAa0TxmPiM4F3QWvwtF6Rgo7hD/iuTVUW4i6mOIDfTWRPD4Ha6zdkj6OCRZ1OsIuw3OiYZNtlytX7aTyHIC2aoZw0sUkExbE/3fCP1Ej6632zxGjhof8jlvrnFJZacf921Q0/4O52H6KaQM6L0CV+YpPuctsEkFeoZ6xR0WXS9RTmCyGC3J6Qv+GWlbkFyLsphz43HSaGb8pIrljjmP1N7Q/7Oft54yEwbT6s8pXmBymkVeJQuyKTHzg5yyZgddWbiWM20kN6RA8jnykTMy5FU=
diff --git a/app/build.gradle b/app/build.gradle
index 1e453524..b2929faa 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -18,16 +18,39 @@ android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFile = new File(output.outputFile.parent,
- "${project.APP_ID}-v${variant.versionName}.apk")
+ "${project.APP_ID}-${variant.buildType.name}.apk")
}
}
+
+ signingConfigs {
+ test {
+ storeFile file("../files/test.keystore")
+ storePassword "testkey"
+ keyAlias "testKey"
+ keyPassword "testkey"
+ }
+ }
+
buildTypes {
+ debug {
+ applicationIdSuffix ".debug"
+ versionNameSuffix "-debug"
+ resValue "string", "app_name", "Frost Debug"
+ }
+ releaseTest {
+ applicationIdSuffix ".test"
+ signingConfig signingConfigs.test
+ versionNameSuffix "-test"
+ resValue "string", "app_name", "Frost Test"
+ }
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ resValue "string", "app_name", "Frost"
}
}
+
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
diff --git a/app/src/main/assets/facebook.compact.css b/app/src/main/assets/facebook.compact.css
new file mode 100644
index 00000000..a3a67d95
--- /dev/null
+++ b/app/src/main/assets/facebook.compact.css
@@ -0,0 +1,3 @@
+#header[data-sigil="MTopBlueBarHeader"], #header-notices { display: None !important; }
+
+textarea, ._2gn4 { background-color: transparent !important; }
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
index 74a55888..0482fdc9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
@@ -6,9 +6,10 @@ import com.pitchedapps.frost.utils.L
/**
* Created by Allan Wang on 2017-05-31.
*/
-enum class CssAssets(val file: String) {
- BASE("facebook.min.css");
+enum class CssAssets(f: String) {
+ BASE("facebook");
+ var file = "$f.compact.css"
var content: String? = null
var injector: JsInjector? = null
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e3b13ebb..8bf0e417 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,4 @@
<resources>
- <string name="app_name">Frost for Facebook</string>
-
<string name="action_settings">Settings</string>
<string name="section_format">Hello World from section: %1$d</string>
diff --git a/generate-apk-release.sh b/generate-apk-release.sh
new file mode 100644
index 00000000..830fa07d
--- /dev/null
+++ b/generate-apk-release.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+# config
+# make sure the GITHUB_API_KEY is encrypted and inside the travis file
+# travis encrypt GITHUB_API_KEY=super_secret --add env.global
+
+RELEASE_REPO=AllanWang/Frost-for-Facebook-APK-Builder
+USER_AUTH=AllanWang
+EMAIL=me@allanwang.ca
+APK_NAME=Frost-releaseTest
+MODULE_NAME=app
+VERSION_KEY=Frost
+# Make version key different from module name
+
+# create a new directory that will contain our generated apk
+mkdir $HOME/$VERSION_KEY/
+# copy generated apk from build folder to the folder just created
+cp -R $MODULE_NAME/build/outputs/apk/$APK_NAME.apk $HOME/$VERSION_KEY/
+
+# go to home and setup git
+echo "Clone Git"
+cd $HOME
+git config --global user.email "$EMAIL"
+git config --global user.name "$USER_AUTH CI"
+# clone the repository in the buildApk folder
+git clone --quiet --branch=master https://$USER_AUTH:$GITHUB_API_KEY@github.com/$RELEASE_REPO.git master > /dev/null
+# create version file
+echo "Create Version File"
+cd master
+echo "$VERSION_KEY v$TRAVIS_BUILD_NUMBER" > "$VERSION_KEY.txt"
+
+echo "Push Version File"
+git remote rm origin
+git remote add origin https://$USER_AUTH:$GITHUB_API_KEY@github.com/$RELEASE_REPO.git
+git add -f .
+git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed [skip ci]"
+git push -fq origin master > /dev/null
+
+echo "Create New Release"
+API_JSON="$(printf '{"tag_name": "v%s","target_commitish": "master","name": "v%s","body": "Automatic Release v%s","draft": false,"prerelease": false}' $TRAVIS_BUILD_NUMBER $TRAVIS_BUILD_NUMBER $TRAVIS_BUILD_NUMBER)"
+newRelease="$(curl --data "$API_JSON" https://api.github.com/repos/$RELEASE_REPO/releases?access_token=$GITHUB_API_KEY)"
+rID="$(echo "$newRelease" | jq ".id")"
+
+cd $HOME
+echo "Push apk to $rID"
+curl "https://uploads.github.com/repos/${RELEASE_REPO}/releases/${rID}/assets?access_token=${GITHUB_API_KEY}&name=${APK_NAME}-v${TRAVIS_BUILD_NUMBER}.apk" --header 'Content-Type: application/zip' --upload-file $VERSION_KEY/$APK_NAME.apk -X POST
+
+
+echo -e "Done\n" \ No newline at end of file