Skip to content

Commit 8c5e346

Browse files
authored
Merge pull request #30 from AlaaN-Smadi/fix/qr-code-generator
fix(widget): use qr-code-generator - PLUG-2337
2 parents 8cd8bd4 + d03f62b commit 8c5e346

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

widget/index.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<script type="text/javascript" src="../../../scripts/owlCarousel/owlCarousel.js"></script>
1919
<script type="text/javascript" src="../../../scripts/buildfire/components/carousel/carousel.js"></script>
2020
<script type="text/javascript" src="../../../scripts/buildfire/components/pluginInstance/sortableList.js"></script>
21+
<script type="text/javascript" src="./js/qrcode.min.js"></script>
2122
<script type="text/javascript" src="../js/shared.js"></script>
2223
</head>
2324
<body ng-controller="sharePluginCtrl" data-ng-cloak>
@@ -33,7 +34,7 @@
3334
<div class="text-center padded padding-bottom-zero clearfix">
3435
<p>Scan to share with QR Code.</p>
3536
<div class="qr-holder margin-top-ten" style="max-width:190px; margin:0 auto;">
36-
<img ng-src="{{qrCodeUrl}}"/>
37+
<div class="qrcodeContainer flex flex-justify-center" id="qrcodeContainer"></div>
3738
<div class="margin-top-fifteen">
3839
<a class="btn btn-primary stretch" disabled="disabled" data-ng-click="share();" data-ng-disabled="disableShare">Share the App Via...</a>
3940
</div>
@@ -44,7 +45,6 @@
4445
</div>
4546
<script>
4647
var sharePluginApp = angular.module('sharePlugin', []);
47-
var qrGeneratorUrl = 'https://chart.googleapis.com/chart?chs=180x180&cht=qr&chl=';
4848
var shareUrl = 'http://[appHost]/api/promoProxy/[appId]/';
4949
sharePluginApp.controller('sharePluginCtrl', ['$scope', '$sce', function ($scope, $sce) {
5050
var view = null;
@@ -69,7 +69,13 @@
6969
}
7070
else {
7171
$scope.shareUrl = shareUrl.replace('[appHost]', context.cpDomain).replace('[appId]', context.appId);
72-
$scope.qrCodeUrl = qrGeneratorUrl + $scope.shareUrl;
72+
// Generate QR Code using qrcodejs library
73+
const qrcode = new QRCode("qrcodeContainer", {
74+
text: $scope.shareUrl,
75+
width: 170,
76+
height: 170,
77+
correctLevel : QRCode.CorrectLevel.H,
78+
});
7379
}
7480
});
7581

0 commit comments

Comments
 (0)