SyncSlises: Making everything work without a special network setup.

Updating to latest Syncbase and Discovery code and using proxy
and public mounttable so the app can work in any network setup
internet access still required but otherwise app should work with
no WiFi and through 4G only setup.

Plus fixing a small null-pointer bug.

Change-Id: Ia241a49c1e564ce49358c63cddccef85d5894605
diff --git a/dart/Makefile b/dart/Makefile
index 6ae7cd9..b850d95 100644
--- a/dart/Makefile
+++ b/dart/Makefile
@@ -3,10 +3,9 @@
 endif
 
 SYNCBASE_DATA_DIR=/data/data/org.chromium.mojo.shell/app_home/syncbasedata
-# Mounttable address on SyncSlides-Alpha network
-# TODO(aghassemi): Now that BLE discovery support is added and sync uses neighbourhood,
-# we should no longer need a mounttable after upgrading and testing the latest code.
-MOUNTTABLE_ADDR := /192.168.86.254:8101
+# TODO(aghassemi): We should be able to drop the mount table dependency once syncgroup creation no longer requires one.
+# See https://github.com/vanadium/issues/issues/873
+MOUNTTABLE_ADDR := /ns.dev.v.io:8101/tmp/syncslides
 
 DEVICE_NUM_PLUS_ONE := $(shell echo $(DEVICE_NUM) \+ 1 | bc)
 DEVICE_ID := $(shell adb devices | sed -n $(DEVICE_NUM_PLUS_ONE)p | awk '{ print $$1; }')
@@ -20,7 +19,8 @@
 	VLOG_FLAGS = --v=$(VLOG) --logtostderr=true
 endif
 
-SYNCBASE_ARGS := https://syncbase.syncslides.mojo.v.io/syncbase_server.mojo --root-dir=$(SYNCBASE_DATA_DIR) --v23.namespace.root=$(MOUNTTABLE_ADDR) --name=$(DEVICE_ID) $(VLOG_FLAGS)
+# TODO(aghassemi): Remove use of proxy once BLE-RPC is supported.
+SYNCBASE_ARGS := https://syncbase.syncslides.mojo.v.io/syncbase_server.mojo --root-dir=$(SYNCBASE_DATA_DIR) --v23.proxy=/ns.dev.v.io:8101/proxy --v23.namespace.root=$(MOUNTTABLE_ADDR) --name=$(DEVICE_ID) $(VLOG_FLAGS)
 
 SETTINGS_FILE := /sdcard/syncslides_settings.json
 SETTINGS_JSON := {\"deviceid\": \"$(DEVICE_ID)\", \"mounttable\": \"$(MOUNTTABLE_ADDR)\"}
diff --git a/dart/lib/stores/syncbase/actions.dart b/dart/lib/stores/syncbase/actions.dart
index 7feda01..a266586 100644
--- a/dart/lib/stores/syncbase/actions.dart
+++ b/dart/lib/stores/syncbase/actions.dart
@@ -153,7 +153,7 @@
     // Wait until at least the current slide number, driver and the slide for current slide number is synced.
     join() async {
       bool isMyOwnPresentation =
-          _state._advertisedPresentation.key == presentation.key;
+          _state._advertisedPresentation?.key == presentation.key;
       if (!isMyOwnPresentation) {
         await sb.joinSyncgroup(presentation.syncgroupName);
       }
diff --git a/dart/pubspec.lock b/dart/pubspec.lock
index af44d6f..1674050 100644
--- a/dart/pubspec.lock
+++ b/dart/pubspec.lock
@@ -238,7 +238,7 @@
   syncbase:
     description: syncbase
     source: hosted
-    version: "0.0.26"
+    version: "0.0.27"
   test:
     description: test
     source: hosted
@@ -258,7 +258,7 @@
   v23discovery:
     description: v23discovery
     source: hosted
-    version: "0.0.8"
+    version: "0.0.9"
   vector_math:
     description: vector_math
     source: hosted
diff --git a/dart/pubspec.yaml b/dart/pubspec.yaml
index 67ad8a3..f0cccde 100644
--- a/dart/pubspec.yaml
+++ b/dart/pubspec.yaml
@@ -5,8 +5,8 @@
     path: "../../../../../flutter/packages/flutter"
   logging: ">=0.11.2 <0.12.0"
   mojo_services: ">=0.4.5 <0.5.0"
-  syncbase: ">=0.0.23 <0.1.0"
-  v23discovery: ">=0.0.4 < 0.1.0"
+  syncbase: ">=0.0.27 <0.1.0"
+  v23discovery: ">=0.0.9 < 0.1.0"
   uuid: ">=0.5.0 <0.6.0"
 dev_dependencies:
   flutter_tools: