Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual signing #13

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0eee0a8
Remove unnecessary files
RomanovX Aug 4, 2017
6be224f
test applinks
RomanovX Aug 4, 2017
eebb6c5
Change name to parent name rather than widget name
RomanovX Aug 21, 2017
cd56ed2
Update universal links
DanielReus Aug 1, 2018
0a88062
Fix import
RomanovX May 9, 2019
778f05f
Move Q
RomanovX May 9, 2019
b896f06
fix requires
RomanovX May 9, 2019
2a43396
Update swift version
RomanovX May 14, 2019
b05b0e9
Also do replace in config files
RomanovX May 14, 2019
06aa5bf
Directly use bundleId
RomanovX May 14, 2019
b6484a5
Merge pull request #1 from olisto/feature/fix-import
RomanovX May 14, 2019
607ca89
Include widget
RomanovX Aug 27, 2019
6ad4c62
add native data dependency
RomanovX Aug 27, 2019
efe2fcd
Add dependency path
RomanovX Aug 27, 2019
62de01d
typo
RomanovX Aug 27, 2019
da95054
Allow specific files
RomanovX Aug 27, 2019
9a6b714
Update addTodayWidgetToProject.js
RomanovX Aug 27, 2019
acf4a99
oops
RomanovX Aug 27, 2019
992a1f9
Update addTodayWidgetToProject.js
RomanovX Aug 27, 2019
41985aa
Redo placeholders
RomanovX Aug 28, 2019
3ec9f53
Copy dependencies
RomanovX Aug 28, 2019
823b29d
rename
RomanovX Aug 28, 2019
561cfc9
Add project name
RomanovX Aug 28, 2019
edc7236
trim
RomanovX Aug 28, 2019
b5490b7
Correct destination folder
RomanovX Aug 28, 2019
6929654
Dont double add dependencies
RomanovX Aug 28, 2019
1d489f3
Add log inidication
RomanovX Aug 28, 2019
17ce4b4
Use widget name
RomanovX Sep 2, 2019
ee48f1c
add prefix
RomanovX Sep 2, 2019
ef4119f
ref -> prefix
RomanovX Sep 2, 2019
b29eee4
Update TodayViewController.swift
RomanovX Sep 2, 2019
49d7849
Review comments
RomanovX Sep 5, 2019
53dcbc0
add dev language
RomanovX Sep 10, 2019
1c879cc
Fix Title on ios 13
RomanovX Sep 30, 2019
153722f
Always draw and load
RomanovX Mar 12, 2020
1e41bf6
Update package.json
RomanovX Mar 12, 2020
2da4b41
Allow dark mode
RomanovX May 8, 2020
2d10aa0
Fix label
RomanovX May 8, 2020
7b16a6a
add log and allow manual signing
RomanovX Jul 10, 2021
4708c02
change log
RomanovX Jul 10, 2021
5c51a98
Discern between debug and release profiles
RomanovX Jul 12, 2021
ba25666
Add prefix for discerning
RomanovX Jul 13, 2021
d8917ce
Add more prefixes
RomanovX Jul 13, 2021
fd242a9
Remove logs
RomanovX Jul 13, 2021
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
63 changes: 63 additions & 0 deletions NowWidget/MainInterface.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="M4Y-Lb-cyx">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Today View Controller-->
<scene sceneID="cwh-vc-ff4">
<objects>
<viewController id="M4Y-Lb-cyx" customClass="TodayViewController" customModule="NowWidget" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ft6-oW-KC0"/>
<viewControllerLayoutGuide type="bottom" id="FKl-LY-JtV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" simulatedAppContext="notificationCenter" id="S3S-Oj-5AN">
<rect key="frame" x="0.0" y="0.0" width="320" height="110"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WJw-Fa-LCz">
<rect key="frame" x="0.0" y="0.0" width="320" height="110"/>
<state key="normal">
<color key="titleColor" systemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
</state>
<connections>
<action selector="openApp:" destination="M4Y-Lb-cyx" eventType="touchUpInside" id="nGM-Uj-8Ni"/>
</connections>
</button>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="vWT-Yz-vXb">
<rect key="frame" x="150" y="45" width="20" height="20"/>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="WJw-Fa-LCz" firstAttribute="centerX" secondItem="S3S-Oj-5AN" secondAttribute="centerX" id="Arl-xn-eKp"/>
<constraint firstItem="vWT-Yz-vXb" firstAttribute="centerX" secondItem="S3S-Oj-5AN" secondAttribute="centerX" id="Bx8-eW-xmD"/>
<constraint firstItem="vWT-Yz-vXb" firstAttribute="centerY" secondItem="S3S-Oj-5AN" secondAttribute="centerY" id="Otc-Fi-bij"/>
<constraint firstItem="FKl-LY-JtV" firstAttribute="top" secondItem="WJw-Fa-LCz" secondAttribute="bottom" id="ULI-J3-5K5"/>
<constraint firstItem="WJw-Fa-LCz" firstAttribute="centerY" secondItem="S3S-Oj-5AN" secondAttribute="centerY" id="UMp-Ge-usp"/>
<constraint firstItem="WJw-Fa-LCz" firstAttribute="leading" secondItem="S3S-Oj-5AN" secondAttribute="leading" id="hn2-9U-SWo"/>
<constraint firstAttribute="trailing" secondItem="WJw-Fa-LCz" secondAttribute="trailing" id="jAM-gX-oFu"/>
<constraint firstItem="WJw-Fa-LCz" firstAttribute="top" secondItem="Ft6-oW-KC0" secondAttribute="bottom" id="vA2-St-dg1"/>
</constraints>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<nil key="simulatedStatusBarMetrics"/>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="110"/>
<connections>
<outlet property="appButton" destination="WJw-Fa-LCz" id="DuL-fU-RAJ"/>
<outlet property="spinner" destination="vWT-Yz-vXb" id="PzT-n0-av2"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="vXp-U4-Rya" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="25.600000000000001" y="35.082458770614693"/>
</scene>
</scenes>
</document>
147 changes: 147 additions & 0 deletions NowWidget/NowButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
//
// NowButton.swift
// NowWidget
//
// Created by Triggi on 24-01-17.
//
//

