1
0
Fork 0
tooty/src/Types.elm

275 lines
6.7 KiB
Elm
Raw Normal View History

module Types exposing (..)
import Autocomplete
import Keyboard
import Mastodon.Http exposing (Response, Links)
import Mastodon.Model exposing (..)
import Navigation
import Time exposing (Time)
type alias Flags =
{ clients : String
, registration : Maybe AppRegistration
}
type DraftMsg
= ClearDraft
2017-05-11 08:55:15 +00:00
| CloseAutocomplete
| RemoveMedia String
2017-05-11 08:55:15 +00:00
| ResetAutocomplete Bool
| SelectAccount String
| SetAutoState Autocomplete.Msg
| ToggleSpoiler Bool
| UpdateAltText String String
2017-05-11 08:55:15 +00:00
| UpdateInputInformation InputInformation
| UpdateSensitive Bool
| UpdateSpoiler String
| UpdateVisibility String
| UpdateReplyTo Status
2017-05-11 08:55:15 +00:00
| UploadError String
| UploadMedia String
| UploadResult String
type ViewerMsg
= CloseViewer
| OpenViewer (List Attachment) Attachment
| PrevAttachment
| NextAttachment
type alias MastodonResult a =
Result Error (Response a)
type MastodonMsg
= AccessToken (MastodonResult AccessTokenResult)
| AccountFollowed Account (MastodonResult Relationship)
| AccountFollowers Bool (MastodonResult (List Account))
| AccountFollowing Bool (MastodonResult (List Account))
| AccountBlocked Account (MastodonResult Relationship)
| AccountMuted Account (MastodonResult Relationship)
2021-01-12 06:08:43 +00:00
| AccountPins Bool (MastodonResult (List Status))
| AccountReceived (MastodonResult Account)
| AccountRelationship (MastodonResult (List Relationship))
| AccountRelationships (MastodonResult (List Relationship))
| AccountTimeline Bool (MastodonResult (List Status))
| AccountUnfollowed Account (MastodonResult Relationship)
| AccountUnblocked Account (MastodonResult Relationship)
| AccountUnmuted Account (MastodonResult Relationship)
| AppRegistered (MastodonResult AppRegistration)
| AutoSearch (MastodonResult SearchResults)
| Blocks Bool (MastodonResult (List Account))
| CurrentUser (MastodonResult Account)
| FavoriteAdded (MastodonResult Status)
| FavoriteRemoved (MastodonResult Status)
| FavoriteTimeline Bool (MastodonResult (List Status))
| GlobalTimeline Bool (MastodonResult (List Status))
| HashtagTimeline Bool (MastodonResult (List Status))
| HomeTimeline Bool (MastodonResult (List Status))
| LocalTimeline Bool (MastodonResult (List Status))
| Mutes Bool (MastodonResult (List Account))
| Notifications Bool (MastodonResult (List Notification))
| Reblogged (MastodonResult Status)
| SearchResultsReceived (MastodonResult SearchResults)
| StatusDeleted (MastodonResult StatusId)
| StatusPosted (MastodonResult Status)
| ThreadStatusLoaded StatusId (MastodonResult Status)
| ThreadContextLoaded StatusId (MastodonResult Context)
| Unreblogged (MastodonResult Status)
type SearchMsg
= SubmitSearch
| UpdateSearch String
type WebSocketMsg
= NewWebsocketGlobalMessage String
| NewWebsocketLocalMessage String
| NewWebsocketUserMessage String
type KeyEvent
= KeyUp
| KeyDown
type Msg
= AddFavorite Status
2017-05-12 20:41:11 +00:00
| AskConfirm String Msg Msg
2017-05-29 14:28:01 +00:00
| Back
| Block Account
| ClearError Int
2017-05-12 20:41:11 +00:00
| ConfirmCancelled Msg
| Confirmed Msg
| DeleteStatus StatusId
| DraftEvent DraftMsg
2017-04-30 10:15:33 +00:00
| FilterNotifications NotificationFilter
| FollowAccount Account
| KeyMsg KeyEvent Keyboard.KeyCode
2017-05-12 20:03:52 +00:00
| LogoutClient Client
| TimelineLoadNext String String
| MastodonEvent MastodonMsg
| Mute Account
2017-05-29 14:28:01 +00:00
| Navigate String
| NoOp
| OpenThread Status
| ReblogStatus Status
| Register
| RemoveFavorite Status
| ScrollColumn ScrollDirection String
| SearchEvent SearchMsg
| ServerChange String
| SubmitDraft
| SwitchClient Client
| Tick Time
| UnfollowAccount Account
| Unblock Account
| Unmute Account
| UnreblogStatus Status
| UrlChange Navigation.Location
| ViewerEvent ViewerMsg
| WebSocketEvent WebSocketMsg
2017-05-29 14:28:01 +00:00
type alias AccountInfo =
{ account : Maybe Account
2021-01-12 06:08:43 +00:00
, pins : List Status
2017-05-29 14:28:01 +00:00
, timeline : Timeline Status
, followers : Timeline Account
, following : Timeline Account
, relationships : List Relationship
, relationship : Maybe Relationship
}
2017-05-12 20:41:11 +00:00
type alias Confirm =
{ message : String
, onConfirm : Msg
, onCancel : Msg
}
type CurrentView
= -- Basically, what we should be displaying in the fourth column
2017-05-29 14:28:01 +00:00
AccountView CurrentAccountView
| AccountSelectorView
| BlocksView
| FavoriteTimelineView
| GlobalTimelineView
| HashtagView String
| LocalTimelineView
| MutesView
| SearchView
| ThreadView Thread
2017-05-29 14:28:01 +00:00
type CurrentAccountView
= AccountStatusesView
2021-01-12 04:20:35 +00:00
| AccountStatusesRepliesView
2017-05-29 14:28:01 +00:00
| AccountFollowersView
| AccountFollowingView
type alias Draft =
{ status : String
, inReplyTo : Maybe Status
, spoilerText : Maybe String
, sensitive : Bool
, visibility : String
2017-05-11 08:55:15 +00:00
, attachments : List Attachment
2017-05-11 10:23:10 +00:00
, mediaUploading : Bool
, statusLength : Int
-- Autocomplete values
, autoState : Autocomplete.State
, autoCursorPosition : Int
, autoAtPosition : Maybe Int
, autoQuery : String
, autoMaxResults : Int
, autoAccounts : List Account
, showAutoMenu : Bool
}
2017-04-30 09:46:51 +00:00
type NotificationFilter
= NotificationAll
| NotificationOnlyMentions
| NotificationOnlyDirect
2017-04-30 09:46:51 +00:00
| NotificationOnlyBoosts
| NotificationOnlyFavourites
| NotificationOnlyFollows
type ScrollDirection
= ScrollTop
| ScrollBottom
type alias Search =
{ term : String
, results : Maybe SearchResults
}
type alias Thread =
2017-05-29 14:28:01 +00:00
{ status : Maybe Status
, context : Maybe Context
}
type alias Viewer =
{ attachments : List Attachment
, attachment : Attachment
}
type alias Timeline a =
{ id : String
, entries : List a
, links : Links
2017-05-06 09:38:56 +00:00
, loading : Bool
}
type alias ErrorNotification =
{ message : String
, time : Time
}
type alias Model =
{ server : String
, currentTime : Time
, registration : Maybe AppRegistration
, clients : List Client
2017-05-06 09:15:52 +00:00
, homeTimeline : Timeline Status
, localTimeline : Timeline Status
, globalTimeline : Timeline Status
, favoriteTimeline : Timeline Status
, hashtagTimeline : Timeline Status
, mutes : Timeline Account
, blocks : Timeline Account
2017-05-29 14:28:01 +00:00
, accountInfo : AccountInfo
, notifications : Timeline NotificationAggregate
, draft : Draft
, errors : List ErrorNotification
, location : Navigation.Location
, viewer : Maybe Viewer
, currentUser : Maybe Account
, currentView : CurrentView
2017-04-30 09:46:51 +00:00
, notificationFilter : NotificationFilter
2017-05-12 20:41:11 +00:00
, confirm : Maybe Confirm
, search : Search
, ctrlPressed : Bool
}
type alias InputInformation =
{ status : String
, selectionStart : Int
}