mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Push work
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
c48969253f
commit
8931f36bda
4
.gitignore
vendored
4
.gitignore
vendored
@ -47,8 +47,8 @@ captures/
|
|||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
|
|
||||||
# Google Services (e.g. APIs or Firebase)
|
# Google Services (e.g. APIs or Firebase)
|
||||||
google-services.json
|
#google-services.json
|
||||||
app/google-services.json
|
#app/google-services.json
|
||||||
|
|
||||||
# Freeline
|
# Freeline
|
||||||
freeline.py
|
freeline.py
|
||||||
|
@ -6,3 +6,5 @@ dependencies {
|
|||||||
implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}"
|
implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}"
|
||||||
implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
|
implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
@ -40,21 +40,12 @@ public class DeviceUtils {
|
|||||||
try {
|
try {
|
||||||
@SuppressLint("PrivateApi") Class<?> appOpsUtilsClass = Class.forName("android.miui.AppOpsUtils");
|
@SuppressLint("PrivateApi") Class<?> appOpsUtilsClass = Class.forName("android.miui.AppOpsUtils");
|
||||||
if (appOpsUtilsClass != null) {
|
if (appOpsUtilsClass != null) {
|
||||||
Method getApplicationAutoStart = appOpsUtilsClass.getDeclaredMethod("getApplicationAutoStart", Context.class, String.class);
|
Method setApplicationAutoStartMethod = appOpsUtilsClass.getDeclaredMethod("setApplicationAutoStart", Context.class, String
|
||||||
if (getApplicationAutoStart != null) {
|
.class, Boolean.TYPE);
|
||||||
Context applicationContext = NextcloudTalkApplication.getSharedApplication().getApplicationContext();
|
|
||||||
Object result = getApplicationAutoStart.invoke(appOpsUtilsClass, applicationContext, applicationContext.getPackageName());
|
|
||||||
if (result instanceof Integer) {
|
|
||||||
Integer integerResult = (Integer) result;
|
|
||||||
if (integerResult == 0) {
|
|
||||||
Method setApplicationAutoStartMethod = appOpsUtilsClass.getDeclaredMethod("setApplicationAutoStart",
|
|
||||||
Context.class, String.class, Boolean.TYPE);
|
|
||||||
if (setApplicationAutoStartMethod != null) {
|
if (setApplicationAutoStartMethod != null) {
|
||||||
setApplicationAutoStartMethod.invoke(appOpsUtilsClass, applicationContext, applicationContext.getPackageName(),
|
Context applicationContext = NextcloudTalkApplication.getSharedApplication().getApplicationContext();
|
||||||
Boolean.TRUE);
|
setApplicationAutoStartMethod.invoke(appOpsUtilsClass, applicationContext, applicationContext
|
||||||
}
|
.getPackageName(), Boolean.TRUE);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
@ -78,12 +69,6 @@ public class DeviceUtils {
|
|||||||
if (getInstanceMethod != null) {
|
if (getInstanceMethod != null) {
|
||||||
Object protectAppControlInstance = getInstanceMethod.invoke(null, applicationContext);
|
Object protectAppControlInstance = getInstanceMethod.invoke(null, applicationContext);
|
||||||
|
|
||||||
Method isProtectedMethod = protectAppControlClass.getDeclaredMethod("isProtect", String.class);
|
|
||||||
if (isProtectedMethod != null) {
|
|
||||||
Object result = isProtectedMethod.invoke(protectAppControlInstance, applicationContext.getPackageName());
|
|
||||||
if (result instanceof Boolean) {
|
|
||||||
boolean booleanResult = (boolean) result;
|
|
||||||
if (!booleanResult) {
|
|
||||||
Method setProtectMethod = protectAppControlClass.getDeclaredMethod("setProtect", List.class);
|
Method setProtectMethod = protectAppControlClass.getDeclaredMethod("setProtect", List.class);
|
||||||
if (setProtectMethod != null) {
|
if (setProtectMethod != null) {
|
||||||
List<String> appsList = new ArrayList<>();
|
List<String> appsList = new ArrayList<>();
|
||||||
@ -92,9 +77,6 @@ public class DeviceUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
Log.e(TAG, "Class not found");
|
Log.e(TAG, "Class not found");
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
|
@ -19,14 +19,4 @@
|
|||||||
<string name="nc_import_accounts_from" translatable="false">com.nextcloud.client</string>
|
<string name="nc_import_accounts_from" translatable="false">com.nextcloud.client</string>
|
||||||
<string name="nc_import_account_type" translatable="false">nextcloud</string>
|
<string name="nc_import_account_type" translatable="false">nextcloud</string>
|
||||||
|
|
||||||
<!-- Push notifications -->
|
|
||||||
<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:54b65087c544d819</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>
|
</resources>
|
||||||
|
@ -12,6 +12,9 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.0.1'
|
classpath 'com.android.tools.build:gradle:3.0.1'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
|
||||||
|
if (getGradle().getStartParameter().getTaskRequests().toString().contains("GPlay")){
|
||||||
|
classpath 'com.google.gms:google-services:3.1.0'
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
Loading…
Reference in New Issue
Block a user