From 49956cdd87b3958f8e5929d558268b4119873abe Mon Sep 17 00:00:00 2001 From: alaa smadi Date: Fri, 6 Dec 2024 01:25:27 +0300 Subject: [PATCH 1/6] fix(cp): enhance cp font family enhance cp text font family --- control/assets/control.css | 8 ++------ control/content/index.html | 4 +--- control/settings/index.html | 15 +++++++++------ gulpfile.js | 18 ++++++++++++++---- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/control/assets/control.css b/control/assets/control.css index 0e6115f..1d79aa5 100644 --- a/control/assets/control.css +++ b/control/assets/control.css @@ -7,9 +7,7 @@ html { font-size: 16px !important; } -body{ - font-family: 'Conv_apercu_regular','Helvetica','Sans-Serif','Arial'; -} + /* Text */ p{ font-size: .875rem; @@ -45,7 +43,6 @@ input[type="date"], input[type="email"], input[type="number"], textarea{ - font-family: 'Conv_apercu_regular','Helvetica','Sans-Serif','Arial'; font-size: .875rem; padding: .5rem .75rem; border: 1px solid #ddd; @@ -77,7 +74,6 @@ textarea{ } input[type="text"]::placeholder, textarea{ - font-family: 'Conv_apercu_regular','Helvetica','Sans-Serif','Arial'; font-size: .875rem; color: #5f5f5f; } @@ -91,4 +87,4 @@ textarea{ font-size: .875rem; margin-bottom: 1rem; display: block; -} \ No newline at end of file +} diff --git a/control/content/index.html b/control/content/index.html index 03fad7c..5cdd559 100755 --- a/control/content/index.html +++ b/control/content/index.html @@ -10,10 +10,8 @@ - - @@ -91,7 +89,7 @@

Introduction

- + - - - - + + + - +
- +
@@ -227,5 +228,7 @@
+ + diff --git a/gulpfile.js b/gulpfile.js index f2414c0..bf9e54f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -55,7 +55,7 @@ cssTasks.forEach(function(task){ }); const jsTasks=[ - {name:"widgetJS",src:["widget/assets/**/*.js", "widget/*.js" ,"widget/controllers/*.js"],dest:"/widget"} + {name:"widgetJS",src:["!widget/assets/**/*.js", "widget/*.js" ,"widget/controllers/*.js"],dest:"/widget"} ,{name:"controlContentJS",src:"control/content/**/*.js",dest:"/control/content"} ,{name:"controlDesignJS",src:"control/design/**/*.js",dest:"/control/design"} ,{name:"controlSettingsJS",src:"control/settings/**/*.js",dest:"/control/settings"} @@ -115,7 +115,7 @@ gulp.task('Controlhtml', function(){ /// replace all the comment bodies /// with scripts.min.js with cache buster .pipe(htmlReplace({ - bundleJSFiles:"../../widget/scripts.min.js?v=" + (new Date().getTime()) + bundleJSFiles:"./scripts.min.js?v=" + (new Date().getTime()) ,bundleCSSFiles:"styles.min.css?v=" + (new Date().getTime()) })) @@ -143,6 +143,16 @@ gulp.task('fonts', function(){ .pipe(gulp.dest(destinationFolder)); }); +gulp.task('assets', function(){ + return gulp.src(['widget/assets/**/**', 'control/assets/**'],{base: '.'}) + .pipe(gulp.dest(destinationFolder)); +}); + +gulp.task('tests', function(){ + return gulp.src(['control/tests/**'],{base: '.'}) + .pipe(gulp.dest(destinationFolder)); +}); + gulp.task('icons', function(){ return gulp.src(['widget/css/fonts/**/*.{ttf,woff,eot,svg}']) .pipe(gulp.dest(destinationFolder + '/widget/fonts')); @@ -155,10 +165,10 @@ gulp.task('zip', function () { .pipe(gulp.dest('..')); }); -var buildTasksToRun=['html', 'Controlhtml','resources','images','fonts','icons']; +var buildTasksToRun=['html', 'Controlhtml','resources','images','fonts','icons', 'assets', 'tests']; cssTasks.forEach(function(task){ buildTasksToRun.push(task.name)}); jsTasks.forEach(function(task){ buildTasksToRun.push(task.name)}); gulp.task('build', gulpSequence('clean',buildTasksToRun) ); -gulp.task('zipit', gulpSequence('zip'));// run by 'gulp zip' (191001 - Marcela) \ No newline at end of file +gulp.task('zipit', gulpSequence('zip'));// run by 'gulp zip' (191001 - Marcela) From d93535687e16c7e178cbfc21d6432366604d405b Mon Sep 17 00:00:00 2001 From: alaa smadi Date: Fri, 6 Dec 2024 01:28:28 +0300 Subject: [PATCH 2/6] fix(widget): add messing languages add messing languages and add user image loader --- resources/languages.json | 131 +++++++++ widget/app.services.js | 13 +- widget/assets/css/animations.css | 20 ++ widget/assets/js/utils.js | 21 +- widget/controllers/widget.home.controller.js | 292 ++++++++++++------- widget/controllers/widget.item.controller.js | 12 +- widget/index.html | 14 +- widget/templates/Item_details.html | 12 +- 8 files changed, 376 insertions(+), 139 deletions(-) diff --git a/resources/languages.json b/resources/languages.json index 2c1caa3..974cd8a 100644 --- a/resources/languages.json +++ b/resources/languages.json @@ -13,6 +13,14 @@ "toolTip": "The word Comment in the comment button", "placeholder": "Comment" }, + "updateStatus": { + "title": "Update Status", + "defaultValue": "Update Status", + "inputType": "text", + "maxLength": 20, + "toolTip": "", + "placeholder": "Update Status" + }, "backlog": { "title": "Backlog", "defaultValue": "Backlog", @@ -50,6 +58,41 @@ "inputType": "text", "toolTip": "", "placeholder": "Getting your purchase ready, please wait..." + }, + "suggestionSuccessfullyAdded": { + "title": "Suggestion Successfully Added", + "defaultValue": "Your suggestion has been successfully added.", + "inputType": "text", + "toolTip": "", + "placeholder": "Your suggestion has been successfully added." + }, + "somethingWentWrong": { + "title": "Something went wrong", + "defaultValue": "Something went wrong, please try again later.", + "inputType": "text", + "toolTip": "", + "placeholder": "Something went wrong, please try again later." + }, + "purchaseWasCancelled": { + "title": "Purchase Was Cancelled", + "defaultValue": "The purchase was cancelled", + "inputType": "text", + "toolTip": "", + "placeholder": "The purchase was cancelled" + }, + "upvotes": { + "title": "Upvotes", + "defaultValue": "Upvotes", + "inputType": "text", + "toolTip": "", + "placeholder": "Upvotes" + }, + "purchaseNotAvailable": { + "title": "Purchase Not Available", + "defaultValue": "Purchase Not Available On Browser", + "inputType": "text", + "toolTip": "", + "placeholder": "Purchase Not Available On Browser" } } }, @@ -197,6 +240,94 @@ "placeholder": "Remove" } } + }, + "notifications": { + "title": "Notifications", + "labels": { + "newItemTitle": { + "title": "New Item Created Title", + "defaultValue": "A new item has been created", + "inputType": "text", + "toolTip": "", + "maxLength": 50, + "placeholder": "A new item has been created" + }, + "newItemBody": { + "title": "New Item Created Message", + "defaultValue": "A ${context.plugin.title} has been created", + "inputType": "text", + "toolTip": "", + "maxLength": 150, + "placeholder": "A ${context.plugin.title} has been created" + }, + + "backlogItemTitle": { + "title": "Task in Backlog Title", + "defaultValue": "Task in Backlog", + "inputType": "text", + "toolTip": "", + "maxLength": 50, + "placeholder": "Task in Backlog" + }, + "backlogItemBody": { + "title": "Task in Backlog Message", + "defaultValue": "${context.plugin.title} has been marked as in backlog", + "inputType": "text", + "toolTip": "", + "maxLength": 150, + "placeholder": "${context.plugin.title} has been marked as in backlog" + }, + + "inProgressItemTitle": { + "title": "Task in Progress Title", + "defaultValue": "Task in Progress", + "inputType": "text", + "toolTip": "", + "maxLength": 50, + "placeholder": "Task in Progress" + }, + "inProgressItemBody": { + "title": "Task in Progress Message", + "defaultValue": "${context.plugin.title} has been marked as in Progress", + "inputType": "text", + "toolTip": "", + "maxLength": 150, + "placeholder": "${context.plugin.title} has been marked as in Progress" + }, + + "completedItemBody": { + "title": "Task Completed", + "defaultValue": "Task Completed", + "inputType": "text", + "toolTip": "", + "maxLength": 50, + "placeholder": "Task Completed" + }, + "completedItemMessageInputPlaceholder": { + "title": "Completed Task Message Input", + "defaultValue": "${context.plugin.title} has been marked as completed", + "inputType": "text", + "toolTip": "", + "maxLength": 150, + "placeholder": "${context.plugin.title} has been marked as completed" + }, + "completedItemMessageSendText": { + "title": "Completed Task Message Send Text", + "defaultValue": "Send", + "inputType": "text", + "toolTip": "", + "maxLength": 9, + "placeholder": "Send" + }, + "completedItemMessageCancelText": { + "title": "Completed Task Message Cancel Text", + "defaultValue": "Cancel", + "inputType": "text", + "toolTip": "", + "maxLength": 9, + "placeholder": "Cancel" + } + } } } } diff --git a/widget/app.services.js b/widget/app.services.js index 1d247ba..4e50f22 100644 --- a/widget/app.services.js +++ b/widget/app.services.js @@ -41,15 +41,4 @@ } }; }]) - .filter('getUserImage', function () { - return function (user) { - var url = './assets/images/avatar.png'; - if (user) { - url = buildfire.auth.getUserPictureUrl({ userId: user._id }); - url = buildfire.imageLib.cropImage(url,{ size: "xs", aspect: "1:1" }); - return url; - } - return url; - }; - }) -})(window.angular, window.buildfire); \ No newline at end of file +})(window.angular, window.buildfire); diff --git a/widget/assets/css/animations.css b/widget/assets/css/animations.css index d8c7d4a..da88ab6 100644 --- a/widget/assets/css/animations.css +++ b/widget/assets/css/animations.css @@ -5,6 +5,26 @@ animation-fill-mode: both; } +.user-image-container { + min-width: 40px; + min-height: 40px; + overflow: hidden; + position: relative; + border-radius: 100%; +} + +.loading-image::after { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + transform: translateX(-100%); + background-image: linear-gradient(90deg, rgba(var(--bf-theme-background-rgb), 0) 0, rgba(var(--bf-theme-background-rgb), 0.2) 20%, rgba(var(--bf-theme-background-rgb), 0.5) 60%, rgba(var(--bf-theme-background-rgb), 0)); + -webkit-animation: shimmer 2s infinite; + animation: shimmer 2s infinite; + content: ""; +} @-webkit-keyframes fadeInRight { from { diff --git a/widget/assets/js/utils.js b/widget/assets/js/utils.js index 39451b3..3a479ff 100644 --- a/widget/assets/js/utils.js +++ b/widget/assets/js/utils.js @@ -22,9 +22,9 @@ function getStartDate(selectedDuration) { } /** - * - * @param {string} credit - * @param {string} key + * + * @param {string} credit + * @param {string} key * @returns Base64 encoding value */ function encryptCredit(credit, key) { @@ -39,9 +39,9 @@ function encryptCredit(credit, key) { } /** - * - * @param {string} encryptedCredit - * @param {string} key + * + * @param {string} encryptedCredit + * @param {string} key * @returns Base64 decoding value */ function decryptCredit(encryptedCredit, key) { @@ -54,3 +54,12 @@ function decryptCredit(encryptedCredit, key) { } return decryptedCredit; } + +function validateImage(imgUrl) { + return new Promise((resolve) => { + const img = new Image(); + img.onload = () => resolve(true); + img.onerror = () => resolve(false); + img.src = imgUrl; + }); +} diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js index 4760fc8..575e82d 100644 --- a/widget/controllers/widget.home.controller.js +++ b/widget/controllers/widget.home.controller.js @@ -93,14 +93,14 @@ var config = {}; appThemeColors = result.colors }); - let remainingVotesExpressionOptions = { + let votesExpressionOptions = { plugin: { remainingVotes: 0, } } buildfire.dynamic.expressions.getContext = (options, callback) => { - callback(null, remainingVotesExpressionOptions) + callback(null, votesExpressionOptions) } UpVoteHome.goToItemDetails = function (selectedItem) { @@ -139,7 +139,6 @@ var config = {}; Promise.all([callBacklogText, callInProgressText,callCompletedText]).then(result => { $rootScope.TextStatuses = result; _suggestion.statusName = $rootScope.TextStatuses[_suggestion.status - 1] - _suggestion.imgUrl = getUserImage(_suggestion.createdBy); _suggestion._createdOn = getCurrentDate(_suggestion.createdOn); _suggestion._displayName = getUserName(_suggestion.createdBy); @@ -275,8 +274,22 @@ var config = {}; function update(data) { hideSkeleton(); UpVoteHome.isInitalized = true; - $scope.suggestions = data; + $scope.suggestions = data.map((suggestion) => { + suggestion.imgUrl = 'assets/images/avatar.png'; + suggestion.imageInProgress = true; + return suggestion; + }) $scope.suggestions = sortArray($scope.suggestions); + $scope.suggestions.forEach((suggestion) => { + const ownerImage = buildfire.auth.getUserPictureUrl({ userId: suggestion.createdBy._id }); + validateImage(ownerImage).then((isValid) => { + if (isValid) { + suggestion.imgUrl = buildfire.imageLib.cropImage(ownerImage, { size: 'm', aspect: '1:1' }); + } + suggestion.imageInProgress = false; + if (!$scope.$$phase) $scope.$apply(); + }); + }) buildfire.spinner.hide(); if (!$scope.$$phase) $scope.$apply(); } @@ -287,7 +300,6 @@ var config = {}; item.disableUpvote = _currentUser ? !item || !item.upVotedBy || item.upVotedBy[_currentUser._id] : false; item.upvoteByYou = item.upVotedBy && _currentUser && item.upVotedBy[_currentUser._id] != null; item.statusName = $rootScope.TextStatuses[item.status - 1] - item.imgUrl = getUserImage(item.createdBy); return item; } }).catch(err => console.log(err)) @@ -309,21 +321,16 @@ var config = {}; init(); }); - function getUserImage(user){ - var url = './avatar.png'; - if (user) { - url = buildfire.auth.getUserPictureUrl({ userId: user._id }); - url = buildfire.imageLib.cropImage(url,{ size: "xs", aspect: "1:1" }); - return url; - } - return url; - } - function renderStatusItem(text, index){ const element = ` -
- ${text}
` + + ${text}` return element; } @@ -407,22 +414,28 @@ var config = {}; const listItems = []; for(let i=0;iUpvotes', - isHTML: true, - triggerCallbackOnUIDismiss: false, - autoUseImageCdn: true, - listItems: listItems - }, - () => {} - ); + getLanguageValue('mainScreen.upvotes').then((upvotesText) => { + buildfire.components.drawer.open( + { + content: `${upvotesText}`, + isHTML: true, + triggerCallbackOnUIDismiss: false, + autoUseImageCdn: true, + listItems: listItems + }, + () => {} + ); + }); }); }; @@ -441,7 +454,7 @@ var config = {}; if(_currentUser.tags && _currentUser.tags[buildfire.context.appId] && $rootScope.settings.statusUpdateTags.length > 0){ _currentUser.tags[buildfire.context.appId].forEach(tag => { $rootScope.settings.statusUpdateTags.forEach(settingTag => { - if(settingTag.tagName == tag.tagName){ + if(settingTag.value == tag.tagName || settingTag.tagName == tag.tagName){ userContainAnyStatusTags = true; } }) @@ -453,43 +466,79 @@ var config = {}; for(let i=1;i<=$rootScope.TextStatuses.length;i++){ listItems.push({ id: i, - text: renderStatusItem($rootScope.TextStatuses[i-1], i) - }) + text: renderStatusItem($rootScope.TextStatuses[i-1], i), + selected: suggestion.status === i + }); } - buildfire.components.drawer.open( - { - content: 'Update Status', - isHTML: true, - triggerCallbackOnUIDismiss: false, - listItems: listItems - }, - (err, result) => { - if(suggestion.status != result.id){ - suggestion.status = parseInt(result.id) - Suggestion.update(suggestion).then(()=>{ - suggestion.statusName = $rootScope.TextStatuses[suggestion.status-1] - const voterIds = Object.keys(suggestion.upVotedBy); - if(suggestion.status == SUGGESTION_STATUS.COMPLETED){ - buildfire.input.showTextDialog({ - placeholder: `"${suggestion.title}" has been marked as completed`, - saveText: "Post", - defaultValue: `"${suggestion.title}" has been marked as completed`, - required: true - }, (err, response)=>{ - //$rootScope.goSocial(suggestion); - PushNotification.sendToCustomUsers("Task Completed", response.results[0].textValue, suggestion.id, voterIds); - }) - } else if(suggestion.status === SUGGESTION_STATUS.INPROGRESS){ - PushNotification.sendToCustomUsers("Task in Progress", `"${suggestion.title}" has been marked as in progress`,suggestion.id, voterIds); - } else if(suggestion.status === SUGGESTION_STATUS.BACKLOG){ - PushNotification.sendToCustomUsers("Task in Backlog", `"${suggestion.title}" has been marked as in backlog`,suggestion.id, voterIds); - } - if (!$scope.$$phase) $scope.$apply(); - }) + + const _appThemeColors = buildfire.getContext().appTheme.colors; + getLanguageValue('mainScreen.updateStatus').then((headerText) => { + buildfire.components.drawer.open( + { + multiSelection: false, + allowSelectAll : false, + content: `
${headerText}
`, + isHTML: true, + triggerCallbackOnUIDismiss: false, + listItems: listItems + }, + (err, result) => { + buildfire.components.drawer.closeDrawer(); + + if (err) return console.error(err); + + if(suggestion.status != result.id){ + suggestion.status = parseInt(result.id) + Suggestion.update(suggestion).then(()=>{ + suggestion.statusName = $rootScope.TextStatuses[suggestion.status-1] + const voterIds = Object.keys(suggestion.upVotedBy); + + votesExpressionOptions.plugin.title = suggestion.title; + Promise.all([ + getLanguageValue("notifications.backlogItemTitle"), + getLanguageValue("notifications.backlogItemBody"), + getLanguageValue("notifications.inProgressItemTitle"), + getLanguageValue("notifications.inProgressItemBody"), + getLanguageValue("notifications.completedItemBody"), + getLanguageValue("notifications.completedItemMessageInputPlaceholder"), + getLanguageValue("notifications.completedItemMessageSendText"), + getLanguageValue("notifications.completedItemMessageCancelText"), + ]) + .then(([ + backlogItemTitle, + backlogItemBody, + inProgressItemTitle, + inProgressItemBody, + completedItemBody, + completedItemMessageInputPlaceholder, + completedItemMessageSendText, + completedItemMessageCancelText, + ]) => { + if(suggestion.status == SUGGESTION_STATUS.COMPLETED){ + buildfire.input.showTextDialog({ + placeholder: completedItemMessageInputPlaceholder, + saveText: completedItemMessageSendText, + defaultValue: completedItemMessageInputPlaceholder, + required: true, + cancelText: completedItemMessageCancelText + }, (err, response)=>{ + if (err) console.error(err); + if (response && response.results && response.results[0]) { + PushNotification.sendToCustomUsers(completedItemBody, response.results[0].textValue, suggestion.id, voterIds); + } + }) + } else if(suggestion.status === SUGGESTION_STATUS.INPROGRESS){ + PushNotification.sendToCustomUsers(inProgressItemTitle, inProgressItemBody,suggestion.id, voterIds); + } else if(suggestion.status === SUGGESTION_STATUS.BACKLOG){ + PushNotification.sendToCustomUsers(backlogItemTitle, backlogItemBody,suggestion.id, voterIds); + } + if (!$scope.$$phase) $scope.$apply(); + }); + }); + } } - buildfire.components.drawer.closeDrawer(); - } - ); + ); + }) } @@ -566,6 +615,16 @@ var config = {}; }; const purchaseHandler = function() { + const platform = buildfire.getContext().device.platform; + if (platform === 'web') { + getLanguageValue('mainScreen.purchaseNotAvailable').then((toastMessage) => { + buildfire.dialog.toast({ + message: toastMessage, + type: 'danger', + }); + }); + return; + } if ($rootScope.settings.selectedPurchaseProductId) { if (!blockIAP) { $scope.blockVote = true; @@ -580,26 +639,26 @@ var config = {}; type: 'info', }); buildfire.services.commerce.inAppPurchase.purchase( - $rootScope.settings.selectedPurchaseProductId, - (err, res) => { - if (err) { - return console.error( - err - ); - } - if (res.hasErrors) { - buildfire.dialog.toast({ - message: - 'Something went wrong, please try again later.', - type: 'danger', + $rootScope.settings.selectedPurchaseProductId, (err, res) => { + if (err || !res || res.hasErrors) { + getLanguageValue('mainScreen.somethingWentWrong').then((toastMessage) => { + buildfire.dialog.toast({ + message: toastMessage, + type: 'danger', + }); + + if (err) console.error(err); + return; }); } + if (res.isCancelled) { - buildfire.dialog.toast({ - message: - 'The purchase was cancelled', - type: 'warning', - }); + getLanguageValue('mainScreen.purchaseWasCancelled').then((toastMessage) => { + buildfire.dialog.toast({ + message: toastMessage, + type: 'warning', + }); + }) return; } if (res.isApproved) { @@ -698,7 +757,7 @@ var config = {}; }, }; - remainingVotesExpressionOptions.plugin.remainingVotes = credit + votesExpressionOptions.plugin.remainingVotes = credit return UserCredit.update($scope.currentUserCreditData.id,payload).then( () => { buildfire.language.get({stringKey: 'mainScreen.voteConfirmed'}, (err, result) => { @@ -881,7 +940,13 @@ var config = {}; var obj = { title: title, suggestion: text, - createdBy: user, + createdBy: { + _id: user._id, + displayName: user.displayName, + email: user.email, + firstName: user.firstName, + lastName: user.lastName, + }, createdOn: new Date(), upVoteCount: 1, upVotedBy: {}, @@ -893,33 +958,42 @@ var config = {}; }; Suggestion.insert(obj, (err, result) => { - buildfire.dialog.toast({ - message: "Your suggestion has been successfully added.", - type: "info" - }); - const suggestion = new Suggestion(result) - suggestion.disableUpvote = true; - suggestion.statusName = $rootScope.TextStatuses[0]; - suggestion.upvoteByYou = true; - $scope.suggestions.unshift(suggestion); - if($rootScope.settings){ - const title = "A new item has been created"; - const message = `A "${suggestion.title}" has been created`; - if($rootScope.settings.pushNotificationUsersSegment === PUSH_NOTIFICATIONS_SEGMENT.ALL_USERS){ - PushNotification.sendToAll(title, message, suggestion.id); - } else if($rootScope.settings.pushNotificationUsersSegment === PUSH_NOTIFICATIONS_SEGMENT.TAGS){ - const userTags = $rootScope.settings.pushNotificationTags.map(tag=> tag.tagName); - if(userTags.length > 0){ - PushNotification.sendToUserSegment(title, message, suggestion.id, userTags) - } + let languageKey = 'mainScreen.suggestionSuccessfullyAdded'; + if (err) languageKey = 'mainScreen.somethingWentWrong'; + + getLanguageValue(languageKey).then((toastMessage) => { + buildfire.dialog.toast({ + message: toastMessage, + type: "info" + }); + + if (err) return console.error(err); + + const suggestion = new Suggestion(result) + suggestion.disableUpvote = true; + suggestion.statusName = $rootScope.TextStatuses[0]; + suggestion.upvoteByYou = true; + $scope.suggestions.unshift(suggestion); + if($rootScope.settings){ + votesExpressionOptions.plugin.title = suggestion.title; + Promise.all([getLanguageValue("notifications.newItemTitle"), getLanguageValue("notifications.newItemBody")]) + .then(([title, message]) => { + if($rootScope.settings.pushNotificationUsersSegment === PUSH_NOTIFICATIONS_SEGMENT.ALL_USERS){ + PushNotification.sendToAll(title, message, suggestion.id); + } else if($rootScope.settings.pushNotificationUsersSegment === PUSH_NOTIFICATIONS_SEGMENT.TAGS){ + const userTags = $rootScope.settings.pushNotificationTags.map(tag=> tag.tagName); + if(userTags.length > 0){ + PushNotification.sendToUserSegment(title, message, suggestion.id, userTags) + } + } + }) } - } - suggestion._createdOn = getCurrentDate(suggestion.createdOn); - suggestion.createdBy = _currentUser - suggestion._displayName = getUserName(suggestion.createdBy); - suggestion.imgUrl = getUserImage(suggestion.createdBy); + suggestion._createdOn = getCurrentDate(suggestion.createdOn); + suggestion.createdBy = _currentUser + suggestion._displayName = getUserName(suggestion.createdBy); - if (!$scope.$$phase) $scope.$apply(); + if (!$scope.$$phase) $scope.$apply(); + }); }) } diff --git a/widget/controllers/widget.item.controller.js b/widget/controllers/widget.item.controller.js index 94e17f0..d078949 100644 --- a/widget/controllers/widget.item.controller.js +++ b/widget/controllers/widget.item.controller.js @@ -8,8 +8,18 @@ var WidgetItem = this; WidgetItem.listeners = {} $scope.selectedSuggestion = ViewStack.getCurrentView().item + $scope.selectedSuggestion.imageInProgress = true; + + const ownerImage = buildfire.auth.getUserPictureUrl({ userId: $scope.selectedSuggestion.createdBy._id }); + + validateImage(ownerImage).then((isValid) => { + if (isValid) { + $scope.selectedSuggestion.imgUrl = ownerImage; + } + $scope.selectedSuggestion.imageInProgress = false; + if (!$scope.$$phase) $scope.$apply(); + }); - } diff --git a/widget/index.html b/widget/index.html index 009ae4d..0ad005a 100755 --- a/widget/index.html +++ b/widget/index.html @@ -18,6 +18,10 @@ + + + + @@ -25,9 +29,6 @@ - - - @@ -64,9 +65,10 @@
- {{s.createdBy.displayName}} profile image +
+ {{s.createdBy.displayName}} profile image +

{{s._displayName}}

{{s._createdOn}}
diff --git a/widget/templates/Item_details.html b/widget/templates/Item_details.html index 609c644..ea8b37b 100644 --- a/widget/templates/Item_details.html +++ b/widget/templates/Item_details.html @@ -2,14 +2,16 @@
- {{selectedSuggestion.createdBy.displayName}} profile image +
+ {{selectedSuggestion.createdBy.displayName}} profile image +

{{selectedSuggestion._displayName}}

{{selectedSuggestion._createdOn}}
{{selectedSuggestion.createdOn | date:'MMM dd, y'}}
- +

{{selectedSuggestion.statusName}}

@@ -31,9 +33,9 @@

{{selec

From 2985ac25595862fc9cd2d707dea3546d1e5a03e7 Mon Sep 17 00:00:00 2001 From: alaa smadi Date: Fri, 6 Dec 2024 02:50:57 +0300 Subject: [PATCH 3/6] fix(widget): finalize gulp build finalize gulp build to include shared and data files \ --- control/content/index.html | 9 ++++++--- control/settings/index.html | 4 +++- control/tests/index.html | 5 ++++- gulpfile.js | 5 ++++- widget/assets/css/animations.css | 2 ++ widget/controllers/widget.home.controller.js | 12 +++++++++++- widget/controllers/widget.item.controller.js | 2 +- widget/index.html | 2 ++ 8 files changed, 33 insertions(+), 8 deletions(-) diff --git a/control/content/index.html b/control/content/index.html index 5cdd559..bbc5864 100755 --- a/control/content/index.html +++ b/control/content/index.html @@ -10,8 +10,11 @@ + + + @@ -19,7 +22,7 @@ - + + + diff --git a/control/tests/index.html b/control/tests/index.html index a52aa9e..e1761b8 100644 --- a/control/tests/index.html +++ b/control/tests/index.html @@ -9,12 +9,15 @@ + + + - \ No newline at end of file + diff --git a/gulpfile.js b/gulpfile.js index bf9e54f..441760e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -56,6 +56,7 @@ cssTasks.forEach(function(task){ const jsTasks=[ {name:"widgetJS",src:["!widget/assets/**/*.js", "widget/*.js" ,"widget/controllers/*.js"],dest:"/widget"} + ,{name:"sharedJS",src:["widget/assets/**/*.js"],dest:"/widget/shared"} ,{name:"controlContentJS",src:"control/content/**/*.js",dest:"/control/content"} ,{name:"controlDesignJS",src:"control/design/**/*.js",dest:"/control/design"} ,{name:"controlSettingsJS",src:"control/settings/**/*.js",dest:"/control/settings"} @@ -101,6 +102,7 @@ gulp.task('html', function(){ .pipe(htmlReplace({ bundleJSFiles:"scripts.min.js?v=" + (new Date().getTime()) ,bundleCSSFiles:"styles.min.css?v=" + (new Date().getTime()) + ,bundleSharedJSFiles:"./shared/scripts.min.js?v=" + (new Date().getTime()) })) /// then strip the html from any comments @@ -116,6 +118,7 @@ gulp.task('Controlhtml', function(){ /// with scripts.min.js with cache buster .pipe(htmlReplace({ bundleJSFiles:"./scripts.min.js?v=" + (new Date().getTime()) + ,bundleSharedJSFiles:"../../widget/shared/scripts.min.js?v=" + (new Date().getTime()) ,bundleCSSFiles:"styles.min.css?v=" + (new Date().getTime()) })) @@ -144,7 +147,7 @@ gulp.task('fonts', function(){ }); gulp.task('assets', function(){ - return gulp.src(['widget/assets/**/**', 'control/assets/**'],{base: '.'}) + return gulp.src(['widget/assets/**/*.{css,png,svg}', 'control/assets/**'],{base: '.'}) .pipe(gulp.dest(destinationFolder)); }); diff --git a/widget/assets/css/animations.css b/widget/assets/css/animations.css index da88ab6..bbc7dca 100644 --- a/widget/assets/css/animations.css +++ b/widget/assets/css/animations.css @@ -8,6 +8,8 @@ .user-image-container { min-width: 40px; min-height: 40px; + width: 40px; + height: 40px; overflow: hidden; position: relative; border-radius: 100%; diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js index 575e82d..8bca804 100644 --- a/widget/controllers/widget.home.controller.js +++ b/widget/controllers/widget.home.controller.js @@ -989,9 +989,19 @@ var config = {}; }) } suggestion._createdOn = getCurrentDate(suggestion.createdOn); - suggestion.createdBy = _currentUser suggestion._displayName = getUserName(suggestion.createdBy); + suggestion.imgUrl = 'assets/images/avatar.png'; + suggestion.imageInProgress = true; + const ownerImage = buildfire.auth.getUserPictureUrl({ userId: suggestion.createdBy._id }); + validateImage(ownerImage).then((isValid) => { + if (isValid) { + suggestion.imgUrl = buildfire.imageLib.cropImage(ownerImage, { size: 'm', aspect: '1:1' }); + } + suggestion.imageInProgress = false; + if (!$scope.$$phase) $scope.$apply(); + }); + if (!$scope.$$phase) $scope.$apply(); }); }) diff --git a/widget/controllers/widget.item.controller.js b/widget/controllers/widget.item.controller.js index d078949..f0f3030 100644 --- a/widget/controllers/widget.item.controller.js +++ b/widget/controllers/widget.item.controller.js @@ -14,7 +14,7 @@ validateImage(ownerImage).then((isValid) => { if (isValid) { - $scope.selectedSuggestion.imgUrl = ownerImage; + $scope.selectedSuggestion.imgUrl = buildfire.imageLib.cropImage(ownerImage, { size: 'm', aspect: '1:1' }); } $scope.selectedSuggestion.imageInProgress = false; if (!$scope.$$phase) $scope.$apply(); diff --git a/widget/index.html b/widget/index.html index 0ad005a..bc903e8 100755 --- a/widget/index.html +++ b/widget/index.html @@ -22,6 +22,7 @@ + @@ -29,6 +30,7 @@ + From 5d653d4ad9d0aa3e7d981b9b1404d9b90b4c5867 Mon Sep 17 00:00:00 2001 From: alaa smadi Date: Fri, 6 Dec 2024 03:08:30 +0300 Subject: [PATCH 4/6] fix(widget): handle tag value use tag value for notifications --- widget/controllers/widget.home.controller.js | 2 +- widget/controllers/widget.item.controller.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js index 8bca804..895427c 100644 --- a/widget/controllers/widget.home.controller.js +++ b/widget/controllers/widget.home.controller.js @@ -981,7 +981,7 @@ var config = {}; if($rootScope.settings.pushNotificationUsersSegment === PUSH_NOTIFICATIONS_SEGMENT.ALL_USERS){ PushNotification.sendToAll(title, message, suggestion.id); } else if($rootScope.settings.pushNotificationUsersSegment === PUSH_NOTIFICATIONS_SEGMENT.TAGS){ - const userTags = $rootScope.settings.pushNotificationTags.map(tag=> tag.tagName); + const userTags = $rootScope.settings.pushNotificationTags.map(tag=> (tag.tagName ? tag.tagName : tag.value)); if(userTags.length > 0){ PushNotification.sendToUserSegment(title, message, suggestion.id, userTags) } diff --git a/widget/controllers/widget.item.controller.js b/widget/controllers/widget.item.controller.js index f0f3030..e2477c5 100644 --- a/widget/controllers/widget.item.controller.js +++ b/widget/controllers/widget.item.controller.js @@ -13,8 +13,9 @@ const ownerImage = buildfire.auth.getUserPictureUrl({ userId: $scope.selectedSuggestion.createdBy._id }); validateImage(ownerImage).then((isValid) => { + if (!$scope.selectedSuggestion) return; if (isValid) { - $scope.selectedSuggestion.imgUrl = buildfire.imageLib.cropImage(ownerImage, { size: 'm', aspect: '1:1' }); + $scope.selectedSuggestion.imgUrl = buildfire.imageLib.cropImage(ownerImage, { size: 'm', aspect: '1:1' }); } $scope.selectedSuggestion.imageInProgress = false; if (!$scope.$$phase) $scope.$apply(); From 319e6505ee1363e129bf27c5893f91ba5364d433 Mon Sep 17 00:00:00 2001 From: alaa smadi Date: Mon, 9 Dec 2024 01:14:45 +0300 Subject: [PATCH 5/6] fix(widget): enhance notifications enhance notifications default string value --- resources/languages.json | 32 ++++++++++---------- widget/controllers/widget.home.controller.js | 4 +-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/resources/languages.json b/resources/languages.json index 974cd8a..79d8750 100644 --- a/resources/languages.json +++ b/resources/languages.json @@ -254,45 +254,45 @@ }, "newItemBody": { "title": "New Item Created Message", - "defaultValue": "A ${context.plugin.title} has been created", + "defaultValue": "A ${context.plugin.itemTitle} has been created", "inputType": "text", "toolTip": "", "maxLength": 150, - "placeholder": "A ${context.plugin.title} has been created" + "placeholder": "A ${context.plugin.itemTitle} has been created" }, "backlogItemTitle": { - "title": "Task in Backlog Title", - "defaultValue": "Task in Backlog", + "title": "Task In Backlog Title", + "defaultValue": "Task In Backlog", "inputType": "text", "toolTip": "", "maxLength": 50, - "placeholder": "Task in Backlog" + "placeholder": "Task In Backlog" }, "backlogItemBody": { - "title": "Task in Backlog Message", - "defaultValue": "${context.plugin.title} has been marked as in backlog", + "title": "Task In Backlog Message", + "defaultValue": "${context.plugin.itemTitle} has been marked as In Backlog", "inputType": "text", "toolTip": "", "maxLength": 150, - "placeholder": "${context.plugin.title} has been marked as in backlog" + "placeholder": "${context.plugin.itemTitle} has been marked as In Backlog" }, "inProgressItemTitle": { - "title": "Task in Progress Title", - "defaultValue": "Task in Progress", + "title": "Task In Progress Title", + "defaultValue": "Task In Progress", "inputType": "text", "toolTip": "", "maxLength": 50, - "placeholder": "Task in Progress" + "placeholder": "Task In Progress" }, "inProgressItemBody": { - "title": "Task in Progress Message", - "defaultValue": "${context.plugin.title} has been marked as in Progress", + "title": "Task In Progress Message", + "defaultValue": "${context.plugin.itemTitle} has been marked as In Progress", "inputType": "text", "toolTip": "", "maxLength": 150, - "placeholder": "${context.plugin.title} has been marked as in Progress" + "placeholder": "${context.plugin.itemTitle} has been marked as In Progress" }, "completedItemBody": { @@ -305,11 +305,11 @@ }, "completedItemMessageInputPlaceholder": { "title": "Completed Task Message Input", - "defaultValue": "${context.plugin.title} has been marked as completed", + "defaultValue": "${context.plugin.itemTitle} has been marked as completed", "inputType": "text", "toolTip": "", "maxLength": 150, - "placeholder": "${context.plugin.title} has been marked as completed" + "placeholder": "${context.plugin.itemTitle} has been marked as completed" }, "completedItemMessageSendText": { "title": "Completed Task Message Send Text", diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js index 895427c..d38f9d1 100644 --- a/widget/controllers/widget.home.controller.js +++ b/widget/controllers/widget.home.controller.js @@ -493,7 +493,7 @@ var config = {}; suggestion.statusName = $rootScope.TextStatuses[suggestion.status-1] const voterIds = Object.keys(suggestion.upVotedBy); - votesExpressionOptions.plugin.title = suggestion.title; + votesExpressionOptions.plugin.itemTitle = suggestion.title; Promise.all([ getLanguageValue("notifications.backlogItemTitle"), getLanguageValue("notifications.backlogItemBody"), @@ -975,7 +975,7 @@ var config = {}; suggestion.upvoteByYou = true; $scope.suggestions.unshift(suggestion); if($rootScope.settings){ - votesExpressionOptions.plugin.title = suggestion.title; + votesExpressionOptions.plugin.itemTitle = suggestion.title; Promise.all([getLanguageValue("notifications.newItemTitle"), getLanguageValue("notifications.newItemBody")]) .then(([title, message]) => { if($rootScope.settings.pushNotificationUsersSegment === PUSH_NOTIFICATIONS_SEGMENT.ALL_USERS){ From 1241493e0101528db56f00358aeca5f3407f6bfd Mon Sep 17 00:00:00 2001 From: alaa smadi Date: Wed, 11 Dec 2024 00:33:21 +0300 Subject: [PATCH 6/6] feat(widget): add unknown user name to language tab add unknown user name to language tab --- resources/languages.json | 8 ++++++++ widget/controllers/widget.home.controller.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/resources/languages.json b/resources/languages.json index 79d8750..6d44950 100644 --- a/resources/languages.json +++ b/resources/languages.json @@ -93,6 +93,14 @@ "inputType": "text", "toolTip": "", "placeholder": "Purchase Not Available On Browser" + }, + "unknownUser": { + "title": "Unknown User", + "defaultValue": "Someone", + "inputType": "text", + "maxLength": 20, + "toolTip": "", + "placeholder": "Someone" } } }, diff --git a/widget/controllers/widget.home.controller.js b/widget/controllers/widget.home.controller.js index d38f9d1..5489c21 100644 --- a/widget/controllers/widget.home.controller.js +++ b/widget/controllers/widget.home.controller.js @@ -165,7 +165,7 @@ var config = {}; (user.lastName ? user.lastName : '') ); } else { - return 'Someone'; + return getLanguageString('mainScreen.unknownUser') || 'Someone'; } } }