forked from gujjwal00/avnc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Architecture.kt
129 lines (126 loc) · 5.08 KB
/
Architecture.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* Copyright (c) 2021 Gaurav Ujjwal.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
* See COPYING.txt for more details.
*/
package com.gaurav.avnc
import com.gaurav.avnc.model.ServerProfile
import com.gaurav.avnc.model.db.MainDb
import com.gaurav.avnc.ui.about.AboutActivity
import com.gaurav.avnc.ui.home.HomeActivity
import com.gaurav.avnc.ui.home.ServerTabs
import com.gaurav.avnc.ui.home.UrlBarActivity
import com.gaurav.avnc.ui.prefs.PrefsActivity
import com.gaurav.avnc.ui.vnc.Dispatcher
import com.gaurav.avnc.ui.vnc.FrameState
import com.gaurav.avnc.ui.vnc.FrameView
import com.gaurav.avnc.ui.vnc.ConfirmationDialog
import com.gaurav.avnc.ui.vnc.LoginFragment
import com.gaurav.avnc.ui.vnc.VirtualKeys
import com.gaurav.avnc.ui.vnc.VncActivity
import com.gaurav.avnc.viewmodel.HomeViewModel
import com.gaurav.avnc.viewmodel.PrefsViewModel
import com.gaurav.avnc.viewmodel.VncViewModel
import com.gaurav.avnc.viewmodel.service.Discovery
import com.gaurav.avnc.viewmodel.service.SshTunnel
import com.gaurav.avnc.vnc.Messenger
import com.gaurav.avnc.vnc.VncClient
/**
* This is a brain dump of the design & architecture of this app.
*
*
* Overview
* ========
*
* There are three main layers:
*
*- +---------------------------------------------------------------------------------------------------------------+
*- UI
*-
*- +------------------+ +------------------+ +------------------+ +------------------+
*- | [HomeActivity] | | [VncActivity] | | [PrefsActivity] | | [AboutActivity] |
*- +--------+---------+ +--------+---------+ +--------+---------+ +------------------+
*- | | |
*- | | |
*- +------------------------|-------------------------|-------------------------|----------------------------------+
*- ViewModel | | |
*- v v v
*- +------------------+ +------------------+ +------------------+
*- | [HomeViewModel] | | [VncViewModel] | | [PrefsViewModel] |
*- +------------------+ +------------------+ +------------------+
*- A A +--------------+
*- | | | Services |
*- | | +--------------+
*- +------------------------|-------------------------|------------------------------------------------------------+
*- Model & Client | |
*- V V
*- +------------------+ +------------------+
*- | [ServerProfile] | | [VncClient] |
*- | | | |
*- | Database | | LibVNCClient |
*- +------------------+ +------------------+
*-
*- +---------------------------------------------------------------------------------------------------------------+
*
*
* Home
* ====
*
* [HomeActivity] is the main activity of the app. Components:
*
* - A urlbar, which launches [UrlBarActivity], allowing user to quickly connect
* to a server without creating a profile for it.
*
* - Lists of saved & discovered servers, in [ServerTabs].
*
* - Profile editors used for creating/editing [ServerProfile].
*
*
* VNC UI
* ======
*
* [VncActivity] is responsible for driving the connection to VNC server.
*
* - [FrameView] renders the VNC framebuffer on screen.
* - [FrameState] maintains information related to framebuffer rendering,
* like zoom, pan etc.
*
* - See [Dispatcher] for overview of input handling.
* - [VirtualKeys] are used for keys not normally found on Android Keyboards.
*
*
* VNC Connection
* ==============
*
* - Connection to VNC server is managed by [VncViewModel], using [VncClient].
* - [VncClient] is a wrapper around native `rfbClient` from LibVNCClient.
*
* - [LoginFragment] is used to ask username & password from user.
* - [SshTunnel] is used to create a SSH tunnel, which can be used for connection.
* - [ConfirmationDialog] is used to verify unknown SSH hosts and X509 certs with user.
* -
* - [Messenger] is used to send events to VNC server.
*
*
* Database
* ========
*
* We use a Room Database, [MainDb], to save list of servers.
* Servers are modeled by the [ServerProfile] entity.
*
*
* Services
* ========
*
* These are sort-of standalone components which perform a particular task:
*
* - Server discovery ([Discovery])
* - SSH Tunnel ([SshTunnel])
* - Import/Export (in [PrefsViewModel])
*
* Note: These are NOT Android Services (these are called services for lack of a better word).
*/
private fun avnc() {
}