Commit 02fe457
committed
remove all user providers from repositories to avoid crashes.
-> try to keep repositories more stateless.
user providers must not be injected in repositories!
users should be fetched in viewModels (For now they are also sometimes fetched in activities).
add old user provider as deprecated solution and rename it to CurrentUserProviderOld(Impl).
Also:
do not define api url in repositories. Should be passed into each method from outside.
For further improvements:
Use a shared view model to get users?
3 example crashes which should be avoided by these changes:
1)
Exception java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4418)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4639)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:112)
at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem (TransactionExecutor.java:186)
at android.app.servertransaction.TransactionExecutor.executeTransactionItems (TransactionExecutor.java:112)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:84)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2881)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loopOnce (Looper.java:249)
at android.os.Looper.loop (Looper.java:337)
at android.app.ActivityThread.main (ActivityThread.java:9593)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:593)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)
Caused by com.nextcloud.talk.utils.NoSupportedApiException:
at com.nextcloud.talk.utils.ApiUtils.getConversationApiVersion (ApiUtils.kt:127)
at com.nextcloud.talk.openconversations.data.OpenConversationsRepositoryImpl.<init> (OpenConversationsRepositoryImpl.kt:23)
at com.nextcloud.talk.dagger.modules.RepositoryModule.provideOpenConversationsRepository (RepositoryModule.kt:129)
at com.nextcloud.talk.dagger.modules.RepositoryModule_ProvideOpenConversationsRepositoryFactory.provideOpenConversationsRepository (RepositoryModule_ProvideOpenConversationsRepositoryFactory.java:59)
at com.nextcloud.talk.dagger.modules.RepositoryModule_ProvideOpenConversationsRepositoryFactory.get (RepositoryModule_ProvideOpenConversationsRepositoryFactory.java:47)
at com.nextcloud.talk.dagger.modules.RepositoryModule_ProvideOpenConversationsRepositoryFactory.get (RepositoryModule_ProvideOpenConversationsRepositoryFactory.java:14)
at com.nextcloud.talk.conversationlist.viewmodels.ConversationsListViewModel_Factory.get (ConversationsListViewModel_Factory.java:67)
at com.nextcloud.talk.conversationlist.viewmodels.ConversationsListViewModel_Factory.get (ConversationsListViewModel_Factory.java:17)
at com.nextcloud.talk.dagger.modules.ViewModelFactory.create (ViewModelModule.kt:46)
at androidx.lifecycle.ViewModelProvider$Factory.create (ViewModelProvider.android.kt:148)
at com.nextcloud.talk.dagger.modules.ViewModelFactory.create (ViewModelModule.kt:43)
at androidx.lifecycle.ViewModelProvider$Factory.create (ViewModelProvider.android.kt:153)
at com.nextcloud.talk.dagger.modules.ViewModelFactory.create (ViewModelModule.kt:43)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl_androidKt.createViewModel (ViewModelProviderImpl.android.kt:34)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl.getViewModel$lifecycle_viewmodel_release (ViewModelProviderImpl.kt:60)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl.getViewModel$lifecycle_viewmodel_release$default (ViewModelProviderImpl.kt:43)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.android.kt:92)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.android.kt:106)
at com.nextcloud.talk.conversationlist.ConversationsListActivity.onCreate (ConversationsListActivity.kt:263)
at android.app.Activity.performCreate (Activity.java:9217)
at android.app.Activity.performCreate (Activity.java:9176)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1538)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4400)
2)
Exception java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4710)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4941)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:222)
at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem (TransactionExecutor.java:133)
at android.app.servertransaction.TransactionExecutor.executeTransactionItems (TransactionExecutor.java:103)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:80)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:3150)
at android.os.Handler.dispatchMessage (Handler.java:110)
at android.os.Looper.loopOnce (Looper.java:273)
at android.os.Looper.loop (Looper.java:363)
at android.app.ActivityThread.main (ActivityThread.java:10060)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:632)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
Caused by com.nextcloud.talk.utils.NoSupportedApiException:
at com.nextcloud.talk.utils.ApiUtils.getConversationApiVersion (ApiUtils.kt:127)
at com.nextcloud.talk.repositories.conversations.ConversationsRepositoryImpl.<init> (ConversationsRepositoryImpl.kt:35)
at com.nextcloud.talk.dagger.modules.RepositoryModule.provideConversationsRepository (RepositoryModule.kt:81)
at com.nextcloud.talk.dagger.modules.RepositoryModule_ProvideConversationsRepositoryFactory.provideConversationsRepository (RepositoryModule_ProvideConversationsRepositoryFactory.java:63)
at com.nextcloud.talk.dagger.modules.RepositoryModule_ProvideConversationsRepositoryFactory.get (RepositoryModule_ProvideConversationsRepositoryFactory.java:51)
at com.nextcloud.talk.dagger.modules.RepositoryModule_ProvideConversationsRepositoryFactory.get (RepositoryModule_ProvideConversationsRepositoryFactory.java:15)
at com.nextcloud.talk.conversationinfo.viewmodel.ConversationInfoViewModel_Factory.get (ConversationInfoViewModel_Factory.java:42)
at com.nextcloud.talk.conversationinfo.viewmodel.ConversationInfoViewModel_Factory.get (ConversationInfoViewModel_Factory.java:12)
at com.nextcloud.talk.dagger.modules.ViewModelFactory.create (ViewModelModule.kt:46)
at androidx.lifecycle.ViewModelProvider$Factory.create (ViewModelProvider.android.kt:148)
at com.nextcloud.talk.dagger.modules.ViewModelFactory.create (ViewModelModule.kt:43)
at androidx.lifecycle.ViewModelProvider$Factory.create (ViewModelProvider.android.kt:153)
at com.nextcloud.talk.dagger.modules.ViewModelFactory.create (ViewModelModule.kt:43)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl_androidKt.createViewModel (ViewModelProviderImpl.android.kt:34)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl.getViewModel$lifecycle_viewmodel_release (ViewModelProviderImpl.kt:60)
at androidx.lifecycle.viewmodel.ViewModelProviderImpl.getViewModel$lifecycle_viewmodel_release$default (ViewModelProviderImpl.kt:43)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.android.kt:92)
at androidx.lifecycle.ViewModelProvider.get (ViewModelProvider.android.kt:106)
at com.nextcloud.talk.chat.ChatActivity.onCreate (ChatActivity.kt:517)
at android.app.Activity.performCreate (Activity.java:9519)
at android.app.Activity.performCreate (Activity.java:9488)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1524)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4692)
3)
Exception java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4169)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:4325)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2574)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8762)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Caused by java.lang.NullPointerException:
at com.nextcloud.talk.chat.data.network.OfflineFirstChatRepository.<init> (OfflineFirstChatRepository.kt:63)
at com.nextcloud.talk.dagger.modules.RepositoryModule.provideOfflineFirstChatRepository (RepositoryModule.kt:160)
at com.nextcloud.talk.dagger.modules.RepositoryModule_ProvideOfflineFirstChatRepositoryFactory.provideOfflineFirstChatRepository (RepositoryModule_ProvideOfflineFirstChatRepositoryFactory.java:78)
at com.nextcloud.talk.application.DaggerNextcloudTalkApplicationComponent$NextcloudTalkApplicationComponentImpl.chatMessageRepository (DaggerNextcloudTalkApplicationComponent.java:761)
at com.nextcloud.talk.application.DaggerNextcloudTalkApplicationComponent$NextcloudTalkApplicationComponentImpl.chatViewModel (DaggerNextcloudTalkApplicationComponent.java:789)
at com.nextcloud.talk.application.DaggerNextcloudTalkApplicationComponent$NextcloudTalkApplicationComponentImpl.injectConversationsListActivity (DaggerNextcloudTalkApplicationComponent.java:2160)
at com.nextcloud.talk.application.DaggerNextcloudTalkApplicationComponent$NextcloudTalkApplicationComponentImpl.inject (DaggerNextcloudTalkApplicationComponent.java:1284)
at com.nextcloud.talk.conversationlist.ConversationsListActivity.onCreate (ConversationsListActivity.kt:260)
at android.app.Activity.performCreate (Activity.java:8591)
at android.app.Activity.performCreate (Activity.java:8570)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1384)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:4150)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>1 parent 0d2d987 commit 02fe457
103 files changed
Lines changed: 1219 additions & 732 deletions
File tree
- app
- src
- androidTest/java/com/nextcloud/talk/ui
- main/java/com/nextcloud/talk
- account
- activities
- adapters/messages
- chat
- data
- network
- viewmodels
- chooseaccount
- contacts
- components
- conversationcreation
- conversationinfoedit
- data
- viewmodel
- conversationinfo
- viewmodel
- conversationlist
- data
- network
- viewmodels
- dagger/modules
- diagnose
- invitation
- jobs
- location
- messagesearch
- openconversations
- data
- viewmodels
- polls
- repositories
- ui
- viewmodels
- presenters
- profile
- raisehand
- viewmodel
- receivers
- remotefilebrowser
- activities
- repositories
- viewmodels
- repositories
- callrecording
- conversations
- reactions
- unifiedsearch
- settings
- threadsoverview
- data
- viewmodels
- translate/viewmodels
- ui
- dialog
- theme
- utils
- database/user
- preview
- viewmodels
- test/java/com/nextcloud/talk
- messagesearch
- test/fakes
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
| 419 | + | |
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
| |||
Lines changed: 8 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
77 | 79 | | |
78 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
257 | | - | |
| 262 | + | |
258 | 263 | | |
259 | 264 | | |
260 | 265 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
Lines changed: 36 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | | - | |
| 373 | + | |
374 | 374 | | |
375 | 375 | | |
376 | 376 | | |
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | 512 | | |
516 | 513 | | |
517 | 514 | | |
518 | 515 | | |
519 | 516 | | |
520 | 517 | | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
529 | 532 | | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
538 | 546 | | |
539 | | - | |
540 | 547 | | |
541 | 548 | | |
542 | 549 | | |
| |||
1412 | 1419 | | |
1413 | 1420 | | |
1414 | 1421 | | |
1415 | | - | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
1416 | 1426 | | |
1417 | 1427 | | |
1418 | 1428 | | |
| |||
1891 | 1901 | | |
1892 | 1902 | | |
1893 | 1903 | | |
1894 | | - | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
1895 | 1908 | | |
1896 | 1909 | | |
1897 | 1910 | | |
| |||
0 commit comments