From 5d1bef8f8585b6a53c9476b0df9a119f627ed619 Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Mon, 19 Feb 2018 02:14:21 +0100 Subject: [PATCH] Update bunch of things Signed-off-by: Mario Danic --- app/build.gradle | 19 ++-- app/google-services.json | 93 ------------------- app/gplay.gradle | 8 ++ app/src/GPlay/AndroidManifest.xml | 32 +++++++ .../MagicFirebaseInstanceIDService.java | 0 .../MagicFirebaseMessagingService.java | 0 .../talk/utils/MagicProviderInstaller.java | 47 ++++++++++ .../talk/utils/MagicProviderInstaller.java | 31 +++++++ app/src/main/AndroidManifest.xml | 14 --- .../application/NextcloudTalkApplication.java | 15 +-- .../talk/interfaces/ClosedInterface.java | 25 +++++ build.gradle | 2 - 12 files changed, 156 insertions(+), 130 deletions(-) delete mode 100644 app/google-services.json create mode 100644 app/gplay.gradle create mode 100644 app/src/GPlay/AndroidManifest.xml rename app/src/{main => GPlay}/java/com/nextcloud/talk/services/firebase/MagicFirebaseInstanceIDService.java (100%) rename app/src/{main => GPlay}/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.java (100%) create mode 100644 app/src/GPlay/java/com/nextcloud/talk/utils/MagicProviderInstaller.java create mode 100644 app/src/Generic/java/com/nextcloud/talk/utils/MagicProviderInstaller.java create mode 100644 app/src/main/java/com/nextcloud/talk/interfaces/ClosedInterface.java diff --git a/app/build.gradle b/app/build.gradle index ca733553a..9dca56ecd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,9 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +if (getGradle().getStartParameter().getTaskRequests().toString().contains("GPlay")){ + apply from: 'gplay.gradle' +} android { compileSdkVersion 27 @@ -12,9 +15,16 @@ android { targetSdkVersion 27 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - versionCode 26 - versionName "1.1.0beta1" + versionCode 27 + versionName "1.1.0beta2" + flavorDimensions "default" + + productFlavors { + // used for f-droid + Generic + GPlay + } // Enabling multidex support. multiDexEnabled true @@ -48,7 +58,6 @@ android { ext { supportLibraryVersion = '27.0.2' - googleLibraryVersion = '11.8.0' } @@ -125,9 +134,6 @@ dependencies { implementation 'com.evernote:android-job:1.2.4' - implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}" - implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}" - implementation 'com.yarolegovich:lovely-dialog:1.1.0' implementation 'com.yarolegovich:lovelyinput:1.0.9' implementation 'com.yarolegovich:mp:1.0.9' @@ -143,4 +149,3 @@ dependencies { exclude group: 'com.android.support', module: 'support-annotations' }) } -//apply plugin: 'com.google.gms.google-services' diff --git a/app/google-services.json b/app/google-services.json deleted file mode 100644 index 0a1e926af..000000000 --- a/app/google-services.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "project_info": { - "project_number": "", - "firebase_url": "", - "project_id": "", - "storage_bucket": "" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "", - "android_client_info": { - "package_name": "com.nextcloud.client" - } - }, - "oauth_client": [ - { - "client_id": "", - "client_type": 1, - "android_info": { - "package_name": "com.nextcloud.client", - "certificate_hash": "" - } - }, - { - "client_id": "", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "appinvite_service": { - "status": 2, - "other_platform_oauth_client": [ - { - "client_id": "", - "client_type": 3 - }, - { - "client_id": "", - "client_type": 2, - "ios_info": { - "bundle_id": "com.nextcloud.talk2" - } - } - ] - }, - "ads_service": { - "status": 2 - } - } - }, - { - "client_info": { - "mobilesdk_app_id": "1:111111111111:android:111a1a1a11111111", - "android_client_info": { - "package_name": "com.nextcloud.talk2" - } - }, - "oauth_client": [ - { - "client_id": "", - "client_type": 3 - } - ], - "api_key": [ - { - "current_key": "" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "ads_service": { - "status": 2 - } - } - } - ], - "configuration_version": "1" -} diff --git a/app/gplay.gradle b/app/gplay.gradle new file mode 100644 index 000000000..9af8ded79 --- /dev/null +++ b/app/gplay.gradle @@ -0,0 +1,8 @@ +ext { + googleLibraryVersion = '11.8.0' +} + +dependencies { + implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}" + implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}" +} diff --git a/app/src/GPlay/AndroidManifest.xml b/app/src/GPlay/AndroidManifest.xml new file mode 100644 index 000000000..22082a9c3 --- /dev/null +++ b/app/src/GPlay/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/com/nextcloud/talk/services/firebase/MagicFirebaseInstanceIDService.java b/app/src/GPlay/java/com/nextcloud/talk/services/firebase/MagicFirebaseInstanceIDService.java similarity index 100% rename from app/src/main/java/com/nextcloud/talk/services/firebase/MagicFirebaseInstanceIDService.java rename to app/src/GPlay/java/com/nextcloud/talk/services/firebase/MagicFirebaseInstanceIDService.java diff --git a/app/src/main/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.java b/app/src/GPlay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.java similarity index 100% rename from app/src/main/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.java rename to app/src/GPlay/java/com/nextcloud/talk/services/firebase/MagicFirebaseMessagingService.java diff --git a/app/src/GPlay/java/com/nextcloud/talk/utils/MagicProviderInstaller.java b/app/src/GPlay/java/com/nextcloud/talk/utils/MagicProviderInstaller.java new file mode 100644 index 000000000..1c484445c --- /dev/null +++ b/app/src/GPlay/java/com/nextcloud/talk/utils/MagicProviderInstaller.java @@ -0,0 +1,47 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017-2018 Mario Danic + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.talk.utils; + + +import android.content.Intent; + +import com.google.android.gms.security.ProviderInstaller; +import com.google.android.gms.security.ProviderInstaller.ProviderInstallListener; +import com.nextcloud.talk.application.NextcloudTalkApplication; +import com.nextcloud.talk.interfaces.ClosedInterface; + +public class MagicProviderInstaller implements ClosedInterface, ProviderInstallListener { + @Override + public void ProviderInstallerInstallIfNeededAsync() { + ProviderInstaller.installIfNeededAsync(NextcloudTalkApplication.getSharedApplication().getApplicationContext(), + this); + } + + @Override + public void onProviderInstalled() { + + } + + @Override + public void onProviderInstallFailed(int i, Intent intent) { + + } +} diff --git a/app/src/Generic/java/com/nextcloud/talk/utils/MagicProviderInstaller.java b/app/src/Generic/java/com/nextcloud/talk/utils/MagicProviderInstaller.java new file mode 100644 index 000000000..5dd1939fd --- /dev/null +++ b/app/src/Generic/java/com/nextcloud/talk/utils/MagicProviderInstaller.java @@ -0,0 +1,31 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017-2018 Mario Danic + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.talk.utils; + + +import com.nextcloud.talk.interfaces.ClosedInterface; + +public class MagicProviderInstaller implements ClosedInterface { + @Override + public void ProviderInstallerInstallIfNeededAsync() { + // does absolutely nothing :) + } +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f1a9c9dd4..7429c9430 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -62,19 +62,5 @@ android:launchMode="singleTask" /> - - - - - - - - - - - - diff --git a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java index cdaea9168..ec3704b66 100644 --- a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java +++ b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java @@ -21,7 +21,6 @@ package com.nextcloud.talk.application; import android.content.Context; -import android.content.Intent; import android.os.Build; import android.support.multidex.MultiDex; import android.support.multidex.MultiDexApplication; @@ -29,7 +28,6 @@ import android.util.Log; import com.evernote.android.job.JobManager; import com.evernote.android.job.JobRequest; -import com.google.android.gms.security.ProviderInstaller; import com.nextcloud.talk.BuildConfig; import com.nextcloud.talk.dagger.modules.BusModule; import com.nextcloud.talk.dagger.modules.ContextModule; @@ -70,7 +68,7 @@ import autodagger.AutoInjector; @Singleton @AutoInjector(NextcloudTalkApplication.class) -public class NextcloudTalkApplication extends MultiDexApplication implements ProviderInstaller.ProviderInstallListener { +public class NextcloudTalkApplication extends MultiDexApplication { private static final String TAG = NextcloudTalkApplication.class.getSimpleName(); //region Public variables @@ -113,7 +111,6 @@ public class NextcloudTalkApplication extends MultiDexApplication implements Pro @Override public void onCreate() { super.onCreate(); - ProviderInstaller.installIfNeededAsync(this, this); JobManager.create(this).addJobCreator(new MagicJobCreator()); @@ -184,15 +181,5 @@ public class NextcloudTalkApplication extends MultiDexApplication implements Pro super.attachBaseContext(base); MultiDex.install(this); } - - @Override - public void onProviderInstalled() { - - } - - @Override - public void onProviderInstallFailed(int i, Intent intent) { - - } //endregion } diff --git a/app/src/main/java/com/nextcloud/talk/interfaces/ClosedInterface.java b/app/src/main/java/com/nextcloud/talk/interfaces/ClosedInterface.java new file mode 100644 index 000000000..0883dfcba --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/interfaces/ClosedInterface.java @@ -0,0 +1,25 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017-2018 Mario Danic + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.talk.interfaces; + +public interface ClosedInterface { + void ProviderInstallerInstallIfNeededAsync(); +} diff --git a/build.gradle b/build.gradle index 250cf25b1..126dc410d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { ext { @@ -13,7 +12,6 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}" - //classpath 'com.google.gms:google-services:3.1.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files