See Complications OS2 deep link to a page in the application

I'm trying to create an application that supports several families of complications on OS2, for example, modular large, utilitarian large, circular small, etc., each of which shows useful information from the application. I know that the complications are not very similar to the views that we observe with OS1 in terms of user interaction, i.e. It opens the application when the user clicks on it and without much interaction there.

In short, I was able to make a deep link to an application based on the current content of the look, but I am looking for a way to do the same with complications.

So my question is: when a user clicks on my application, I get some contextual information that says that this difficulty was clicked, etc. I think if I can get the CLKComplication object in context.

enter image description here

Any help is appreciated.

+5
source share
2 answers

In ClockKit/CLKDefines.h you can find the constant CLKLaunchedTimelineEntryDateKey .
But you cannot define your own user information to help you determine what to do when the application starts.

From the CLKComplicationDataSource Protocol Link :

CLKLaunchedTimelineEntryDateKey

A key indicating the date on which the complication was started. The value of this key is an NSDate object. When the user selects your complication, ClockKit includes this key in the dictionary passed to the handleUserActivity: extension delegate method.

Available in watchOS 2.0 and later.

+6
source

Since you can get the date you entered the timeline through CLKLaunchedTimelineEntryDateKey , you can get the type of complication (family) by making a β€œfixed second” to record a specific timeline.

The corrected second must be calculated by NSDateComponents and then converted to NSDate , which you can pass to CLKComplicationTimelineEntry .

For example, you can specify the end of a modularSmall record with 10 seconds, but modularLarge the end date of the record is 20 seconds. Thus, an entry with a date of 9:41:10 AM must be of type modularSmall , and a record with a date of 9:41:20 AM must be of type modularLarge .

0
source

All Articles