Lister
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
||||
|
@ -18,7 +18,7 @@ import Foundation
|
|||
the Objective-C version of Lister to unarchive a `List` instance that was archived in the Swift version.
|
||||
*/
|
||||
@objc(AAPLList)
|
||||
final public class List: NSObject, NSCoding, NSCopying, CustomDebugStringConvertible {
|
||||
final public class List: NSObject, NSCoding, NSCopying {
|
||||
// MARK: Types
|
||||
|
||||
/**
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
||||
|
@ -18,7 +18,7 @@ import Foundation
|
|||
version of Lister to unarchive a `ListItem` instance that was archived in the Swift version.
|
||||
*/
|
||||
@objc(AAPLListItem)
|
||||
final public class ListItem: NSObject, NSCoding, NSCopying, CustomDebugStringConvertible {
|
||||
final public class ListItem: NSObject, NSCoding, NSCopying {
|
||||
// MARK: Types
|
||||
|
||||
/**
|
||||
|
@ -130,6 +130,6 @@ final public class ListItem: NSObject, NSCoding, NSCopying, CustomDebugStringCon
|
|||
// MARK: DebugPrintable
|
||||
|
||||
public override var debugDescription: String {
|
||||
return "\"\(text)\""
|
||||
return "\"\(text)\" [\(isComplete ? "X" : " ")]"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
Sample code project: Lister (for watchOS, iOS, and OS X)
|
||||
Version: 3.0
|
||||
Version: 3.3
|
||||
|
||||
IMPORTANT: This Apple software is supplied to you by Apple
|
||||
Inc. ("Apple") in consideration of your agreement to the following
|
||||
|
@ -39,4 +39,4 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
|
|||
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
||||
|
@ -42,7 +42,12 @@ class AppLaunchContextTests: XCTestCase {
|
|||
AppConfiguration.UserActivity.listColorUserInfoKey: color.rawValue
|
||||
])
|
||||
|
||||
let launchContext = AppLaunchContext(userActivity: userActivity)
|
||||
let listsController = AppConfiguration.sharedConfiguration.listsControllerForCurrentConfigurationWithPathExtension(AppConfiguration.listerFileExtension, firstQueryHandler: nil)
|
||||
let possibleLaunchContext = AppLaunchContext(userActivity: userActivity, listsController: listsController)
|
||||
|
||||
XCTAssertNotNil(possibleLaunchContext)
|
||||
|
||||
guard let launchContext = possibleLaunchContext else { return }
|
||||
|
||||
XCTAssertEqual(launchContext.listURL.absoluteURL, listURLs.first!.absoluteURL)
|
||||
XCTAssertEqual(launchContext.listColor, color)
|
||||
|
@ -56,7 +61,12 @@ class AppLaunchContextTests: XCTestCase {
|
|||
AppConfiguration.UserActivity.listColorUserInfoKey: color.rawValue
|
||||
])
|
||||
|
||||
let launchContext = AppLaunchContext(userActivity: userActivity)
|
||||
let listsController = AppConfiguration.sharedConfiguration.listsControllerForCurrentConfigurationWithPathExtension(AppConfiguration.listerFileExtension, firstQueryHandler: nil)
|
||||
let possibleLaunchContext = AppLaunchContext(userActivity: userActivity, listsController: listsController)
|
||||
|
||||
XCTAssertNotNil(possibleLaunchContext)
|
||||
|
||||
guard let launchContext = possibleLaunchContext else { return }
|
||||
|
||||
XCTAssertEqual(launchContext.listURL.absoluteURL, listURLs.first!.absoluteURL)
|
||||
XCTAssertEqual(launchContext.listColor, color)
|
||||
|
@ -71,7 +81,12 @@ class AppLaunchContextTests: XCTestCase {
|
|||
AppConfiguration.UserActivity.listColorUserInfoKey: color.rawValue
|
||||
])
|
||||
|
||||
let launchContext = AppLaunchContext(userActivity: userActivity)
|
||||
let listsController = AppConfiguration.sharedConfiguration.listsControllerForCurrentConfigurationWithPathExtension(AppConfiguration.listerFileExtension, firstQueryHandler: nil)
|
||||
let possibleLaunchContext = AppLaunchContext(userActivity: userActivity, listsController: listsController)
|
||||
|
||||
XCTAssertNotNil(possibleLaunchContext)
|
||||
|
||||
guard let launchContext = possibleLaunchContext else { return }
|
||||
|
||||
XCTAssertEqual(launchContext.listURL.absoluteURL, listURLs.first!.absoluteURL)
|
||||
XCTAssertEqual(launchContext.listColor, color)
|
||||
|
@ -88,7 +103,11 @@ class AppLaunchContextTests: XCTestCase {
|
|||
let colorQueryItem = NSURLQueryItem(name: AppConfiguration.ListerScheme.colorQueryKey, value: colorQueryValue)
|
||||
urlComponents.queryItems = [colorQueryItem]
|
||||
|
||||
let launchContext = AppLaunchContext(listerURL: urlComponents.URL!)
|
||||
let possibleLaunchContext = AppLaunchContext(listerURL: urlComponents.URL!)
|
||||
|
||||
XCTAssertNotNil(possibleLaunchContext)
|
||||
|
||||
guard let launchContext = possibleLaunchContext else { return }
|
||||
|
||||
XCTAssertEqual(launchContext.listURL.absoluteURL, listURLs.first!.absoluteURL)
|
||||
XCTAssertEqual(launchContext.listColor, color)
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 895 B After Width: | Height: | Size: 895 B |
Before Width: | Height: | Size: 778 B After Width: | Height: | Size: 778 B |
Before Width: | Height: | Size: 841 B After Width: | Height: | Size: 841 B |
Before Width: | Height: | Size: 728 B After Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 881 B After Width: | Height: | Size: 881 B |
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
Before Width: | Height: | Size: 887 B After Width: | Height: | Size: 887 B |
Before Width: | Height: | Size: 767 B After Width: | Height: | Size: 767 B |
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 878 B |
Before Width: | Height: | Size: 758 B After Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 892 B After Width: | Height: | Size: 892 B |
Before Width: | Height: | Size: 778 B After Width: | Height: | Size: 778 B |
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 688 B |
Before Width: | Height: | Size: 623 B After Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0</string>
|
||||
<string>3.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
||||
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import WatchKit
|
||||
import ListerKit
|
||||
import ListerWatchKit
|
||||
|
||||
class GlanceInterfaceController: WKInterfaceController, ConnectivityListsControllerDelegate, ListPresenterDelegate, NSFilePresenter {
|
||||
// MARK: Properties
|
|
@ -19,7 +19,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0</string>
|
||||
<string>3.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>WKAppBundleIdentifier</key>
|
||||
<string>${LISTER_BUNDLE_PREFIX}.Lister.nativewatchkitapp</string>
|
||||
<string>${LISTER_BUNDLE_PREFIX}.Lister.watchkitapp</string>
|
||||
</dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.watchkit</string>
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
import WatchKit
|
||||
import WatchConnectivity
|
||||
import ListerKit
|
||||
import ListerWatchKit
|
||||
|
||||
/**
|
||||
The interface controller that presents a list. The interface controller listens for changes to how the list
|
||||
|
@ -233,6 +233,9 @@ class ListInterfaceController: WKInterfaceController, ListPresenterDelegate, NSF
|
|||
|
||||
let session = WCSession.defaultSession()
|
||||
|
||||
// Do not proceed if `session` is not currently `.Activated`.
|
||||
guard session.activationState == .Activated else { return }
|
||||
|
||||
for transfer in session.outstandingFileTransfers {
|
||||
if transfer.file.fileURL == self.presentedItemURL! {
|
||||
transfer.cancel()
|
||||
|
@ -263,6 +266,10 @@ class ListInterfaceController: WKInterfaceController, ListPresenterDelegate, NSF
|
|||
setupInterfaceTable()
|
||||
}
|
||||
|
||||
override func willActivate() {
|
||||
addFilePresenterIfNeeded()
|
||||
}
|
||||
|
||||
override func didDeactivate() {
|
||||
saveUnsavedChangesWithCompletionHandler { _ in
|
||||
self.removeFilePresenterIfNeeded()
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2015 Apple Inc. All Rights Reserved.
|
||||
Copyright (C) 2016 Apple Inc. All Rights Reserved.
|
||||
See LICENSE.txt for this sample’s licensing information
|
||||
|
||||
Abstract:
|
||||
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import WatchKit
|
||||
import ListerKit
|
||||
import ListerWatchKit
|
||||
|
||||
class ListsInterfaceController: WKInterfaceController, ConnectivityListsControllerDelegate {
|
||||
// MARK: Types
|
||||
|
@ -83,12 +83,12 @@ class ListsInterfaceController: WKInterfaceController, ConnectivityListsControll
|
|||
// MARK: Convenience
|
||||
|
||||
func configureRowControllerAtIndex(index: Int) {
|
||||
let ListRowController = interfaceTable.rowControllerAtIndex(index) as! ColoredTextRowController
|
||||
let listRowController = interfaceTable.rowControllerAtIndex(index) as! ColoredTextRowController
|
||||
|
||||
let listInfo = listsController[index]
|
||||
|
||||
ListRowController.setColor(listInfo.color.colorValue)
|
||||
ListRowController.setText(listInfo.name)
|
||||
listRowController.setColor(listInfo.color.colorValue)
|
||||
listRowController.setText(listInfo.name)
|
||||
}
|
||||
|
||||
// MARK: Interface Life Cycle
|
||||
|
@ -117,7 +117,8 @@ class ListsInterfaceController: WKInterfaceController, ConnectivityListsControll
|
|||
let color = List.Color(rawValue: rawColor) else { return }
|
||||
|
||||
// Create a `ListInfo` that represents the list at `listInfoURL`.
|
||||
let name = listInfoFilePath.lastPathComponent.stringByDeletingPathExtension
|
||||
let lastPathComponent = (listInfoFilePath as NSString).lastPathComponent
|
||||
let name = (lastPathComponent as NSString).stringByDeletingPathExtension
|
||||
let listInfo = ListInfo(name: name, color: color)
|
||||
|
||||
// Present a `ListInterfaceController`.
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |