All Projects → DavidStrausz → cordova-plugin-today-widget

DavidStrausz / cordova-plugin-today-widget

Licence: MIT License
Add a today widget app extension target to your cordova project.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cordova-plugin-today-widget

ionic-hockeyapp
Need HockeyApp in your Ionic application, add this package!
Stars: ✭ 19 (-62.75%)
Mutual labels:  cordova, ionic, cordova-plugin, ionic2, ionic3
Awesome Ionic
An "awesome" list of Ionic resources
Stars: ✭ 799 (+1466.67%)
Mutual labels:  cordova, ionic, ionic2, ionic3
cordova-plugin-flurryanalytics
Adds support for all that Flurry Analytics flavored goodness to your Cordova based apps
Stars: ✭ 23 (-54.9%)
Mutual labels:  cordova, ionic, cordova-plugin, cordova-ios
ionic-native-sms-retriever-plugin-master
Cross-platform plugin for Cordova / PhoneGap to Retrieve SMS. Available for Android.
Stars: ✭ 16 (-68.63%)
Mutual labels:  cordova, ionic, cordova-plugin, ionic3
Chihu2
ionic2-example <吃乎2>混合开发-美食app 🍜 ☕️ 🍦 (This is a support android and apple ionic2 case, a food app)
Stars: ✭ 124 (+143.14%)
Mutual labels:  cordova, ionic, ionic2, ionic3
todo-list
TodoList using Ionic2/3 & Firebase: * PWA * SSO Google plus. * Share list via QRcode. * Upload image from Camera or Storage. * Speech Recognition.
Stars: ✭ 18 (-64.71%)
Mutual labels:  cordova, ionic, ionic2, ionic3
Wooionic3
An eCommerce App for WooCommerce stores using Ionic 3.
Stars: ✭ 208 (+307.84%)
Mutual labels:  cordova, ionic, ionic2, ionic3
Dianoia-app
Mobile (Ionic 3 - Angular 4) app about non-pharmaceutical activities and information for people with dementia.
Stars: ✭ 13 (-74.51%)
Mutual labels:  cordova, ionic, ionic2, ionic3
ionic-3-video-calling-using-webrtc
This is demo code of how to implement video calling in ionic 3 using webrtc
Stars: ✭ 58 (+13.73%)
Mutual labels:  cordova, ionic, ionic2, ionic3
cordova-gmv-barcode-scanner
A Cordova barcode scanning plugin based on the Google Mobile Vision library for iOS & Android.
Stars: ✭ 48 (-5.88%)
Mutual labels:  cordova, cordova-plugin, cordova-ios
ionic-uuchat
基于ionic3,angular4的实时聊天app,兼容web端。该项目只是前端部分,所有数据需要请求后端服务器,需要配套express-uuchat-api使用。
Stars: ✭ 14 (-72.55%)
Mutual labels:  ionic, ionic2, ionic3
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (-49.02%)
Mutual labels:  ionic, ionic2, ionic3
fireblogger
Ionic 2 social media microblogging platform built with firebase 3 as backend
Stars: ✭ 54 (+5.88%)
Mutual labels:  ionic, ionic2, ionic3
cordova-plugin-webpack
Integrate webpack into your Cordova workflow.
Stars: ✭ 61 (+19.61%)
Mutual labels:  cordova, cordova-plugin, cordova-ios
cordova-plugin-dbcopy
Copy SQLite Database from www folder to default app database location
Stars: ✭ 90 (+76.47%)
Mutual labels:  cordova, cordova-plugin, cordova-ios-plugin
cordova-plugin-zeep
Zip compression/decompression for the cordova/phonegap platform
Stars: ✭ 27 (-47.06%)
Mutual labels:  cordova, cordova-plugin, cordova-ios
example-cordova-code-push-plugin
Ionic + Cordova Code Push Plugin Example
Stars: ✭ 45 (-11.76%)
Mutual labels:  cordova, ionic, cordova-plugin
ionic3-angular4-sample-app
Sample app of Ionic 3 and Angular 4
Stars: ✭ 35 (-31.37%)
Mutual labels:  cordova, ionic, ionic3
ionicfirebasecrud
An example of crud with Firebase and Ionic
Stars: ✭ 15 (-70.59%)
Mutual labels:  ionic, ionic2, ionic3
ionic-uber-clone
Ionic 4 Taxi Booking script
Stars: ✭ 34 (-33.33%)
Mutual labels:  ionic, ionic2, ionic3

