diff --git a/package.json b/package.json index 7406ad3314bc06e5f1e16fa81017d18f37531809..dd4a3148623104432c9057715d177c00c3c14728 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,15 @@ "cordova-android", "cordova-ios" ], - "author": "Codevise Solutions Ltd.", + "author": "Codevise Solutions GmbH", "license": "MIT", "dependencies": { + "child_process": "^1.0.2", + "elementtree": "^0.1.7", "file-system": "^2.2.2", "path": "^0.12.7", "plist": "^2.1.0", + "q": "^1.5.1", "xcode": "git+https://github.com/apache/cordova-node-xcode.git" }, "engines": { diff --git a/plugin.xml b/plugin.xml index 18726ec313ceea8e716f03033efc3473b61a43c7..d1bc8edf92409856f052193c76d4c89723f3c8f9 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - SportschauWidget @@ -38,7 +38,18 @@ - + + + + + + + + + + + + { +class GetHttpsServerAsyncTask extends AsyncTask { private static final int READ_TIMEOUT = 30000; private static final int CONNECT_TIMEOUT = 30000; private String url = null; private AsyncCallback asyncCallback = null; - public GetHttpsServerAysncTask(String url) { + public GetHttpsServerAsyncTask(String url) { this.url = url; } - public GetHttpsServerAysncTask(String url, AsyncCallback asyncCallback) { + public GetHttpsServerAsyncTask(String url, AsyncCallback asyncCallback) { this.url = url; this.asyncCallback = asyncCallback; } diff --git a/src/android/widget/WidgetUpdateService.java b/src/android/widget/WidgetUpdateService.java index f2aeba8c26df1dc59cba738cbc313396e275a9cb..38336f1d578ae9156a37e8dae00905b104604ce9 100644 --- a/src/android/widget/WidgetUpdateService.java +++ b/src/android/widget/WidgetUpdateService.java @@ -256,11 +256,11 @@ public class WidgetUpdateService extends Service { hideHint(widgetId); } - new GetHttpsServerAysncTask(menuUrl, new AsyncCallback() { + new GetHttpsServerAsyncTask(menuUrl, new AsyncCallback() { @Override public void onPostExecute(final String json) { if (json != null && json.length() > 0) { - new GetHttpsServerAysncTask(getMainCategoryUrl(json), new AsyncCallback() { + new GetHttpsServerAsyncTask(getMainCategoryUrl(json), new AsyncCallback() { @Override public void onPostExecute(String jsonStr) { if (jsonStr != null && jsonStr.length() > 0) { diff --git a/src/ios/SportschauWidget/SportschauWidget-Info.plist b/src/ios/SportschauWidget/SportschauWidget-Info.plist index a93fb8b09652b242b704415fa368c2630a7a2fc3..fe175f41ff2201ba1070e4207834544346dcda1a 100644 --- a/src/ios/SportschauWidget/SportschauWidget-Info.plist +++ b/src/ios/SportschauWidget/SportschauWidget-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - __APP_IDENTIFIER__.__BUNDLE_SUFFIX__ + __APP_IDENTIFIER__ CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/src/ios/SportschauWidget/TodayViewController.swift b/src/ios/SportschauWidget/TodayViewController.swift index 674d5e6dd00b2c53fada1ad156754709f4eb214a..a692c15d99f26ceb046fbde229ab58119b6b6214 100644 --- a/src/ios/SportschauWidget/TodayViewController.swift +++ b/src/ios/SportschauWidget/TodayViewController.swift @@ -225,7 +225,7 @@ class TodayViewController: UITableViewController, NCWidgetProviding { fileprivate func fetchCategoriesUrl(_ menuUrl: NSURL?, _ result: @escaping (NSURL?) -> Void) { //fetching the data from the menu url URLSession.shared.dataTask(with: (menuUrl as URL?)!, completionHandler: {(data, response, error) -> Void in - if let jsonObj = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? NSDictionary { + if let jsonObj = ((try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? NSDictionary) as NSDictionary??) { result(self.getCategoryUrlFromMenuJson(jsonObj)) return } @@ -246,7 +246,7 @@ class TodayViewController: UITableViewController, NCWidgetProviding { fetchCategoriesUrl(NSURL(string: urlString), { categoriesUrl in //fetching the data from the categories url URLSession.shared.dataTask(with: (categoriesUrl as URL?)!, completionHandler: {(data, response, error) -> Void in - if let jsonObj = try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? NSDictionary { + if let jsonObj = ((try? JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? NSDictionary) as NSDictionary??) { result(self.parseCategoriesJson(limit: limit, jsonObj)) return } diff --git a/src/ios/hooks/addTodayWidgetToProject.js b/src/ios/hooks/addTodayWidgetToProject.js index 2ec14a1a2e35dd28cc23381b1b7161215955e178..2e0f01326c08c8168dd85a43e1924080a0b376b1 100644 --- a/src/ios/hooks/addTodayWidgetToProject.js +++ b/src/ios/hooks/addTodayWidgetToProject.js @@ -69,8 +69,8 @@ log( ); module.exports = function (context) { - var xcode = context.requireCordovaModule('xcode'); - var Q = context.requireCordovaModule('q'); + var xcode = require('xcode'); + var Q = require('q'); var deferral = new Q.defer(); if (context.opts.cordova.platforms.indexOf('ios') < 0) { @@ -92,7 +92,7 @@ module.exports = function (context) { } // Get the bundle-id from config.xml - var elementTree = context.requireCordovaModule('elementtree'); + var elementTree = require('elementtree'); var etree = elementTree.parse(contents); var bundleId = etree.getroot().get('id'); log('Bundle id of your host app: ' + bundleId, 'info'); @@ -369,8 +369,11 @@ module.exports = function (context) { buildSettingsObj['PROVISIONING_PROFILE_SPECIFIER'] = '$WIDGET_PROVISIONING_PROFILE'; log('Added variable $WIDGET_PROVISIONING_PROFILE for widget configuration!', 'info'); + buildSettingsObj['"PRODUCT_BUNDLE_IDENTIFIER"'] = bundleId + '.' + widgetBundleId; + log('Added widget "bundleIdentifier": ' + bundleId + '.' + widgetBundleId +' to configuration!', 'info'); + if (projectContainsSwiftFiles) { - buildSettingsObj['SWIFT_VERSION'] = '3.0'; + buildSettingsObj['SWIFT_VERSION'] = '5.0'; buildSettingsObj['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'; log('Added build settings for swift support!', 'info'); } @@ -385,7 +388,7 @@ module.exports = function (context) { } } else { if (projectContainsSwiftFiles) { - buildSettingsObj['SWIFT_VERSION'] = '3.0'; + buildSettingsObj['SWIFT_VERSION'] = '5.0'; buildSettingsObj['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES || 'YES'; log('Added build settings for swift support in main target!', 'info'); } diff --git a/src/ios/hooks/fixAppEntitlements.js b/src/ios/hooks/fixAppEntitlements.js index 6badff7d7af8c914020a34287164d683442456f5..cda4857f6d5853ad9cfd683da58dc1a4c3dc62cf 100644 --- a/src/ios/hooks/fixAppEntitlements.js +++ b/src/ios/hooks/fixAppEntitlements.js @@ -57,8 +57,8 @@ log( ); module.exports = function (context) { - var xcode = context.requireCordovaModule('xcode'); - var Q = context.requireCordovaModule('q'); + var xcode = require('xcode'); + var Q = require('q'); var deferral = new Q.defer(); if (context.opts.cordova.platforms.indexOf('ios') < 0) { @@ -75,7 +75,7 @@ module.exports = function (context) { } // Get the bundle-id from config.xml - var elementTree = context.requireCordovaModule('elementtree'); + var elementTree = require('elementtree'); var etree = elementTree.parse(contents); var bundleId = etree.getroot().get('id'); @@ -84,7 +84,7 @@ module.exports = function (context) { : path.join(context.opts.projectRoot, 'platforms/ios/'); fs.readdir(iosFolder, function (err, data) { - var projectFolder + var projectFolder; var projectName; var run = function () { var placeHolderValues = [ diff --git a/src/ios/hooks/prerequisites.js b/src/ios/hooks/prerequisites.js index c9b57d8080ebe332c9b598b78ddd02fb4347a627..81005fcf0df5adaa04f83c059e6783369dbdb1cf 100644 --- a/src/ios/hooks/prerequisites.js +++ b/src/ios/hooks/prerequisites.js @@ -1,6 +1,6 @@ -module.exports = function (context) { - var child_process = context.requireCordovaModule('child_process'), - deferral = context.requireCordovaModule('q').defer(); +module.exports = function() { + var child_process = require('child_process'), + deferral = require('q').defer(); child_process.exec('npm install', {cwd:__dirname}, function (error) {