Skip to content

Commit

Permalink
add support for desktop app
Browse files Browse the repository at this point in the history
  • Loading branch information
smpallen99 committed Mar 26, 2018
1 parent 4f627f5 commit e54cd56
Show file tree
Hide file tree
Showing 12 changed files with 332 additions and 100 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# InfinityOne Changelog

## 1.0.0.beta6 (2018-03-xx)
## 1.0.0.beta8 (2018-03-xx)

### Enhancements

* Add support for the upcoming desktop app
* Fix exception in notification JS
* Add page_params for the desktop app
* Add couple new help pages for the desktop app - WIP

### Bug Fixes

## 1.0.0.beta6 (2018-03-19)

## Enhancements

Expand Down
11 changes: 8 additions & 3 deletions assets/js/notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ OneChat.on_load(function(one_chat) {
class Notifier {
constructor(one_chat) {
this.one_chat = one_chat;
Notification.requestPermission().then(function(result) {
console.log('request permissions', result);
});
let promise = Notification.requestPermission();
if (promise) {
promise.then(function(result) {
console.log('request permissions', result);
});
} else {
console.log('no promise returned');
}
this.useNewNotification = this.supportsNewNofification();
}

Expand Down
6 changes: 6 additions & 0 deletions assets/js/one_chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,9 @@ require('./chan_room')
require('./messages')

import * as cc from "./chat_channel"

window.page_params = {
default_language: "en",
default_language_name: "English",
ucxchat: ucxchat,
};
40 changes: 29 additions & 11 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
use Mix.Config

# General application configuration
config :infinity_one,
ecto_repos: [InfinityOne.Repo]
config :infinity_one, ecto_repos: [InfinityOne.Repo]

# Configures the endpoint
config :infinity_one, InfinityOneWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "wsFrikxHW07+ALSOPyI681jvpAdnRTQHyrfCwfd0gQlIEfqKegAvSGTVnaTzVSqH",
render_errors: [view: InfinityOneWeb.ErrorView, accepts: ~w(html json)],
pubsub: [name: InfinityOneWeb.PubSub,
adapter: Phoenix.PubSub.PG2]
pubsub: [name: InfinityOneWeb.PubSub, adapter: Phoenix.PubSub.PG2]

# Configures Elixir's Logger
config :logger, :console,
Expand All @@ -25,7 +23,8 @@ config :logger, :console,
config :infinity_one, :generators,
migration: true,
binary_id: true
# sample_binary_id: "11111111-1111-1111-1111-111111111111"

# sample_binary_id: "11111111-1111-1111-1111-111111111111"

# The example below replaces [UCX-123] with
# [UCX-123](https://emetrotel.atlassian.net/browse/UCX-123) before
Expand All @@ -45,14 +44,14 @@ config :infinity_one, :settings_modules, [
OneChat.Settings.FileUpload,
OneChat.Settings.Layout,
OneChat.Settings.Message,
OneWebrtc.Settings.Webrtc,
OneWebrtc.Settings.Webrtc
]

config :phoenix, :template_engines,
# haml: PhoenixHaml.Engine,
slim: PhoenixSlime.Engine,
slime: PhoenixSlime.Engine,
md: PhoenixMarkdown.Engine
md: PhoenixMarkdown.Engine

# %% Coherence Configuration %% Don't remove this line
config :coherence,
Expand All @@ -70,12 +69,24 @@ config :coherence,
layout: {InfinityOneWeb.Coherence.LayoutView, "app.html"},
email_from_name: {:system, "COH_NAME"},
email_from_email: {:system, "COH_EMAIL"},
opts: [:rememberable, :invitable, :authenticatable, :recoverable, :lockable, :trackable, :unlockable_with_token, :confirmable, :registerable]
# opts: [:rememberable, :invitable, :authenticatable, :recoverable, :lockable, :trackable, :unlockable_with_token, :confirmable, :registerable]
opts: [
:rememberable,
:invitable,
:authenticatable,
:recoverable,
:lockable,
:trackable,
:unlockable_with_token,
:confirmable,
:registerable
]

# opts: [:rememberable, :invitable, :authenticatable, :recoverable, :lockable, :trackable, :unlockable_with_token, :confirmable, :registerable]

config :coherence, InfinityOneWeb.Coherence.Mailer,
adapter: Swoosh.Adapters.Sendgrid,
api_key: {:system, "SENDGRID_API_KEY"}

# %% End Coherence Configuration %%

config :slime, :keep_lines, true
Expand All @@ -88,12 +99,19 @@ config :distillery,
:postgrex
]

config :phoenix_markdown,
earmark: %{
gfm: true,
breaks: true
},
server_tags: :all

import_config("../plugins/*/config/config.exs")

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"
import_config "#{Mix.env()}.exs"

if File.exists? Path.join("config", "unbrella.exs") do
if File.exists?(Path.join("config", "unbrella.exs")) do
import_config Path.join("config", "unbrella.exs")
end
9 changes: 9 additions & 0 deletions lib/infinity_one_web/controllers/help_controller.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule InfinityOneWeb.HelpController do
use InfinityOneWeb, :controller

plug(:put_layout, false)

def index(conn, _params) do
render(conn, "index.html")
end
end
57 changes: 29 additions & 28 deletions lib/infinity_one_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,55 @@ defmodule InfinityOneWeb.Router do
use Coherence.Router

pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug InfinityOne.Plugs.Setup
plug Coherence.Authentication.Session
plug(:accepts, ["html", "md"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:protect_from_forgery)
plug(:put_secure_browser_headers)
plug(InfinityOne.Plugs.Setup)
plug(Coherence.Authentication.Session)
end

pipeline :protected do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug InfinityOne.Plugs.Setup
plug Coherence.Authentication.Session, protected: true
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:protect_from_forgery)
plug(:put_secure_browser_headers)
plug(InfinityOne.Plugs.Setup)
plug(Coherence.Authentication.Session, protected: true)
end

pipeline :api do
plug :accepts, ["json"]
plug(:accepts, ["json"])
end

scope "/", InfinityOneWeb do
pipe_through :browser
get "/landing", LandingController, :index
scope "/", InfinityOneWeb do
pipe_through(:browser)
get("/landing", LandingController, :index)
get("/help", HelpController, :index)
coherence_routes()
end

scope "/", InfinityOneWeb do
pipe_through :protected
scope "/", InfinityOneWeb do
pipe_through(:protected)

get "/logout", Coherence.SessionController, :delete
coherence_routes :protected
get("/logout", Coherence.SessionController, :delete)
coherence_routes(:protected)
end


scope "/", OneChatWeb do
pipe_through :protected # Use the default browser stack
# Use the default browser stack
pipe_through(:protected)

get "/", ChannelController, :page
get "/phone", MasterController, :phone
get("/", ChannelController, :page)
get("/phone", MasterController, :phone)
end

scope "/", OneBackupRestoreWeb do
pipe_through :protected
pipe_through(:protected)

post "/upload_backup", UploadController, :create
post("/upload_backup", UploadController, :create)
end

# The following is a prototype of an API implementation. It is basically
Expand Down
119 changes: 119 additions & 0 deletions lib/infinity_one_web/templates/help/desktop-app-install-guide.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Installing the InfinityOne desktop app

InfinityOne on your macOS, Windows, or Linux desktop is even better than
InfinityOne on the web, with a cleaner look, tray/dock integration, native
notifications, and support for multiple InfinityOne accounts.

To install the latest stable release (recommended for most users),
find your operating system below. If you're interested in an early
look at the newest features, consider the [beta releases](#beta-releases).

<!-- This heading is linked to directly from /apps; change with caution -->
## Installing on macOS

### Disk image (recommended)
<!-- TODO why zip? -->

1. Download [InfinityOne-x.x.x.dmg][latest]
2. Open the file, and drag the app into the `Applications` folder
3. Done!
4. The app will update automatically to future versions.

### Homebrew

If you have Homebrew installed and prefer to use it, here's how.

1. Run `brew cask install infinityone` in your terminal
2. Done! Run InfinityOne from `Applications`. <!-- TODO fact check -->
3. The app will update automatically to future versions.
(`brew upgrade` will also work, if you prefer.)

<!-- This heading is linked to directly from /apps; change with caution -->
## Installing on Windows

### Installer (recommended)

1. Download and run [InfinityOne-Web-Setup-x.x.x.exe][latest]
2. The installer will download and install the app.
3. Done! Run InfinityOne from the Start menu.
4. The app will update automatically to future versions.

### Offline installer (for isolated networks)

1. Download [infinityone-x.x.x-x64.nsis.7z][latest] for 64-bit desktops
(common), or [infinityone-x.x.x-ia32.nsis.7z][latest] for 32-bit (rare).
2. Copy the installer file to the machine you want to install the app
on, and run it there.
3. Done! Run InfinityOne from the Start menu.
4. The app will NOT update automatically. You can repeat these steps
to upgrade to future versions. <!-- TODO fact check -->

<!-- This heading is linked to directly from /apps; change with caution -->
## Installing on Linux

### apt (recommended for Ubuntu or Debian 8+)

1. Set up the InfinityOne Desktop apt repository and its signing key, from a
terminal:

sudo apt-key adv --keyserver pool.sks-keyservers.net --recv 69AD12704E71A4803DCA3A682424BE5AE9BD10D9
echo "deb https://dl.bintray.com/infinityone/debian/ stable main" | \
sudo tee -a /etc/apt/sources.list.d/infinityone.list

2. Install the client, from a terminal:

sudo apt update
sudo apt install infinityone

3. Done! Run InfinityOne from your app launcher, or with `infinityone` from a
terminal.
4. The app will be updated automatically to future versions when
you do a regular software update on your system, e.g. with
`sudo apt update && sudo apt upgrade`.

### AppImage (recommended for all other distros)

1. Download [InfinityOne-x.x.x-x86_64.AppImage][latest]
2. Make the file executable, with
`chmod a+x InfinityOne-x.x.x-x86_64.AppImage` from a terminal.
3. Done! No installer necessary; this file is the InfinityOne app. Run it
from your app launcher, or from a terminal.
3. The app will NOT update automatically. You can repeat these steps
to upgrade to future versions.

<!-- TODO why dpkg? -->

# Beta releases

Get a peek at new features before they're released! If you'd like to
be among the first to get new features in the InfinityOne desktop app, and
to give the InfinityOne developers feedback to help make each stable release
the best it can be, then you might like the beta releases.

## Installing on macOS, Windows, or Linux with AppImage

Start by finding the latest version marked "Pre-release" on the
[release list page][release-list]. Then follow the instructions
above, except download the InfinityOne installer or app from that version
instead of from the latest stable release.

## Installing on Linux with apt

Follow the instructions above, except in the step involving
`/etc/apt/sources.list.d/infinityone.list`, write "beta" instead of
"stable".

If you already have the stable version installed: edit that file, with
this command in a terminal:
```
sudo sed -i s/stable/beta/ /etc/apt/sources.list.d/infinityone.list
```
and repeat the next step:
```
sudo apt update
sudo apt install infinityone
```


[latest]: https://github.com/infinityoneframework/infinityone-electron/releases/latest
[release-list]: https://github.com/infinityoneframework/infinityone-electron/releases
3 changes: 3 additions & 0 deletions lib/infinity_one_web/templates/help/include/sidebar.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Apps
* [Desktop installation guides](/help/desktop-app-install-guide)
* [Tips for Zulip on Windows](/help/zulip-on-windows)
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

## Overview

{!sidebar.html!}

23 changes: 23 additions & 0 deletions lib/infinity_one_web/templates/help/infinityone-on-windows.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Using InfinityOne on Windows

InfinityOne has a Windows client, compatible with Windows versions 7, 8 and 10; it is identical in
functionality to the InfinityOne web application. The client
can be download through the [InfinityOne website](https://infintiyoneframework.org/).

The client is regularly updated and is a wrapper of the web application, but with enhanced
notifications and can run in the background. The current version does not contain
any significant features additional to those in the web application.

!!! warn ""
**Note:** Since InfinityOne is no longer running on a browser, many external keyboard shortcuts
endemic to a browser will no longer work, for example, ALT-LEFT to go back to the previous page.

## Connecting to a server

When you open the InfinityOne client for the first time, you will come across a screen
asking for your organizations's server address on InfinityOne. Enter your organization's
address and press the **Connect** button.

!!! warn ""
There's no need to add `https://` in the case that your server is running a secure
HTTP (HTTPS) protocol.
Loading

0 comments on commit e54cd56

Please sign in to comment.