import UIKit

public func drawButton(_ view: UIView, _ position: Int, _ color: UIColor, _ title: String!) -> UIButton! {
let buttonsPerRow = 6.0
let spacing = 8.0

let viewWidth = Double(view.frame.width)
let marginLeft = Double(view.layoutMargins.left)
let marginRight = Double(view.layoutMargins.right)
let marginTop = 15.0

let totalSpacing = spacing * (buttonsPerRow - 1)
let containerWidth = viewWidth - marginLeft - marginRight

let row = floor(Double(position) / buttonsPerRow)
let positionOnRow = Double(position) - (row * buttonsPerRow)
let width = (containerWidth - totalSpacing) / buttonsPerRow
let height = width
let x = marginLeft + (Double(positionOnRow) * width) + (Double(positionOnRow) * spacing)
let y = marginTop + (110 * row)

let button = UIButton(frame: CGRect(x: x, y: y, width: width, height: height))

button.backgroundColor = color

button.layer.cornerRadius = CGFloat(width / 2)
// button.layer.borderWidth = 1.5
// button.layer.borderColor = UIColor.whiteColor().CGColor
// button.layer.shadowColor = UIColor.blackColor().CGColor
// button.layer.shadowOffset = CGSizeMake(0, 1)
// button.layer.shadowRadius = 1
// button.layer.shadowOpacity = 0.5
// button.layer.shadowPath = UIBezierPath(roundedRect: button.bounds, cornerRadius: CGFloat(width / 2)).CGPath

button.setImage(UIImage(named: "notification_icon.png")?.maskWithColor(hexStringToUIColor(hex: "#ffffff")), for: UIControl.State())
button.setTitle(title, for: UIControl.State())
button.adjustsImageWhenHighlighted = false;

let iconMargin: CGFloat = 5.0
let titleSpacing: CGFloat = 5.0

var titleEdgeInsets = UIEdgeInsets.init();

if #available(iOS 13.0, *) {
let imageSize = button.imageView!.image!.size
let frameSize = button.imageView!.frame
titleEdgeInsets = UIEdgeInsets.init(top: 0.0, left: -(frameSize.width - 2*titleSpacing), bottom: -(imageSize.height - titleSpacing), right: 0.0)
} else {
let imageSize = button.imageView!.image!.size
titleEdgeInsets = UIEdgeInsets.init(top: 0.0, left: -imageSize.width, bottom: -(imageSize.height - titleSpacing), right: 0.0)
}
let imageEdgeInsets = UIEdgeInsets.init(top: iconMargin, left: iconMargin, bottom: iconMargin, right: iconMargin);

