Skip to content

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Oct 31, 2023
2 parents 98892bd + 1868d03 commit 3b9d8b6
Show file tree
Hide file tree
Showing 117 changed files with 3,179 additions and 3,385 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ on:
permissions:
contents: read

concurrency:
group: code-ql-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
Expand All @@ -36,7 +32,7 @@ jobs:
with:
swap-size-gb: 10
- name: Initialize CodeQL
uses: github/codeql-action/init@49abf0ba24d0b7953cb586944e918a0b92074c80 # v2.22.4
uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
with:
languages: ${{ matrix.language }}
- name: Set up JDK 17
Expand All @@ -50,4 +46,4 @@ jobs:
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
./gradlew assembleDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@49abf0ba24d0b7953cb586944e918a0b92074c80 # v2.22.4
uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@49abf0ba24d0b7953cb586944e918a0b92074c80 # v2.22.4
uses: github/codeql-action/upload-sarif@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
with:
sarif_file: results.sarif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions app/src/androidTest/java/com/owncloud/android/AbstractIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
Expand Down Expand Up @@ -58,6 +60,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Locale;
import java.util.Objects;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -403,6 +406,21 @@ public boolean isPowerSavingExclusionAvailable() {
assertTrue(result.getLogMessage(), result.isSuccess());
}

protected void enableRTL() {
Locale locale = new Locale("ar");
Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
Configuration config = resources.getConfiguration();
config.setLocale(locale);
resources.updateConfiguration(config, null);
}

protected void resetLocale() {
Resources resources = InstrumentationRegistry.getInstrumentation().getTargetContext().getResources();
Configuration defaultConfig = resources.getConfiguration();
defaultConfig.setLocale(Locale.getDefault());
resources.updateConfiguration(defaultConfig, null);
}

protected void screenshot(View view) {
screenshot(view, "");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void open() {
sut.setFile(origin);

sut.runOnUiThread(() -> {
sut.findViewById(R.id.folder_picker_btn_choose).requestFocus();
sut.findViewById(R.id.folder_picker_btn_copy).requestFocus();
});
waitForIdleSync();
screenshot(sut);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.rule.GrantPermissionRule;
import kotlin.Unit;

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
Expand All @@ -108,6 +109,9 @@ private FileDisplayActivity getFileDisplayActivity() {
return activityRule.launchActivity(intent);
}

@Rule
public GrantPermissionRule permissionRule = GrantPermissionRule.grant(
android.Manifest.permission.POST_NOTIFICATIONS);

@After
public void quitLooperIfNeeded() {
Expand All @@ -134,6 +138,38 @@ public void testLoadingDialog() {
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithOneAction() {
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, -1, -1);
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithTwoAction() {
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, -1);
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithThreeAction() {
ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[]{}, R.string.filedetails_sync_file, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
showDialog(dialog);
}

@Test
@ScreenshotTest
public void testConfirmationDialogWithThreeActionRTL() {
enableRTL();

ConfirmationDialogFragment dialog = ConfirmationDialogFragment.newInstance(R.string.upload_list_empty_text_auto_upload, new String[] { }, -1, R.string.common_ok, R.string.common_cancel, R.string.common_confirm);
showDialog(dialog);

resetLocale();
}

@Test
@ScreenshotTest
public void testRemoveFileDialog() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public void showNotEnoughSpaceDialogForFolder() {
FileDisplayActivity test = activityRule.launchActivity(null);
OCFile ocFile = new OCFile("/Document/");
ocFile.setFileLength(5000000);
ocFile.setFolder();

SyncFileNotEnoughSpaceDialogFragment dialog = SyncFileNotEnoughSpaceDialogFragment.newInstance(ocFile, 1000);
dialog.show(test.getListOfFilesFragment().getFragmentManager(), "1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,26 @@
* 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.nextcloud.client.di

package com.nextcloud.client.di;
import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import dagger.android.support.AndroidSupportInjection

import android.content.Context;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import dagger.android.support.AndroidSupportInjection;

class FragmentInjector extends FragmentManager.FragmentLifecycleCallbacks {
@Override
public void onFragmentPreAttached(
@NonNull FragmentManager fragmentManager,
@NonNull Fragment fragment,
@NonNull Context context
internal class FragmentInjector : FragmentManager.FragmentLifecycleCallbacks() {
override fun onFragmentPreAttached(
fragmentManager: FragmentManager,
fragment: Fragment,
context: Context
) {
super.onFragmentPreAttached(fragmentManager, fragment, context);
if (fragment instanceof Injectable) {
super.onFragmentPreAttached(fragmentManager, fragment, context)
if (fragment is Injectable) {
try {
AndroidSupportInjection.inject(fragment);
} catch (IllegalArgumentException directCause) {
AndroidSupportInjection.inject(fragment)
} catch (directCause: IllegalArgumentException) {
// this provides a cause description that is a bit more friendly for developers
throw new InjectorNotFoundException(fragment, directCause);
throw InjectorNotFoundException(fragment, directCause)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,29 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.integrations.deck

package com.nextcloud.client.integrations.deck;

import android.app.PendingIntent;

import com.nextcloud.client.account.User;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.lib.resources.notifications.models.Notification;

import androidx.annotation.NonNull;
import android.app.PendingIntent
import com.nextcloud.client.account.User
import com.nextcloud.java.util.Optional
import com.owncloud.android.lib.resources.notifications.models.Notification

/**
* This API is for an integration with the <a href="https://github.com/stefan-niedermann/nextcloud-deck">Nextcloud
* Deck</a> app for android.
* This API is for an integration with the [Nextcloud
* Deck](https://github.com/stefan-niedermann/nextcloud-deck) app for android.
*/
public interface DeckApi {

interface DeckApi {
/**
* Creates a PendingIntent that can be used in a NotificationBuilder to open the notification link in Deck app
*
* @param notification Notification Notification that could be forwarded to Deck
* @param user The user that is affected by the notification
* @return If notification can be consumed by Deck, a PendingIntent opening notification link in Deck app; empty
* value otherwise
* @see <a href="https://apps.nextcloud.com/apps/deck">Deck Server App</a>
* @see [Deck Server App](https://apps.nextcloud.com/apps/deck)
*/
@NonNull
Optional<PendingIntent> createForwardToDeckActionIntent(@NonNull final Notification notification,
@NonNull final User user);
fun createForwardToDeckActionIntent(
notification: Notification,
user: User
): Optional<PendingIntent?>
}

This file was deleted.

Loading

0 comments on commit 3b9d8b6

Please sign in to comment.