From 4b0dea8c9814fa8a0006ef089891aae4da85ef31 Mon Sep 17 00:00:00 2001 From: TL Date: Mon, 8 Jul 2024 17:21:09 +0200 Subject: [PATCH] refactor class side of spocstyle --- src/SpotifyConnect/SPOCApiAlbum.class.st | 4 +- src/SpotifyConnect/SPOCApiPlaylist.class.st | 4 +- src/SpotifyConnect/SPOCApiSearch.class.st | 4 +- .../SPOCResultListItem.class.st | 17 +++++++-- src/SpotifyConnect/SPOCStyle.class.st | 37 +++---------------- src/SpotifyConnect/SPOCTestApiSearch.class.st | 4 +- 6 files changed, 26 insertions(+), 44 deletions(-) diff --git a/src/SpotifyConnect/SPOCApiAlbum.class.st b/src/SpotifyConnect/SPOCApiAlbum.class.st index def4455..2eed61d 100644 --- a/src/SpotifyConnect/SPOCApiAlbum.class.st +++ b/src/SpotifyConnect/SPOCApiAlbum.class.st @@ -28,11 +28,11 @@ SPOCApiAlbum >> endpointMethod [ { #category : #'api-call', - #'squeak_changestamp' : 'TL 7/7/2024 01:21' + #'squeak_changestamp' : 'TL 7/8/2024 17:20' } SPOCApiAlbum >> executeRequest: request withParams: aParameterDictionary [ - request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle resultListLimit). + request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle defaultRequestLimit). ^ self client sendRequest: request ] diff --git a/src/SpotifyConnect/SPOCApiPlaylist.class.st b/src/SpotifyConnect/SPOCApiPlaylist.class.st index a0cdf52..5984882 100644 --- a/src/SpotifyConnect/SPOCApiPlaylist.class.st +++ b/src/SpotifyConnect/SPOCApiPlaylist.class.st @@ -28,11 +28,11 @@ SPOCApiPlaylist >> endpointMethod [ { #category : #'api-call', - #'squeak_changestamp' : 'TL 7/7/2024 01:20' + #'squeak_changestamp' : 'TL 7/8/2024 17:20' } SPOCApiPlaylist >> executeRequest: request withParams: aParameterDictionary [ - request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle resultListLimit). + request rawUrl: (request rawUrl, (aParameterDictionary at: #id), '/tracks?limit=', SPOCStyle defaultRequestLimit). ^ self client sendRequest: request ] diff --git a/src/SpotifyConnect/SPOCApiSearch.class.st b/src/SpotifyConnect/SPOCApiSearch.class.st index b29bbb7..9d18842 100644 --- a/src/SpotifyConnect/SPOCApiSearch.class.st +++ b/src/SpotifyConnect/SPOCApiSearch.class.st @@ -58,13 +58,13 @@ SPOCApiSearch >> executeTest [ { #category : #'api-call', - #'squeak_changestamp' : 'TL 7/7/2024 03:25' + #'squeak_changestamp' : 'TL 7/8/2024 17:20' } SPOCApiSearch >> search: aString withFilter: aFilter [ ^ self execute: (Dictionary new at: #input put: aString; at: #type put: aFilter; - at: #limit put: SPOCStyle resultListLimit; + at: #limit put: SPOCStyle defaultRequestLimit; yourself) ] diff --git a/src/SpotifyConnect/SPOCResultListItem.class.st b/src/SpotifyConnect/SPOCResultListItem.class.st index 4b963ff..b5b42b7 100644 --- a/src/SpotifyConnect/SPOCResultListItem.class.st +++ b/src/SpotifyConnect/SPOCResultListItem.class.st @@ -29,6 +29,15 @@ SPOCResultListItem class >> newWith: aDataPiece [ yourself ] +{ + #category : #constants, + #'squeak_changestamp' : 'TL 7/8/2024 17:18' +} +SPOCResultListItem class >> resultListItemHeight [ + + ^ 96 +] + { #category : #accessing, #'squeak_changestamp' : 'RK 6/7/2024 12:21' @@ -78,12 +87,12 @@ SPOCResultListItem >> buildCenterBox [ { #category : #building, - #'squeak_changestamp' : 'VE 7/8/2024 16:57' + #'squeak_changestamp' : 'TL 7/8/2024 17:17' } SPOCResultListItem >> buildImage [ | image | - image := self dataPiece image scaledTo: SPOCStyle resultListItemHeight - (2 * SPOCStyle defaultMargin). + image := self dataPiece image scaledTo: self class resultListItemHeight - (2 * SPOCStyle defaultMargin). self image: image; addMorph: image @@ -147,12 +156,12 @@ SPOCResultListItem >> centerBox [ { #category : #'as yet unclassified', - #'squeak_changestamp' : 'RK 7/7/2024 12:55' + #'squeak_changestamp' : 'TL 7/8/2024 17:17' } SPOCResultListItem >> changeItemTo: aDataPiece [ | form | - form := (aDataPiece image scaledTo: SPOCStyle resultListItemHeight - (2 * SPOCStyle defaultMargin)) form. + form := (aDataPiece image scaledTo: self class resultListItemHeight - (2 * SPOCStyle defaultMargin)) form. self image image: form. self primaryText contents: (aDataPiece primaryText asText addAttribute: TextEmphasis bold). self secondaryText contents: (aDataPiece secondaryText). diff --git a/src/SpotifyConnect/SPOCStyle.class.st b/src/SpotifyConnect/SPOCStyle.class.st index 1bc5df1..adc9149 100644 --- a/src/SpotifyConnect/SPOCStyle.class.st +++ b/src/SpotifyConnect/SPOCStyle.class.st @@ -19,47 +19,20 @@ SPOCStyle class >> defaultMargin [ { #category : #constants, - #'squeak_changestamp' : 'RK 6/8/2024 23:35' -} -SPOCStyle class >> gitRepoName [ - - ^ 'SpotifyConnect' -] - -{ - #category : #constants, - #'squeak_changestamp' : 'RK 6/7/2024 11:10' -} -SPOCStyle class >> resultListItemHeight [ - - ^ 96 -] - -{ - #category : #constants, - #'squeak_changestamp' : 'RK 6/7/2024 11:10' + #'squeak_changestamp' : 'TL 7/8/2024 17:20' } -SPOCStyle class >> resultListItemPadding [ - - ^ 95 -] - -{ - #category : #constants, - #'squeak_changestamp' : 'VE 6/10/2024 14:20' -} -SPOCStyle class >> resultListLimit [ +SPOCStyle class >> defaultRequestLimit [ ^ 10 ] { #category : #constants, - #'squeak_changestamp' : 'VE 6/10/2024 14:45' + #'squeak_changestamp' : 'RK 6/8/2024 23:35' } -SPOCStyle class >> resultListWidth [ +SPOCStyle class >> gitRepoName [ - ^ 1048 + ^ 'SpotifyConnect' ] { diff --git a/src/SpotifyConnect/SPOCTestApiSearch.class.st b/src/SpotifyConnect/SPOCTestApiSearch.class.st index 092a0e8..bc23a7a 100644 --- a/src/SpotifyConnect/SPOCTestApiSearch.class.st +++ b/src/SpotifyConnect/SPOCTestApiSearch.class.st @@ -19,7 +19,7 @@ SPOCTestApiSearch >> setUp [ { #category : #testing, - #'squeak_changestamp' : 'TL 6/24/2024 03:27' + #'squeak_changestamp' : 'TL 7/8/2024 17:20' } SPOCTestApiSearch >> testApiSearchExecute [ @@ -27,7 +27,7 @@ SPOCTestApiSearch >> testApiSearchExecute [ dict := Dictionary new at: #input put: 'Morning+Blue'; at: #type put: 'track'; - at: #limit put: SPOCStyle resultListLimit; + at: #limit put: SPOCStyle defaultRequestLimit; yourself. res := self apiEndpoint execute: dict. self assert: res class ~= SPOCApiEndpointResult