-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inbox browser: add announcements for automatic self-update notifications
- Loading branch information
Showing
98 changed files
with
533 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
...elineOfSqueakInboxTalk.package/BaselineOfSqueakInboxTalk.class/class/cleanUpTimeStamps.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
cleanUpTimeStamps | ||
|
||
LatestTimeStamps := nil. |
4 changes: 4 additions & 0 deletions
4
...ineOfSqueakInboxTalk.package/BaselineOfSqueakInboxTalk.class/class/latestTimeStampFor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
accessing | ||
latestTimeStampFor: spec | ||
|
||
^ (self latestTimeStampsFor: spec) max |
8 changes: 8 additions & 0 deletions
8
...ueakInboxTalk.package/BaselineOfSqueakInboxTalk.class/class/latestTimeStampForPackage..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
accessing | ||
latestTimeStampForPackage: aPackageInfo | ||
|
||
^ (LatestTimeStamps ifNil: [LatestTimeStamps := Dictionary new]) | ||
at: aPackageInfo name ifAbsentPut: | ||
[(aPackageInfo methods collect: [:method | | ||
[TimeStamp fromMethodTimeStamp: method timeStamp] ifError: [TimeStamp new]]) | ||
max] |
8 changes: 8 additions & 0 deletions
8
...neOfSqueakInboxTalk.package/BaselineOfSqueakInboxTalk.class/class/latestTimeStampsFor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
accessing | ||
latestTimeStampsFor: spec | ||
|
||
^ (((self project version allPackagesForSpecNamed: spec) | ||
collect: [:packageSpec | packageSpec workingCopy packageInfo]) | ||
, {self packageInfo. (Smalltalk classNamed: #BaselineOfSqueakHistory) package}) | ||
collect: [:package | package -> (self latestTimeStampForPackage: package)] | ||
as: Dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...es/BaselineOfSqueakInboxTalk.package/BaselineOfSqueakInboxTalk.class/instance/postLoad.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
scripts | ||
postLoad | ||
|
||
self postLoadMailingLists | ||
self postLoadGeneric. | ||
self postLoadMailingLists. |
4 changes: 4 additions & 0 deletions
4
...lineOfSqueakInboxTalk.package/BaselineOfSqueakInboxTalk.class/instance/postLoadGeneric.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
scripts | ||
postLoadGeneric | ||
|
||
self class cleanUpTimeStamps. |
10 changes: 7 additions & 3 deletions
10
...s/BaselineOfSqueakInboxTalk.package/BaselineOfSqueakInboxTalk.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"cleanUpTimeStamps" : "ct 11/18/2024 02:08", | ||
"latestTimeStampFor:" : "ct 11/18/2024 02:23", | ||
"latestTimeStampForPackage:" : "ct 11/18/2024 02:22", | ||
"latestTimeStampsFor:" : "ct 11/18/2024 20:26" }, | ||
"instance" : { | ||
"baseline:" : "ct 11/17/2024 23:16", | ||
"baseline:" : "ct 11/18/2024 02:08", | ||
"initializeSqhPreferences" : "ct 11/17/2024 23:26", | ||
"installDependencies" : "ct 11/17/2024 23:17", | ||
"isCI" : "ct 10/15/2022 21:23", | ||
"openWelcomeContentsSync" : "ct 7/8/2021 21:00", | ||
"postLoad" : "ct 5/26/2021 15:42", | ||
"postLoad" : "ct 11/18/2024 02:08", | ||
"postLoadGeneric" : "ct 11/18/2024 02:08", | ||
"postLoadMailingLists" : "ct 7/8/2021 21:00", | ||
"projectClass" : "ct 5/26/2021 15:29" } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/SqueakInboxTalk.package/TalkConversation.class/instance/isTalkAnnouncement.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*SqueakInboxTalk-UI-testing | ||
isTalkAnnouncement | ||
|
||
^ false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/SqueakInboxTalk.package/TalkConversationBrowser.class/instance/canReply.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
testing | ||
canReply | ||
|
||
^ self hasActualMessageSelected and: [self selectedMessage isTalkAnnouncement not] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/allAnnouncementSelectors.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
announcements | ||
allAnnouncementSelectors | ||
|
||
^ (Pragma allNamed: #talkAnnouncement in: self class) | ||
collect: [:pragma | pragma selector] |
18 changes: 18 additions & 0 deletions
18
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/checkSelfUpdatesIfFound..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
self-updating | ||
checkSelfUpdatesIfFound: dateBlock | ||
|
||
| selfUpdateTimeStamps response selfUpdateTimeStampsUrl hasUpdates | | ||
selfUpdateTimeStampsUrl := 'https://gist.githubusercontent.com/LinqLover/36dd3c4a155eed5aa7e874415cd60eea/raw/{1}.json' format: {('latestTimeStamps/{1}' format: {"self selfUpdateBranch"nil}) asFileName encodeForHTTP}. | ||
response := WebClient httpGet: selfUpdateTimeStampsUrl. | ||
response isSuccess ifFalse: [^ false]. | ||
|
||
selfUpdateTimeStamps := response content parseAsJson timeStamps | ||
collect: [:ea | ea asDateAndTime asTimeStamp]. | ||
|
||
hasUpdates := self latestPackageTimeStamps associations anySatisfy: [:packageInfoAndTimeStamp | | ||
selfUpdateTimeStamps | ||
at: packageInfoAndTimeStamp key name | ||
ifPresent: [:selfUpdateTimeStamp | selfUpdateTimeStamp > packageInfoAndTimeStamp value] | ||
ifAbsent: [true]]. | ||
|
||
^ "hasUpdates"true ifTrue: [dateBlock value: selfUpdateTimeStamps max asDateAndTime] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/defaultFeedbackText.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
feedback | ||
defaultFeedbackText | ||
|
||
| latestTimeStamp | | ||
latestTimeStamp := (self packageInfo methods collect: [:method | TimeStamp fromMethodTimeStamp: method timeStamp]) max. | ||
^ '<br><br><i>Reported from {1}, for version of {2} last updated at {3}.</i>' asTextFromHtml format: {SystemVersion current. self appName. latestTimeStamp} | ||
^ '<br><br><i>Reported from {1}, for version of {2} last updated at {3}.</i>' asTextFromHtml format: {SystemVersion current. self appName. self latestTimeStamp} |
5 changes: 5 additions & 0 deletions
5
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/hideAnnouncementSelector..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
announcements | ||
hideAnnouncementSelector: selector | ||
|
||
(HiddenAnnouncementSelectors ifNil: [HiddenAnnouncementSelectors := Set new]) | ||
add: selector. |
5 changes: 5 additions & 0 deletions
5
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/latestPackageTimeStamps.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
self-updating | ||
latestPackageTimeStamps | ||
|
||
^ (Smalltalk classNamed: #BaselineOfSqueakInboxTalk) | ||
latestTimeStampsFor: self basicSelfUpdateMetacelloSpec |
5 changes: 5 additions & 0 deletions
5
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/latestTimeStamp.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
self-updating | ||
latestTimeStamp | ||
|
||
^ (self environment classNamed: #BaselineOfSqueakInboxTalk) ifNotNil: [:baseline | | ||
baseline latestTimeStampFor: self basicSelfUpdateMetacelloSpec] |
9 changes: 9 additions & 0 deletions
9
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/pendingAnnouncements.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
announcements | ||
pendingAnnouncements | ||
|
||
self shouldShowAnnouncements ifFalse: [^ #()]. | ||
|
||
^ Array streamContents: [:stream | | ||
self checkSelfUpdatesIfFound: [:date | stream nextPut: (self selfUpdateAnnouncementFor: DateAndTime today - 5 days"date")]. | ||
(self allAnnouncementSelectors copyWithoutAll: (HiddenAnnouncementSelectors ifNil: [#()])) do: [:selector | | ||
stream nextPut: (self perform: selector)]] |
4 changes: 4 additions & 0 deletions
4
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/resetAnnouncements.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
announcements | ||
resetAnnouncements | ||
|
||
HiddenAnnouncementSelectors := nil. |
57 changes: 57 additions & 0 deletions
57
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/selfUpdateAnnouncementFor..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
announcements | ||
selfUpdateAnnouncementFor: aDateAndTime | ||
|
||
| changes changesSummary | | ||
changesSummary := 'This might include new features, bug fixes, or performance improvements.'. | ||
changes := | ||
[| response | | ||
response := WebClient httpGet: ('https://api.github.com/repos/{1}/{2}/commits?sha={3}&since={4}' format: | ||
{self githubRepositoryParams first. | ||
self githubRepositoryParams second. | ||
self selfUpdateBranch. | ||
aDateAndTime asString}). | ||
response isSuccess ifFalse: [self error: response content]. | ||
response content parseAsJson collect: [:ea | ea commit message]] | ||
ifError: [:msg | 'Error retrieving changes: {1}' format: {msg}]. | ||
(changes isArray and: [TalkInbox enableSemanticSearch]) ifTrue: | ||
[| changesHash | | ||
changesHash := changes hash. | ||
(thisContext homeMethod propertyValueAt: #changesHash ifAbsent: []) = changesHash | ||
ifTrue: [changesSummary := thisContext homeMethod propertyValueAt: #changesSummary] | ||
ifFalse: | ||
[[changesSummary := (Smalltalk classNamed: #SemanticConversation) new | ||
addSystemMessage: ('Summarize the following changes to Squeak Inbox Talk (which is a mailing list client for squeak-dev) in a single very short sentence. The changes are provided as technical commit messages. The sentence should have the form "This..." and be very short. | ||
If you very unsure about the nature of the changes, answer "{1}" instead. | ||
Audience: Users of the tool.' format: {changesSummary}); | ||
addUserMessage: changes asJsonString; | ||
in: [:conversation | | ||
(Smalltalk classNamed: #SemanticText) registeredConversationModels | ||
detect: [:model | model name = (Smalltalk classNamed: #OpenAIConversationModel) cheapestName] | ||
ifFound: [:model | conversation model: model]]; | ||
getAssistantReply. | ||
thisContext homeMethod propertyValueAt: #changesSummary put: changesSummary. | ||
thisContext homeMethod propertyValueAt: #changesHash put: changesHash] | ||
ifError: [:msg | changesSummary := '{1} (Error retrieving summary: {2}.)' format: {changesSummary. msg}]]]. | ||
|
||
^ TalkInboxBrowserAnnouncement | ||
date: aDateAndTime | ||
subject: ('Updates for {1} are available' format: {self appName}) | ||
content: ('New updates for {appName} are available. {changesSummary} It is recommended to install {appName} updates together with Squeak updates. | ||
You can <a href="{codeInstallUpdates}">install the updates now</a> or <a href="{changesUrl}">inspect the changes on GitHub first</a>. | ||
New changes: | ||
{changes}' | ||
format: | ||
(Dictionary new | ||
at: #appName put: self appName; | ||
at: #codeInstallUpdates put: 'code:// TalkInboxBrowser selfUpdate. nil'; | ||
at: #changesUrl put: | ||
('https://github.com/{1}/{2}/commits/{3}' format: { | ||
self githubRepositoryParams first. | ||
self githubRepositoryParams second. | ||
self selfUpdateBranch}); | ||
at: #changesSummary put: changesSummary; | ||
at: #changes put: (changes isArray ifTrue: [changes ifEmpty: ['(not found)'] ifNotEmpty: [(changes collect: [:ea | '* ' , (ea lines at: 1 ifAbsent: [''])]) joinSeparatedBy: String cr]] ifFalse: [changes]); | ||
yourself)) | ||
talkAsTextFromHtmlWithCRs |
7 changes: 7 additions & 0 deletions
7
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/shouldShowAnnouncements..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
preferences | ||
shouldShowAnnouncements: aBoolean | ||
|
||
aBoolean ifTrue: | ||
[(self confirm: 'Reset all announcements?') ifTrue: | ||
[self resetAnnouncements]]. | ||
ShowAnnouncements := aBoolean. |
5 changes: 5 additions & 0 deletions
5
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/class/shouldShowAnnouncements.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
preferences | ||
shouldShowAnnouncements | ||
<preference: 'Show announcements in inbox browser' category: #'Squeak Inbox Talk' description: 'Learn about new features in Squeak Inbox Talk when browsing mailing lists.' type: #Boolean> | ||
|
||
^ ShowAnnouncements ifNil: [true] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/SqueakInboxTalk.package/TalkInboxBrowser.class/instance/pendingAnnouncements.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
accessing | ||
pendingAnnouncements | ||
|
||
^ pendingAnnouncements ifNil: [pendingAnnouncements := | ||
self class pendingAnnouncements] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...es/SqueakInboxTalk.package/TalkInboxBrowser.class/instance/refreshPendingAnnouncements.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
private | ||
refreshPendingAnnouncements | ||
|
||
pendingAnnouncements := nil. | ||
self pendingAnnouncements. |
Oops, something went wrong.