Skip to content

Commit

Permalink
Merge mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscant committed Jun 19, 2018
2 parents ac829c3 + 986d158 commit 336d82b
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 45 deletions.
2 changes: 1 addition & 1 deletion dev/webpack.appfd.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = new Config().extend({
}),
// CC new FaviconsPlugin('images/user_logo.png'),
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify('1.3.11, 13 June 2018'),
APP_VERSION: JSON.stringify('1.3.12, 19 June 2018'),
// CC SET ABOVE: API: JSON.stringify(BASE_URL+'/api/'),
FACEBOOK_APPID: JSON.stringify('134980666550322'),
FACEBOOK_GRAFFITI_APPID: JSON.stringify('115376591981611'),
Expand Down
2 changes: 1 addition & 1 deletion dev/webpack.appmt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = new Config().extend({
}),
// CC new FaviconsPlugin('images/modtools_logo.png'),
new webpack.DefinePlugin({
APP_VERSION: JSON.stringify('0.1.7, 15 June 2018.'),
APP_VERSION: JSON.stringify('0.1.8, 19 June 2018.'),
// CC SET ABOVE: API: JSON.stringify(BASE_URL+'/api/'),
FACEBOOK_APPID: JSON.stringify('134980666550322'),
FACEBOOK_GRAFFITI_APPID: JSON.stringify('115376591981611'),
Expand Down
8 changes: 7 additions & 1 deletion http/js/iznik/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,12 @@ define([
} else {
document.title = title;
}

if (window.mobilePush) { // CC
window.mobilePush.setApplicationIconBadgeNumber(function () { }, function () { }, unseen);
console.log("badge count set to: " + unseen);
}

}

Iznik.ellipsical = function(str, len) {
Expand Down Expand Up @@ -862,7 +868,7 @@ define([
var $this = $(this);
var src = $this.attr('src');

if (src) {
if (src && !$this.data('nolazysizes')) {
$this.attr('data-src', src);
$this.prop('src', iznikroot +'images/1x1_placeholder.png'); // CC
$this.addClass('lazyload');
Expand Down
11 changes: 0 additions & 11 deletions http/js/iznik/views/chat/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,6 @@ define([

self.showMin();

if (window.mobilePush) {
/* Not on MT
Storage.set("chatcount", unseen);
var notifcount = Storage.get("notifcount");
if (!notifcount) notifcount = 0;
notifcount = parseInt(notifcount);
if (isNaN(notifcount)) notifcount = 0;
var badgecount = notifcount + unseen;
window.mobilePush.setApplicationIconBadgeNumber(function () { }, function () { }, badgecount);
console.log("badge count set to : " + badgecount);*/
}
},

updateCountTimer: function() {
Expand Down
18 changes: 0 additions & 18 deletions http/js/iznik/views/pages/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,24 +147,6 @@ define([
if (el.html() != ret.count) {
el.html(ret.count);

if (window.mobilePush) { // CC
var notifcount = parseInt(ret.count);
if (isNaN(notifcount)) notifcount = 0;
Storage.set("notifcount", notifcount);
var chatcount = Storage.get("chatcount");
if (!chatcount) chatcount = 0;
chatcount = parseInt(chatcount);
if (isNaN(chatcount)) chatcount = 0;
var badgecount = notifcount + chatcount;
window.mobilePush.setApplicationIconBadgeNumber(function () { }, function () { }, badgecount);
console.log("badge count set to : " + badgecount);
/*window.mobilePush.setApplicationIconBadgeNumber(
function () { console.log("badge success") },
function () { console.log("badge error") },
badgecount);
console.log("badge count set to: " + badgecount, typeof (badgecount));*/
}

if (ret.count) {
$('.js-notifholder .js-notifcount').css('visibility', 'visible');

Expand Down
35 changes: 31 additions & 4 deletions http/js/iznik/views/user/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,15 +504,33 @@ define([

template: 'user_message_photo',

refetch: function(src) {
var self = this;

self.$('img').attr('src', src);

},

zoom: function (e) {
var self = this;

e.preventDefault();
e.stopPropagation();

var v = new Iznik.Views.User.Message.PhotoZoom({
model: this.model,
message: this.options.message
});
this.listenToOnce(v, 'deleted', _.bind(this.destroyIt, this));

this.listenToOnce(v, 'deleted', _.bind(function(id) {
self.trigger('deleted', id)
self.destroyIt();
}, this));

this.listenTo(v, 'rotated', _.bind(function(id, src) {
this.refetch(src)
}, this));

v.render();
}
});
Expand Down Expand Up @@ -555,6 +573,7 @@ define([
var url = 'https://www.ilovefreegle.org/img_' + self.model.get('id') + '.jpg?t=' + t; // CC
console.log("Rotated", url);
self.$('img').attr('src', url);
self.trigger('rotated', self.model.get('id'), url);
}
}
})
Expand Down Expand Up @@ -593,7 +612,7 @@ define([
},
success: function(ret) {
if (ret.ret === 0) {
self.trigger('deleted');
self.trigger('deleted', self.model.get('id'));
self.close();
}
}
Expand All @@ -604,8 +623,8 @@ define([
if (self.collection) {
self.collection.remove(self.model);
}
self.destroyIt();
//self.close();
self.trigger('deleted', self.model.get('id'));
self.close();
}
},

Expand All @@ -615,6 +634,9 @@ define([
console.log("Editable?", self.model.get('mine'), Iznik.Session.isFreegleMod());
self.model.set('canedit', self.model.get('mine') || Iznik.Session.isFreegleMod());

// We want to force a fetch from the server in case the image has been rotated.
self.model.set('timestamp', (new Date()).getTime());

var p = Iznik.Views.Modal.prototype.render.call(this);

return(p);
Expand Down Expand Up @@ -668,10 +690,15 @@ define([
message: self.options.message,
collection: self.collection
});

v.render().then(function() {
self.$('.js-photos').append(v.$el);
});

self.listenToOnce(v, 'deleted', _.bind(function(id) {
self.collection.remove(id);
}));

self.photos.push(v.$el);

if (!self.options.showAll) {
Expand Down
2 changes: 1 addition & 1 deletion http/template/user/message/photo.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="img-wrapper">
<img alt="Item photo" class="clickme img img-thumbnail img-rounded" style="height: 150px !important;" src="{{paththumb}}" />
<img alt="Item photo" data-nolazysizes="true" class="clickme img img-thumbnail img-rounded" style="height: 150px !important;" src="{{paththumb}}" />
</div>
2 changes: 1 addition & 1 deletion http/template/user/message/photozoom.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
</div>
<% } %>
<img alt="Item photo" class="img img-responsive img-rounded" src="{{path}}" />
<img alt="Item photo" class="img img-responsive img-rounded" src="{{path}}?t={{timestamp}}" />
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default js-close" data-dismiss="modal">Close</button>
Expand Down
8 changes: 4 additions & 4 deletions mobile/freegle/android/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="521" id="org.ilovefreegle.direct" version="1.3.11" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="523" id="org.ilovefreegle.direct" version="1.3.12" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Freegle</name>
<description>Offer and request free items on your local Freegle reuse group</description>
<author />
Expand Down Expand Up @@ -67,11 +67,11 @@
<platform name="android">
<resource-file src="google-services.json" target="google-services.json" />
</platform>
<plugin name="phonegap-plugin-push" spec="^1.11.0">
<variable name="SENDER_ID" value="85075801930" />
</plugin>
<plugin name="cordova-plugin-googleplus" spec="https://github.com/EddyVerbruggen/cordova-plugin-googleplus" />
<plugin name="cordova-plugin-camera" spec="^4.0.3" />
<hook src="scripts/before_build.sh" type="before_build" />
<plugin name="phonegap-plugin-push" spec="^1.11.1">
<variable name="SENDER_ID" value="85075801930" />
</plugin>
<engine name="android" spec="^6.3.0" />
</widget>
2 changes: 1 addition & 1 deletion mobile/freegle/ios/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.ilovefreegle.iphone" ios-CFBundleVersion="146" version="1.3.11" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="org.ilovefreegle.iphone" ios-CFBundleVersion="147" version="1.3.12" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Freegle</name>
<description>Offer and request free items on your local Freegle reuse group</description>
<author />
Expand Down
2 changes: 1 addition & 1 deletion mobile/modtools/android/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="112" id="org.ilovefreegle.modtools" version="0.1.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="113" id="org.ilovefreegle.modtools" version="0.1.8" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ModTools</name>
<description>Tool to help moderators of Freegle and similar groups</description>
<author email="[email protected]" href="https://ilovefreegle.org">
Expand Down
2 changes: 1 addition & 1 deletion mobile/modtools/ios/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.ilovefreegle.modtools" ios-CFBundleVersion="107" version="0.1.7" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="org.ilovefreegle.modtools" ios-CFBundleVersion="108" version="0.1.8" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ModTools</name>
<description>Tool to help moderators of Freegle and similar groups</description>
<author email="[email protected]" href="https://ilovefreegle.org">
Expand Down

0 comments on commit 336d82b

Please sign in to comment.