Skip to content

Commit 849c77a

Browse files
committed
- added support for JAVA_VERSION 11
- upgraded AGP (android gradle plugin) - updated all test dependencies, mockito, androidx.test - updated a test using an old syntax that would make the build fail - bumped compileSdk to 36 - handling onBackPressed overrides calling superclass in NoteEditorActivity and NewCredentialsActivity
1 parent 891f3db commit 849c77a

File tree

9 files changed

+43
-41
lines changed

9 files changed

+43
-41
lines changed

PasscodeLock/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ android {
2828
}
2929
}
3030
compileOptions {
31-
sourceCompatibility JavaVersion.VERSION_1_8
32-
targetCompatibility JavaVersion.VERSION_1_8
31+
sourceCompatibility JavaVersion.VERSION_11
32+
targetCompatibility JavaVersion.VERSION_11
3333
}
3434
}
3535

PasscodeLock/src/main/java/org/wordpress/passcodelock/AbstractPasscodeKeyboardActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public abstract class AbstractPasscodeKeyboardActivity extends Activity {
2525
protected InputFilter[] filters = null;
2626
protected TextView topMessage = null;
2727

28+
@SuppressLint("RestrictedApi")
2829
protected FingerprintManagerCompat mFingerprintManager;
2930
protected CancellationSignal mCancel;
3031

@@ -162,6 +163,7 @@ protected void showPasswordError(){
162163
}
163164

164165
protected abstract void onPinLockInserted();
166+
@SuppressLint("RestrictedApi")
165167
protected abstract FingerprintManagerCompat.AuthenticationCallback getFingerprintCallback();
166168

167169
private InputFilter onlyNumber = new InputFilter() {

Simplenote/build.gradle

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ android {
4646
testInstrumentationRunner 'com.automattic.simplenote.SimplenoteAppRunner'
4747
}
4848

49-
lintOptions {
50-
checkReleaseBuilds false
51-
}
5249

5350
testOptions {
5451
unitTests.returnDefaultValues = true
@@ -59,16 +56,19 @@ android {
5956

6057
// Target Java8 to avoid use certain Kotlin's features
6158
compileOptions {
62-
sourceCompatibility JavaVersion.VERSION_1_8
63-
targetCompatibility JavaVersion.VERSION_1_8
59+
sourceCompatibility JavaVersion.VERSION_11
60+
targetCompatibility JavaVersion.VERSION_11
6461
}
6562
kotlinOptions {
66-
jvmTarget = JavaVersion.VERSION_1_8.toString()
63+
jvmTarget = JavaVersion.VERSION_11.toString()
6764
}
6865

6966
viewBinding {
7067
enabled = true
7168
}
69+
lint {
70+
checkReleaseBuilds false
71+
}
7272
}
7373

7474
buildscript {
@@ -83,26 +83,26 @@ buildscript {
8383
}
8484

8585
dependencies {
86-
testImplementation 'junit:junit:4.12'
87-
testImplementation 'org.mockito:mockito-core:4.0.0'
88-
testImplementation 'org.mockito:mockito-inline:4.0.0'
89-
androidTestImplementation 'androidx.test:core:1.3.0'
90-
androidTestImplementation 'androidx.annotation:annotation:1.0.0'
91-
androidTestImplementation 'androidx.test:runner:1.3.0'
92-
androidTestImplementation 'androidx.test:rules:1.3.0'
93-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
94-
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'
95-
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.1.0') {
86+
testImplementation 'junit:junit:4.13.2'
87+
testImplementation 'org.mockito:mockito-core:5.18.0'
88+
testImplementation 'org.mockito:mockito-inline:5.2.0'
89+
androidTestImplementation 'androidx.test:core:1.7.0'
90+
androidTestImplementation 'androidx.annotation:annotation:1.9.1'
91+
androidTestImplementation 'androidx.test:runner:1.7.0'
92+
androidTestImplementation 'androidx.test:rules:1.7.0'
93+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
94+
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.7.0'
95+
androidTestImplementation('androidx.test.espresso:espresso-contrib:3.7.0') {
9696
// Necessary to avoid version conflicts
9797
exclude group: 'androidx', module: 'appcompat'
9898
exclude group: 'androidx', module: 'support-v4'
9999
exclude group: 'androidx', module: 'support-annotations'
100100
exclude module: 'recyclerview-v7'
101101
}
102102
// Infrastructure to test fragments
103-
testImplementation "androidx.arch.core:core-testing:2.1.0"
104-
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.4.3"
105-
testImplementation "org.mockito.kotlin:mockito-kotlin:3.2.0"
103+
testImplementation "androidx.arch.core:core-testing:2.2.0"
104+
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2"
105+
testImplementation "org.mockito.kotlin:mockito-kotlin:6.0.0"
106106

107107

108108
// Support for JsonObjects in unit tests since they are used by BucketObjects
@@ -124,7 +124,7 @@ dependencies {
124124
implementation 'androidx.vectordrawable:vectordrawable:1.2.0'
125125
implementation 'androidx.preference:preference:1.2.1'
126126
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
127-
implementation 'androidx.work:work-runtime:2.10.2'
127+
implementation 'androidx.work:work-runtime:2.10.3'
128128
implementation 'androidx.concurrent:concurrent-futures:1.3.0'
129129
implementation "androidx.constraintlayout:constraintlayout:2.2.1"
130130
implementation "androidx.multidex:multidex:2.0.1"

Simplenote/src/main/java/com/automattic/simplenote/NoteEditorActivity.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ public void onPageScrollStateChanged(int state) {
234234

235235
@Override
236236
public void onBackPressed() {
237-
handleBackPressed();
237+
super.onBackPressed();
238+
handleBackPressed();
238239
}
239240

240241
private void handleBackPressed() {
@@ -248,8 +249,6 @@ private void handleBackPressed() {
248249
startActivity(intent);
249250

250251
finish();
251-
} else {
252-
super.onBackPressed();
253252
}
254253
}
255254

Simplenote/src/main/java/com/automattic/simplenote/authentication/NewCredentialsActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ open class NewCredentialsActivity : AppCompatActivity() {
9090
}
9191

9292
override fun onBackPressed() {
93+
super.onBackPressed()
9394
this.startActivity(Intent(this, SimplenoteAuthenticationActivity::class.java))
9495
finish()
9596
}

Simplenote/src/test/java/com/automattic/simplenote/viewmodels/TagDialogViewModelTest.kt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import org.junit.Assert.*
1616
import org.junit.Before
1717
import org.junit.Rule
1818
import org.junit.Test
19-
import org.mockito.Mockito.`when`
2019
import org.mockito.Mockito.mock
20+
import org.mockito.kotlin.whenever
2121

2222
@ExperimentalCoroutinesApi
2323
class TagDialogViewModelTest {
@@ -85,8 +85,8 @@ class TagDialogViewModelTest {
8585
@Test
8686
fun validateTagIsCollaborator() {
8787
val tagName = "[email protected]"
88-
`when`(fakeTagsRepository.isTagValid(tagName)).thenReturn(true)
89-
`when`(fakeTagsRepository.isTagMissing(tagName)).thenReturn(true)
88+
whenever(fakeTagsRepository.isTagValid(tagName)).thenReturn(true)
89+
whenever(fakeTagsRepository.isTagMissing(tagName)).thenReturn(true)
9090

9191
viewModel.updateUiState(tagName)
9292

@@ -96,8 +96,8 @@ class TagDialogViewModelTest {
9696
@Test
9797
fun validateValidTag() {
9898
val hewTagName = "tag2"
99-
`when`(fakeTagsRepository.isTagValid(hewTagName)).thenReturn(true)
100-
`when`(fakeTagsRepository.isTagConflict(hewTagName, tagName)).thenReturn(false)
99+
whenever(fakeTagsRepository.isTagValid(hewTagName)).thenReturn(true)
100+
whenever(fakeTagsRepository.isTagConflict(hewTagName, tagName)).thenReturn(false)
101101

102102
viewModel.updateUiState(hewTagName)
103103

@@ -117,8 +117,8 @@ class TagDialogViewModelTest {
117117
fun editTagWithNewName() {
118118
val newTagName = "tag2"
119119
viewModel.updateUiState(newTagName)
120-
`when`(fakeTagsRepository.isTagConflict(newTagName, tagName)).thenReturn(false)
121-
`when`(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(true)
120+
whenever(fakeTagsRepository.isTagConflict(newTagName, tagName)).thenReturn(false)
121+
whenever(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(true)
122122

123123
viewModel.renameTagIfValid()
124124

@@ -130,8 +130,8 @@ class TagDialogViewModelTest {
130130
fun editTagWithConflict() {
131131
val newTagName = "tag2"
132132
viewModel.updateUiState(newTagName)
133-
`when`(fakeTagsRepository.isTagConflict(newTagName, tagName)).thenReturn(true)
134-
`when`(fakeTagsRepository.getCanonicalTagName(newTagName)).thenReturn(newTagName)
133+
whenever(fakeTagsRepository.isTagConflict(newTagName, tagName)).thenReturn(true)
134+
whenever(fakeTagsRepository.getCanonicalTagName(newTagName)).thenReturn(newTagName)
135135

136136
viewModel.renameTagIfValid()
137137

@@ -145,8 +145,8 @@ class TagDialogViewModelTest {
145145
fun editTagWithError() {
146146
val newTagName = "tag2"
147147
viewModel.updateUiState(newTagName)
148-
`when`(fakeTagsRepository.isTagConflict(newTagName, tagName)).thenReturn(false)
149-
`when`(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(false)
148+
whenever(fakeTagsRepository.isTagConflict(newTagName, tagName)).thenReturn(false)
149+
whenever(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(false)
150150

151151
viewModel.renameTagIfValid()
152152

@@ -158,7 +158,7 @@ class TagDialogViewModelTest {
158158
fun renameTagValid() {
159159
val newTagName = "tag2"
160160
viewModel.updateUiState(newTagName)
161-
`when`(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(true)
161+
whenever(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(true)
162162

163163
viewModel.renameTag()
164164

@@ -170,7 +170,7 @@ class TagDialogViewModelTest {
170170
fun renameTagError() {
171171
val newTagName = "tag2"
172172
viewModel.updateUiState(newTagName)
173-
`when`(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(false)
173+
whenever(fakeTagsRepository.renameTag(newTagName, tag)).thenReturn(false)
174174

175175
viewModel.renameTag()
176176

Wear/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ apply plugin: 'com.android.application'
88

99
android {
1010
namespace 'com.automattic.simplenote'
11-
compileSdk 34
11+
compileSdk 36
1212

1313
buildTypes {
1414
release {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ buildscript {
1616
maven { url 'https://maven.google.com' }
1717
}
1818
dependencies {
19-
classpath 'com.android.tools.build:gradle:8.2.2'
19+
classpath 'com.android.tools.build:gradle:8.11.1'
2020
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
2121
classpath "com.google.dagger:hilt-android-gradle-plugin:$google_dagger"
2222
classpath 'com.automattic.android:configure:0.6.5'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)