Skip to content

Commit cc9cf06

Browse files
committed
Merge branch 'trunk' into andy/fluxc-issue-3024-test
2 parents b0284a0 + fe8a023 commit cc9cf06

33 files changed

+346
-162
lines changed

.buildkite/beta-builds.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
common_params:
66
# Common plugin settings to use with the `plugins` key.
77
- &common_plugins
8-
- automattic/a8c-ci-toolkit#2.17.0
8+
- automattic/a8c-ci-toolkit#3.4.2
99

1010
steps:
1111
#################

.buildkite/code-freeze.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common_params:
33
# Common plugin settings to use with the `plugins` key.
44
- &common_plugins
5-
- automattic/a8c-ci-toolkit#2.17.0
5+
- automattic/a8c-ci-toolkit#3.4.2
66

77
steps:
88
- label: "Code Freeze"

.buildkite/complete-code-freeze.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common_params:
33
# Common plugin settings to use with the `plugins` key.
44
- &common_plugins
5-
- automattic/a8c-ci-toolkit#2.17.0
5+
- automattic/a8c-ci-toolkit#3.4.2
66

77
steps:
88
- label: "Complete Code Freeze"

.buildkite/finalize-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common_params:
33
# Common plugin settings to use with the `plugins` key.
44
- &common_plugins
5-
- automattic/a8c-ci-toolkit#2.17.0
5+
- automattic/a8c-ci-toolkit#3.4.2
66

77
steps:
88
- label: "Finalize release"

.buildkite/new-beta-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common_params:
33
# Common plugin settings to use with the `plugins` key.
44
- &common_plugins
5-
- automattic/a8c-ci-toolkit#2.17.0
5+
- automattic/a8c-ci-toolkit#3.4.2
66

77
steps:
88
- label: "New Beta Release"

.buildkite/pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common_params:
33
# Common plugin settings to use with the `plugins` key.
44
- &ci_toolkit
5-
automattic/a8c-ci-toolkit#2.18.2
5+
automattic/a8c-ci-toolkit#3.4.2
66
- &test_collector
77
test-collector#v1.8.0
88
- &test_collector_common_params

.buildkite/release-builds.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
common_params:
66
# Common plugin settings to use with the `plugins` key.
77
- &common_plugins
8-
- automattic/a8c-ci-toolkit#2.17.0
8+
- automattic/a8c-ci-toolkit#3.4.2
99

1010
steps:
1111
#################

.buildkite/update-release-notes.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common_params:
33
# Common plugin settings to use with the `plugins` key.
44
- &common_plugins
5-
- automattic/a8c-ci-toolkit#2.17.0
5+
- automattic/a8c-ci-toolkit#3.4.2
66

77
steps:
88
- label: "Update release notes"

.github/workflows/run-danger.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
dangermattic:
99
if: ${{ (github.event.pull_request.draft == false) }}
10-
uses: Automattic/dangermattic/.github/workflows/[email protected].0
10+
uses: Automattic/dangermattic/.github/workflows/[email protected].2
1111
with:
1212
org-slug: "automattic"
1313
pipeline-slug: "wordpress-android"

.github/workflows/validate-issues.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
check-labels-on-issues:
9-
uses: Automattic/dangermattic/.github/workflows/reusable-check-labels-on-issues.yml@v1.0.0
9+
uses: Automattic/dangermattic/.github/workflows/reusable-check-labels-on-issues.yml@v1.1.2
1010
with:
1111
label-format-list: '[
1212
"^\[.+\]",

Gemfile.lock

