Skip to content

Commit

Permalink
Merge pull request #14523 from nextcloud/backport/14475/stable-3.31
Browse files Browse the repository at this point in the history
[stable-3.31] Use localized log message
  • Loading branch information
tobiasKaminsky authored Feb 11, 2025
2 parents 89cfb2c + 21a13ec commit 50a002d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2023-2024 TSI-mc <[email protected]>
* SPDX-FileCopyrightText: 2023-2025 TSI-mc <[email protected]>
* SPDX-FileCopyrightText: 2019-2021 Tobias Kaminsky <[email protected]>
* SPDX-FileCopyrightText: 2018 Andy Scherzinger <info@andy-scherzinger>
* SPDX-FileCopyrightText: 2017 Mario Danic <[email protected]>
Expand Down Expand Up @@ -1171,7 +1171,7 @@ public void onAuthenticatorTaskCallback(RemoteOperationResult<UserInfo> result)
if (accountSetupWebviewBinding != null) {
anonymouslyPostLoginRequest(mServerInfo.mBaseUrl + WEB_LOGIN);
} else {
DisplayUtils.showSnackMessage(this, R.string.auth_access_failed, result.getLogMessage());
DisplayUtils.showSnackMessage(this, R.string.auth_access_failed, result.getLogMessage(this));

// init webView again
updateAuthStatusIconAndText(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Nextcloud - Android Client
*
* SPDX-FileCopyrightText: 2023 Alper Ozturk <[email protected]>
* SPDX-FileCopyrightText: 2022 TSI-mc
* SPDX-FileCopyrightText: 2022-2025 TSI-mc <[email protected]>
* SPDX-FileCopyrightText: 2021 Chris Narkiewicz <[email protected]>
* SPDX-FileCopyrightText: 2018-2020 Tobias Kaminsky <[email protected]>
* SPDX-FileCopyrightText: 2018 Andy Scherzinger <[email protected]>
Expand Down Expand Up @@ -567,7 +567,7 @@ public OCFile saveFileWithParent(OCFile ocFile, Context context) {
} else {
Exception exception = result.getException();
String message = "Error during saving file with parents: " + ocFile.getRemotePath() + " / "
+ result.getLogMessage();
+ result.getLogMessage(context);

if (exception != null) {
throw new RemoteOperationFailedException(message, exception);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* SPDX-FileCopyrightText: 2019 Chris Narkiewicz <[email protected]>
* SPDX-FileCopyrightText: 2018 Edvard Holst <[email protected]>
* SPDX-FileCopyrightText: 2025 TSI-mc <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.owncloud.android.ui.activities.data.activities;
Expand Down Expand Up @@ -94,7 +95,7 @@ protected Boolean doInBackground(Void... voids) {
} else {
Log_OC.d(TAG, result.getLogMessage());
// show error
errorMessage = result.getLogMessage();
errorMessage = result.getLogMessage(MainApp.getAppContext());
if (result.getHttpCode() == HttpStatus.SC_NOT_MODIFIED) {
errorMessage = context.getString(R.string.file_list_empty_headline_server_search);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* SPDX-FileCopyrightText: 2020 Chris Narkiewicz <[email protected]>
* SPDX-FileCopyrightText: 2017 Mario Danic <[email protected]>
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH
* SPDX-FileCopyrightText: 2025 TSI-mc <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.owncloud.android.ui.activity
Expand Down Expand Up @@ -259,7 +260,7 @@ class NotificationsActivity : AppCompatActivity(), NotificationsContract.View, I
runOnUiThread {
setEmptyContent(
getString(R.string.notifications_no_results_headline),
result?.logMessage
result?.getLogMessage(this)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* SPDX-FileCopyrightText: 2018 Tobias Kaminsky <[email protected]>
* SPDX-FileCopyrightText: 2017 Mario Danic <[email protected]>
* SPDX-FileCopyrightText: 2017 Nextcloud GmbH
* SPDX-FileCopyrightText: 2025 TSI-mc <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.owncloud.android.ui.activity;
Expand Down Expand Up @@ -317,7 +318,7 @@ private void fetchAndSetData() {
// show error
runOnUiThread(() -> setErrorMessageForMultiList(
getString(R.string.user_information_retrieval_error),
result.getLogMessage(),
result.getLogMessage(this),
R.drawable.ic_list_empty_error)
);
Log_OC.d(TAG, result.getLogMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
*
* SPDX-FileCopyrightText: 2019 Tobias Kaminsky <[email protected]>
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH
* SPDX-FileCopyrightText: 2025 TSI-mc <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.owncloud.android.ui.asynctasks;

import android.os.AsyncTask;

import com.nextcloud.client.account.User;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
Expand Down Expand Up @@ -60,7 +62,7 @@ protected String doInBackground(Void... voids) {

if (!result.isSuccess()) {
Exception exception = result.getException();
String message = "Fetching file " + remotePath + " fails with: " + result.getLogMessage();
String message = "Fetching file " + remotePath + " fails with: " + result.getLogMessage(MainApp.getAppContext());

if (exception != null) {
return exception.getMessage();
Expand Down Expand Up @@ -95,7 +97,7 @@ protected String doInBackground(Void... voids) {

fileDisplayActivity.setFile(ocFile);
} else {
return remoteOperationResult.getLogMessage();
return remoteOperationResult.getLogMessage(MainApp.getAppContext());
}

return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* SPDX-FileCopyrightText: 2019 Chris Narkiewicz <[email protected]>
* SPDX-FileCopyrightText: 2018 Andy Scherzinger <[email protected]>
* SPDX-FileCopyrightText: 2025 TSI-mc <[email protected]>
* SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
*/
package com.owncloud.android.ui.fragment;
Expand Down Expand Up @@ -331,7 +332,7 @@ private void fetchAndSetData(int lastGiven) {
} else {
Log_OC.d(TAG, result.getLogMessage());
// show error
String logMessage = result.getLogMessage();
String logMessage = result.getLogMessage(requireContext());
if (result.getHttpCode() == HttpStatus.SC_NOT_MODIFIED) {
logMessage = getString(R.string.activities_no_results_message);
}
Expand Down

0 comments on commit 50a002d

Please sign in to comment.