Skip to content

Commit

Permalink
Fix story saving for subscriptions and snap maps.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodit committed Jun 2, 2022
1 parent 2376f40 commit 981c94a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ class AutoSaveOption(context: FeatureContext) : Contextual(context), MenuPlugin
override val isEnabled = true

override fun createActions(params: ParamsMap): Collection<OperaActionMenuOptionViewModel> {
return setOf(
val storyId = params.storyId
return if (storyId == null) emptySet() else setOf(
OperaActionMenuOptionViewModel(
0,
if (context.autoDownloadStories.isEnabled(params.storyId))
if (context.autoDownloadStories.isEnabled(storyId))
CustomResources.string.menu_story_disable_auto_download
else
CustomResources.string.menu_story_enable_auto_download,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ val ParamsMap.isChat: Boolean

val ParamsMap.storyId: String?
get() {
val reportingInfo = map[FriendStoryKeys.getStorySnapViewReportingInfo().instance]
return if (reportingInfo is Collection<*>) StorySnapViewReportingInfo.wrap(reportingInfo.first()).storySnapKey.storyKey.storyId else null
return try {
val reportingInfo = map[FriendStoryKeys.getStorySnapViewReportingInfo().instance]
if (reportingInfo is Collection<*>) StorySnapViewReportingInfo.wrap(reportingInfo.first()).storySnapKey.storyKey.storyId else null
} catch (ex: NullPointerException) {
null
}
}

class StoryMedia(
Expand Down

0 comments on commit 981c94a

Please sign in to comment.