+11-9
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ GEM
6969
no_proxy_fix
7070
octokit (>= 4.0)
7171
terminal-table (>= 1, < 4)
72-
danger-dangermattic (1.0.2)
72+
danger-dangermattic (1.1.1)
7373
danger (~> 9.4)
7474
danger-plugin-api (~> 1.0)
75-
danger-rubocop (~> 0.12)
76-
rubocop (~> 1.61)
75+
danger-rubocop (~> 0.13)
76+
rubocop (~> 1.63)
7777
danger-plugin-api (1.0.0)
7878
danger (> 2.0)
79-
danger-rubocop (0.12.0)
79+
danger-rubocop (0.13.0)
8080
danger
8181
rubocop (~> 1.0)
8282
declarative (0.0.20)
@@ -259,30 +259,31 @@ GEM
259259
optparse (0.4.0)
260260
os (1.1.4)
261261
parallel (1.24.0)
262-
parser (3.3.1.0)
262+
parser (3.3.2.0)
263263
ast (~> 2.4.1)
264264
racc
265265
plist (3.7.1)
266266
progress_bar (1.3.3)
267267
highline (>= 1.6, < 3)
268268
options (~> 2.3.0)
269269
public_suffix (5.0.5)
270-
racc (1.7.3)
270+
racc (1.8.0)
271271
rainbow (3.1.1)
272272
rake (13.2.1)
273273
rake-compiler (1.2.7)
274274
rake
275275
rchardet (1.8.0)
276-
regexp_parser (2.9.1)
276+
regexp_parser (2.9.2)
277277
representable (3.2.0)
278278
declarative (< 0.1.0)
279279
trailblazer-option (>= 0.1.1, < 0.2.0)
280280
uber (< 0.2.0)
281281
retriable (3.1.2)
282-
rexml (3.2.6)
282+
rexml (3.2.8)
283+
strscan (>= 3.0.9)
283284
rmagick (4.3.0)
284285
rouge (2.0.7)
285-
rubocop (1.63.5)
286+
rubocop (1.64.1)
286287
json (~> 2.3)
287288
language_server-protocol (>= 3.17.0)
288289
parallel (~> 1.10)
@@ -310,6 +311,7 @@ GEM
310311
simctl (1.6.10)
311312
CFPropertyList
312313
naturally
314+
strscan (3.1.0)
313315
terminal-notifier (2.0.0)
314316
terminal-table (3.0.2)
315317
unicode-display_width (>= 1.1.1, < 3)

README.md

+7-33
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,8 @@ If you're a developer wanting to contribute, read on.
1616

1717
Notes:
1818

