SyncSlides: Initial repo setup for the Flutter version of
SyncSlides presentation application.
MultiPart: 2/2
Change-Id: I7bcb0df499b7c50bf073dcc5bcb3de45fb6621e1
diff --git a/.gitignore b/.gitignore
index 4209dc0..f1f400e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,6 @@
/.jiri
+/.pub
+/packages
+.packages
+snapshot_blob.bin
+app.flx
\ No newline at end of file
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..574583c
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,9 @@
+# This is the official list of Vanadium authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS files.
+# See the latter for an explanation.
+
+# Names should be added to this file as:
+# Name or Organization <email address>
+# The email address is not required for organizations.
+
+# Please keep the list sorted.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..69f169c
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,23 @@
+# Contributing to Vanadium
+
+Vanadium is an open source project.
+
+It is the work of many contributors. We appreciate your help!
+
+## Filing issues
+
+We use a single GitHub repository for [tracking all
+issues](https://github.com/vanadium/issues/issues) across all Vanadium
+repositories.
+
+## Contributing code
+
+Please read the [contribution
+guidelines](https://github.com/vanadium/docs/blob/master/contributing/README.md)
+before sending patches.
+
+**We do not accept GitHub pull requests.** (We use
+[Gerrit](https://www.gerritcodereview.com/) instead for code reviews.)
+
+Unless otherwise noted, the Vanadium source files are distributed under the
+BSD-style license found in the LICENSE file.
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
new file mode 100644
index 0000000..411d2df
--- /dev/null
+++ b/CONTRIBUTORS
@@ -0,0 +1,11 @@
+# People who have agreed to one of the CLAs and can contribute patches.
+# The AUTHORS file lists the copyright holders; this file
+# lists people. For example, Google employees are listed here
+# but not in AUTHORS, because Google holds the copyright.
+#
+# https://developers.google.com/open-source/cla/individual
+# https://developers.google.com/open-source/cla/corporate
+#
+# Names should be added to this file as:
+# Name <email address>
+Ali Ghassemi <aghassemi@google.com>
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..411db13
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2015 The Vanadium Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..c3ef734
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,10 @@
+packages:
+ pub upgrade
+
+run: packages
+ pub run sky_tools build && pub run sky_tools run_mojo --mojo-path $(MOJO_DIR)/src --android --mojo-debug -- --enable-multiprocess --map-origin="https://syncslides.mojo.v.io/=$(PWD)" --args-for="https://syncslides.mojo.v.io/packages/syncbase/mojo_services/android/syncbase_server.mojo --v=1 --logtostderr=true --root-dir=/data/data/org.chromium.mojo.shell/app_home/syncbasedata" --no-config-file --free-host-ports
+
+.PHONY: clean
+clean:
+ rm -f app.flx snapshot_blob.bin
+ rm -rf packages
diff --git a/PATENTS b/PATENTS
new file mode 100644
index 0000000..d52cc55
--- /dev/null
+++ b/PATENTS
@@ -0,0 +1,22 @@
+Additional IP Rights Grant (Patents)
+
+"This implementation" means the copyrightable works distributed by
+Google as part of the Vanadium project.
+
+Google hereby grants to You a perpetual, worldwide, non-exclusive,
+no-charge, royalty-free, irrevocable (except as stated in this section)
+patent license to make, have made, use, offer to sell, sell, import,
+transfer and otherwise run, modify and propagate the contents of this
+implementation of Vanadium, where such license applies only to those patent
+claims, both currently owned or controlled by Google and acquired in
+the future, licensable by Google that are necessarily infringed by this
+implementation of Vanadium. This grant does not include claims that would be
+infringed only as a consequence of further modification of this
+implementation. If you or your agent or exclusive licensee institute or
+order or agree to the institution of patent litigation against any
+entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that this implementation of Vanadium or any code incorporated within this
+implementation of Vanadium constitutes direct or contributory patent
+infringement, or inducement of patent infringement, then any patent
+rights granted to you under this License for this implementation of Vanadium
+shall terminate as of the date such litigation is filed.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c2f904f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,33 @@
+# SyncSlides
+
+A simple multi-device presentation system built on [Flutter](https://flutter.io) and [Syncbase](https://github.com/vanadium/mojo.syncbase)
+
+**Looking for the Java/Android version?** It is located in the Java repository
+for the time being. https://github.com/vanadium/java/tree/master/projects/syncslides
+
+# Prerequisites
+
+##Mojo
+
+Currently, development is heavily tied to an existing installation of [Mojo](https://github.com/domokit/mojo). Please ensure that your Mojo checkout is located at `$MOJO_DIR` and has been build for Android. Instructions are available [here](https://github.com/domokit/mojo#mojo).
+
+## Dart
+
+Flutter depends on a relatively new version of the Dart SDK. Therefore, please ensure that you have installed the following version or greater:
+
+`Dart VM version: 1.13.0-dev.3.1 (Thu Sep 17 10:54:54 2015) on "linux_x64"`
+If you are unsure what version you are on, use `dart --version`.
+
+To install Dart, visit the [download page](https://www.dartlang.org/downloads/).
+
+## Android Setup
+
+Currently Flutter requires an Android device running the Lollipop (or newer) version of the Android operating system.
+`adb` tool from Android SDK needs to be installed. Please follow instructions on setting up your android device [here](http://flutter.io/getting-started/#setting-up-your-android-device)
+
+# Running SyncSlides
+
+Connect your Android device via USB and ensure `Android debugging` is enabled, then execute:
+`
+make run
+`
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..603150b
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+jiri-0.1
diff --git a/lib/main.dart b/lib/main.dart
new file mode 100644
index 0000000..72890ac
--- /dev/null
+++ b/lib/main.dart
@@ -0,0 +1,140 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:math' show Random;
+import 'dart:convert' show UTF8;
+
+import 'package:flutter/material.dart';
+
+import 'package:flutter/services.dart' show embedder;
+import 'package:syncbase/syncbase_client.dart' as sb;
+
+// TODO(aghassemi) Temporary main.
+void main() {
+ runApp(new MaterialApp(
+ title: "Flutter & Syncbase Demo",
+ routes: {'/': (RouteArguments args) => new FlutterSyncbaseDemo()}));
+}
+
+class FlutterSyncbaseDemoState extends State<FlutterSyncbaseDemo> {
+ List<String> activityLog = [];
+
+ void addActivityLogItem(String item) {
+ setState(() {
+ activityLog.add(item);
+ });
+ }
+
+ Widget build(BuildContext context) {
+ return new Scaffold(
+ toolBar: new ToolBar(center: new Text("Flutter & Syncbase Demo")),
+ body: new Material(child: new Text(activityLog.join("\n"))));
+ }
+}
+
+class FlutterSyncbaseDemo extends StatefulComponent {
+ FlutterSyncbaseDemoState _state = new FlutterSyncbaseDemoState();
+
+ FlutterSyncbaseDemo() {
+ initSyncbase(_state);
+ }
+
+ FlutterSyncbaseDemoState createState() {
+ return _state;
+ }
+}
+
+bool initialized = false;
+initSyncbase(FlutterSyncbaseDemoState state) async {
+ if (initialized) {
+ return;
+ }
+
+ initialized = true;
+ sb.SyncbaseClient c = new sb.SyncbaseClient(embedder.connectToService,
+ 'https://syncslides.mojo.v.io/packages/syncbase/mojo_services/android/syncbase_server.mojo');
+
+ sb.SyncbaseApp sbApp = await createApp(c, 'testapp');
+ sb.SyncbaseNoSqlDatabase sbDb = await createDb(sbApp, 'testdb');
+ sb.SyncbaseTable sbTable = await createTable(sbDb, 'testtable');
+
+ startWatch(sbDb, sbTable, state);
+ startPuts(sbTable, state);
+
+ // Wait forever.
+ await new Completer().future;
+
+ // Looks like forever came and went. Might as well clean up after
+ // ourselves...
+ await c.close();
+}
+
+startWatch(db, table, state) async {
+ var s = db.watch(table.name, '', await db.getResumeMarker());
+ await for (var change in s) {
+ var activity =
+ 'GOT CHANGE: ${change.rowKey} - ${UTF8.decode(change.valueBytes)}';
+ state.addActivityLogItem(activity);
+ print(activity);
+ }
+}
+
+var r = new Random();
+
+startPuts(table, state) async {
+ var key = r.nextInt(100000000);
+ var val = r.nextInt(100000000);
+
+ var row = table.row('k-$key');
+ var activity = 'PUTTING k-$key';
+ state.addActivityLogItem(activity);
+ print(activity);
+ await row.put(UTF8.encode('v-$val'));
+
+ await new Future.delayed(new Duration(seconds: 2));
+ startPuts(table, state);
+}
+
+String openPermsJson =
+ '{"Admin":{"In":["..."]},"Write":{"In":["..."]},"Read":{"In":["..."]},"Resolve":{"In":["..."]},"Debug":{"In":["..."]}}';
+sb.Perms openPerms = sb.SyncbaseClient.perms(openPermsJson);
+
+Future<sb.SyncbaseApp> createApp(sb.SyncbaseClient c, String name) async {
+ var app = c.app(name);
+ var exists = await app.exists();
+ if (exists) {
+ print('app exists, rolling with it');
+ return app;
+ }
+ print('app does not exist, creating it');
+ await app.create(openPerms);
+ return app;
+}
+
+Future<sb.SyncbaseNoSqlDatabase> createDb(
+ sb.SyncbaseApp app, String name) async {
+ var db = app.noSqlDatabase(name);
+ var exists = await db.exists();
+ if (exists) {
+ print('db exists, rolling with it');
+ return db;
+ }
+ print('db does not exist, creating it');
+ await db.create(openPerms);
+ return db;
+}
+
+Future<sb.SyncbaseTable> createTable(
+ sb.SyncbaseNoSqlDatabase db, String name) async {
+ var table = db.table(name);
+ var exists = await table.exists();
+ if (exists) {
+ print('table exists, rolling with it');
+ return table;
+ }
+ print('table does not exist, creating it');
+ await table.create(openPerms);
+ return table;
+}
diff --git a/pubspec.lock b/pubspec.lock
new file mode 100644
index 0000000..509bd29
--- /dev/null
+++ b/pubspec.lock
@@ -0,0 +1,259 @@
+# Generated by pub
+# See http://pub.dartlang.org/doc/glossary.html#lockfile
+packages:
+ analyzer:
+ description: analyzer
+ source: hosted
+ version: "0.26.1+16"
+ archive:
+ description: archive
+ source: hosted
+ version: "1.0.20"
+ args:
+ description: args
+ source: hosted
+ version: "0.13.2"
+ asn1lib:
+ description: asn1lib
+ source: hosted
+ version: "0.4.1"
+ async:
+ description: async
+ source: hosted
+ version: "1.4.0"
+ barback:
+ description: barback
+ source: hosted
+ version: "0.15.2+7"
+ bignum:
+ description: bignum
+ source: hosted
+ version: "0.0.7"
+ cassowary:
+ description: cassowary
+ source: hosted
+ version: "0.1.7"
+ charcode:
+ description: charcode
+ source: hosted
+ version: "1.1.0"
+ cipher:
+ description: cipher
+ source: hosted
+ version: "0.7.1"
+ collection:
+ description: collection
+ source: hosted
+ version: "1.1.3"
+ concepts:
+ description: concepts
+ source: hosted
+ version: "0.2.0"
+ convert:
+ description: convert
+ source: hosted
+ version: "1.0.0"
+ crypto:
+ description: crypto
+ source: hosted
+ version: "0.9.1"
+ csslib:
+ description: csslib
+ source: hosted
+ version: "0.12.2"
+ either:
+ description: either
+ source: hosted
+ version: "0.1.8"
+ fixnum:
+ description: fixnum
+ source: hosted
+ version: "0.9.1+2"
+ flutter:
+ description: flutter
+ source: hosted
+ version: "0.0.13"
+ flx:
+ description: flx
+ source: hosted
+ version: "0.0.1"
+ glob:
+ description: glob
+ source: hosted
+ version: "1.0.5"
+ html:
+ description: html
+ source: hosted
+ version: "0.12.2"
+ http_multi_server:
+ description: http_multi_server
+ source: hosted
+ version: "1.3.2"
+ http_parser:
+ description: http_parser
+ source: hosted
+ version: "1.1.0"
+ intl:
+ description: intl
+ source: hosted
+ version: "0.12.4+2"
+ logging:
+ description: logging
+ source: hosted
+ version: "0.11.2"
+ matcher:
+ description: matcher
+ source: hosted
+ version: "0.12.0+1"
+ material_design_icons:
+ description: material_design_icons
+ source: hosted
+ version: "0.0.3"
+ mime:
+ description: mime
+ source: hosted
+ version: "0.9.3"
+ mojo:
+ description: mojo
+ source: hosted
+ version: "0.3.0"
+ mojo_apptest:
+ description: mojo_apptest
+ source: hosted
+ version: "0.2.3"
+ mojo_sdk:
+ description: mojo_sdk
+ source: hosted
+ version: "0.1.0"
+ mojo_services:
+ description: mojo_services
+ source: hosted
+ version: "0.4.0"
+ mojom:
+ description: mojom
+ source: hosted
+ version: "0.2.3"
+ mustache4dart:
+ description: mustache4dart
+ source: hosted
+ version: "1.0.10"
+ newton:
+ description: newton
+ source: hosted
+ version: "0.1.5"
+ option:
+ description: option
+ source: hosted
+ version: "1.1.0"
+ package_config:
+ description: package_config
+ source: hosted
+ version: "0.1.3"
+ path:
+ description: path
+ source: hosted
+ version: "1.3.6"
+ petitparser:
+ description: petitparser
+ source: hosted
+ version: "1.5.0"
+ plugin:
+ description: plugin
+ source: hosted
+ version: "0.1.0"
+ pool:
+ description: pool
+ source: hosted
+ version: "1.2.1"
+ pub_semver:
+ description: pub_semver
+ source: hosted
+ version: "1.2.2"
+ quiver:
+ description: quiver
+ source: hosted
+ version: "0.21.4"
+ shelf:
+ description: shelf
+ source: hosted
+ version: "0.6.4"
+ shelf_path:
+ description: shelf_path
+ source: hosted
+ version: "0.1.7"
+ shelf_route:
+ description: shelf_route
+ source: hosted
+ version: "0.13.5"
+ shelf_static:
+ description: shelf_static
+ source: hosted
+ version: "0.2.3+1"
+ shelf_web_socket:
+ description: shelf_web_socket
+ source: hosted
+ version: "0.0.1+4"
+ sky_engine:
+ description: sky_engine
+ source: hosted
+ version: "0.0.43"
+ sky_services:
+ description: sky_services
+ source: hosted
+ version: "0.0.43"
+ sky_tools:
+ description: sky_tools
+ source: hosted
+ version: "0.0.27"
+ source_map_stack_trace:
+ description: source_map_stack_trace
+ source: hosted
+ version: "1.0.4"
+ source_maps:
+ description: source_maps
+ source: hosted
+ version: "0.10.1"
+ source_span:
+ description: source_span
+ source: hosted
+ version: "1.2.1"
+ stack_trace:
+ description: stack_trace
+ source: hosted
+ version: "1.4.2"
+ string_scanner:
+ description: string_scanner
+ source: hosted
+ version: "0.1.4"
+ syncbase:
+ description: syncbase
+ source: hosted
+ version: "0.0.9"
+ test:
+ description: test
+ source: hosted
+ version: "0.12.4+9"
+ typed_data:
+ description: typed_data
+ source: hosted
+ version: "1.1.0"
+ uri:
+ description: uri
+ source: hosted
+ version: "0.11.0"
+ utf:
+ description: utf
+ source: hosted
+ version: "0.9.0+2"
+ vector_math:
+ description: vector_math
+ source: hosted
+ version: "1.4.3"
+ watcher:
+ description: watcher
+ source: hosted
+ version: "0.9.7"
+ yaml:
+ description: yaml
+ source: hosted
+ version: "2.1.7"
diff --git a/pubspec.yaml b/pubspec.yaml
new file mode 100644
index 0000000..a8d7ee0
--- /dev/null
+++ b/pubspec.yaml
@@ -0,0 +1,7 @@
+name: syncslides
+description: A simple multi-device presentation system built on Flutter and Syncbase.
+dependencies:
+ flutter: ">=0.0.2 <0.1.0"
+ syncbase: ">=0.0.9 <0.1.0"
+dev_dependencies:
+ sky_tools: ">=0.0.27 <0.1.0"