button.imageEdgeInsets = imageEdgeInsets
button.titleEdgeInsets = titleEdgeInsets

button.titleLabel?.font = UIFont.systemFont(ofSize: 11.0)
button.titleLabel?.lineBreakMode = NSLineBreakMode.byTruncatingTail
button.titleLabel?.numberOfLines = 2
button.titleLabel?.textAlignment = NSTextAlignment.center
button.setTitleColor(primaryColor(), for: UIControl.State())

button.tag = position;

return button
}

extension UIColor {
func darkerColor(_ amount: CGFloat) -> UIColor {
let rgba = UnsafeMutablePointer<CGFloat>.allocate(capacity: 4)

self.getRed(&rgba[0], green: &rgba[1], blue: &rgba[2], alpha: &rgba[3])
let darkerColor = UIColor(red: amount*rgba[0], green: amount*rgba[1], blue: amount*rgba[2], alpha: rgba[3])

rgba.deinitialize(count:4)
rgba.deallocate()
return darkerColor
}
}

func hexStringToUIColor (hex:String) -> UIColor {
var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()

if (cString.hasPrefix("#")) {
cString.remove(at: cString.startIndex)
}

if ((cString.count) != 6) {
return UIColor.gray
}

var rgbValue:UInt32 = 0
Scanner(string: cString).scanHexInt32(&rgbValue)

return UIColor(
red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
alpha: CGFloat(1.0)
)
}

func primaryColor() -> UIColor {
if #available(iOS 13.0, *) {
return UIColor.label
} else if #available(iOS 10.0, *){
return UIColor.darkText
} else {
return UIColor.lightText
}
}

extension UIImage {
func maskWithColor(_ color: UIColor) -> UIImage? {

let maskImage = self.cgImage
let width = self.size.width
let height = self.size.height
let bounds = CGRect(x: 0, y: 0, width: width, height: height)

let colorSpace = CGColorSpaceCreateDeviceRGB()
let bitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue)
let bitmapContext = CGContext(data: nil, width: Int(width), height: Int(height), bitsPerComponent: 8, bytesPerRow: 0, space: colorSpace, bitmapInfo: bitmapInfo.rawValue) //needs rawValue of bitmapInfo

bitmapContext!.clip(to: bounds, mask: maskImage!)
bitmapContext!.setFillColor(color.cgColor)
bitmapContext!.fill(bounds)

//is it nil?
if let cImage = bitmapContext!.makeImage() {
let coloredImage = UIImage(cgImage: cImage)

return coloredImage

} else {
return nil
}
}
}
31 changes: 31 additions & 0 deletions NowWidget/NowWidget-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en_US</string>
<key>CFBundleDisplayName</key>
<string>__DISPLAY_NAME__</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>__APP_IDENTIFIER__.__BUNDLE_SUFFIX__</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>__BUNDLE_SHORT_VERSION_STRING__</string>
<key>CFBundleVersion</key>
<string>__BUNDLE_VERSION__</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widget-extension</string>
</dict>
</dict>
</plist>
10 changes: 10 additions & 0 deletions NowWidget/NowWidget.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.__APP_IDENTIFIER__</string>
</array>
</dict>
</plist>
5 changes: 5 additions & 0 deletions NowWidget/NowWidget.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "../cordova/build-extras.xcconfig"

IPHONEOS_DEPLOYMENT_TARGET = 9.0
TARGETED_DEVICE_FAMILY = 1,2
PRODUCT_BUNDLE_IDENTIFIER = __APP_IDENTIFIER__.__BUNDLE_SUFFIX__
3 changes: 3 additions & 0 deletions NowWidget/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# native-ios-widget-triggi-now
Beware, this are the XCode 8+ files of the iOS widget for olisto Now.
In order to deploy this it needs to be ported to [cordova-plugin-native-data](https://gitlab.com/triggi/cordova-plugin-native-data).
Loading