Cordova Plugin for adding a Today Widget to an existing iOS Project dynamically

This plugin extends your existing xcode project by parsing and modifying the project.pbxproj file using cordova-node-xcode. The today extension will be added to the XCode-Project everytime a cordova platform add ios is done.

Usage

1. First of all you have to create a Today Widget yourself using XCode (Editor > Add target > Today Extension)

  • Fill in the fields, making note of the following:
  • Remember the name of the widget
  • Remember the last part of the bundle identifier (the suffix)
  • Enable the App Groups entitlement (Targets > Select your widget > Capabilities) and name your group: group.<Bundle-ID of your host app> (you can use the group to share NSUserDefaults between the Widget and the main App). Note that you have to add this to your provisioning profile
  • Implement your widget using TodayViewController.swift and MainInterface.storyboard (you can add additional source-files too).
  • When done implementing copy the <Widget name> folder from </platforms/ios> to anywhere tracked by your repository.
  • If your MainInterface.storyboard is listed in a sub-older named Base.lproj, pull it out of the folder and delete the folder. (there is no handling of variant-groups for different languages)
  • If you want to use an objective-c bridging header you can add it to the folder, just make sure it is named Header.h (Bridging-Header.h works too but the file won't be listed in XCode because the cordova bridging header has the same name and node-xcode thinks's it's the same file because it's checking the name and not the UUID)
  • If you need to add custom build settings you can use a xcconfig file, the script will add it to the project
  • Every file that is not a .swift, .h, .m, .plist, .entitlements, .xcconfig or .storyboard file will be added as a resource file to the project (images, fonts, etc.)

2. Install the plugin

  • cordova plugin add https://github.com/DavidStrausz/cordova-plugin-today-widget.git --save
  • This will not modify anything yet because the hooks only run after_platform_add
  • You can add variables to your config.xml in order to change some of the settings:
Variable Default Description
WIDGET_PATH /www Path to the folder that contains your widget folder relative to the project root
WIDGET_NAME Widget Name of your widget
WIDGET_BUNDLE_SUFFIX widget The last part of the widget bundle id
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES YES You might have to turn this off (change to NO) if you use other swift based plugins (such as cordova-plugin-geofence)
SWIFT_VERSION '3.0' The version of Swift that your widget uses

This can be done either manually in the config.xml after installing the plugin, or be done through the CLI.

Example:

In the config.xml

<plugin name="cordova-plugin-today-widget" spec="https://github.com/Triggi/cordova-plugin-today-widget.git">
  <variable name="WIDGET_NAME" value="NowWidget" />
  <variable name="ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES" value="NO" />
</plugin>

Directly through CLI:

cordova plugin add cordova-plugin-today-widget --variable WIDGET_NAME="NowWidget" --variable ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES="NO"

3. Parametrization

Especially for automated builds, parametrization is an important part. The following parameters are available:

Variable Example Description
__DISPLAY_NAME__ AppName Name of the original app
__APP_IDENTIFIER__ com.company.app Bundle ID of the main app
__BUNDLE_SUFFIX__ widget Bundle ID suffix for the widget
__BUNDLE_SHORT_VERSION_STRING__ 1.0.0 The version of the main app in form MAJOR.MINOR.PATCH
__BUNDLE_VERSION__ 1234 The build number of the main app

These parameters are available in available in any .plist or .entitlements files.

Examples for usage:

To keep the app and widget in sync use the following settings

Widget-Info.plist:

  • Bundle display name: __DISPLAY_NAME__
  • Bundle identifier: __APP_IDENTIFIER__.__BUNDLE_SUFFIX__
  • Bundle version string, short: __BUNDLE_SHORT_VERSION_STRING__
  • Bundle version: __BUNDLE_VERSION__

Widget.entitlements:

  • App Groups -> Item 0: group.__APP_IDENTIFIER__

Infos

  • I only tested the plugin with cordova 7.0.1 and cordova-ios 4.4.0 up to now, but it should work with other versions too.
  • I used XCode 8.3.2 to create the widget alongside with the plugin.
  • You have to add the app group entitlement to your host app too and you have to recreate your provisioning profiles with the app-group entitlement added if you want to use shared user defaults.
  • Don't forget to copy the widgets folder from platforms/ios to your source folder every time you modify it, otherwise your changes will be lost after you remove the platform.

Acknowledgements

Thanks to Remy Kabel who parametrized the build and made it possible for it to be fully automated. Thanks to Hernan Zhou whos plugin was a great inspiration.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].