Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Floofchat with ArmoredChat #961

Merged
merged 33 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
002fdf0
Initial Commit.
Armored-Dragon May 17, 2024
0d5eb93
Added Settings.
Armored-Dragon May 18, 2024
7b50f91
Clear already logged messages.
Armored-Dragon May 18, 2024
66fd217
Maximum messages setting.
Armored-Dragon May 21, 2024
391a33d
Fixed saved date on messages.
Armored-Dragon May 21, 2024
c48e9d3
Clickable links.
Armored-Dragon May 22, 2024
2a42bce
Minor formatting adjustments.
Armored-Dragon May 22, 2024
9d9b57d
Fix notification width.
Armored-Dragon May 22, 2024
7920610
README
Armored-Dragon May 22, 2024
9bf5f3d
Linking fix.
Armored-Dragon May 22, 2024
86f8e29
Quick Message hotbar.
Armored-Dragon May 23, 2024
0bc11e8
Fix for #975 sticky keys.
Armored-Dragon May 23, 2024
1cddc5a
Added message padding.
Armored-Dragon May 23, 2024
ed3e629
Image embedding.
Armored-Dragon May 23, 2024
0a7b64d
Prevent VR quick_message bar.
Armored-Dragon May 23, 2024
c1e5115
Updated README.
Armored-Dragon May 23, 2024
7ef3322
Moved system chat to script-archive.
Armored-Dragon May 23, 2024
c734e0d
Updated Readme.
Armored-Dragon May 25, 2024
60a4662
Updated URL regex.
Armored-Dragon May 25, 2024
8301bfd
Added development manual.
Armored-Dragon May 26, 2024
82605c5
Scroll to bottom on launch.
Armored-Dragon May 27, 2024
01306b3
Scroll to bottom when changing page.
Armored-Dragon May 27, 2024
7fc1a3d
Fixed scrolling too far.
Armored-Dragon Jun 8, 2024
eb84de8
Corrected case on variables.
Armored-Dragon Jun 8, 2024
192d80a
Floofchat compatibility.
Armored-Dragon Jun 8, 2024
7e100a1
Raise VR Keyboard when textfield is selected
Armored-Dragon Jun 28, 2024
2012cce
Merge branch 'master' into ArmoredChat
Armored-Dragon Jun 29, 2024
ce79cc8
Merge branch 'overte-org:master' into ArmoredChat
Armored-Dragon Jun 30, 2024
c6d2e56
Fix keyboard being invoked when not in VR.
Armored-Dragon Jul 6, 2024
6cf6e6c
Disallow all text formatting by default.
Armored-Dragon Jul 8, 2024
252b33b
Removed commented code.
Armored-Dragon Jul 8, 2024
fe46258
Sanity check on message channel.
Armored-Dragon Jul 9, 2024
9964d91
Fixed message subscription.
Armored-Dragon Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/system/chat.js → script-archive/systemChat/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// By Don Hopkins ([email protected]) on May 5th, 2017
// Copyright 2017 High Fidelity, Inc.
// Copyright 2023 Overte e.V.
// Copyright 2024 Overte e.V.
//
//
// Distributed under the Apache License, Version 2.0.
Expand All @@ -13,7 +13,7 @@

