From be3eb4314b9d9bcbe76600b5f28a09b5fbd84a70 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 24 Apr 2025 16:46:34 -0400 Subject: [PATCH] Fixes casting warnings on viewmodels --- .../amethyst/ui/screen/loggedIn/AccountViewModel.kt | 3 ++- .../loggedIn/bookmarks/dal/BookmarkPrivateFeedViewModel.kt | 3 ++- .../loggedIn/bookmarks/dal/BookmarkPublicFeedViewModel.kt | 3 ++- .../loggedIn/chats/privateDM/dal/ChatroomFeedViewModel.kt | 3 ++- .../chats/publicChannels/dal/ChannelFeedViewModel.kt | 3 ++- .../loggedIn/communities/dal/CommunityFeedViewModel.kt | 3 ++- .../screen/loggedIn/drafts/dal/DraftEventsFeedViewModel.kt | 3 ++- .../loggedIn/dvms/dal/NIP90ContentDiscoveryFeedViewModel.kt | 3 ++- .../ui/screen/loggedIn/geohash/dal/GeoHashFeedViewModel.kt | 3 ++- .../ui/screen/loggedIn/hashtag/dal/HashtagFeedViewModel.kt | 3 ++- .../bookmarks/dal/UserProfileBookmarksFeedViewModel.kt | 5 ++--- .../dal/UserProfileConversationsFeedViewModel.kt | 5 ++--- .../followers/dal/UserProfileFollowersUserFeedViewModel.kt | 5 ++--- .../follows/dal/UserProfileFollowsUserFeedViewModel.kt | 5 ++--- .../profile/gallery/dal/UserProfileGalleryFeedViewModel.kt | 5 ++--- .../header/apps/UserAppRecommendationsFeedViewModel.kt | 5 ++--- .../profile/mutual/dal/UserProfileMutualFeedViewModel.kt | 5 ++--- .../newthreads/dal/UserProfileNewThreadsFeedViewModel.kt | 5 ++--- .../profile/reports/dal/UserProfileReportFeedViewModel.kt | 3 ++- .../profile/zaps/dal/UserProfileZapsFeedViewModel.kt | 3 ++- .../amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt | 3 ++- .../loggedIn/settings/dal/HiddenAccountsFeedViewModel.kt | 3 ++- .../screen/loggedIn/settings/dal/HiddenWordsFeedViewModel.kt | 3 ++- .../loggedIn/settings/dal/SpammerAccountsFeedViewModel.kt | 3 ++- .../ui/screen/loggedIn/threadview/dal/ThreadFeedViewModel.kt | 3 ++- 25 files changed, 50 insertions(+), 41 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 3e3a943fb..82b0a40ec 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -1328,7 +1328,8 @@ class AccountViewModel( val accountSettings: AccountSettings, val settings: SharedSettingsState, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): AccountViewModel = AccountViewModel(accountSettings, settings) as AccountViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = AccountViewModel(accountSettings, settings) as T } private var collectorJob: Job? = null diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPrivateFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPrivateFeedViewModel.kt index 661a5b78c..927058b9f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPrivateFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPrivateFeedViewModel.kt @@ -33,6 +33,7 @@ class BookmarkPrivateFeedViewModel( class Factory( val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrBookmarkPrivateFeedViewModel = BookmarkPrivateFeedViewModel(account) as NostrBookmarkPrivateFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = BookmarkPrivateFeedViewModel(account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPublicFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPublicFeedViewModel.kt index 484825919..d92b4db6b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPublicFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/bookmarks/dal/BookmarkPublicFeedViewModel.kt @@ -33,6 +33,7 @@ class BookmarkPublicFeedViewModel( class Factory( val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrBookmarkPublicFeedViewModel = BookmarkPublicFeedViewModel(account) as NostrBookmarkPublicFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = BookmarkPublicFeedViewModel(account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/dal/ChatroomFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/dal/ChatroomFeedViewModel.kt index d2a22d997..d9bc7c8ab 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/dal/ChatroomFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/dal/ChatroomFeedViewModel.kt @@ -34,6 +34,7 @@ class ChatroomFeedViewModel( val user: ChatroomKey, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrChatRoomFeedViewModel = ChatroomFeedViewModel(user, account) as NostrChatRoomFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = ChatroomFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/dal/ChannelFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/dal/ChannelFeedViewModel.kt index d96587aff..2ab51a7de 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/dal/ChannelFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/publicChannels/dal/ChannelFeedViewModel.kt @@ -34,6 +34,7 @@ class ChannelFeedViewModel( val channel: Channel, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrChannelFeedViewModel = ChannelFeedViewModel(channel, account) as NostrChannelFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = ChannelFeedViewModel(channel, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/dal/CommunityFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/dal/CommunityFeedViewModel.kt index 37ce7c587..b576b6aa9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/dal/CommunityFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/communities/dal/CommunityFeedViewModel.kt @@ -34,6 +34,7 @@ class CommunityFeedViewModel( val note: AddressableNote, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrCommunityFeedViewModel = CommunityFeedViewModel(note, account) as NostrCommunityFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = CommunityFeedViewModel(note, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/drafts/dal/DraftEventsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/drafts/dal/DraftEventsFeedViewModel.kt index 17eca1586..0a908f0d2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/drafts/dal/DraftEventsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/drafts/dal/DraftEventsFeedViewModel.kt @@ -33,6 +33,7 @@ class DraftEventsFeedViewModel( class Factory( val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrDraftEventsFeedViewModel = DraftEventsFeedViewModel(account) as NostrDraftEventsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = DraftEventsFeedViewModel(account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryFeedViewModel.kt index 62bfe7d1f..bf485898a 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/dvms/dal/NIP90ContentDiscoveryFeedViewModel.kt @@ -37,6 +37,7 @@ class NIP90ContentDiscoveryFeedViewModel( val dvmKey: String, val requestId: String, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrNIP90ContentDiscoveryFeedViewModel = NIP90ContentDiscoveryFeedViewModel(account, dvmKey, requestId) as NostrNIP90ContentDiscoveryFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = NIP90ContentDiscoveryFeedViewModel(account, dvmKey, requestId) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedViewModel.kt index 94271d800..b8ce4d67d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/geohash/dal/GeoHashFeedViewModel.kt @@ -39,6 +39,7 @@ class GeoHashFeedViewModel( val geohash: String, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrGeoHashFeedViewModel = GeoHashFeedViewModel(geohash, account) as NostrGeoHashFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = GeoHashFeedViewModel(geohash, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedViewModel.kt index be1908aff..269a99b3b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/hashtag/dal/HashtagFeedViewModel.kt @@ -39,6 +39,7 @@ class HashtagFeedViewModel( val hashtag: String, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrHashtagFeedViewModel = HashtagFeedViewModel(hashtag, account) as NostrHashtagFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = HashtagFeedViewModel(hashtag, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/bookmarks/dal/UserProfileBookmarksFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/bookmarks/dal/UserProfileBookmarksFeedViewModel.kt index b5dcf09bf..c90431c4b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/bookmarks/dal/UserProfileBookmarksFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/bookmarks/dal/UserProfileBookmarksFeedViewModel.kt @@ -34,8 +34,7 @@ class UserProfileBookmarksFeedViewModel( val user: User, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileBookmarksFeedViewModel = - UserProfileBookmarksFeedViewModel(user, account) - as NostrUserProfileBookmarksFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileBookmarksFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/conversations/dal/UserProfileConversationsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/conversations/dal/UserProfileConversationsFeedViewModel.kt index 6e7aa23ac..742086c55 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/conversations/dal/UserProfileConversationsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/conversations/dal/UserProfileConversationsFeedViewModel.kt @@ -34,8 +34,7 @@ class UserProfileConversationsFeedViewModel( val user: User, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileConversationsFeedViewModel = - UserProfileConversationsFeedViewModel(user, account) - as NostrUserProfileConversationsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileConversationsFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/followers/dal/UserProfileFollowersUserFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/followers/dal/UserProfileFollowersUserFeedViewModel.kt index 44e502b56..002e07bb7 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/followers/dal/UserProfileFollowersUserFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/followers/dal/UserProfileFollowersUserFeedViewModel.kt @@ -34,8 +34,7 @@ class UserProfileFollowersUserFeedViewModel( val user: User, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileFollowersUserFeedViewModel = - UserProfileFollowersUserFeedViewModel(user, account) - as NostrUserProfileFollowersUserFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileFollowersUserFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/follows/dal/UserProfileFollowsUserFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/follows/dal/UserProfileFollowsUserFeedViewModel.kt index caae8d779..497a6f925 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/follows/dal/UserProfileFollowsUserFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/follows/dal/UserProfileFollowsUserFeedViewModel.kt @@ -34,8 +34,7 @@ class UserProfileFollowsUserFeedViewModel( val user: User, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileFollowsUserFeedViewModel = - UserProfileFollowsUserFeedViewModel(user, account) - as NostrUserProfileFollowsUserFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileFollowsUserFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedViewModel.kt index b11786212..289163c03 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/gallery/dal/UserProfileGalleryFeedViewModel.kt @@ -34,8 +34,7 @@ class UserProfileGalleryFeedViewModel( val user: User, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileGalleryFeedViewModel = - UserProfileGalleryFeedViewModel(user, account) - as NostrUserProfileGalleryFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileGalleryFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/apps/UserAppRecommendationsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/apps/UserAppRecommendationsFeedViewModel.kt index a66adb593..eb1783940 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/apps/UserAppRecommendationsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/header/apps/UserAppRecommendationsFeedViewModel.kt @@ -31,8 +31,7 @@ class UserAppRecommendationsFeedViewModel( class Factory( val user: User, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserAppRecommendationsFeedViewModel = - UserAppRecommendationsFeedViewModel(user) - as NostrUserAppRecommendationsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserAppRecommendationsFeedViewModel(user) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedViewModel.kt index 68d9f37e8..489924554 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/mutual/dal/UserProfileMutualFeedViewModel.kt @@ -34,8 +34,7 @@ class UserProfileMutualFeedViewModel( val user: User, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileMutualFeedViewModel = - UserProfileMutualFeedViewModel(user, account) - as NostrUserProfileMutualFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileMutualFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadsFeedViewModel.kt index 8de906d4b..a1bf0b7bc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/newthreads/dal/UserProfileNewThreadsFeedViewModel.kt @@ -34,8 +34,7 @@ class UserProfileNewThreadsFeedViewModel( val user: User, val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileNewThreadsFeedViewModel = - UserProfileNewThreadsFeedViewModel(user, account) - as NostrUserProfileNewThreadsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileNewThreadsFeedViewModel(user, account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportFeedViewModel.kt index 4524f533a..345ad68d5 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/reports/dal/UserProfileReportFeedViewModel.kt @@ -31,6 +31,7 @@ class UserProfileReportFeedViewModel( class Factory( val user: User, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileReportFeedViewModel = UserProfileReportFeedViewModel(user) as NostrUserProfileReportFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileReportFeedViewModel(user) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsFeedViewModel.kt index f05ad0974..3d1e48322 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/zaps/dal/UserProfileZapsFeedViewModel.kt @@ -31,6 +31,7 @@ class UserProfileZapsFeedViewModel( class Factory( val user: User, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrUserProfileZapsFeedViewModel = UserProfileZapsFeedViewModel(user) as NostrUserProfileZapsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = UserProfileZapsFeedViewModel(user) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt index b21f7fb20..6e4ccedef 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/search/SearchBarViewModel.kt @@ -131,6 +131,7 @@ class SearchBarViewModel( class Factory( val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): SearchBarViewModel = SearchBarViewModel(account) as SearchBarViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = SearchBarViewModel(account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenAccountsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenAccountsFeedViewModel.kt index ee477764e..8b25172b3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenAccountsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenAccountsFeedViewModel.kt @@ -31,6 +31,7 @@ class HiddenAccountsFeedViewModel( class Factory( val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrHiddenAccountsFeedViewModel = HiddenAccountsFeedViewModel(account) as NostrHiddenAccountsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = HiddenAccountsFeedViewModel(account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenWordsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenWordsFeedViewModel.kt index 545efda1d..ec09a5f84 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenWordsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/HiddenWordsFeedViewModel.kt @@ -33,6 +33,7 @@ class HiddenWordsFeedViewModel( class Factory( val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrHiddenWordsFeedViewModel = HiddenWordsFeedViewModel(account) as NostrHiddenWordsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = HiddenWordsFeedViewModel(account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/SpammerAccountsFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/SpammerAccountsFeedViewModel.kt index cd7290181..03483eb68 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/SpammerAccountsFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/settings/dal/SpammerAccountsFeedViewModel.kt @@ -31,6 +31,7 @@ class SpammerAccountsFeedViewModel( class Factory( val account: Account, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrSpammerAccountsFeedViewModel = SpammerAccountsFeedViewModel(account) as NostrSpammerAccountsFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = SpammerAccountsFeedViewModel(account) as T } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/dal/ThreadFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/dal/ThreadFeedViewModel.kt index ba5a7dee2..8f17f6e81 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/dal/ThreadFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/dal/ThreadFeedViewModel.kt @@ -32,6 +32,7 @@ class ThreadFeedViewModel( val account: Account, val noteId: String, ) : ViewModelProvider.Factory { - override fun create(modelClass: Class): NostrThreadFeedViewModel = ThreadFeedViewModel(account, noteId) as NostrThreadFeedViewModel + @Suppress("UNCHECKED_CAST") + override fun create(modelClass: Class): T = ThreadFeedViewModel(account, noteId) as T } }