Skip to content

Commit

Permalink
add push values to setup.xml
Browse files Browse the repository at this point in the history
automatically uncomment google deps for lint, gplay and findbugs
npe check
disable analytics

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
  • Loading branch information
tobiasKaminsky committed Jul 16, 2018
1 parent 8f3ace4 commit 449f82a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
4 changes: 0 additions & 4 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ pipeline:
compile:
image: nextcloudci/android:android-35
commands:
# uncomment gplay for Gplay
- sh -c "if [ '${FLAVOR}' = 'Gplay' ]; then sed -i '/.*com.google.*/s/^.*\\/\\///g' build.gradle; fi"
# build app and assemble APK
- sh -c "if [ '${FLAVOR}' != 'Analysis' ]; then ./gradlew assemble${FLAVOR}; fi"
when:
Expand Down Expand Up @@ -31,8 +29,6 @@ pipeline:
analysis:
image: nextcloudci/android:android-37
commands:
# needs gplay
- sed -i '/.*com.google.*/s/^.*\\/\\///g' build.gradle
- export BRANCH=$(scripts/analysis/getBranchName.sh $GIT_USERNAME $GIT_TOKEN $DRONE_PULL_REQUEST)
- scripts/analysis/analysis-wrapper.sh $GIT_USERNAME $GIT_TOKEN $BRANCH $LOG_USERNAME $LOG_PASSWORD $DRONE_BUILD_NUMBER $DRONE_PULL_REQUEST
secrets: [ GIT_USERNAME, GIT_TOKEN, LOG_USERNAME, LOG_PASSWORD ]
Expand Down
14 changes: 5 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'org.codehaus.groovy:groovy-all:2.4.12'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.2') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
Expand All @@ -36,8 +35,6 @@ configurations.all {

ext {
supportLibraryVersion = '27.1.1'
googleLibraryVersion = '12.0.1'
androidLibraryVersion = '1.0.40'
jacocoVersion = "0.7.4.201502262128"

travisBuild = System.getenv("TRAVIS") == "true"
Expand All @@ -63,6 +60,11 @@ def versionMinor = 3
def versionPatch = 0
def versionBuild = 0 // 0-49=Alpha / 50-98=RC / 99=stable

def taskRequest = getGradle().getStartParameter().getTaskRequests().toString();
if (taskRequest.contains("Gplay") || taskRequest.contains("findbugs") || taskRequest.contains("lint")) {
apply from: 'gplay.gradle'
}

android {
lintOptions {
abortOnError false
Expand Down Expand Up @@ -232,9 +234,6 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.12'

// uncomment for gplay
// implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
// implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}"
implementation 'org.parceler:parceler-api:1.1.9'
annotationProcessor 'org.parceler:parceler:1.1.9'
implementation ('com.github.bumptech.glide:glide:3.7.0') {
Expand Down Expand Up @@ -310,6 +309,3 @@ task combinedTestReport(type: JacocoReport) {
'jacoco/testGplayDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/GPLAY/*coverage.ec'
])
}

// uncomment for gplay (must be at the bottom)
// apply plugin: 'com.google.gms.google-services'
4 changes: 4 additions & 0 deletions gplay.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies {
implementation "com.google.firebase:firebase-messaging:17.1.0"
implementation "com.google.android.gms:play-services-gcm:15.0.1"
}
8 changes: 6 additions & 2 deletions src/gplay/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
android:theme="@style/Theme.ownCloud.Toolbar"
android:manageSpaceActivity="com.owncloud.android.ui.activity.ManageSpaceActivity">

<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="firebase_analytics_collection_deactivated"
android:value="true"/>
<meta-data
android:name="google_analytics_adid_collection_enabled"
android:value="false"/>

<activity
android:name=".authentication.ModifiedAuthenticatorActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class NCFirebaseMessagingService extends FirebaseMessagingService {

@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (remoteMessage.getData() != null) {
if (remoteMessage != null && remoteMessage.getData() != null) {
PersistableBundleCompat persistableBundleCompat = new PersistableBundleCompat();
persistableBundleCompat.putString(NotificationJob.KEY_NOTIFICATION_SUBJECT, remoteMessage.getData().get
(NotificationJob.KEY_NOTIFICATION_SUBJECT));
Expand Down
9 changes: 9 additions & 0 deletions src/gplay/res/values/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
<resources>
<!-- Push server url -->
<string name="push_server_url" translatable="false">https://push-notifications.nextcloud.com</string>

<string name="default_web_client_id" translatable="false">829118773643-cq33cmhv7mnv7iq8mjv6rt7t15afc70k.apps.googleusercontent.com</string>
<string name="firebase_database_url" translatable="false">https://nextcloud-a7dea.firebaseio.com</string>
<string name="gcm_defaultSenderId" translatable="false">829118773643</string>
<string name="google_api_key" translatable="false">AIzaSyAWIyOcLafaFp8PFL61h64cy1NNZW2cU_s</string>
<string name="google_app_id" translatable="false">1:829118773643:android:512449826e931d0e</string>
<string name="google_crash_reporting_api_key" translatable="false">AIzaSyAWIyOcLafaFp8PFL61h64cy1NNZW2cU_s</string>
<string name="google_storage_bucket" translatable="false">nextcloud-a7dea.appspot.com</string>
<string name="project_id" translatable="false">nextcloud-a7dea</string>
</resources>


0 comments on commit 449f82a

Please sign in to comment.