File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
OneSignalSDK/onesignal/src/main/java/com/onesignal Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,7 @@ object OSWorkManagerHelper {
45
45
@SuppressWarnings(" deprecation" )
46
46
@SuppressLint(" RestrictedApi" )
47
47
private fun isInitialized (): Boolean {
48
- val instance = WorkManagerImpl .getInstance()
49
- return instance != null
48
+ return WorkManagerImpl .getInstance() != null
50
49
}
51
50
52
51
/* *
@@ -57,12 +56,11 @@ object OSWorkManagerHelper {
57
56
* @return an instance of WorkManager
58
57
*/
59
58
@JvmStatic
59
+ @Synchronized
60
60
fun getInstance (context : Context ): WorkManager {
61
- return if (isInitialized()) {
62
- WorkManager .getInstance(context)
63
- } else {
61
+ if (! isInitialized()) {
64
62
WorkManager .initialize(context, Configuration .Builder ().build())
65
- WorkManager .getInstance(context)
66
63
}
64
+ return WorkManager .getInstance(context)
67
65
}
68
66
}
You can’t perform that action at this time.
0 commit comments