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