mirror of
https://github.com/nextcloud/android.git
synced 2024-12-19 07:22:06 +03:00
Merge remote-tracking branch 'origin/master' into dev
This commit is contained in:
commit
0a27242ce0
15 changed files with 132 additions and 97 deletions
|
@ -19,6 +19,7 @@ import com.google.gson.Gson;
|
||||||
import com.nextcloud.client.account.UserAccountManager;
|
import com.nextcloud.client.account.UserAccountManager;
|
||||||
import com.nextcloud.client.preferences.AppPreferences;
|
import com.nextcloud.client.preferences.AppPreferences;
|
||||||
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
import com.nextcloud.client.preferences.AppPreferencesImpl;
|
||||||
|
import com.nextcloud.common.NextcloudClient;
|
||||||
import com.owncloud.android.MainApp;
|
import com.owncloud.android.MainApp;
|
||||||
import com.owncloud.android.R;
|
import com.owncloud.android.R;
|
||||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||||
|
@ -26,9 +27,7 @@ import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
|
||||||
import com.owncloud.android.datamodel.PushConfigurationState;
|
import com.owncloud.android.datamodel.PushConfigurationState;
|
||||||
import com.owncloud.android.datamodel.SignatureVerification;
|
import com.owncloud.android.datamodel.SignatureVerification;
|
||||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
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.OwnCloudClientManagerFactory;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||||
import com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForNotificationsOperation;
|
import com.owncloud.android.lib.resources.notifications.RegisterAccountDeviceForNotificationsOperation;
|
||||||
|
@ -131,14 +130,11 @@ public final class PushUtils {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ocAccount = new OwnCloudAccount(account, context);
|
ocAccount = new OwnCloudAccount(account, context);
|
||||||
OwnCloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
|
NextcloudClient mClient = OwnCloudClientManagerFactory.getDefaultSingleton().
|
||||||
getClientFor(ocAccount, context);
|
getNextcloudClientFor(ocAccount, context);
|
||||||
|
|
||||||
RemoteOperation unregisterAccountDeviceForNotificationsOperation = new
|
RemoteOperationResult<Void> remoteOperationResult =
|
||||||
UnregisterAccountDeviceForNotificationsOperation();
|
new UnregisterAccountDeviceForNotificationsOperation().execute(mClient);
|
||||||
|
|
||||||
RemoteOperationResult remoteOperationResult = unregisterAccountDeviceForNotificationsOperation.
|
|
||||||
execute(mClient);
|
|
||||||
|
|
||||||
if (remoteOperationResult.getHttpCode() == HttpStatus.SC_ACCEPTED) {
|
if (remoteOperationResult.getHttpCode() == HttpStatus.SC_ACCEPTED) {
|
||||||
String arbitraryValue;
|
String arbitraryValue;
|
||||||
|
@ -201,8 +197,8 @@ public final class PushUtils {
|
||||||
TextUtils.isEmpty(providerValue)) {
|
TextUtils.isEmpty(providerValue)) {
|
||||||
try {
|
try {
|
||||||
OwnCloudAccount ocAccount = new OwnCloudAccount(account, context);
|
OwnCloudAccount ocAccount = new OwnCloudAccount(account, context);
|
||||||
OwnCloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton().
|
NextcloudClient client = OwnCloudClientManagerFactory.getDefaultSingleton().
|
||||||
getClientFor(ocAccount, context);
|
getNextcloudClientFor(ocAccount, context);
|
||||||
|
|
||||||
RemoteOperationResult<PushResponse> remoteOperationResult =
|
RemoteOperationResult<PushResponse> remoteOperationResult =
|
||||||
new RegisterAccountDeviceForNotificationsOperation(pushTokenHash,
|
new RegisterAccountDeviceForNotificationsOperation(pushTokenHash,
|
||||||
|
|
|
@ -29,6 +29,7 @@ import com.nextcloud.client.integrations.deck.DeckApi
|
||||||
import com.owncloud.android.R
|
import com.owncloud.android.R
|
||||||
import com.owncloud.android.datamodel.DecryptedPushMessage
|
import com.owncloud.android.datamodel.DecryptedPushMessage
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient
|
import com.owncloud.android.lib.common.OwnCloudClient
|
||||||
|
import com.owncloud.android.lib.common.OwnCloudClientFactory
|
||||||
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory
|
import com.owncloud.android.lib.common.OwnCloudClientManagerFactory
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperation
|
import com.owncloud.android.lib.common.operations.RemoteOperation
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC
|
import com.owncloud.android.lib.common.utils.Log_OC
|
||||||
|
@ -236,8 +237,7 @@ class NotificationWork constructor(
|
||||||
}
|
}
|
||||||
val user = optionalUser.get()
|
val user = optionalUser.get()
|
||||||
try {
|
try {
|
||||||
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
|
val client = OwnCloudClientFactory.createNextcloudClient(user, context)
|
||||||
.getClientFor(user.toOwnCloudAccount(), context)
|
|
||||||
val result = GetNotificationRemoteOperation(decryptedPushMessage.nid)
|
val result = GetNotificationRemoteOperation(decryptedPushMessage.nid)
|
||||||
.execute(client)
|
.execute(client)
|
||||||
if (result.isSuccess) {
|
if (result.isSuccess) {
|
||||||
|
@ -287,6 +287,7 @@ class NotificationWork constructor(
|
||||||
val user = optionalUser.get()
|
val user = optionalUser.get()
|
||||||
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
|
val client = OwnCloudClientManagerFactory.getDefaultSingleton()
|
||||||
.getClientFor(user.toOwnCloudAccount(), context)
|
.getClientFor(user.toOwnCloudAccount(), context)
|
||||||
|
val nextcloudClient = OwnCloudClientFactory.createNextcloudClient(user, context)
|
||||||
val actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE)
|
val actionType = intent.getStringExtra(KEY_NOTIFICATION_ACTION_TYPE)
|
||||||
val actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK)
|
val actionLink = intent.getStringExtra(KEY_NOTIFICATION_ACTION_LINK)
|
||||||
val success: Boolean = if (!actionType.isNullOrEmpty() && !actionLink.isNullOrEmpty()) {
|
val success: Boolean = if (!actionType.isNullOrEmpty() && !actionLink.isNullOrEmpty()) {
|
||||||
|
@ -294,7 +295,7 @@ class NotificationWork constructor(
|
||||||
resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_ACCEPTED
|
resultCode == HttpStatus.SC_OK || resultCode == HttpStatus.SC_ACCEPTED
|
||||||
} else {
|
} else {
|
||||||
DeleteNotificationRemoteOperation(numericNotificationId)
|
DeleteNotificationRemoteOperation(numericNotificationId)
|
||||||
.execute(client).isSuccess
|
.execute(nextcloudClient).isSuccess
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
if (oldNotification == null) {
|
if (oldNotification == null) {
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Nextcloud - Android Client
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2023 ZetaTom
|
||||||
|
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.nextcloud.utils.extensions
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.nextcloud.common.NextcloudClient
|
||||||
|
import com.owncloud.android.lib.common.OwnCloudClient
|
||||||
|
import com.owncloud.android.lib.common.OwnCloudClientFactory
|
||||||
|
|
||||||
|
fun OwnCloudClient.toNextcloudClient(context: Context): NextcloudClient {
|
||||||
|
return OwnCloudClientFactory.createNextcloudClient(
|
||||||
|
baseUri,
|
||||||
|
userId,
|
||||||
|
credentials.toOkHttpCredentials(),
|
||||||
|
context,
|
||||||
|
isFollowRedirects
|
||||||
|
)
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ import android.util.Pair;
|
||||||
|
|
||||||
import com.nextcloud.client.account.User;
|
import com.nextcloud.client.account.User;
|
||||||
import com.nextcloud.client.account.UserAccountManager;
|
import com.nextcloud.client.account.UserAccountManager;
|
||||||
|
import com.nextcloud.common.NextcloudClient;
|
||||||
import com.nextcloud.utils.extensions.IntentExtensionsKt;
|
import com.nextcloud.utils.extensions.IntentExtensionsKt;
|
||||||
import com.owncloud.android.MainApp;
|
import com.owncloud.android.MainApp;
|
||||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||||
|
@ -260,7 +261,7 @@ public class OperationsService extends Service {
|
||||||
*/
|
*/
|
||||||
private final ConcurrentMap<OnRemoteOperationListener, Handler> mBoundListeners = new ConcurrentHashMap<>();
|
private final ConcurrentMap<OnRemoteOperationListener, Handler> mBoundListeners = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private ServiceHandler mServiceHandler;
|
private final ServiceHandler mServiceHandler;
|
||||||
|
|
||||||
public OperationsServiceBinder(ServiceHandler serviceHandler) {
|
public OperationsServiceBinder(ServiceHandler serviceHandler) {
|
||||||
mServiceHandler = serviceHandler;
|
mServiceHandler = serviceHandler;
|
||||||
|
@ -380,7 +381,7 @@ public class OperationsService extends Service {
|
||||||
OperationsService mService;
|
OperationsService mService;
|
||||||
|
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<Pair<Target, RemoteOperation>> mPendingOperations =
|
private final ConcurrentLinkedQueue<Pair<Target, RemoteOperation>> mPendingOperations =
|
||||||
new ConcurrentLinkedQueue<>();
|
new ConcurrentLinkedQueue<>();
|
||||||
private RemoteOperation mCurrentOperation;
|
private RemoteOperation mCurrentOperation;
|
||||||
private Target mLastTarget;
|
private Target mLastTarget;
|
||||||
|
@ -416,11 +417,12 @@ public class OperationsService extends Service {
|
||||||
if (next != null) {
|
if (next != null) {
|
||||||
mCurrentOperation = next.second;
|
mCurrentOperation = next.second;
|
||||||
RemoteOperationResult result;
|
RemoteOperationResult result;
|
||||||
|
OwnCloudAccount ocAccount = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
/// prepare client object to send the request to the ownCloud server
|
/// prepare client object to send the request to the ownCloud server
|
||||||
if (mLastTarget == null || !mLastTarget.equals(next.first)) {
|
if (mLastTarget == null || !mLastTarget.equals(next.first)) {
|
||||||
mLastTarget = next.first;
|
mLastTarget = next.first;
|
||||||
OwnCloudAccount ocAccount;
|
|
||||||
if (mLastTarget.mAccount != null) {
|
if (mLastTarget.mAccount != null) {
|
||||||
ocAccount = new OwnCloudAccount(mLastTarget.mAccount, mService);
|
ocAccount = new OwnCloudAccount(mLastTarget.mAccount, mService);
|
||||||
} else {
|
} else {
|
||||||
|
@ -430,9 +432,21 @@ public class OperationsService extends Service {
|
||||||
getClientFor(ocAccount, mService);
|
getClientFor(ocAccount, mService);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// perform the operation
|
// perform the operation
|
||||||
result = mCurrentOperation.execute(mOwnCloudClient);
|
try {
|
||||||
} catch (AccountsException e) {
|
result = mCurrentOperation.execute(mOwnCloudClient);
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// TODO remove - added to aid in transition to NextcloudClient
|
||||||
|
|
||||||
|
if (ocAccount == null) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
NextcloudClient nextcloudClient = OwnCloudClientManagerFactory.getDefaultSingleton()
|
||||||
|
.getNextcloudClientFor(ocAccount, mService.getBaseContext());
|
||||||
|
result = mCurrentOperation.run(nextcloudClient);
|
||||||
|
}
|
||||||
|
} catch (AccountsException | IOException e) {
|
||||||
if (mLastTarget.mAccount == null) {
|
if (mLastTarget.mAccount == null) {
|
||||||
Log_OC.e(TAG, "Error while trying to get authorization for a NULL account",
|
Log_OC.e(TAG, "Error while trying to get authorization for a NULL account",
|
||||||
e);
|
e);
|
||||||
|
@ -442,15 +456,6 @@ public class OperationsService extends Service {
|
||||||
}
|
}
|
||||||
result = new RemoteOperationResult(e);
|
result = new RemoteOperationResult(e);
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
if (mLastTarget.mAccount == null) {
|
|
||||||
Log_OC.e(TAG, "Error while trying to get authorization for a NULL account",
|
|
||||||
e);
|
|
||||||
} else {
|
|
||||||
Log_OC.e(TAG, "Error while trying to get authorization for " +
|
|
||||||
mLastTarget.mAccount.name, e);
|
|
||||||
}
|
|
||||||
result = new RemoteOperationResult(e);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (mLastTarget.mAccount == null) {
|
if (mLastTarget.mAccount == null) {
|
||||||
Log_OC.e(TAG, "Unexpected error for a NULL account", e);
|
Log_OC.e(TAG, "Unexpected error for a NULL account", e);
|
||||||
|
@ -537,10 +542,6 @@ public class OperationsService extends Service {
|
||||||
false);
|
false);
|
||||||
updateLinkOperation.setHideFileDownload(hideFileDownload);
|
updateLinkOperation.setHideFileDownload(hideFileDownload);
|
||||||
|
|
||||||
// if (operationIntent.hasExtra(EXTRA_SHARE_PUBLIC_UPLOAD)) {
|
|
||||||
// updateLinkOperation.setPublicUpload(true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (operationIntent.hasExtra(EXTRA_SHARE_PUBLIC_LABEL)) {
|
if (operationIntent.hasExtra(EXTRA_SHARE_PUBLIC_LABEL)) {
|
||||||
updateLinkOperation.setLabel(operationIntent.getStringExtra(EXTRA_SHARE_PUBLIC_LABEL));
|
updateLinkOperation.setLabel(operationIntent.getStringExtra(EXTRA_SHARE_PUBLIC_LABEL));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@ import com.nextcloud.client.account.User
|
||||||
import com.nextcloud.client.account.UserAccountManager
|
import com.nextcloud.client.account.UserAccountManager
|
||||||
import com.nextcloud.client.jobs.NotificationWork
|
import com.nextcloud.client.jobs.NotificationWork
|
||||||
import com.nextcloud.client.network.ClientFactory.CreationException
|
import com.nextcloud.client.network.ClientFactory.CreationException
|
||||||
|
import com.nextcloud.common.NextcloudClient
|
||||||
import com.owncloud.android.R
|
import com.owncloud.android.R
|
||||||
import com.owncloud.android.databinding.NotificationsLayoutBinding
|
import com.owncloud.android.databinding.NotificationsLayoutBinding
|
||||||
import com.owncloud.android.datamodel.ArbitraryDataProvider
|
import com.owncloud.android.datamodel.ArbitraryDataProvider
|
||||||
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
|
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient
|
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC
|
import com.owncloud.android.lib.common.utils.Log_OC
|
||||||
import com.owncloud.android.lib.resources.notifications.GetNotificationsRemoteOperation
|
import com.owncloud.android.lib.resources.notifications.GetNotificationsRemoteOperation
|
||||||
import com.owncloud.android.lib.resources.notifications.models.Notification
|
import com.owncloud.android.lib.resources.notifications.models.Notification
|
||||||
|
@ -44,7 +44,7 @@ class NotificationsActivity : DrawerActivity(), NotificationsContract.View {
|
||||||
|
|
||||||
private var adapter: NotificationListAdapter? = null
|
private var adapter: NotificationListAdapter? = null
|
||||||
private var snackbar: Snackbar? = null
|
private var snackbar: Snackbar? = null
|
||||||
private var client: OwnCloudClient? = null
|
private var client: NextcloudClient? = null
|
||||||
private var optionalUser: Optional<User>? = null
|
private var optionalUser: Optional<User>? = null
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -213,16 +213,16 @@ class NotificationsActivity : DrawerActivity(), NotificationsContract.View {
|
||||||
val t = Thread {
|
val t = Thread {
|
||||||
initializeAdapter()
|
initializeAdapter()
|
||||||
val getRemoteNotificationOperation = GetNotificationsRemoteOperation()
|
val getRemoteNotificationOperation = GetNotificationsRemoteOperation()
|
||||||
val result = getRemoteNotificationOperation.execute(client)
|
val result = client?.let { getRemoteNotificationOperation.execute(it) }
|
||||||
if (result.isSuccess && result.resultData != null) {
|
if (result?.isSuccess == true && result.resultData != null) {
|
||||||
runOnUiThread { populateList(result.resultData) }
|
runOnUiThread { populateList(result.resultData) }
|
||||||
} else {
|
} else {
|
||||||
Log_OC.d(TAG, result.logMessage)
|
Log_OC.d(TAG, result?.logMessage)
|
||||||
// show error
|
// show error
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
setEmptyContent(
|
setEmptyContent(
|
||||||
getString(R.string.notifications_no_results_headline),
|
getString(R.string.notifications_no_results_headline),
|
||||||
result.logMessage
|
result?.logMessage
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ class NotificationsActivity : DrawerActivity(), NotificationsContract.View {
|
||||||
if (client == null && optionalUser?.isPresent == true) {
|
if (client == null && optionalUser?.isPresent == true) {
|
||||||
try {
|
try {
|
||||||
val user = optionalUser?.get()
|
val user = optionalUser?.get()
|
||||||
client = clientFactory.create(user)
|
client = clientFactory.createNextcloudClient(user)
|
||||||
} catch (e: CreationException) {
|
} catch (e: CreationException) {
|
||||||
Log_OC.e(TAG, "Error initializing client", e)
|
Log_OC.e(TAG, "Error initializing client", e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,9 @@ import com.bumptech.glide.load.resource.file.FileToStreamDecoder;
|
||||||
import com.caverock.androidsvg.SVG;
|
import com.caverock.androidsvg.SVG;
|
||||||
import com.google.android.material.button.MaterialButton;
|
import com.google.android.material.button.MaterialButton;
|
||||||
import com.nextcloud.android.common.ui.theme.utils.ColorRole;
|
import com.nextcloud.android.common.ui.theme.utils.ColorRole;
|
||||||
|
import com.nextcloud.common.NextcloudClient;
|
||||||
import com.owncloud.android.R;
|
import com.owncloud.android.R;
|
||||||
import com.owncloud.android.databinding.NotificationListItemBinding;
|
import com.owncloud.android.databinding.NotificationListItemBinding;
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
|
||||||
import com.owncloud.android.lib.resources.notifications.models.Action;
|
import com.owncloud.android.lib.resources.notifications.models.Action;
|
||||||
import com.owncloud.android.lib.resources.notifications.models.Notification;
|
import com.owncloud.android.lib.resources.notifications.models.Notification;
|
||||||
import com.owncloud.android.lib.resources.notifications.models.RichObject;
|
import com.owncloud.android.lib.resources.notifications.models.RichObject;
|
||||||
|
@ -71,11 +71,11 @@ public class NotificationListAdapter extends RecyclerView.Adapter<NotificationLi
|
||||||
private final ForegroundColorSpan foregroundColorSpanBlack;
|
private final ForegroundColorSpan foregroundColorSpanBlack;
|
||||||
|
|
||||||
private final List<Notification> notificationsList;
|
private final List<Notification> notificationsList;
|
||||||
private final OwnCloudClient client;
|
private final NextcloudClient client;
|
||||||
private final NotificationsActivity notificationsActivity;
|
private final NotificationsActivity notificationsActivity;
|
||||||
private final ViewThemeUtils viewThemeUtils;
|
private final ViewThemeUtils viewThemeUtils;
|
||||||
|
|
||||||
public NotificationListAdapter(OwnCloudClient client,
|
public NotificationListAdapter(NextcloudClient client,
|
||||||
NotificationsActivity notificationsActivity,
|
NotificationsActivity notificationsActivity,
|
||||||
ViewThemeUtils viewThemeUtils) {
|
ViewThemeUtils viewThemeUtils) {
|
||||||
this.notificationsList = new ArrayList<>();
|
this.notificationsList = new ArrayList<>();
|
||||||
|
|
|
@ -9,7 +9,7 @@ package com.owncloud.android.ui.asynctasks;
|
||||||
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
import com.nextcloud.common.NextcloudClient;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.resources.notifications.DeleteAllNotificationsRemoteOperation;
|
import com.owncloud.android.lib.resources.notifications.DeleteAllNotificationsRemoteOperation;
|
||||||
import com.owncloud.android.lib.resources.notifications.models.Action;
|
import com.owncloud.android.lib.resources.notifications.models.Action;
|
||||||
|
@ -17,10 +17,10 @@ import com.owncloud.android.ui.activity.NotificationsActivity;
|
||||||
import com.owncloud.android.ui.notifications.NotificationsContract;
|
import com.owncloud.android.ui.notifications.NotificationsContract;
|
||||||
|
|
||||||
public class DeleteAllNotificationsTask extends AsyncTask<Action, Void, Boolean> {
|
public class DeleteAllNotificationsTask extends AsyncTask<Action, Void, Boolean> {
|
||||||
private OwnCloudClient client;
|
private NextcloudClient client;
|
||||||
private NotificationsContract.View notificationsActivity;
|
private final NotificationsContract.View notificationsActivity;
|
||||||
|
|
||||||
public DeleteAllNotificationsTask(OwnCloudClient client, NotificationsActivity notificationsActivity) {
|
public DeleteAllNotificationsTask(NextcloudClient client, NotificationsActivity notificationsActivity) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.notificationsActivity = notificationsActivity;
|
this.notificationsActivity = notificationsActivity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ package com.owncloud.android.ui.asynctasks;
|
||||||
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
import com.nextcloud.common.NextcloudClient;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.resources.notifications.DeleteNotificationRemoteOperation;
|
import com.owncloud.android.lib.resources.notifications.DeleteNotificationRemoteOperation;
|
||||||
import com.owncloud.android.lib.resources.notifications.models.Action;
|
import com.owncloud.android.lib.resources.notifications.models.Action;
|
||||||
|
@ -21,10 +21,10 @@ import com.owncloud.android.ui.notifications.NotificationsContract;
|
||||||
public class DeleteNotificationTask extends AsyncTask<Action, Void, Boolean> {
|
public class DeleteNotificationTask extends AsyncTask<Action, Void, Boolean> {
|
||||||
private Notification notification;
|
private Notification notification;
|
||||||
private NotificationListAdapter.NotificationViewHolder holder;
|
private NotificationListAdapter.NotificationViewHolder holder;
|
||||||
private OwnCloudClient client;
|
private NextcloudClient client;
|
||||||
private NotificationsContract.View notificationsActivity;
|
private NotificationsContract.View notificationsActivity;
|
||||||
|
|
||||||
public DeleteNotificationTask(OwnCloudClient client, Notification notification,
|
public DeleteNotificationTask(NextcloudClient client, Notification notification,
|
||||||
NotificationListAdapter.NotificationViewHolder holder,
|
NotificationListAdapter.NotificationViewHolder holder,
|
||||||
NotificationsActivity notificationsActivity) {
|
NotificationsActivity notificationsActivity) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
|
|
|
@ -8,7 +8,12 @@ package com.owncloud.android.ui.asynctasks;
|
||||||
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
import com.nextcloud.common.NextcloudClient;
|
||||||
|
import com.nextcloud.common.OkHttpMethodBase;
|
||||||
|
import com.nextcloud.operations.DeleteMethod;
|
||||||
|
import com.nextcloud.operations.GetMethod;
|
||||||
|
import com.nextcloud.operations.PostMethod;
|
||||||
|
import com.nextcloud.operations.PutMethod;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
||||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||||
import com.owncloud.android.lib.resources.notifications.models.Action;
|
import com.owncloud.android.lib.resources.notifications.models.Action;
|
||||||
|
@ -16,23 +21,20 @@ import com.owncloud.android.lib.resources.notifications.models.Notification;
|
||||||
import com.owncloud.android.ui.activity.NotificationsActivity;
|
import com.owncloud.android.ui.activity.NotificationsActivity;
|
||||||
import com.owncloud.android.ui.adapter.NotificationListAdapter;
|
import com.owncloud.android.ui.adapter.NotificationListAdapter;
|
||||||
|
|
||||||
import org.apache.commons.httpclient.HttpMethod;
|
|
||||||
import org.apache.commons.httpclient.HttpStatus;
|
import org.apache.commons.httpclient.HttpStatus;
|
||||||
import org.apache.commons.httpclient.methods.DeleteMethod;
|
|
||||||
import org.apache.commons.httpclient.methods.GetMethod;
|
|
||||||
import org.apache.commons.httpclient.methods.PutMethod;
|
|
||||||
import org.apache.commons.httpclient.methods.Utf8PostMethod;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
|
||||||
public class NotificationExecuteActionTask extends AsyncTask<Action, Void, Boolean> {
|
public class NotificationExecuteActionTask extends AsyncTask<Action, Void, Boolean> {
|
||||||
|
|
||||||
private NotificationListAdapter.NotificationViewHolder holder;
|
private final NotificationListAdapter.NotificationViewHolder holder;
|
||||||
private OwnCloudClient client;
|
private final NextcloudClient client;
|
||||||
private Notification notification;
|
private final Notification notification;
|
||||||
private NotificationsActivity notificationsActivity;
|
private final NotificationsActivity notificationsActivity;
|
||||||
|
|
||||||
public NotificationExecuteActionTask(OwnCloudClient client,
|
public NotificationExecuteActionTask(NextcloudClient client,
|
||||||
NotificationListAdapter.NotificationViewHolder holder,
|
NotificationListAdapter.NotificationViewHolder holder,
|
||||||
Notification notification,
|
Notification notification,
|
||||||
NotificationsActivity notificationsActivity) {
|
NotificationsActivity notificationsActivity) {
|
||||||
|
@ -44,36 +46,29 @@ public class NotificationExecuteActionTask extends AsyncTask<Action, Void, Boole
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(Action... actions) {
|
protected Boolean doInBackground(Action... actions) {
|
||||||
HttpMethod method;
|
OkHttpMethodBase method;
|
||||||
Action action = actions[0];
|
Action action = actions[0];
|
||||||
|
|
||||||
switch (action.type) {
|
if (action.type == null || action.link == null) {
|
||||||
case "GET":
|
return Boolean.FALSE;
|
||||||
method = new GetMethod(action.link);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "POST":
|
|
||||||
method = new Utf8PostMethod(action.link);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "DELETE":
|
|
||||||
method = new DeleteMethod(action.link);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "PUT":
|
|
||||||
method = new PutMethod(action.link);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// do nothing
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
method.setRequestHeader(RemoteOperation.OCS_API_HEADER, RemoteOperation.OCS_API_HEADER_VALUE);
|
switch (action.type) {
|
||||||
|
case "GET" -> method = new GetMethod(action.link, true);
|
||||||
|
case "POST" -> method = new PostMethod(action.link, true, RequestBody.create("", null));
|
||||||
|
case "DELETE" -> method = new DeleteMethod(action.link, true);
|
||||||
|
case "PUT" -> method = new PutMethod(action.link, true, null);
|
||||||
|
default -> {
|
||||||
|
// do nothing
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
method.addRequestHeader(RemoteOperation.OCS_API_HEADER, RemoteOperation.OCS_API_HEADER_VALUE);
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
try {
|
try {
|
||||||
status = client.executeMethod(method);
|
status = client.execute(method);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log_OC.e(this, "Execution of notification action failed: " + e);
|
Log_OC.e(this, "Execution of notification action failed: " + e);
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
|
|
|
@ -672,6 +672,7 @@
|
||||||
<string name="push_notifications_old_login">Sem envio de notificações devido à sessão de login desatualizada. Considere readicionar sua conta.</string>
|
<string name="push_notifications_old_login">Sem envio de notificações devido à sessão de login desatualizada. Considere readicionar sua conta.</string>
|
||||||
<string name="push_notifications_temp_error">Atualmente o envio de notificações está indisponível.</string>
|
<string name="push_notifications_temp_error">Atualmente o envio de notificações está indisponível.</string>
|
||||||
<string name="qr_could_not_be_read">Não foi possível ler o código QR! </string>
|
<string name="qr_could_not_be_read">Não foi possível ler o código QR! </string>
|
||||||
|
<string name="receive_external_files_activity_start_sync_folder_is_not_exists_message">A pasta não pode ser encontrada, a operação de sincronização foi cancelada</string>
|
||||||
<string name="recommend_subject">Experimente %1$s em seu dispositivo!</string>
|
<string name="recommend_subject">Experimente %1$s em seu dispositivo!</string>
|
||||||
<string name="recommend_text">Quero convidar você a usar %1$s em seu dispositivo.\nBaixe daqui: %2$s</string>
|
<string name="recommend_text">Quero convidar você a usar %1$s em seu dispositivo.\nBaixe daqui: %2$s</string>
|
||||||
<string name="recommend_urls">%1$s ou %2$s</string>
|
<string name="recommend_urls">%1$s ou %2$s</string>
|
||||||
|
|
|
@ -672,6 +672,7 @@
|
||||||
<string name="push_notifications_old_login">Нема брзих обавештења јер је сесија застарела. Избришите и додајте поново налог.</string>
|
<string name="push_notifications_old_login">Нема брзих обавештења јер је сесија застарела. Избришите и додајте поново налог.</string>
|
||||||
<string name="push_notifications_temp_error">Брза обавештења тренутно нису доступна.</string>
|
<string name="push_notifications_temp_error">Брза обавештења тренутно нису доступна.</string>
|
||||||
<string name="qr_could_not_be_read">QR кôд није могао да се прочита!</string>
|
<string name="qr_could_not_be_read">QR кôд није могао да се прочита!</string>
|
||||||
|
<string name="receive_external_files_activity_start_sync_folder_is_not_exists_message">Не може да се пронађе фолдер, операција синхронизације је отказана</string>
|
||||||
<string name="recommend_subject">Испробај %1$s на свом уређају!</string>
|
<string name="recommend_subject">Испробај %1$s на свом уређају!</string>
|
||||||
<string name="recommend_text">Желим да те позовем да испробаш %1$s на свом уређају.\nПреузми га овде: %2$s</string>
|
<string name="recommend_text">Желим да те позовем да испробаш %1$s на свом уређају.\nПреузми га овде: %2$s</string>
|
||||||
<string name="recommend_urls">%1$s или %2$s</string>
|
<string name="recommend_urls">%1$s или %2$s</string>
|
||||||
|
|
|
@ -672,6 +672,7 @@
|
||||||
<string name="push_notifications_old_login">Oturumunuzun süresi dolduğundan anında bildirimler gönderilemez. Lütfen hesabınızı yeniden eklemeyi düşünün.</string>
|
<string name="push_notifications_old_login">Oturumunuzun süresi dolduğundan anında bildirimler gönderilemez. Lütfen hesabınızı yeniden eklemeyi düşünün.</string>
|
||||||
<string name="push_notifications_temp_error">Anında bildirimler şu anda kullanılamıyor.</string>
|
<string name="push_notifications_temp_error">Anında bildirimler şu anda kullanılamıyor.</string>
|
||||||
<string name="qr_could_not_be_read">QR kodu okunamadı!</string>
|
<string name="qr_could_not_be_read">QR kodu okunamadı!</string>
|
||||||
|
<string name="receive_external_files_activity_start_sync_folder_is_not_exists_message">Klasör bulunamadı. Eşitleme işlemi iptal edildi</string>
|
||||||
<string name="recommend_subject">%1$s uygulamasını aygıtınız üzerinde deneyin!</string>
|
<string name="recommend_subject">%1$s uygulamasını aygıtınız üzerinde deneyin!</string>
|
||||||
<string name="recommend_text">Aygıtında %1$s kullanmanı öneriyorum!\nŞuradan indirebilirsin: %2$s</string>
|
<string name="recommend_text">Aygıtında %1$s kullanmanı öneriyorum!\nŞuradan indirebilirsin: %2$s</string>
|
||||||
<string name="recommend_urls">%1$s ya da %2$s</string>
|
<string name="recommend_urls">%1$s ya da %2$s</string>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*/
|
*/
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
androidLibraryVersion ="ba9a356aeed51ab59c1e950aedc6d0acf34f0fe5"
|
androidLibraryVersion = "cda1b08aa81b74201177f29c2326abee62f32c15"
|
||||||
androidPluginVersion = '8.4.0'
|
androidPluginVersion = '8.4.0'
|
||||||
androidxMediaVersion = '1.3.1'
|
androidxMediaVersion = '1.3.1'
|
||||||
androidxTestVersion = "1.5.0"
|
androidxTestVersion = "1.5.0"
|
||||||
|
|
|
@ -5909,14 +5909,17 @@
|
||||||
<sha256 value="66afb9f2eea39427f6f03c14c5b82ca240157e22b8b2a764f0a7c8ad87cb2d3e" origin="Generated by Gradle" reason="Artifact is not signed"/>
|
<sha256 value="66afb9f2eea39427f6f03c14c5b82ca240157e22b8b2a764f0a7c8ad87cb2d3e" origin="Generated by Gradle" reason="Artifact is not signed"/>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
||||||
<component group="com.github.nextcloud" name="android-library" version="e1b11466643421076117627aea57882225a43ba1">
|
<component group="com.github.nextcloud" name="android-library"
|
||||||
<artifact name="android-library-e1b11466643421076117627aea57882225a43ba1.aar">
|
version="cda1b08aa81b74201177f29c2326abee62f32c15">
|
||||||
<sha256 value="57ab4fd7c922875a7e0b5feac20aa27ab5df0fd3b4e042f92ed727c0b6316e81" origin="Generated by Gradle" reason="Artifact is not signed"/>
|
<artifact name="android-library-cda1b08aa81b74201177f29c2326abee62f32c15.aar">
|
||||||
</artifact>
|
<sha256 value="39c76af292201a94cf0753f296a18deb5512d88e97537f7c4e9a766ec50c1520"
|
||||||
<artifact name="android-library-e1b11466643421076117627aea57882225a43ba1.module">
|
origin="Generated by Gradle" reason="Artifact is not signed" />
|
||||||
<sha256 value="57a7a291090f95f50f5be4ac7ca60ed685b3407b1b86ce17618e73241fd06cee" origin="Generated by Gradle" reason="Artifact is not signed"/>
|
</artifact>
|
||||||
</artifact>
|
<artifact name="android-library-cda1b08aa81b74201177f29c2326abee62f32c15.module">
|
||||||
</component>
|
<sha256 value="c7686ef2125d141196bb3e1937a12f0647e5300accc132ddc11dfe37f9db66f2"
|
||||||
|
origin="Generated by Gradle" reason="Artifact is not signed" />
|
||||||
|
</artifact>
|
||||||
|
</component>
|
||||||
<component group="com.github.nextcloud" name="android-library" version="e7a13d03c1e7549a301edb8b4b58d1c5dda84123">
|
<component group="com.github.nextcloud" name="android-library" version="e7a13d03c1e7549a301edb8b4b58d1c5dda84123">
|
||||||
<artifact name="android-library-e7a13d03c1e7549a301edb8b4b58d1c5dda84123.aar">
|
<artifact name="android-library-e7a13d03c1e7549a301edb8b4b58d1c5dda84123.aar">
|
||||||
<sha256 value="57ab4fd7c922875a7e0b5feac20aa27ab5df0fd3b4e042f92ed727c0b6316e81" origin="Generated by Gradle" reason="Artifact is not signed"/>
|
<sha256 value="57ab4fd7c922875a7e0b5feac20aa27ab5df0fd3b4e042f92ed727c0b6316e81" origin="Generated by Gradle" reason="Artifact is not signed"/>
|
||||||
|
|
|
@ -4,12 +4,24 @@
|
||||||
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
|
# SPDX-FileCopyrightText: 2016 Tobias Kaminsky <tobias@kaminsky.me>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
# SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
|
||||||
|
|
||||||
snapshotCount=$(./gradlew dependencies | grep SNAPSHOT | grep -v "com.github.nextcloud:android-library" -c)
|
snapshotCount=$(./gradlew dependencies | grep SNAPSHOT -c)
|
||||||
betaCount=$(grep "<bool name=\"is_beta\">true</bool>" app/src/main/res/values/setup.xml -c)
|
betaCount=$(grep "<bool name=\"is_beta\">true</bool>" app/src/main/res/values/setup.xml -c)
|
||||||
|
libraryHash=$(grep androidLibraryVersion build.gradle | cut -f2 -d'"' | grep "^[0-9a-zA-Z]\{40\}$" -c)
|
||||||
|
|
||||||
if [[ $snapshotCount -eq 0 && $betaCount -eq 0 ]] ; then
|
|
||||||
exit 0
|
if [[ $snapshotCount -gt 0 ]] ; then
|
||||||
else
|
echo "Snapshot found in dependencies"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ $betaCount -gt 0 ]] ; then
|
||||||
|
echo "Beta is set in setup.xml"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $libraryHash -eq 0 ]] ; then
|
||||||
|
echo "Library hash is wrong!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue