Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions widget/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -734,11 +734,19 @@ html[browser="Firefox"] .layout3 .list-layout .list-item-media .list-media-holde
.holder.now-playing .media-header-link a{
color:#fff;
}
.holder.now-playing .media-player-action-btns .icon{
font-size:25px;
.holder.now-playing .media-player-action-btns{
display: flex;
justify-content: center;
margin-top: 8px;
}
.holder.now-playing .media-player-action-btns .icon + .icon{
margin-left:60px;
.holder.now-playing .media-player-action-btns span{
font-size: 18px;
padding: 8px 16px;
margin-top: 12px;
display: block;
}
.holder.now-playing .media-player-action-btns .media-center-btn{
margin: 12px 16px 0 16px;
}
.holder.now-playing .media-player-btns .icon.icon-sm{
font-size:22px;
Expand Down Expand Up @@ -1382,11 +1390,12 @@ input.volume-button[type=range]:focus::-ms-fill-upper {
}
.layout1-detail .li-actions,
.layout2-detail .li-actions{
display: flex;
position: relative;
}
.item-actions{
margin: 16px 0;
padding: 8px 16px;
padding: 0 0 0 16px;
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
display: flex;
Expand All @@ -1402,8 +1411,10 @@ input.volume-button[type=range]:focus::-ms-fill-upper {
.layout2-detail .li-actions i{
flex-shrink: 0;
position: relative;
display: inline-block;
margin-left: 8px;
display: block;
padding: 16px;
flex-shrink: 0;
top: 0;
}
.layout2-detail .li-actions .share,
.layout2-detail .li-actions .bookmark{
Expand All @@ -1414,8 +1425,4 @@ input.volume-button[type=range]:focus::-ms-fill-upper {
}
.layout1-detail .audio-player-holder img{
max-height: 400px;
}
/* Hide share button until functionality is ready*/
.share{
/* display: none !important; */
}
}
3 changes: 2 additions & 1 deletion widget/assets/js/videogular.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ angular.module("com.2fdevs.videogular")
*/
angular.module("com.2fdevs.videogular")
.controller("vgController",
['$scope', '$window', 'vgConfigLoader', 'vgFullscreen', 'VG_UTILS', 'VG_STATES', 'VG_VOLUME_KEY', function ($scope, $window, vgConfigLoader, vgFullscreen, VG_UTILS, VG_STATES, VG_VOLUME_KEY) {
['$scope', '$rootScope', '$window', 'vgConfigLoader', 'vgFullscreen', 'VG_UTILS', 'VG_STATES', 'VG_VOLUME_KEY', function ($scope, $rootScope, $window, vgConfigLoader, vgFullscreen, VG_UTILS, VG_STATES, VG_VOLUME_KEY) {
var currentTheme = null;
var isFullScreenPressed = false;
var isMetaDataLoaded = false;
Expand Down Expand Up @@ -516,6 +516,7 @@ angular.module("com.2fdevs.videogular")
if (vgFullscreen.isAvailable) {
document.addEventListener(vgFullscreen.onchange, this.onFullScreenChange.bind(this));
}
$rootScope.videogularScope = $scope;
};

this.onUpdateTheme = function onUpdateTheme(newValue) {
Expand Down
4 changes: 4 additions & 0 deletions widget/bookmarkHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ var bookmarks = {
});
} else if ($scope.WidgetMedia) {
$scope.WidgetMedia.item.bookmarked = true;
} else if ($scope.NowPlaying) {
$scope.NowPlaying.item.bookmarked = true;
}
if (!$scope.$$phase) {
$scope.$apply();
Expand All @@ -37,6 +39,8 @@ var bookmarks = {
});
} else if ($scope.WidgetMedia) {
$scope.WidgetMedia.item.bookmarked = false;
} else if ($scope.NowPlaying) {
$scope.NowPlaying.item.bookmarked = false;
}
if (!$scope.$$phase) {
$scope.$apply();
Expand Down
119 changes: 69 additions & 50 deletions widget/controllers/widget.home.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,49 +9,64 @@
$rootScope.deviceHeight = window.innerHeight;
$rootScope.deviceWidth = window.innerWidth || 320;

var _path = $location.path();
$scope.first = true;
/**
* @name handleBookmarkNav
* @type {function}
* Handles incoming bookmark navigation
*/
var handleBookmarkNav = function handleBookmarkNav() {
buildfire.deeplink.getData(function(data){
if(data && data.link){
var targetGuid = data.link;
var itemLinks = _items.map(item => item.guid);
var index = itemLinks.indexOf(targetGuid);
if (index < 0) {
console.warn('bookmarked item not found.');
} else {
WidgetHome.goToItem(index, _items[index]);
if ($scope.first) {
buildfire.deeplink.getData(function(data){
if(data && data.link){
var targetGuid = data.link;
var itemLinks = _items.map(item => item.guid);
var index = itemLinks.indexOf(targetGuid);
if (index < 0) {
console.warn('bookmarked item not found.');
} else {
if (data.timeIndex) {
_items[index].seekTo = data.timeIndex;
}
$rootScope.deeplinkFirstNav = true;
WidgetHome.goToItem(index, _items[index]);
}
$scope.first = false;
if (!$scope.$$phase) $scope.$apply();
}
}
});
});
}
};

/**
* Private variables
*
* _items used to hold RSS feed items and helps in lazy loading.
* @name _items used to hold RSS feed items and helps in lazy loading.
* @type {object}
* @private
*
* limit used to load a number of items in list on scroll
* @name limit used to load a number of items in list on scroll
* @type {number}
* @private
*
* chunkData used to hold chunks of _items.
* @name chunkData used to hold chunks of _items.
* @type {object}
* @private
*
* nextChunkDataIndex used to hold index of next chunk.
* @name nextChunkDataIndex used to hold index of next chunk.
* @type {number}
* @private
*
* nextChunk used to hold chunk based on nextChunkDataIndex token.
* @name nextChunk used to hold chunk based on nextChunkDataIndex token.
* @type {object}
* @private
*
* totalChunks used to hold number of available chunks i.e. chunkData.length.
* @name totalChunks used to hold number of available chunks i.e. chunkData.length.
* @type {number}
* @private
*
* currentRssUrl used to hold previously saved rss url.
* @name currentRssUrl used to hold previously saved rss url.
* @type {string}
* @private
*
Expand Down Expand Up @@ -81,36 +96,37 @@
}
};

/*
* WidgetHome.data is used to hold user's data object which used throughout the app.
/**
* @name WidgetHome.data is used to hold user's data object which used throughout the app.
* @type {object}
*/
WidgetHome.data = null;
WidgetHome.view=null;

/*
* WidgetHome.items is used to listing items.
/**
* @name WidgetHome.items is used to listing items.
* @type {object}
*/
WidgetHome.items = [];

/*
* WidgetHome.busy is used to disable ng-infinite scroll when more data not available to show.
/**
* @name WidgetHome.busy is used to disable ng-infinite scroll when more data not available to show.
* @type {boolean}
*/
WidgetHome.busy = false;

/*
* WidgetHome.isItems is used to show info message when _items.length == 0.
/**
* @name WidgetHome.isItems is used to show info message when _items.length == 0.
* @type {boolean}
*/
WidgetHome.isItems = true;

$rootScope.showFeed = true;

/**
* resetDefaults() private method
* @name resetDefaults()
* Used to reset default values
* @private
*/
var resetDefaults = function () {
chunkData = null;
Expand All @@ -123,9 +139,9 @@
WidgetHome.isItems = true;
ItemDetailsService.setData(null);
};

/**
* getImageUrl() private method
* @name getImageUrl()
* Used to extract image url
* @param item
* @returns {*}
Expand Down Expand Up @@ -161,7 +177,8 @@
};

/**
* getFeedData() private method
* @name getFeedData()
* @private
* used to fetch RSS feed Data object if a valid RSS feed url provided
* @param rssUrl
*/
Expand All @@ -187,6 +204,7 @@
handleBookmarkNav();
Buildfire.spinner.hide();
isInit = false;
searchEngine.indexFeed(rssUrl);
}
, error = function (err) {
Buildfire.spinner.hide();
Expand All @@ -196,7 +214,8 @@
};

/**
* onUpdateCallback() private method
* @name onUpdateCallback()
* @private
* Will be called when DataStore.onUpdate() have been made.
* @param event
*/
Expand Down Expand Up @@ -228,7 +247,8 @@
};

/**
* init() private function
* @name init()
* @private
* It is used to fetch previously saved user's data
*/
var init = function () {
Expand Down Expand Up @@ -266,17 +286,17 @@
};

/**
* init() function invocation to fetch previously saved user's data from datastore.
* @name init() function invocation to fetch previously saved user's data from datastore.
*/
init();

/**
* DataStore.onUpdate() will invoked when there is some change in datastore
* @name DataStore.onUpdate() will invoked when there is some change in datastore
*/
DataStore.onUpdate().then(null, null, onUpdateCallback);

/**
* WidgetHome.showDescription() method
* @name WidgetHome.showDescription() method
* will be called to check whether the description have text to show or no.
* @param description
* @returns {boolean}
Expand All @@ -291,7 +311,7 @@
};

/**
* WidgetHome.getTitle() method
* @name WidgetHome.getTitle() method
* Will used to extract item title
* @param item
* @returns {item.title|*}
Expand All @@ -312,7 +332,7 @@
};

/**
* WidgetHome.getItemSummary() method
* @name WidgetHome.getItemSummary() method
* Will used to extract item summary
* @param item
* @returns {*}
Expand All @@ -327,7 +347,7 @@
};

/**
* WidgetHome.getItemPublishDate() method
* @name WidgetHome.getItemPublishDate() method
* Will used to extract item published date
* @param item
* @returns {*}
Expand All @@ -344,12 +364,12 @@
};

/**
* WidgetHome.goToItem() method
* @name WidgetHome.goToItem() method
* will used to redirect on details page
* @param index
*/
WidgetHome.goToItem = function (index, item) {
viewedItems.markViewed($scope, item.link)
viewedItems.markViewed($scope, item.guid)
if (WidgetHome.items[index]) {
WidgetHome.items[index].index = index;
}
Expand All @@ -362,7 +382,7 @@

WidgetHome.bookmark = function ($event, item) {
$event.stopImmediatePropagation();
const isBookmarked = item.bookmarked ? true : false;
var isBookmarked = item.bookmarked ? true : false;
if (isBookmarked) {
bookmarks.delete($scope, item);
} else {
Expand All @@ -373,14 +393,14 @@
WidgetHome.share = function ($event, item) {
$event.stopImmediatePropagation();

const options = {
var options = {
subject: item.title,
text: `${item.title}, by ${item.author}`,
text: item.title + ", by " + item.author,
// image: item.image.url,
link: item.link
};

const callback = err => {
var callback = function(err) {
if (err) {
console.warn(err);
}
Expand All @@ -389,19 +409,18 @@
buildfire.device.share(options, callback);
};


const initAuthUpdate = () => {
Buildfire.auth.onLogin(() => {
var initAuthUpdate = function () {
Buildfire.auth.onLogin(function () {
init();
});

Buildfire.auth.onLogout(() => {
Buildfire.auth.onLogout(function () {
init();
});
};

/**
* WidgetHome.loadMore() function
* @name WidgetHome.loadMore() function
* will used to load more items on scroll to implement lazy loading
*/
WidgetHome.loadMore = function () {
Expand Down
Loading