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 Nov 21, 2023
2 parents 677c80e + dcdd79e commit c48baf7
Show file tree
Hide file tree
Showing 46 changed files with 785 additions and 642 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
swap-size-gb: 10
- name: Initialize CodeQL
uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
uses: github/codeql-action/init@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
with:
languages: ${{ matrix.language }}
- name: Set up JDK 17
Expand All @@ -46,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@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
uses: github/codeql-action/analyze@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
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@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
uses: github/codeql-action/upload-sarif@66b90a5db151a8042fa97405c6cf843bbe433f7b # v2.22.7
with:
sarif_file: results.sarif
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ android {

defaultConfig {
minSdkVersion 24
targetSdkVersion 33
compileSdk 33
targetSdkVersion 34
compileSdk 34

buildConfigField 'boolean', 'CI', ciBuild.toString()
buildConfigField 'boolean', 'RUNTIME_PERF_ANALYSIS', perfAnalysis.toString()
Expand Down Expand Up @@ -246,7 +246,7 @@ dependencies {
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.5' // remove after entire switch to lib v2
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.10.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation "androidx.appcompat:appcompat:$appCompatVersion"
implementation 'androidx.webkit:webkit:1.7.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class ActivitiesActivityIT : AbstractIT() {
sut.dismissSnackbar()
}

shortSleep()
longSleep()
waitForIdleSync()

screenshot(sut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
*/
package com.owncloud.android.ui.activity

import android.os.Bundle
import android.view.View

/**
* Activity providing information about ways to participate in the app's development.
*/
class HuaweiCommunityActivity : CommunityActivity() {
override fun setupContent() {
super.setupContent()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding.communityReleaseCandidatePlaystore.visibility = View.GONE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ abstract class NextcloudDatabase : RoomDatabase() {
INSTANCE = Room
.databaseBuilder(context, NextcloudDatabase::class.java, ProviderMeta.DB_NAME)
.allowMainThreadQueries()
.addLegacyMigrations(clock)
.addLegacyMigrations(clock, context)
.addMigrations(RoomMigration())
.addMigrations(Migration67to68())
.addMigrations(Migration70to71())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package com.nextcloud.client.database.migrations

import android.content.Context
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
Expand All @@ -36,12 +37,13 @@ private const val MIN_SUPPORTED_DB_VERSION = 24
class LegacyMigration(
private val from: Int,
private val to: Int,
private val clock: Clock
private val clock: Clock,
private val context: Context
) : Migration(from, to) {

override fun migrate(database: SupportSQLiteDatabase) {
LegacyMigrationHelper(clock)
.onUpgrade(database, from, to)
LegacyMigrationHelper(clock, context)
.tryUpgrade(database, from, to)
}
}

Expand All @@ -52,10 +54,11 @@ class LegacyMigration(
*/
@Suppress("ForEachOnRange")
fun RoomDatabase.Builder<NextcloudDatabase>.addLegacyMigrations(
clock: Clock
clock: Clock,
context: Context
): RoomDatabase.Builder<NextcloudDatabase> {
(MIN_SUPPORTED_DB_VERSION until NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1)
.map { from -> LegacyMigration(from, from + 1, clock) }
.map { from -> LegacyMigration(from, from + 1, clock, context) }
.forEach { migration -> this.addMigrations(migration) }
return this
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package com.nextcloud.client.database.migrations;

import android.app.ActivityManager;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
Expand All @@ -31,11 +32,11 @@
import com.owncloud.android.db.ProviderMeta;
import com.owncloud.android.files.services.NameCollisionPolicy;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.providers.FileContentProvider;

import java.util.Locale;

import androidx.sqlite.db.SupportSQLiteDatabase;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public class LegacyMigrationHelper {

Expand All @@ -52,12 +53,29 @@ public class LegacyMigrationHelper {
private static final String UPGRADE_VERSION_MSG = "OUT of the ADD in onUpgrade; oldVersion == %d, newVersion == %d";

private final Clock clock;
private final Context context;

public LegacyMigrationHelper(Clock clock) {
public LegacyMigrationHelper(Clock clock, Context context) {
this.clock = clock;
this.context = context;
}

public void onUpgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
public void tryUpgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
try {
upgrade(db, oldVersion, newVersion);
} catch (Throwable t) {
Log_OC.i(TAG, "Migration upgrade failed due to " + t);
clearStorage();
}
}

@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
private void clearStorage() {
context.getCacheDir().delete();
((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).clearApplicationUserData();
}

private void upgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
Log_OC.i(TAG, "Entering in onUpgrade");
boolean upgraded = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Nextcloud Android client application
*
* @author Alper Ozturk
* Copyright (C) 2023 Alper Ozturk
* Copyright (C) 2023 Nextcloud GmbH
*
* 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 <https://www.gnu.org/licenses/>.
*/

package com.nextcloud.utils.extensions

import android.text.method.LinkMovementMethod
import android.widget.TextView
import androidx.core.text.HtmlCompat

@Suppress("NewLineAtEndOfFile")
fun TextView.setHtmlContent(value: String) {
movementMethod = LinkMovementMethod.getInstance()
text = HtmlCompat.fromHtml(value, HtmlCompat.FROM_HTML_MODE_LEGACY)
}

This file was deleted.

Loading

0 comments on commit c48baf7

Please sign in to comment.