From fdc9abcd3434df2f9c9b5fa5e5731a34ea43856b Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 15 Jan 2018 13:33:34 +0100 Subject: [PATCH] remove modified flavor Signed-off-by: tobiasKaminsky --- .drone.yml | 1 - build.gradle | 17 +- src/modified/AndroidManifest.xml | 83 ----- src/modified/google-services.json | 35 -- .../ModifiedAuthenticatorActivity.java | 41 --- .../firebase/NCFirebaseInstanceIDService.java | 42 --- .../firebase/NCFirebaseMessagingService.java | 65 ---- .../android/utils/AnalyticsUtils.java | 37 -- .../android/utils/GooglePlayUtils.java | 49 --- .../com/owncloud/android/utils/PushUtils.java | 338 ------------------ src/modified/res/layout/drawer.xml | 76 ---- src/modified/res/values/setup.xml | 144 -------- 12 files changed, 2 insertions(+), 926 deletions(-) delete mode 100644 src/modified/AndroidManifest.xml delete mode 100644 src/modified/google-services.json delete mode 100644 src/modified/java/com/owncloud/android/authentication/ModifiedAuthenticatorActivity.java delete mode 100644 src/modified/java/com/owncloud/android/services/firebase/NCFirebaseInstanceIDService.java delete mode 100644 src/modified/java/com/owncloud/android/services/firebase/NCFirebaseMessagingService.java delete mode 100644 src/modified/java/com/owncloud/android/utils/AnalyticsUtils.java delete mode 100644 src/modified/java/com/owncloud/android/utils/GooglePlayUtils.java delete mode 100644 src/modified/java/com/owncloud/android/utils/PushUtils.java delete mode 100644 src/modified/res/layout/drawer.xml delete mode 100644 src/modified/res/values/setup.xml diff --git a/.drone.yml b/.drone.yml index b426187951..4f9ecb9d83 100644 --- a/.drone.yml +++ b/.drone.yml @@ -59,7 +59,6 @@ matrix: FLAVOUR: - Generic - Gplay - - Modified - Lint branches: master diff --git a/build.gradle b/build.gradle index 90883436ea..ebc373b0ff 100644 --- a/build.gradle +++ b/build.gradle @@ -98,15 +98,6 @@ android { dimension "default" } - modified { - // structure is: - // domain tld - // domain name - // .client - applicationId 'com.custom.client' - dimension "default" - } - versionDev { applicationId "com.nextcloud.android.beta" dimension "default" @@ -114,10 +105,6 @@ android { versionName "20180121" } } - - configurations { - modifiedCompile - } } @@ -216,7 +203,7 @@ dependencies { implementation 'com.madgag.spongycastle:pkix:1.54.0.0' implementation 'com.google.code.gson:gson:2.8.2' - // uncomment for gplay, modified + // uncomment for gplay // implementation "com.google.firebase:firebase-messaging:${googleLibraryVersion}" // implementation "com.google.android.gms:play-services-base:${googleLibraryVersion}" // implementation "com.google.android.gms:play-services-gcm:${googleLibraryVersion}" @@ -260,5 +247,5 @@ tasks.withType(Test) { } } -// uncomment for gplay, modified (must be at the bottom) +// uncomment for gplay (must be at the bottom) //apply plugin: 'com.google.gms.google-services' diff --git a/src/modified/AndroidManifest.xml b/src/modified/AndroidManifest.xml deleted file mode 100644 index 77b4e52b6d..0000000000 --- a/src/modified/AndroidManifest.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/modified/google-services.json b/src/modified/google-services.json deleted file mode 100644 index c115e9e3ab..0000000000 --- a/src/modified/google-services.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "project_info": { - "project_number": "", - "project_id": "" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "", - "android_client_info": { - "package_name": "com.custom.client" - } - }, - "oauth_client": [], - "api_key": [ - { - "current_key": "" - } - ], - "services": { - "analytics_service": { - "status": 1 - }, - "appinvite_service": { - "status": 1, - "other_platform_oauth_client": [] - }, - "ads_service": { - "status": 1 - } - } - } - ], - "configuration_version": "1" -} diff --git a/src/modified/java/com/owncloud/android/authentication/ModifiedAuthenticatorActivity.java b/src/modified/java/com/owncloud/android/authentication/ModifiedAuthenticatorActivity.java deleted file mode 100644 index 618578891a..0000000000 --- a/src/modified/java/com/owncloud/android/authentication/ModifiedAuthenticatorActivity.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.owncloud.android.authentication; - -import android.os.Bundle; - -import com.owncloud.android.utils.GooglePlayUtils; - -/** - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -public class ModifiedAuthenticatorActivity extends AuthenticatorActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GooglePlayUtils.checkPlayServices(this); - } - - @Override - protected void onResume() { - super.onResume(); - GooglePlayUtils.checkPlayServices(this); - } - -} \ No newline at end of file diff --git a/src/modified/java/com/owncloud/android/services/firebase/NCFirebaseInstanceIDService.java b/src/modified/java/com/owncloud/android/services/firebase/NCFirebaseInstanceIDService.java deleted file mode 100644 index f894264460..0000000000 --- a/src/modified/java/com/owncloud/android/services/firebase/NCFirebaseInstanceIDService.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.owncloud.android.services.firebase; - -import android.text.TextUtils; - -import com.google.firebase.iid.FirebaseInstanceId; -import com.google.firebase.iid.FirebaseInstanceIdService; -import com.owncloud.android.MainApp; -import com.owncloud.android.R; -import com.owncloud.android.db.PreferenceManager; -import com.owncloud.android.utils.PushUtils; - -public class NCFirebaseInstanceIDService extends FirebaseInstanceIdService { - - @Override - public void onTokenRefresh() { - //You can implement this method to store the token on your server - if (!TextUtils.isEmpty(getResources().getString(R.string.push_server_url))) { - PreferenceManager.setPushToken(MainApp.getAppContext(), FirebaseInstanceId.getInstance().getToken()); - PushUtils.pushRegistrationToServer(); - } - } -} - diff --git a/src/modified/java/com/owncloud/android/services/firebase/NCFirebaseMessagingService.java b/src/modified/java/com/owncloud/android/services/firebase/NCFirebaseMessagingService.java deleted file mode 100644 index 970fe7c736..0000000000 --- a/src/modified/java/com/owncloud/android/services/firebase/NCFirebaseMessagingService.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.owncloud.android.services.firebase; - -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.media.RingtoneManager; -import android.support.v4.app.NotificationCompat; - -import com.google.firebase.messaging.FirebaseMessagingService; -import com.google.firebase.messaging.RemoteMessage; -import com.owncloud.android.MainApp; -import com.owncloud.android.R; -import com.owncloud.android.ui.activity.NotificationsActivity; -import com.owncloud.android.utils.ThemeUtils; - -public class NCFirebaseMessagingService extends FirebaseMessagingService { - - @Override - public void onMessageReceived(RemoteMessage remoteMessage) { - super.onMessageReceived(remoteMessage); - - sendNotification(MainApp.getAppContext().getString(R.string.new_notification_received)); - } - - private void sendNotification(String contentTitle) { - Intent intent = new Intent(this, NotificationsActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); - - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) - .setSmallIcon(R.drawable.notification_icon) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.notification_icon)) - .setColor(ThemeUtils.primaryColor()) - .setContentTitle(contentTitle) - .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) - .setAutoCancel(true) - .setContentIntent(pendingIntent); - - NotificationManager notificationManager = - (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - - notificationManager.notify(0, notificationBuilder.build()); - } -} \ No newline at end of file diff --git a/src/modified/java/com/owncloud/android/utils/AnalyticsUtils.java b/src/modified/java/com/owncloud/android/utils/AnalyticsUtils.java deleted file mode 100644 index 855cb4ec47..0000000000 --- a/src/modified/java/com/owncloud/android/utils/AnalyticsUtils.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ -package com.owncloud.android.utils; - -import android.app.Activity; - -import com.google.firebase.analytics.FirebaseAnalytics; -import com.owncloud.android.MainApp; - -public class AnalyticsUtils { - - public static void setCurrentScreenName(Activity activity, String s, String s1) { - FirebaseAnalytics.getInstance(activity).setCurrentScreen(activity, s, s1); - } - - public static void disableAnalytics() { - FirebaseAnalytics.getInstance(MainApp.getAppContext()).setAnalyticsCollectionEnabled(false); - } - -} diff --git a/src/modified/java/com/owncloud/android/utils/GooglePlayUtils.java b/src/modified/java/com/owncloud/android/utils/GooglePlayUtils.java deleted file mode 100644 index 9dd560a126..0000000000 --- a/src/modified/java/com/owncloud/android/utils/GooglePlayUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package com.owncloud.android.utils; - -import android.app.Activity; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GoogleApiAvailability; - -public class GooglePlayUtils { - private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000; - private static final String TAG = "GooglePlayUtils"; - - public static boolean checkPlayServices(Activity activity) { - GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance(); - int resultCode = apiAvailability.isGooglePlayServicesAvailable(activity); - if (resultCode != ConnectionResult.SUCCESS) { - if (apiAvailability.isUserResolvableError(resultCode)) { - apiAvailability.getErrorDialog(activity, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST) - .show(); - } else { - Log.i(TAG, "This device is not supported."); - activity.finish(); - } - return false; - } - return true; - } - -} \ No newline at end of file diff --git a/src/modified/java/com/owncloud/android/utils/PushUtils.java b/src/modified/java/com/owncloud/android/utils/PushUtils.java deleted file mode 100644 index 2a848c9b1f..0000000000 --- a/src/modified/java/com/owncloud/android/utils/PushUtils.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Nextcloud Android client application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package com.owncloud.android.utils; - -import android.accounts.Account; -import android.accounts.AuthenticatorException; -import android.accounts.OperationCanceledException; -import android.content.Context; -import android.text.TextUtils; -import android.util.Base64; - -import com.google.gson.Gson; -import com.owncloud.android.MainApp; -import com.owncloud.android.R; -import com.owncloud.android.authentication.AccountUtils; -import com.owncloud.android.datamodel.ArbitraryDataProvider; -import com.owncloud.android.datamodel.PushConfigurationState; -import com.owncloud.android.db.PreferenceManager; -import com.owncloud.android.lib.common.OwnCloudAccount; -import com.owncloud.android.lib.common.OwnCloudClient; -import com.owncloud.android.lib.common.OwnCloudClientManagerFactory; -import com.owncloud.android.lib.common.operations.RemoteOperation; -import com.owncloud.android.lib.common.operations.RemoteOperationResult; -import com.owncloud.android.lib.common.utils.Log_OC; -import com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForNotificationsOperation; -import com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForProxyOperation; -import com.owncloud.android.lib.resources.notifications.UnregisterAccountDeviceForNotificationsOperation; -import com.owncloud.android.lib.resources.notifications.UnregisterAccountDeviceForProxyOperation; -import com.owncloud.android.lib.resources.notifications.models.PushResponse; - -import org.apache.commons.httpclient.HttpStatus; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.security.Key; -import java.security.KeyFactory; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.PublicKey; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.util.Locale; - -public class PushUtils { - - private static final String TAG = "PushUtils"; - private static final String KEYPAIR_FOLDER = "nc-keypair"; - private static final String KEYPAIR_FILE_NAME = "push_key"; - private static final String KEYPAIR_PRIV_EXTENSION = ".priv"; - private static final String KEYPAIR_PUB_EXTENSION = ".pub"; - - public static final String KEY_PUSH = "push"; - - private static ArbitraryDataProvider arbitraryDataProvider; - - public static String generateSHA512Hash(String pushToken) { - MessageDigest messageDigest = null; - try { - messageDigest = MessageDigest.getInstance("SHA-512"); - messageDigest.update(pushToken.getBytes()); - return bytesToHex(messageDigest.digest()); - } catch (NoSuchAlgorithmException e) { - Log_OC.d(TAG, "SHA-512 algorithm not supported"); - } - return ""; - } - - public static String bytesToHex(byte[] bytes) { - StringBuilder result = new StringBuilder(); - for (byte individualByte : bytes) { - result.append(Integer.toString((individualByte & 0xff) + 0x100, 16) - .substring(1)); - } - return result.toString(); - } - - private static int generateRsa2048KeyPair() { - migratePushKeys(); - String keyPath = MainApp.getAppContext().getFilesDir().getAbsolutePath() + File.separator + - MainApp.getDataFolder() + File.separator + KEYPAIR_FOLDER; - - String privateKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PRIV_EXTENSION; - String publicKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PUB_EXTENSION; - File keyPathFile = new File(keyPath); - - if (!new File(privateKeyPath).exists() && !new File(publicKeyPath).exists()) { - try { - if (!keyPathFile.exists()) { - keyPathFile.mkdir(); - } - KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); - keyGen.initialize(2048); - - KeyPair pair = keyGen.generateKeyPair(); - int statusPrivate = saveKeyToFile(pair.getPrivate(), privateKeyPath); - int statusPublic = saveKeyToFile(pair.getPublic(), publicKeyPath); - - if (statusPrivate == 0 && statusPublic == 0) { - // all went well - return 0; - } else { - return -2; - } - } catch (NoSuchAlgorithmException e) { - Log_OC.d(TAG, "RSA algorithm not supported"); - } - } else { - // we already have the key - return -1; - } - - // we failed to generate the key - return -2; - } - - private static void deleteRegistrationForAccount(Account account) { - Context context = MainApp.getAppContext(); - OwnCloudAccount ocAccount = null; - arbitraryDataProvider = new ArbitraryDataProvider(MainApp.getAppContext().getContentResolver()); - - try { - ocAccount = new OwnCloudAccount(account, context); - OwnCloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton(). - getClientFor(ocAccount, context); - - RemoteOperation unregisterAccountDeviceForNotificationsOperation = new - UnregisterAccountDeviceForNotificationsOperation(); - - RemoteOperationResult remoteOperationResult = unregisterAccountDeviceForNotificationsOperation. - execute(mClient); - - if (remoteOperationResult.getHttpCode() == HttpStatus.SC_ACCEPTED) { - String arbitraryValue; - if (!TextUtils.isEmpty(arbitraryValue = arbitraryDataProvider.getValue(account, KEY_PUSH))) { - Gson gson = new Gson(); - PushConfigurationState pushArbitraryData = gson.fromJson(arbitraryValue, - PushConfigurationState.class); - RemoteOperation unregisterAccountDeviceForProxyOperation = - new UnregisterAccountDeviceForProxyOperation(context.getResources(). - getString(R.string.push_server_url), - pushArbitraryData.getDeviceIdentifier(), - pushArbitraryData.getDeviceIdentifierSignature(), - pushArbitraryData.getUserPublicKey()); - - remoteOperationResult = unregisterAccountDeviceForProxyOperation.execute(mClient); - - if (remoteOperationResult.isSuccess()) { - arbitraryDataProvider.deleteKeyForAccount(account.name, KEY_PUSH); - } - } - } - - - } catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) { - Log_OC.d(TAG, "Failed to find an account"); - } catch (AuthenticatorException e) { - Log_OC.d(TAG, "Failed via AuthenticatorException"); - } catch (IOException e) { - Log_OC.d(TAG, "Failed via IOException"); - } catch (OperationCanceledException e) { - Log_OC.d(TAG, "Failed via OperationCanceledException"); - } - } - - public static void pushRegistrationToServer() { - String token = PreferenceManager.getPushToken(MainApp.getAppContext()); - arbitraryDataProvider = new ArbitraryDataProvider(MainApp.getAppContext().getContentResolver()); - - if (!TextUtils.isEmpty(MainApp.getAppContext().getResources().getString(R.string.push_server_url)) && - !TextUtils.isEmpty(token)) { - PushUtils.generateRsa2048KeyPair(); - String pushTokenHash = PushUtils.generateSHA512Hash(token).toLowerCase(Locale.ROOT); - PublicKey devicePublicKey = (PublicKey) PushUtils.readKeyFromFile(true); - if (devicePublicKey != null) { - byte[] publicKeyBytes = Base64.encode(devicePublicKey.getEncoded(), Base64.NO_WRAP); - String publicKey = new String(publicKeyBytes); - publicKey = publicKey.replaceAll("(.{64})", "$1\n"); - - publicKey = "-----BEGIN PUBLIC KEY-----\n" + publicKey + "\n-----END PUBLIC KEY-----\n"; - - Context context = MainApp.getAppContext(); - String providerValue; - PushConfigurationState accountPushData = null; - Gson gson = new Gson(); - for (Account account : AccountUtils.getAccounts(context)) { - providerValue = arbitraryDataProvider.getValue(account, KEY_PUSH); - if (!TextUtils.isEmpty(providerValue)) { - accountPushData = gson.fromJson(providerValue, - PushConfigurationState.class); - } else { - accountPushData = null; - } - - if (accountPushData != null && !accountPushData.getPushToken().equals(token) && - !accountPushData.isShouldBeDeleted() || - TextUtils.isEmpty(providerValue)) { - try { - OwnCloudAccount ocAccount = new OwnCloudAccount(account, context); - OwnCloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton(). - getClientFor(ocAccount, context); - - RemoteOperation registerAccountDeviceForNotificationsOperation = - new RegisterAccountDeviceForNotificationsOperation(pushTokenHash, - publicKey, - context.getResources().getString(R.string.push_server_url)); - - RemoteOperationResult remoteOperationResult = - registerAccountDeviceForNotificationsOperation.execute(mClient); - - if (remoteOperationResult.isSuccess()) { - PushResponse pushResponse = remoteOperationResult.getPushResponseData(); - - RemoteOperation registerAccountDeviceForProxyOperation = new - RegisterAccountDeviceForProxyOperation( - context.getResources().getString(R.string.push_server_url), - token, pushResponse.getDeviceIdentifier(), pushResponse.getSignature(), - pushResponse.getPublicKey()); - - remoteOperationResult = registerAccountDeviceForProxyOperation.execute(mClient); - - if (remoteOperationResult.isSuccess()) { - PushConfigurationState pushArbitraryData = new PushConfigurationState(token, - pushResponse.getDeviceIdentifier(), pushResponse.getSignature(), - pushResponse.getPublicKey(), false); - arbitraryDataProvider.storeOrUpdateKeyValue(account.name, KEY_PUSH, - gson.toJson(pushArbitraryData)); - } - } - } catch (com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException e) { - Log_OC.d(TAG, "Failed to find an account"); - } catch (AuthenticatorException e) { - Log_OC.d(TAG, "Failed via AuthenticatorException"); - } catch (IOException e) { - Log_OC.d(TAG, "Failed via IOException"); - } catch (OperationCanceledException e) { - Log_OC.d(TAG, "Failed via OperationCanceledException"); - } - } else if (accountPushData != null && accountPushData.isShouldBeDeleted()) { - deleteRegistrationForAccount(account); - } - } - } - } - } - - public static Key readKeyFromFile(boolean readPublicKey) { - String keyPath = MainApp.getAppContext().getFilesDir().getAbsolutePath() + File.separator + - MainApp.getDataFolder() + File.separator + KEYPAIR_FOLDER; - - String privateKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PRIV_EXTENSION; - String publicKeyPath = keyPath + File.separator + KEYPAIR_FILE_NAME + KEYPAIR_PUB_EXTENSION; - - String path; - - if (readPublicKey) { - path = publicKeyPath; - } else { - path = privateKeyPath; - } - - FileInputStream fileInputStream = null; - try { - fileInputStream = new FileInputStream(path); - byte[] bytes = new byte[fileInputStream.available()]; - fileInputStream.read(bytes); - fileInputStream.close(); - - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - - if (readPublicKey) { - X509EncodedKeySpec keySpec = new X509EncodedKeySpec(bytes); - return keyFactory.generatePublic(keySpec); - } else { - PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bytes); - return keyFactory.generatePrivate(keySpec); - } - - } catch (FileNotFoundException e) { - Log_OC.d(TAG, "Failed to find path while reading the Key"); - } catch (IOException e) { - Log_OC.d(TAG, "IOException while reading the key"); - } catch (InvalidKeySpecException e) { - Log_OC.d(TAG, "InvalidKeySpecException while reading the key"); - } catch (NoSuchAlgorithmException e) { - Log_OC.d(TAG, "RSA algorithm not supported"); - } - - return null; - } - - private static int saveKeyToFile(Key key, String path) { - byte[] encoded = key.getEncoded(); - FileOutputStream keyFileOutputStream = null; - try { - if (!new File(path).exists()) { - new File(path).createNewFile(); - } - keyFileOutputStream = new FileOutputStream(path); - keyFileOutputStream.write(encoded); - keyFileOutputStream.close(); - return 0; - } catch (FileNotFoundException e) { - Log_OC.d(TAG, "Failed to save key to file"); - } catch (IOException e) { - Log_OC.d(TAG, "Failed to save key to file via IOException"); - } - - return -1; - } - - private static void migratePushKeys() { - - } -} diff --git a/src/modified/res/layout/drawer.xml b/src/modified/res/layout/drawer.xml deleted file mode 100644 index b83ceb195a..0000000000 --- a/src/modified/res/layout/drawer.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/modified/res/values/setup.xml b/src/modified/res/values/setup.xml deleted file mode 100644 index fab5ff00f6..0000000000 --- a/src/modified/res/values/setup.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - false - - - Custom - custom - com.custom.client.provider - com.custom.client.provider.UsersAndGroupsSearch - com.custom.client.provider.UsersAndGroupsSearch.action.SHARE_WITH - com.custom.client.provider.Documents - com.custom.client.provider.Files - custom.db - custom - custom - custom - Custom - Mozilla/5.0 (Android) ownCloud-android/%1$s - - - - true - - - regular - true - "https://nextcloud.com/providers" - - - off - off - - - on - true - true - true - - - true - /.Contacts-Backup - 30 - - - true - - - - - #1E2751 - #006AA3 - #007CC2 - @color/white - #7fC0E3 - #FFFFFF - @color/color_accent - @color/white - #D6D7D7 - @color/black - - - #201D2D44 - #40162233 - - - #757575 - #616161 - #ECECEC - - - true - - - false - true - true - true - true - - - false - - - true - - - false - false - false - false - true - https://help.nextcloud.com/c/feature - true - https://nextcloud.com/privacy - false - true - true - false - - "mailto:android@nextcloud.com" - "https://play.google.com/store/apps/details?id=com.nextcloud.client" - https://nextcloud.com/install - - - true - @string/instant_upload_path - false - false - FileUploader.LOCAL_BEHAVIOUR_FORGET - - - - - - false - - https://f-droid.org/repository/browse/?fdid=com.nextcloud.android.beta - https://github.com/nextcloud/android/raw/beta/apks/latest.apk - https://play.google.com/apps/testing/com.nextcloud.client - https://f-droid.org/repository/browse/?fdid=com.nextcloud.client - http://webchat.freenode.net?channels=nextcloud-mobile - https://help.nextcloud.com/c/clients/android - https://www.transifex.com/nextcloud/nextcloud/android/ - https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md - https://github.com/nextcloud/android/issues - - - cloud - - - - - false - - - true - - - - - -