Skip to content

Commit

Permalink
Widgets improvements (#1148)
Browse files Browse the repository at this point in the history
* fix(widgets): remove unused static recommendations widget

* fix(widgets): update recent saves widget upon login state change
  • Loading branch information
Gio2018 authored Feb 3, 2025
1 parent fa39ede commit d5184e8
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 42 deletions.
35 changes: 0 additions & 35 deletions ItemWidgets/ItemWidgetsKit/Widgets/RecommendationsWidget.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public struct TopicRecommendationsWidget: Widget {
let kind: String

public init() {
self.kind = WidgetKind.topicRecommendations
self.kind = WidgetKind.recommendations
}

public var body: some WidgetConfiguration {
Expand Down
4 changes: 0 additions & 4 deletions Pocket.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
AA41DD882BD04DC3003CEDBF /* ItemWidgetsRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA41DD732BD04D09003CEDBF /* ItemWidgetsRow.swift */; };
AA41DD892BD04DC7003CEDBF /* ItemWidgetsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA41DD742BD04D09003CEDBF /* ItemWidgetsView.swift */; };
AA41DD8B2BD04DD0003CEDBF /* RecentSavesWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA41DD772BD04D09003CEDBF /* RecentSavesWidget.swift */; };
AA41DD8C2BD04DD3003CEDBF /* RecommendationsWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA41DD782BD04D09003CEDBF /* RecommendationsWidget.swift */; };
AA41DD8D2BD04DD6003CEDBF /* TopicRecommendationsWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA41DD792BD04D09003CEDBF /* TopicRecommendationsWidget.swift */; };
AA41DD8F2BD04EC9003CEDBF /* Textile in Frameworks */ = {isa = PBXBuildFile; productRef = AA41DD8E2BD04EC9003CEDBF /* Textile */; };
AA41DD912BD04EF0003CEDBF /* Sync in Frameworks */ = {isa = PBXBuildFile; productRef = AA41DD902BD04EF0003CEDBF /* Sync */; };
Expand Down Expand Up @@ -340,7 +339,6 @@
AA41DD732BD04D09003CEDBF /* ItemWidgetsRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemWidgetsRow.swift; sourceTree = "<group>"; };
AA41DD742BD04D09003CEDBF /* ItemWidgetsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemWidgetsView.swift; sourceTree = "<group>"; };
AA41DD772BD04D09003CEDBF /* RecentSavesWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentSavesWidget.swift; sourceTree = "<group>"; };
AA41DD782BD04D09003CEDBF /* RecommendationsWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendationsWidget.swift; sourceTree = "<group>"; };
AA41DD792BD04D09003CEDBF /* TopicRecommendationsWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TopicRecommendationsWidget.swift; sourceTree = "<group>"; };
AA561B8E2C740F10006DF948 /* PocketShortcuts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PocketShortcuts.swift; sourceTree = "<group>"; };
AA561B8F2C740F10006DF948 /* SearchSavesIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSavesIntent.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -754,7 +752,6 @@
isa = PBXGroup;
children = (
AA41DD772BD04D09003CEDBF /* RecentSavesWidget.swift */,
AA41DD782BD04D09003CEDBF /* RecommendationsWidget.swift */,
AA41DD792BD04D09003CEDBF /* TopicRecommendationsWidget.swift */,
);
path = Widgets;
Expand Down Expand Up @@ -1282,7 +1279,6 @@
AA41DD892BD04DC7003CEDBF /* ItemWidgetsView.swift in Sources */,
AA41DD872BD04DBF003CEDBF /* ItemWidgetsListView.swift in Sources */,
AA41DD842BD04DB5003CEDBF /* ItemWidgetsContainerView.swift in Sources */,
AA41DD8C2BD04DD3003CEDBF /* RecommendationsWidget.swift in Sources */,
AA256B4A2BD1CCC200939C6C /* TopicQuery.swift in Sources */,
AA41DD7F2BD04DA1003CEDBF /* ItemRowContent.swift in Sources */,
AA41DD882BD04DC3003CEDBF /* ItemWidgetsRow.swift in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions PocketKit/Sources/PocketKit/Home/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ struct HomeView: View {
.onAppear {
homeActions.trackHomeScreenImpression()
}
.onChange(of: accessService.accessLevel, initial: true) {
homeActions.updateRecentSavesWidget()
}
.contentMargins(.bottom, -32)
.scrollIndicators(.hidden)
.background(Color(.ui.white1))
Expand Down
1 change: 0 additions & 1 deletion PocketKit/Sources/SharedPocketKit/WidgetKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
public enum WidgetKind {
public static let recentSaves = "RecentSavesWidget"
public static let recommendations = "DiscoverWidget"
public static let topicRecommendations = "TopicRecommendationsWidget"
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public struct RecommendationsWidgetUpdateService {

/// Reloads the widget
private func reloadWidget() {
WidgetCenter.shared.reloadTimelines(ofKind: WidgetKind.topicRecommendations)
WidgetCenter.shared.reloadTimelines(ofKind: WidgetKind.recommendations)
}
}

0 comments on commit d5184e8

Please sign in to comment.