remove modified flavor

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2018-01-15 13:33:34 +01:00 committed by AndyScherzinger
parent d293cd50ec
commit fdc9abcd34
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
12 changed files with 2 additions and 926 deletions

View file

@ -59,7 +59,6 @@ matrix:
FLAVOUR:
- Generic
- Gplay
- Modified
- Lint
branches: master

View file

@ -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'

View file

@ -1,83 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Nextcloud Android client application
Copyright (C) 2017 Mario Danic
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2,
as published by the Free Software Foundation.
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 <http://www.gnu.org/licenses/>.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.owncloud.android">
<application
android:name=".MainApp"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:fullBackupContent="@xml/backup_config"
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" />
<activity
android:name=".authentication.ModifiedAuthenticatorActivity"
android:exported="true"
android:launchMode="singleTask"
android:theme="@style/Theme.ownCloud.noActionBar.Login">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/oauth2_redirect_scheme" />
</intent-filter>
<intent-filter>
<action android:name="com.owncloud.android.workaround.accounts.CREATE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/login_data_own_scheme" android:host="login"/>
</intent-filter>
</activity>
<activity-alias
android:name=".authentication.AuthenticatorActivity"
android:targetActivity=".authentication.ModifiedAuthenticatorActivity"
tools:replace="android:targetActivity"/>
<service
android:name=".services.firebase.NCFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".services.firebase.NCFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
</manifest>

View file

@ -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"
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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());
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
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() {
}
}

View file

@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Nextcloud Android client application
Copyright (C) 2016 Andy Scherzinger
Copyright (C) 2016 Nextcloud.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
License as published by the Free Software Foundation; either
version 3 of the License, or 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 <http://www.gnu.org/licenses/>.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_weight="1"
android:fitsSystemWindows="true"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/drawer_menu"
app:theme="@style/NavigationView_ItemTextAppearance">
<LinearLayout
android:id="@+id/drawer_quota"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white"
android:clickable="false"
android:orientation="vertical"
android:paddingBottom="@dimen/standard_half_padding"
android:paddingLeft="@dimen/standard_padding"
android:paddingRight="@dimen/standard_padding"
android:paddingTop="@dimen/standard_half_padding"
android:visibility="gone">
<TextView
android:id="@+id/drawer_quota_percentage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/drawer_quota"/>
<ProgressBar
android:id="@+id/drawer_quota_ProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="false"
android:indeterminateOnly="false"
android:text="@string/drawer_quota"
/>
<TextView
android:id="@+id/drawer_quota_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="5dp"
/>
</LinearLayout>
</android.support.design.widget.NavigationView>
</merge>

