Skip to content

Commit 5e6fb9e

Browse files
committed
Merge branch 'trunk' into task/os-version-rules
# Conflicts: # build.gradle
2 parents f7f572b + a0b6ece commit 5e6fb9e

157 files changed

Lines changed: 3083 additions & 1535 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

RELEASE-NOTES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]
22

3+
25.2
4+
-----
5+
6+
37
25.1
48
-----
59
* [*] [internal] Block editor: Add onContentUpdate bridge functionality [https://github.com/wordpress-mobile/gutenberg-mobile/pull/20852]

WordPress/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ android {
154154
buildConfigField "boolean", "READER_TAGS_FEED", "false"
155155
buildConfigField "boolean", "READER_ANNOUNCEMENT_CARD", "false"
156156
buildConfigField "boolean", "VOICE_TO_CONTENT", "false"
157+
buildConfigField "boolean", "READER_FLOATING_BUTTON", "false"
157158

158159
// Override these constants in jetpack product flavor to enable/ disable features
159160
buildConfigField "boolean", "ENABLE_SITE_CREATION", "true"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
The Tags feed is live! You can now see content with specific tags, all in one place. Tag, you’re it.
1+
* [*] [internal] Block editor: Add onContentUpdate bridge functionality [https://github.com/wordpress-mobile/gutenberg-mobile/pull/20852]
22

3-
We fixed assorted crashes on the login and Posts List screens, as well as actions associated with blogging reminders, feature images, and user removal. Less crashing? How smashing.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
We fixed assorted crashes on the login and Posts List screens, as well as actions associated with blogging reminders, feature images, and user removal. Less crashing? How smashing.
1+
* [*] [internal] Block editor: Add onContentUpdate bridge functionality [https://github.com/wordpress-mobile/gutenberg-mobile/pull/20852]
2+

WordPress/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
3030
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
3131
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
32+
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
3233
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
3334

3435
<!-- GCM all build types configuration -->
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package org.wordpress.android.datasets
2+
3+
import kotlinx.coroutines.CoroutineDispatcher
4+
import kotlinx.coroutines.CoroutineScope
5+
import kotlinx.coroutines.Dispatchers
6+
import kotlinx.coroutines.launch
7+
import kotlinx.coroutines.withContext
8+
9+
/**
10+
* Helper class to handle asynchronous I/O tasks using coroutines
11+
* @see <a href="https://github.com/wordpress-mobile/WordPress-Android/pull/20937">Introduction</a>
12+
*/
13+
object AsyncTaskExecutor {
14+
/**
15+
* Execute a data loading task in the IO thread and handle the result on the main thread
16+
*/
17+
@JvmStatic
18+
fun <T> executeIo(scope: CoroutineScope, backgroundTask: () -> T, callback: AsyncTaskCallback<T>) {
19+
execute(scope, Dispatchers.IO, backgroundTask, callback)
20+
}
21+
22+
/**
23+
* Execute a data loading task in the default thread and handle the result on the main thread
24+
*/
25+
@JvmStatic
26+
fun <T> executeDefault(scope: CoroutineScope, backgroundTask: () -> T, callback: AsyncTaskCallback<T>) {
27+
execute(scope, Dispatchers.Default, backgroundTask, callback)
28+
}
29+
30+
private fun <T> execute(
31+
scope: CoroutineScope,
32+
dispatcher: CoroutineDispatcher,
33+
backgroundTask: () -> T,
34+
callback: AsyncTaskCallback<T>
35+
) {
36+
scope.launch(dispatcher) {
37+
// handle the background task
38+
val result = backgroundTask()
39+
40+
withContext(Dispatchers.Main) {
41+
// handle the result on the main thread
42+
callback.onTaskFinished(result)
43+
}
44+
}
45+
}
46+
47+
interface AsyncTaskCallback<T> {
48+
fun onTaskFinished(result: T)
49+
}
50+
}
51+

WordPress/src/main/java/org/wordpress/android/datasets/AsyncTaskHandler.kt

Lines changed: 0 additions & 33 deletions
This file was deleted.

WordPress/src/main/java/org/wordpress/android/inappupdate/InAppUpdateAnalyticsTracker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class InAppUpdateAnalyticsTracker @Inject constructor(
2121
}
2222

2323
fun trackAppRestartToCompleteUpdate() {
24-
tracker.track(AnalyticsTracker.Stat.IN_APP_UPDATE_COMPLETED_WITH_APP_RESTART)
24+
tracker.track(AnalyticsTracker.Stat.IN_APP_UPDATE_COMPLETED_WITH_APP_RESTART_BY_USER)
2525
}
2626

2727
private fun createPropertyMap(updateType: Int): Map<String, String> {

WordPress/src/main/java/org/wordpress/android/inappupdate/InAppUpdateManagerImpl.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ import com.google.android.play.core.install.model.UpdateAvailability.DEVELOPER_T
2222
import com.google.android.play.core.install.model.UpdateAvailability.UPDATE_AVAILABLE
2323
import com.google.android.play.core.install.model.UpdateAvailability.UPDATE_NOT_AVAILABLE
2424
import dagger.hilt.android.qualifiers.ApplicationContext
25+
import kotlinx.coroutines.CoroutineScope
26+
import kotlinx.coroutines.Dispatchers
27+
import kotlinx.coroutines.delay
28+
import kotlinx.coroutines.launch
2529
import org.wordpress.android.inappupdate.IInAppUpdateManager.Companion.APP_UPDATE_FLEXIBLE_REQUEST_CODE
2630
import org.wordpress.android.inappupdate.IInAppUpdateManager.Companion.APP_UPDATE_IMMEDIATE_REQUEST_CODE
2731

@@ -33,6 +37,7 @@ import javax.inject.Singleton
3337
@Suppress("TooManyFunctions")
3438
class InAppUpdateManagerImpl(
3539
@ApplicationContext private val applicationContext: Context,
40+
private val coroutineScope: CoroutineScope,
3641
private val appUpdateManager: AppUpdateManager,
3742
private val remoteConfigWrapper: RemoteConfigWrapper,
3843
private val buildConfigWrapper: BuildConfigWrapper,
@@ -51,8 +56,16 @@ class InAppUpdateManagerImpl(
5156
}
5257

5358
override fun completeAppUpdate() {
54-
inAppUpdateAnalyticsTracker.trackAppRestartToCompleteUpdate()
55-
appUpdateManager.completeUpdate()
59+
coroutineScope.launch(Dispatchers.Main) {
60+
// Track the app restart to complete update
61+
inAppUpdateAnalyticsTracker.trackAppRestartToCompleteUpdate()
62+
63+
// Delay so the event above can be logged
64+
delay(RESTART_DELAY_IN_MILLIS)
65+
66+
// Complete the update
67+
appUpdateManager.completeUpdate()
68+
}
5669
}
5770

5871
override fun cancelAppUpdate(updateType: Int) {
@@ -226,5 +239,6 @@ class InAppUpdateManagerImpl(
226239
private const val TAG = "AppUpdateChecker"
227240
private const val PREF_NAME = "in_app_update_prefs"
228241
private const val KEY_LAST_APP_UPDATE_CHECK_VERSION = "last_app_update_check_version"
242+
private const val RESTART_DELAY_IN_MILLIS = 500L
229243
}
230244
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,17 @@
3939
import org.wordpress.android.viewmodel.helpers.ConnectionStatus;
4040
import org.wordpress.android.viewmodel.helpers.ConnectionStatusLiveData;
4141

42+
import javax.inject.Named;
43+
4244
import dagger.Binds;
4345
import dagger.Module;
4446
import dagger.Provides;
4547
import dagger.android.AndroidInjectionModule;
4648
import dagger.hilt.InstallIn;
4749
import dagger.hilt.android.qualifiers.ApplicationContext;
4850
import dagger.hilt.components.SingletonComponent;
51+
import kotlinx.coroutines.CoroutineScope;
52+
import static org.wordpress.android.modules.ThreadModuleKt.APPLICATION_SCOPE;
4953

5054
@InstallIn(SingletonComponent.class)
5155
@Module(includes = AndroidInjectionModule.class)
@@ -98,6 +102,7 @@ public static AppUpdateManager provideAppUpdateManager(@ApplicationContext Conte
98102
@Provides
99103
public static IInAppUpdateManager provideInAppUpdateManager(
100104
@ApplicationContext Context context,
105+
@Named(APPLICATION_SCOPE) CoroutineScope appScope,
101106
AppUpdateManager appUpdateManager,
102107
RemoteConfigWrapper remoteConfigWrapper,
103108
BuildConfigWrapper buildConfigWrapper,
@@ -108,6 +113,7 @@ public static IInAppUpdateManager provideInAppUpdateManager(
108113
return inAppUpdatesFeatureConfig.isEnabled()
109114
? new InAppUpdateManagerImpl(
110115
context,
116+
appScope,
111117
appUpdateManager,
112118
remoteConfigWrapper,
113119
buildConfigWrapper,

0 commit comments

Comments
 (0)