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
|
|
|
|
| UpdateSensitive Bool
|
|
|
|
| UpdateSpoiler String
|
|
|
|
| UpdateVisibility String
|
|
|
|
| UpdateReplyTo Status
|
2017-05-01 16:10:34 -04:00
|
|
|
| SelectAccount String
|
2017-04-29 12:05:06 -04:00
|
|
|
| ToggleSpoiler Bool
|
2017-05-01 16:10:34 -04:00
|
|
|
| UpdateInputInformation InputInformation
|
|
|
|
| ResetAutocomplete Bool
|
2017-05-06 10:00:00 -04:00
|
|
|
| CloseAutocomplete
|
2017-05-01 16:10:34 -04:00
|
|
|
| SetAutoState Autocomplete.Msg
|
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)
|
|
|
|
| AccountFollowed (MastodonResult Relationship)
|
2017-05-08 06:22:20 -04:00
|
|
|
| AccountFollowers Bool (MastodonResult (List Account))
|
|
|
|
| AccountFollowing Bool (MastodonResult (List Account))
|
2017-05-05 11:26:49 -04:00
|
|
|
| AccountReceived (MastodonResult Account)
|
|
|
|
| AccountRelationship (MastodonResult (List Relationship))
|
|
|
|
| AccountRelationships (MastodonResult (List Relationship))
|
|
|
|
| AccountTimeline Bool (MastodonResult (List Status))
|
|
|
|
| AccountUnfollowed (MastodonResult Relationship)
|
|
|
|
| AppRegistered (MastodonResult AppRegistration)
|
|
|
|
| AutoSearch (MastodonResult (List Account))
|
|
|
|
| ContextLoaded Status (MastodonResult Context)
|
|
|
|
| CurrentUser (MastodonResult Account)
|
|
|
|
| FavoriteAdded (MastodonResult Status)
|
|
|
|
| FavoriteRemoved (MastodonResult Status)
|
|
|
|
| GlobalTimeline Bool (MastodonResult (List Status))
|
|
|
|
| LocalTimeline Bool (MastodonResult (List Status))
|
2017-05-05 17:35:54 -04:00
|
|
|
| Notifications Bool (MastodonResult (List Notification))
|
2017-05-05 11:26:49 -04:00
|
|
|
| Reblogged (MastodonResult Status)
|
|
|
|
| StatusDeleted (MastodonResult Int)
|
|
|
|
| StatusPosted (MastodonResult Status)
|
|
|
|
| Unreblogged (MastodonResult Status)
|
2017-05-06 05:15:52 -04:00
|
|
|
| HomeTimeline Bool (MastodonResult (List Status))
|
2017-04-29 12:05:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
type WebSocketMsg
|
|
|
|
= NewWebsocketGlobalMessage String
|
|
|
|
| NewWebsocketLocalMessage String
|
|
|
|
| NewWebsocketUserMessage String
|
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
|
|
|
= AddFavorite Int
|
2017-05-05 17:36:16 -04:00
|
|
|
| ClearError Int
|
2017-04-29 12:05:06 -04:00
|
|
|
| CloseAccount
|
2017-05-09 12:43:12 -04:00
|
|
|
| CloseAccountSelector
|
2017-04-29 12:05:06 -04:00
|
|
|
| CloseThread
|
|
|
|
| DeleteStatus Int
|
|
|
|
| DraftEvent DraftMsg
|
2017-04-30 06:15:33 -04:00
|
|
|
| FilterNotifications NotificationFilter
|
2017-04-29 16:48:55 -04:00
|
|
|
| FollowAccount Int
|
2017-04-29 12:05:06 -04:00
|
|
|
| LoadAccount Int
|
2017-05-05 17:35:54 -04:00
|
|
|
| TimelineLoadNext String String
|
2017-04-29 12:05:06 -04:00
|
|
|
| MastodonEvent MastodonMsg
|
|
|
|
| NoOp
|
|
|
|
| OpenThread Status
|
2017-05-09 12:43:12 -04:00
|
|
|
| OpenAccountSelector
|
2017-04-29 12:05:06 -04:00
|
|
|
| ReblogStatus Int
|
|
|
|
| Register
|
|
|
|
| RemoveFavorite Int
|
2017-04-30 05:08:30 -04:00
|
|
|
| ScrollColumn ScrollDirection String
|
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-04-29 16:48:55 -04:00
|
|
|
| UnfollowAccount Int
|
2017-04-29 12:05:06 -04:00
|
|
|
| UrlChange Navigation.Location
|
|
|
|
| UseGlobalTimeline Bool
|
|
|
|
| UnreblogStatus Int
|
|
|
|
| ViewAccountFollowing Account
|
|
|
|
| ViewAccountFollowers Account
|
|
|
|
| ViewAccountStatuses Account
|
|
|
|
| ViewerEvent ViewerMsg
|
|
|
|
| WebSocketEvent WebSocketMsg
|
|
|
|
|
|
|
|
|
2017-04-30 05:08:30 -04:00
|
|
|
type CurrentView
|
|
|
|
= -- Basically, what we should be displaying in the fourth column
|
2017-05-08 06:22:20 -04:00
|
|
|
AccountFollowersView Account (Timeline Account)
|
|
|
|
| AccountFollowingView Account (Timeline Account)
|
2017-04-30 05:08:30 -04:00
|
|
|
| AccountView Account
|
2017-05-09 12:43:12 -04:00
|
|
|
| AccountSelectorView
|
2017-04-30 05:08:30 -04:00
|
|
|
| GlobalTimelineView
|
|
|
|
| LocalTimelineView
|
|
|
|
| ThreadView Thread
|
|
|
|
|
|
|
|
|
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-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
|
|
|
|
| NotificationOnlyBoosts
|
|
|
|
| NotificationOnlyFavourites
|
|
|
|
| NotificationOnlyFollows
|
|
|
|
|
|
|
|
|
2017-04-30 05:08:30 -04:00
|
|
|
type ScrollDirection
|
|
|
|
= ScrollTop
|
|
|
|
| ScrollBottom
|
|
|
|
|
|
|
|
|
2017-04-29 12:05:06 -04:00
|
|
|
type alias Thread =
|
|
|
|
{ status : Status
|
|
|
|
, context : Context
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
, accountTimeline : Timeline Status
|
2017-05-08 06:22:20 -04:00
|
|
|
, accountFollowers : Timeline Account
|
|
|
|
, accountFollowing : Timeline Account
|
2017-04-29 16:48:55 -04:00
|
|
|
, accountRelationships : List Relationship
|
|
|
|
, accountRelationship : Maybe Relationship
|
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
|
|
|
|
, useGlobalTimeline : Bool
|
|
|
|
, viewer : Maybe Viewer
|
|
|
|
, currentUser : Maybe Account
|
|
|
|
, currentView : CurrentView
|
2017-04-30 05:46:51 -04:00
|
|
|
, notificationFilter : NotificationFilter
|
2017-04-29 12:05:06 -04:00
|
|
|
}
|
2017-05-01 16:10:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
type alias InputInformation =
|
|
|
|
{ status : String
|
|
|
|
, selectionStart : Int
|
|
|
|
}
|