View file

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Beta indicator -->
<bool name="is_beta">false</bool>
<!-- App name and other strings-->
<string name="app_name">Custom</string>
<string name="account_type">custom</string> <!-- better if was a domain name; but changing it now would require migrate accounts when the app is updated -->
<string name="authority">com.custom.client.provider</string> <!-- better if was the app package with ".provider" appended ; it identifies the provider -->
<string name="users_and_groups_search_authority">com.custom.client.provider.UsersAndGroupsSearch</string>
<string name="users_and_groups_share_with">com.custom.client.provider.UsersAndGroupsSearch.action.SHARE_WITH</string>
<string name="document_provider_authority">com.custom.client.provider.Documents</string>
<string name="file_provider_authority">com.custom.client.provider.Files</string>
<string name ="db_file">custom.db</string>
<string name ="db_name">custom</string>
<string name="data_folder">custom</string>
<string name ="log_name">custom</string>
<string name="default_display_name_for_root_folder">Custom</string>
<string name ="user_agent">Mozilla/5.0 (Android) ownCloud-android/%1$s</string>
<!-- URLs and flags related -->
<string name="server_url"></string>
<bool name="show_server_url_input">true</bool>
<!-- Can be regular (full input), prefix (subdomain input) and suffix (directory input) -->
<!-- Requires server url to be set -->
<string name="server_input_type">regular</string>
<bool name="show_welcome_link">true</bool>
<string name="welcome_link_url">"https://nextcloud.com/providers"</string>
<!-- Flags to setup the authentication methods available in the app -->
<string name="auth_method_oauth2">off</string>
<string name="auth_method_saml_web_sso">off</string>
<!-- Flags to enable/disable some features -->
<string name="send_files_to_other_apps">on</string>
<bool name="share_via_link_feature">true</bool>
<bool name="share_with_users_feature">true</bool>
<bool name="show_external_links">true</bool>
<!-- Contacts backup -->
<bool name="contacts_backup">true</bool>
<string name="contacts_backup_folder">/.Contacts-Backup</string>
<integer name="contacts_backup_expire">30</integer>
<!-- What's new -->
<bool name="show_whats_new">true</bool>
<!-- To fill if you want to show webviews instead of regular welcome views -->
<array name="whatsnew_urls"></array>
<!-- Colors -->
<color name="primary">#1E2751</color>
<color name="primary_dark">#006AA3</color>
<color name="color_accent">#007CC2</color>
<color name="login_text_color">@color/white</color>
<color name="login_text_hint_color">#7fC0E3</color>
<color name="background_color">#FFFFFF</color>
<color name="primary_button_background_color">@color/color_accent</color>
<color name="primary_button_text_color">@color/white</color>
<color name="secondary_button_background_color">#D6D7D7</color>
<color name="secondary_button_text_color">@color/black</color>
<!-- special transparent action bar colors for image preview -->
<color name="color_transparent">#201D2D44</color>
<color name="color_dark_transparent">#40162233</color>
<!-- Multiselect backgrounds -->
<color name="action_mode_background">#757575</color>
<color name="action_mode_status_bar_background">#616161</color>
<color name="selected_item_background">#ECECEC</color>
<!-- Multiaccount support -->
<bool name="multiaccount_support">true</bool>
<!-- Drawer options -->
<bool name="recently_added_enabled">false</bool>
<bool name="recently_modified_enabled">true</bool>
<bool name="shared_enabled">true</bool>
<bool name="videos_enabled">true</bool>
<bool name="show_drawer_logout">true</bool>
<!-- Various other options -->
<bool name="allow_profile_click">false</bool>
<!-- Bottom toolbar -->
<bool name="bottom_toolbar_enabled">true</bool>
<!-- Help, imprint and feedback, and other things -->
<bool name="fingerprint_enabled">false</bool>
<bool name="passcode_enabled">false</bool>
<bool name="show_hidden_files_enabled">false</bool>
<bool name="davdroid_integration_enabled">false</bool>
<bool name="help_enabled">true</bool>
<string name="url_help">https://help.nextcloud.com/c/feature</string>
<bool name="privacy_enabled">true</bool>
<string name="privacy_url">https://nextcloud.com/privacy</string>
<bool name="imprint_enabled">false</bool>
<bool name="recommend_enabled">true</bool>
<bool name="feedback_enabled">true</bool>
<bool name="logger_enabled">false</bool>
<string name="url_imprint"></string>
<string name="mail_feedback">"mailto:android@nextcloud.com"</string>
<string name="url_app_download">"https://play.google.com/store/apps/details?id=com.nextcloud.client"</string>
<string name="url_server_install">https://nextcloud.com/install</string>
<!-- synced folder light; if enabled: move to setting & global upload settings -->
<bool name="syncedFolder_light">true</bool>
<string name="syncedFolder_remote_folder">@string/instant_upload_path</string>
<bool name="syncedFolder_light_on_charging">false</bool>
<bool name="syncedFolder_light_use_subfolders">false</bool>
<string name="syncedFolder_light_upload_behaviour">FileUploader.LOCAL_BEHAVIOUR_FORGET</string>
<!--Destination mail for sending log files -->
<string name="mail_logger"></string>
<!-- Determine is participate enabled -->
<bool name="participate_enabled">false</bool>
<!-- Participate links -->
<string name="fdroid_beta_link" translatable="false">https://f-droid.org/repository/browse/?fdid=com.nextcloud.android.beta</string>
<string name="beta_apk_link" translatable="false">https://github.com/nextcloud/android/raw/beta/apks/latest.apk</string>
<string name="play_store_register_beta" translatable="false">https://play.google.com/apps/testing/com.nextcloud.client</string>
<string name="fdroid_link" translatable="false">https://f-droid.org/repository/browse/?fdid=com.nextcloud.client</string>
<string name="irc_weblink" translatable="false">http://webchat.freenode.net?channels=nextcloud-mobile</string>
<string name="help_link" translatable="false">https://help.nextcloud.com/c/clients/android</string>
<string name="translation_link" translatable="false">https://www.transifex.com/nextcloud/nextcloud/android/</string>
<string name="contributing_link" translatable="false">https://github.com/nextcloud/android/blob/master/CONTRIBUTING.md</string>
<string name="report_issue_link" translatable="false">https://github.com/nextcloud/android/issues</string>
<!-- login data links -->
<string name="login_data_own_scheme" translatable="false">cloud</string>
<!-- url for webview login, with the protocol prefix
If set, will replace all other login methods available -->
<string name="webview_login_url" translatable="false"></string>
<!-- analytics enabled -->
<bool name="analytics_enabled">false</bool>
<!-- Files becomes Home -->
<bool name="use_home">true</bool>
<!-- Push server url -->
<string name="push_server_url" translatable="false"></string>
</resources>