(function() {

var webPageURL = Script.resolvePath("html/ChatPage.html"); // URL of tablet web page.
var webPageURL = Script.resolvePath("ChatPage.html"); // URL of tablet web page.
var randomizeWebPageURL = true; // Set to true for debugging.
var lastWebPageURL = ""; // Last random URL of tablet web page.
var onChatPage = false; // True when chat web page is opened.
Expand Down
205 changes: 205 additions & 0 deletions scripts/communityScripts/armored-chat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# Armored Chat

1. What is Armored Chat
2. User manual
- Installation
- Settings
- Usability tips
3. Development

## What is Armored Chat

Armored Chat is a chat application strictly made to communicate between players in the same domain. It is made using QML and to be as light weight as reasonably possible.

### Dependencies

AC uses the Overte [Messages](https://apidocs.overte.org/Messages.html) API to communicate.

For notifications, AC uses [notificationCore.js](https://github.com/overte-org/overte/blob/bb8bac43eadd3b20956a2ff7b0b21c28844b0f77/scripts/communityScripts/notificationCore/notificationCore.js).

## User manual

### Installation

Armored Chat is preinstalled courtesy of [defaultScripts.js](https://github.com/overte-org/overte/blob/8661e8a858663b48e8485c2cd7120dc3e2d7b87e/scripts/defaultScripts.js).

If AC is not preinstalled, or for some other reason it can not be automatically installed, you can install it manually by following [these instructions](https://github.com/overte-org/overte/blob/8661e8a858663b48e8485c2cd7120dc3e2d7b87e/scripts/defaultScripts.js) to open your script management application, and loading the script url:

```
https://raw.githubusercontent.com/overte-org/overte/master/scripts/communityScripts/armored-chat/armored_chat.js
```

---

### Settings

Armored Chat comes with basic settings for managing itself.

#### External window

This boolean setting toggles whether AC will be a in-game overlay window, or whether AC will be a external floating window.

Default is `false`.

#### Maximum saved messages

This integer represents the amount of messages to save in the AC history. More messages may be present if AC is left on long enough. This setting only sets the number of saved messages and not the maximum amount of messages that can be viewed at any time.

This means if you set the value to `5`, your history will save a maximum of 5 messages, however you will still be able to see a longer history in the session should you receive more. Once AC completely closes and fetches your message history as it initializes, you will only see the last 5 messages.

Default value is `200`

#### Erase chat history

This action immediately clears the AC history and the session. Functionally this will set the message list to a empty Array.

### Usage

AC has two chat modes: Local, and Domain. Local chat displays all other local chat messages that are within 20 units of you. Domain chat will display all other Domain messages sent though that channel regardless of distance.

AC also handles link embedding. When you send an HTTP(S) link, it will automatically parse it using Qt RichText and allow everyone to click on the message. Next to the link you will also see a "⮺" symbol. Clicking on this symbol will open the link in an external window.

### Usability tips

#### Navigation

You can scroll quickly using kinetic scrolling! Try "grabbing" the right side of messages, where the timestamp is, and flinging yourself in a direction.

#### Formatting

You can format messages using basic HTML elements. Try `<div style="color: red"> Red text! </div>` to color your text red.
Find the full list of Qt rich text tags [here](https://doc.qt.io/qt-6/richtext-html-subset.html). Please note that some of these tags may be intentionally restricted.

#### Media embedding

Images can be embedded when linked directly.

Try it out by linking to the Overte logo! `https://github.com/overte-org/overte/raw/master/interface/resources/images/brand-banner.svg`

In order for images to be embedded, URLs must end in a image filetype.
Supported filetypes are:

- `.png`
- `.jpg`
- `.jpeg`
- `.gif`
- `.bmp`
- `.svg`
- `.webp`

## Development

### To QML communication

Here are the signals needed to communicate from the JavaScript core to the QML interface.

AC calls a `_emitEvent()` function that also includes a `type` key in the object. This `type` tells the QML and/or the JS core what the packet is for.
When you call the `_emitEvent()` function be sure to include the following signals as a `type`. In the examples below, the `type` is being excluded for brevity.

Example:

```json
{ type: "show_message", displayName: "username", ...}
```

#### "show_message"

This signal tells the QML to add a new message to the ListView element list.

Supply a `JSON` object.

```json
{
"displayName": "username",
"message": "chat message",
"channel": "domain", // Channel to send message on. By default it should only be "domain" or "local".
"date": "[ time and date string ]" // Optional, defaults to current time and date.
}
```

#### "clear_messages"

Clear all messages displayed in the ListView elements. Note this does not clear the history and this is only a visual erasure.

No payload required.

#### "notification"

Renders a notification to the domain channel.
The intended use is to provide updates about the domain and make the notifications accessible.

Supply a `JSON` object.

```json
{
"message": "notification message" // Notification to render
}
```

#### "initial_settings"

Visually set the settings in the QML interface based on the supplied object.

Supply a `JSON` object.

```json
{
"settings": {
// JSON object of current AC settings
"external_window": false,
"maximum_messages": 200
}
}
```

### To JS communication

Here are the signals needed to communicate from the QML interface to the JavaScript core. AC is developed in a way that all actions that are not style related are preformed though the JavaScript core.
This means that what ever action you want to preform must go though the JavaScript core for processing.

This is formatted the same was as the communication packets to the QML interface. Supply the following entries as "type"s in your packet.

#### "send_message"

Tell AC to broadcast a message to the domain.

Supply a `JSON` object.

```json
{
"message": "message content", // The contents of the message to send.
"channel": "domain" // Channel to emit the message to.
}
```

#### "setting_change"

Tell AC to change a setting. Exercise caution when using this as you can add new settings unintentionally if you are not careful.

Supply a `JSON` object

```json
{
"setting": "external_window", // The name of the setting to change
"value": true // The value to change the setting to
}
```

#### "action"

Tell AC to preform a generic action. This is normally reserved for functions that would get called on a button onClicked event in the QML.

Supply a `JSON` object

```json
{
"action": "erase_history" // The action to preform
}
```

#### "initialized"

Tell AC the QML overlay has loaded successfully.
This is called to hide the overlay on creation.

No payload required.
Loading
Loading