diff --git a/example/mobile/app/App.js b/example/mobile/app/App.js
index 5063f54..aae9a47 100644
--- a/example/mobile/app/App.js
+++ b/example/mobile/app/App.js
@@ -19,7 +19,10 @@ export default class App extends Component {
};
}
componentWillMount() {
- const url = 'http://'+(this.props.serverUrl || '127.0.0.1')+':3000/websocket';
+ console.info('------');
+ console.info('------');
+
+ const url = 'http://'+(this.props.serverUrl || '192.168.1.139')+':3000/websocket';
Meteor.connect(url);
Meteor.ddp.on('connected', function() {
diff --git a/example/mobile/app/Routes/CollectionFS.js b/example/mobile/app/Routes/CollectionFS.js
index a242fa5..a274b69 100644
--- a/example/mobile/app/Routes/CollectionFS.js
+++ b/example/mobile/app/Routes/CollectionFS.js
@@ -6,6 +6,7 @@ console.disableYellowBox = true;
import React, {
Component,
StyleSheet,
+ Image,
Text,
View
} from 'react-native';
@@ -17,10 +18,30 @@ import Button from 'react-native-button';
@connectMeteor
export default class CollectionFS extends Component {
+ startMeteorSubscriptions() {
+ Meteor.subscribe('imagesFiles');
+ }
+ getMeteorData() {
+ return {
+ image: Meteor.FSCollection('imagesFiles').findOne()
+ }
+ }
render() {
+ const { image } = this.data;
+
+ console.log(image && image.url());
return (
+ You have to be logged to see this image (see publish method). CollectionFS url() generate an authToken and it is checked in this example.
+
+ {image &&
+
+ }
+
);
}
diff --git a/example/mobile/app/Tabs.ios.js b/example/mobile/app/Tabs.ios.js
index ff58a34..00f03db 100644
--- a/example/mobile/app/Tabs.ios.js
+++ b/example/mobile/app/Tabs.ios.js
@@ -19,7 +19,7 @@ export default class Tabs extends Component {
constructor(props) {
super(props);
this.state = {
- selectedTab: 0
+ selectedTab: 1
};
}
selectTab(index) {
diff --git a/example/mobile/ios/mobile/AppDelegate.m b/example/mobile/ios/mobile/AppDelegate.m
index 4043a40..f5a03c9 100644
--- a/example/mobile/ios/mobile/AppDelegate.m
+++ b/example/mobile/ios/mobile/AppDelegate.m
@@ -31,7 +31,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
* on the same Wi-Fi network.
*/
- jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
+ jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.139:8081/index.ios.bundle?platform=ios&dev=true"];
/**
* OPTION 2
diff --git a/example/web/app/collections/images_files.js b/example/web/app/collections/images_files.js
new file mode 100644
index 0000000..1be692e
--- /dev/null
+++ b/example/web/app/collections/images_files.js
@@ -0,0 +1,17 @@
+
+const ImagesFiles = new FS.Collection("imagesFiles", {
+ stores: [
+ new FS.Store.GridFS("imagesFiles"),
+ new FS.Store.GridFS("anotherStore")
+ ]
+});
+
+const allow = function(userId) {
+ return !!userId;
+};
+
+ImagesFiles.allow({
+ download: allow
+});
+
+export default ImagesFiles;
\ No newline at end of file
diff --git a/example/web/app/collections/index.js b/example/web/app/collections/index.js
index 8648330..41a88bc 100644
--- a/example/web/app/collections/index.js
+++ b/example/web/app/collections/index.js
@@ -2,4 +2,5 @@
export const Users = Meteor.users;
export const Todos = require('./todos');
+export const ImagesFiles = require('./images_files');
export const Settings = new Mongo.Collection('settings');
diff --git a/example/web/app/components/Header.jsx b/example/web/app/components/Header.jsx
index 530cd9b..3d90cee 100644
--- a/example/web/app/components/Header.jsx
+++ b/example/web/app/components/Header.jsx
@@ -18,6 +18,9 @@ export default class Header extends Component {
{browserHistory.push('/todos')}}>
Todos
+ {browserHistory.push('/image')}}>
+ CollectionFS
+
diff --git a/example/web/app/components/Routes/ImageFile.jsx b/example/web/app/components/Routes/ImageFile.jsx
new file mode 100644
index 0000000..4f5e34a
--- /dev/null
+++ b/example/web/app/components/Routes/ImageFile.jsx
@@ -0,0 +1,23 @@
+/* global ReactMeteorData */
+import React, {Component} from 'react';
+import reactMixin from 'react-mixin';
+
+import { ImagesFiles } from 'collections';
+
+@reactMixin.decorate(ReactMeteorData)
+export default class TodosComponent extends Component {
+ getMeteorData() {
+ return {
+ image: ImagesFiles.findOne()
+ };
+ }
+ render() {
+ const { image } = this.data;
+ console.log(image);
+ return (
+
+
+
+ );
+ }
+}
diff --git a/example/web/app/fixtures.js b/example/web/app/fixtures.js
index 659aaa5..f1b7a58 100644
--- a/example/web/app/fixtures.js
+++ b/example/web/app/fixtures.js
@@ -1,5 +1,7 @@
/* global Accounts */
+import { Settings, ImagesFiles } from 'collections';
+
export function createUsers() {
console.log('Creating fake users');
['User'].forEach(function(name) {
@@ -11,10 +13,15 @@ export function createUsers() {
});
}
-import { Settings } from 'collections';
-
export function createSettings() {
Settings.insert({
param1: 'react-native-meteor'
});
+}
+
+
+export function createImages() {
+ const imageFile = new FS.File(Npm.require('fs').realpathSync(__meteor_bootstrap__.serverDir+'/../../../../../../app/opengraph.png'));
+ ImagesFiles.insert(imageFile);
+
}
\ No newline at end of file
diff --git a/example/web/app/main_client.js b/example/web/app/main_client.js
index d460d52..75b0088 100644
--- a/example/web/app/main_client.js
+++ b/example/web/app/main_client.js
@@ -5,12 +5,13 @@ import { Router, Route, browserHistory } from 'react-router';
import App from './components/App.jsx';
import Home from './components/Routes/Home.jsx';
import Todos from './components/Routes/Todos.jsx';
+import ImageFile from './components/Routes/ImageFile.jsx';
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY',
});
-import publications from './publications/todos';
+import publications from './publications';
publications();
Meteor.startup(() => {
@@ -20,6 +21,7 @@ Meteor.startup(() => {
+
), document.getElementById('root')
diff --git a/example/web/app/main_server.js b/example/web/app/main_server.js
index 274d06a..4b00957 100644
--- a/example/web/app/main_server.js
+++ b/example/web/app/main_server.js
@@ -2,16 +2,16 @@ import React from 'react';
//import {Posts} from './collections';
//import {createPosts, createUsers} from './fixtures';
import './methods';
-import { createUsers, createSettings } from './fixtures';
+import { createUsers, createSettings, createImages } from './fixtures';
-import todos from './publications/todos';
-import settings from './publications/settings';
-todos();
-settings();
+import publications from './publications';
+publications();
if(Meteor.users.find().count()===0) {
createUsers();
createSettings();
+ createImages();
}
+
console.log('\n\nRunning on server only');;
diff --git a/example/web/app/opengraph.png b/example/web/app/opengraph.png
new file mode 100644
index 0000000..0e9e1d3
Binary files /dev/null and b/example/web/app/opengraph.png differ
diff --git a/example/web/app/publications/imagesFiles.js b/example/web/app/publications/imagesFiles.js
new file mode 100644
index 0000000..333b1c8
--- /dev/null
+++ b/example/web/app/publications/imagesFiles.js
@@ -0,0 +1,13 @@
+import { ImagesFiles } from '../collections';
+
+export default function() {
+ if (Meteor.isClient) {
+ Meteor.subscribe('imagesFiles');
+ }
+
+ if (Meteor.isServer) {
+ Meteor.publish('imagesFiles', function() {
+ return ImagesFiles.find({});
+ });
+ }
+};
\ No newline at end of file
diff --git a/example/web/app/publications/index.js b/example/web/app/publications/index.js
new file mode 100644
index 0000000..eca6b6d
--- /dev/null
+++ b/example/web/app/publications/index.js
@@ -0,0 +1,9 @@
+import imagesFiles from './imagesFiles';
+import settings from './settings';
+import todos from './todos';
+
+export default function() {
+ imagesFiles();
+ todos();
+ settings();
+};
\ No newline at end of file
diff --git a/example/web/meteor_core/.meteor/packages b/example/web/meteor_core/.meteor/packages
index 919a3b5..c88c139 100644
--- a/example/web/meteor_core/.meteor/packages
+++ b/example/web/meteor_core/.meteor/packages
@@ -25,3 +25,5 @@ mindfront:why-reminify
aldeed:simple-schema
aldeed:collection2
reactjs:react
+cfs:standard-packages
+cfs:gridfs
diff --git a/example/web/meteor_core/.meteor/versions b/example/web/meteor_core/.meteor/versions
index ce4c218..b96fa1d 100644
--- a/example/web/meteor_core/.meteor/versions
+++ b/example/web/meteor_core/.meteor/versions
@@ -19,6 +19,23 @@ boilerplate-generator@1.0.4
caching-compiler@1.0.0
caching-html-compiler@1.0.2
callback-hook@1.0.4
+cfs:access-point@0.1.49
+cfs:base-package@0.0.30
+cfs:collection@0.5.5
+cfs:collection-filters@0.2.4
+cfs:data-man@0.0.6
+cfs:file@0.1.17
+cfs:gridfs@0.0.33
+cfs:http-methods@0.0.30
+cfs:http-publish@0.0.13
+cfs:power-queue@0.9.11
+cfs:reactive-list@0.0.9
+cfs:reactive-property@0.0.4
+cfs:standard-packages@0.5.9
+cfs:storage-adapter@0.2.3
+cfs:tempstore@0.1.5
+cfs:upload-http@0.0.20
+cfs:worker@0.1.4
check@1.0.6
ddp@1.2.2
ddp-client@1.2.1
@@ -55,6 +72,7 @@ mobile-experience@1.0.1
mobile-status-bar@1.0.6
mongo@1.1.2
mongo-id@1.0.1
+mongo-livedata@1.0.9
npm-bcrypt@0.7.8_2
npm-mongo@1.4.39_1
observe-sequence@1.0.7