Skip to content

Commit

Permalink
Merge pull request #499 from crossroads/master
Browse files Browse the repository at this point in the history
[Release] v0.18.1
  • Loading branch information
abulsayyad123 authored Mar 8, 2021
2 parents b9c47b9 + 0191ac4 commit ed1cd15
Show file tree
Hide file tree
Showing 60 changed files with 1,524 additions and 426 deletions.
31 changes: 17 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.1.0)
aws-partitions (1.417.0)
aws-sdk-core (3.111.2)
aws-partitions (1.430.0)
aws-sdk-core (3.112.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.41.0)
aws-sdk-core (~> 3, >= 3.109.0)
aws-sdk-kms (1.42.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.87.0)
aws-sdk-core (~> 3, >= 3.109.0)
aws-sdk-s3 (1.89.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.2)
Expand Down Expand Up @@ -86,9 +86,9 @@ GEM
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
emoji_regex (3.2.1)
emoji_regex (3.2.2)
escape (0.0.4)
excon (0.78.1)
excon (0.79.0)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
Expand All @@ -99,8 +99,8 @@ GEM
faraday-net_http (1.0.1)
faraday_middleware (1.0.0)
faraday (~> 1.0)
fastimage (2.2.1)
fastlane (2.172.0)
fastimage (2.2.3)
fastlane (2.176.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -124,6 +124,7 @@ GEM
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (~> 2.0.0)
naturally (~> 2.2)
plist (>= 3.1.0, < 4.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
Expand All @@ -148,7 +149,7 @@ GEM
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
signet (~> 0.12)
google-apis-core (0.2.0)
google-apis-core (0.2.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.14)
httpclient (>= 2.8.1, < 3.0)
Expand All @@ -157,9 +158,10 @@ GEM
retriable (>= 2.0, < 4.0)
rexml
signet (~> 0.14)
webrick
google-apis-iamcredentials_v1 (0.1.0)
google-apis-core (~> 0.1)
google-apis-storage_v1 (0.1.0)
google-apis-storage_v1 (0.2.0)
google-apis-core (~> 0.1)
google-cloud-core (1.5.0)
google-cloud-env (~> 1.0)
Expand All @@ -175,7 +177,7 @@ GEM
google-cloud-core (~> 1.2)
googleauth (~> 0.9)
mini_mime (~> 1.0)
googleauth (0.14.0)
googleauth (0.15.1)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
Expand Down Expand Up @@ -223,7 +225,7 @@ GEM
ruby2_keywords (0.0.4)
rubyzip (2.3.0)
security (0.1.3)
signet (0.14.0)
signet (0.14.1)
addressable (~> 2.3)
faraday (>= 0.17.3, < 2.0)
jwt (>= 1.5, < 3.0)
Expand All @@ -250,6 +252,7 @@ GEM
unf_ext
unf_ext (0.0.7.7)
unicode-display_width (1.7.0)
webrick (1.7.0)
word_wrap (1.0.0)
xcodeproj (1.19.0)
CFPropertyList (>= 2.3.3, < 4.0)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace :cordova do
if platform == 'android'
sh %{ cordova plugin add phonegap-plugin-push@2.1.2 }
else
sh %{ cordova plugin add phonegap-plugin-push@1.9.2 --variable SENDER_ID="XXXXXXX" }
sh %{ cordova plugin add phonegap-plugin-push@2.3.0 --variable SENDER_ID="XXXXXXX" }
end
build = (environment == "staging" && platform == 'android') ? "debug" : "release"
extra_params = (platform === "android") ? '' : ios_build_config
Expand Down
61 changes: 61 additions & 0 deletions app/components/add-edit-message-overlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import Ember from "ember";
import _ from "lodash";
import AsyncTasksMixin, { ERROR_STRATEGIES } from "../mixins/async_tasks";

export default Ember.Component.extend(AsyncTasksMixin, {
messageService: Ember.inject.service(),
store: Ember.inject.service(),

async didReceiveAttrs() {
const editMessage = this.get("messageService.editMessage");
const store = this.get("store");
const message =
store.peekRecord("canned_response", editMessage.messageId) ||
store.createRecord("canned-response");
this.set("message", message);
this.set("isEnglish", true);
},

disableCreateEdit: Ember.computed(
"message.nameEn",
"message.contentEn",
function() {
return !(this.get("message.nameEn") && this.get("message.contentEn"));
}
),

actions: {
createCannedMessage() {
this.runTask(
this.get("message")
.save()
.then(() => this.set("messageService.isAddMessageVisible", false))
);
},

closeOverlay() {
this.set("messageService.isAddMessageVisible", false);
this.set("messageService.editMessage.language", "en");
this.set("messageService.editMessage.messageId", "");
},

setLanguage(lang = "en") {
this.set("isEnglish", lang == "en");
},

deleteMessage() {
const store = this.get("store");
const message = store.peekRecord(
"canned_response",
this.get("message").id
);
this.runTask(
message.destroyRecord().then(() => {
store.unloadRecord(message);
this.set("messageService.isAddMessageVisible", false);
}),
ERROR_STRATEGIES
);
}
}
});
13 changes: 13 additions & 0 deletions app/components/canned-messages-overlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,25 @@ export default Ember.Component.extend({
return this.get("searchText") && this.get("searchText").trim().length;
}),

refreshDisplayResult: Ember.observer(
"messageService.isAddMessageVisible",
function() {
if (!this.get("messageService.isAddMessageVisible")) {
this.reloadResults();
}
}
),

actions: {
loadMoreCannedMessages() {
const params = { searchText: this.get("searchText") };
return this.get("store").query("canned_response", params);
},

openProFormaOverlay() {
this.set("messageService.isProFormaMessageVisible", true);
},

setCannedResponse(text) {
if (!text) return;
const onSelect = this.getWithDefault("onSelect", _.noop);
Expand Down
20 changes: 20 additions & 0 deletions app/components/let-alias.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Ember from "ember";

/**
* @module Components/let-alias
* @description Small helper component allowing to rename variables within the .hbs file
* @example
*
* {{#let-alias model.someReallyLongPropertyName as |short| }}
* <div> This is {{short}} </div>
* <div> I can use {{short}} many times {{short}} </div>
* <div> because it's very {{short}} </div
* {{/let-alias}}
*/
const AliasComponent = Ember.Component.extend();

AliasComponent.reopenClass({
positionalParams: ["value"]
});

export default AliasComponent;
6 changes: 5 additions & 1 deletion app/components/offer-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export default Ember.Component.extend({

offerStateFilters: Ember.computed("allOfferStateFilters.[]", function() {
// Separate out "showPriority" filter as it has some different css properties than others
return _.without(this.get("allOfferStateFilters"), STATE_FILTERS.PRIORITY);
return _.without(
this.get("allOfferStateFilters"),
STATE_FILTERS.PRIORITY,
STATE_FILTERS.PUBLISHED
);
}),

presetTimeKeys: Ember.computed(function() {
Expand Down
67 changes: 67 additions & 0 deletions app/components/pro-forma-message-overlay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import Ember from "ember";
import _ from "lodash";

export default Ember.Component.extend({
messageService: Ember.inject.service(),
store: Ember.inject.service(),

init() {
this._super(...arguments);
this.set("isSelected", true);
},

onSearchTextChange: Ember.observer("searchText", function() {
Ember.run.debounce(this, this.reloadResults, 500);
}),

refreshDisplayResult: Ember.observer(
"messageService.isAddMessageVisible",
function() {
if (!this.get("messageService.isAddMessageVisible")) {
this.reloadResults();
}
}
),

didRender() {
if (this.get("messageService.isProFormaMessageVisible")) {
this.set("displayResults", true);
}
},

reloadResults() {
this.set("displayResults", false);
Ember.run.debounce(this, () => this.set("displayResults", true), 500);
},

hasSearchText: Ember.computed("searchText", function() {
return this.get("searchText") && this.get("searchText").trim().length;
}),

actions: {
loadMoreCannedMessages() {
const params = {
searchText: this.get("searchText")
};
return this.get("store").query("canned_response", params);
},

addMessage() {
this.set("messageService.isAddMessageVisible", true);
},

closeOverlay() {
this.set("messageService.isProFormaMessageVisible", false);
},

editMessage(message, lang) {
this.set("messageService.editMessage.messageId", message.id);
this.set("messageService.editMessage.language", lang);
this.send("addMessage");
},

cancel() {
this.set("open", false);
}
}
});
20 changes: 20 additions & 0 deletions app/components/receive-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ export default Ember.Component.extend(AsyncTasksMixin, {
isReceived: Ember.computed.equal("package.state", "received"),
isMissing: Ember.computed.equal("package.state", "missing"),

isReceivedWithoutInventory: Ember.computed(
"package",
"isReceived",
function() {
return this.get("isReceived") && !this.get("package.inventoryNumber");
}
),

allowLabelPrint: Ember.computed(
"isReceived",
"package.inventoryNumber",
Expand Down Expand Up @@ -157,6 +165,18 @@ export default Ember.Component.extend(AsyncTasksMixin, {
}
},

inventorizeReceivedItem() {
this.get("messageBox").confirm(
this.get("i18n").t("receive.inventorize_warning"),
() => {
this.get("router").transitionTo(
"receive_package",
this.get("packageId")
);
}
);
},

applyReceiving(event, allow_event = true) {
if (!this.get("isFirstReceivingPackage") && allow_event) {
return this.send(event);
Expand Down
59 changes: 59 additions & 0 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import config from "../config/environment";

export default Ember.Controller.extend({
cordova: Ember.inject.service(),
subscriptions: Ember.inject.controller(),
messageService: Ember.inject.service(),
isMobileApp: config.cordova.enabled,
config,

app_id: config.APP.ANDROID_APP_ID,
ios_app_id: config.APP.IOS_APP_ID,
appTitle: config.APP.TITLE,
bannerImage: config.APP.BANNER_IMAGE,

initSubscriptions: Ember.on("init", function() {
if (this.session.get("isLoggedIn")) {
this.send("setSubscriptions");
}
}),

supportGCLink: Ember.computed("session.language", function() {
return this.get("session.language") === "zh-tw"
? "https://www.crossroads.org.hk/zh-hant/home/donate-funds/"
: "https://www.crossroads.org.hk/home/donate-funds/";
}),

appVersion: Ember.computed(function() {
return config.cordova.enabled ? config.APP.VERSION : null;
}),

actions: {
logMeOut() {
this.session.clear(); // this should be first since it updates isLoggedIn status
this.get("subscriptions").send("unwire");
this.get("subscriptions").send("unloadNotifications");
this.store.unloadAll();
var _this = this;
config.APP.PRELOAD_TYPES.forEach(function(type) {
_this.store.findAll(type);
});
this.transitionToRoute("login");
},

logMeIn() {
this.send("setSubscriptions");
},

setSubscriptions() {
this.get("subscriptions").send("wire");
},

rateApp() {
if (this.get("cordova").isIOS()) {
this.set("app_id", this.get("ios_app_id"));
}
LaunchReview.launch(this.get("app_id"));
}
}
});
Loading

0 comments on commit ed1cd15

Please sign in to comment.