19-
* To use WordPress.com features (login to WordPress.com, access Reader and Stats, etc) you need a WordPress.com OAuth2 ID and secret. Please read the [OAuth2 Authentication](#oauth2-authentication) section.
2019
* While loading/building the app in Android Studio ignore the prompt to update the gradle plugin version as that will probably introduce build errors. On the other hand, feel free to update if you are planning to work on ensuring the compatibility of the newer version.
2120

22-
23-
## OAuth2 Authentication ##
24-
25-
In order to use WordPress.com functions you will need a client ID and
26-
a client secret key. These details will be used to authenticate your
27-
application and verify that the API calls being made are valid. You can
28-
create an application or view details for your existing applications with
29-
our [WordPress.com applications manager][5].
30-
31-
When creating your application, you should select "Native client" for the application type.
32-
The "**Website URL**", "**Redirect URLs**", and "**Javascript Origins**" fields are required but not used for
33-
the mobile apps. Just use "**[https://localhost](https://localhost)**".
34-
35-
Once you've created your application in the [applications manager][5], you'll
36-
need to edit the `./gradle.properties` file and change the
37-
`wp.oauth.app_id` and `wp.oauth.app_secret` fields. Then you can compile and
38-
run the app on a device or an emulator and try to login with a WordPress.com
39-
account. Note that authenticating to WordPress.com via Google is not supported
40-
in development builds of the app, only in the official release.
41-
42-
Note that credentials created with our [WordPress.com applications manager][5]
43-
allow login only and not signup. New accounts must be created using the [official app][1]
44-
or [on the web](https://wordpress.com/start). Login is restricted to the WordPress.com
45-
account with which the credentials were created. In other words, if the credentials
46-
were created with [email protected], you will only be able to login with [email protected].
47-
Using another account like [email protected] will cause the `Client cannot use "password" grant_type` error.
48-
49-
For security reasons, some account-related actions aren't supported for development
50-
builds when using a WordPress.com account with 2-factor authentication enabled.
51-
52-
Read more about [OAuth2][6] and the [WordPress.com REST endpoint][7].
53-
5421
## Build and Test ##
5522

5623
To build, install, and test the project from the command line:
@@ -61,6 +28,13 @@ To build, install, and test the project from the command line:
6128
$ ./gradlew :WordPress:testWordPressVanillaDebugUnitTest # assemble, install and run unit tests
6229
$ ./gradlew :WordPress:connectedWordPressVanillaDebugAndroidTest # assemble, install and run Android tests
6330

31+
## Running the app ##
32+
33+
You can use your own WordPress site for developing and testing the app. If you don't have one, you can create a temporary test site for free at https://jurassic.ninja/.
34+
On the app start up screen, choose "Enter your existing site address" and enter the URL of your site and your credentials.
35+
36+
Note: Access to WordPress.com features is temporarily disabled in the development environment.
37+
6438
## Directory structure ##
6539
.
6640
├── libs # dependencies used to build debug variants

RELEASE-NOTES.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
25.1
44
-----
5-
5+
* [*] [internal] Block editor: Add onContentUpdate bridge functionality [https://github.com/wordpress-mobile/gutenberg-mobile/pull/20852]
66

77
25.0
88
-----

WordPress/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,15 @@ dependencies {
364364
implementation (project(path:':libs:editor')) {
365365
exclude group: 'org.wordpress', module: 'utils'
366366
}
367-
implementation("$gradle.ext.fluxCBinaryPath") {
367+
implementation("$gradle.ext.fluxCBinaryPath:$wordPressFluxCVersion") {
368368
version {
369369
strictly wordPressFluxCVersion
370370
}
371371
exclude group: "com.android.volley"
372372
exclude group: 'org.wordpress', module: 'utils'
373373
exclude group: 'com.android.support', module: 'support-annotations'
374374
}
375-
implementation ("$gradle.ext.wputilsBinaryPath") {
375+
implementation ("$gradle.ext.wputilsBinaryPath:$wordPressUtilsVersion") {
376376
version {
377377
strictly wordPressUtilsVersion
378378
}
@@ -383,7 +383,7 @@ dependencies {
383383
}
384384
implementation "$gradle.ext.aboutAutomatticBinaryPath:$automatticAboutVersion"
385385

386-
implementation("$gradle.ext.tracksBinaryPath") {
386+
implementation("$gradle.ext.tracksBinaryPath:$automatticTracksVersion") {
387387
version {
388388
strictly automatticTracksVersion
389389
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package org.wordpress.android.datasets
2+
3+
import kotlinx.coroutines.CoroutineScope
4+
import kotlinx.coroutines.Dispatchers
5+
import kotlinx.coroutines.launch
6+
import kotlinx.coroutines.withContext
7+
8+
/**
9+
* Helper class to handle async tasks by using coroutines
10+
* @see <a href="https://github.com/wordpress-mobile/WordPress-Android/pull/20937">Introduction</a>
11+
*/
12+
object AsyncTaskHandler {
13+
/**
14+
* Load data in the background and handle the result on the main thread
15+
*/
16+
@JvmStatic
17+
fun <T> load(backgroundTask: () -> T, callback: AsyncTaskCallback<T>) {
18+
CoroutineScope(Dispatchers.IO).launch {
19+
// handle the background task
20+
val result = backgroundTask()
21+
22+
withContext(Dispatchers.Main) {
23+
// handle the result on the main thread
24+
callback.onTaskFinished(result)
25+
}
26+
}
27+
}
28+
29+
interface AsyncTaskCallback<T> {
30+
fun onTaskFinished(result: T)
31+
}
32+
}
33+

WordPress/src/main/java/org/wordpress/android/modules/ApplicationModule.java

+15-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
import org.wordpress.android.util.BuildConfigWrapper;
3131
import org.wordpress.android.util.audio.AudioRecorder;
3232
import org.wordpress.android.util.audio.IAudioRecorder;
33+
import org.wordpress.android.util.audio.RecordingStrategy;
34+
import org.wordpress.android.util.audio.RecordingStrategy.VoiceToContentRecordingStrategy;
35+
import org.wordpress.android.util.audio.VoiceToContentStrategy;
3336
import org.wordpress.android.util.config.InAppUpdatesFeatureConfig;
3437
import org.wordpress.android.util.config.RemoteConfigWrapper;
3538
import org.wordpress.android.util.wizard.WizardManager;
@@ -124,8 +127,18 @@ public static SensorManager provideSensorManager(@ApplicationContext Context con
124127
return (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
125128
}
126129

130+
@VoiceToContentStrategy
127131
@Provides
128-
public static IAudioRecorder provideAudioRecorder(@ApplicationContext Context context) {
129-
return new AudioRecorder(context);
132+
public static IAudioRecorder provideAudioRecorder(
133+
@ApplicationContext Context context,
134+
@VoiceToContentStrategy RecordingStrategy recordingStrategy
135+
) {
136+
return new AudioRecorder(context, recordingStrategy);
137+
}
138+
139+
@VoiceToContentStrategy
140+
@Provides
141+
public static RecordingStrategy provideVoiceToContentRecordingStrategy() {
142+
return new VoiceToContentRecordingStrategy();
130143
}
131144
}

WordPress/src/main/java/org/wordpress/android/ui/main/ChooseSiteViewHolder.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ class ChooseSiteViewHolder(private val binding: ItemChooseSiteBinding) : Recycle
8888
}
8989

9090
private fun handleAvatar(site: SiteRecord) {
91-
imageManager.loadImageWithCorners(
92-
binding.avatar, site.blavatarType, site.blavatarUrl,
93-
itemView.context.resources.getDimensionPixelSize(R.dimen.blavatar_sz) / 2
94-
)
91+
imageManager.load(binding.avatar, site.blavatarType, site.blavatarUrl)
9592
val isDarkTheme = itemView.resources.configuration.isDarkTheme()
9693
val borderColor = ContextCompat.getColor(
9794
itemView.context,

0 commit comments

Comments
 (0)