Class CLSContext

  • All Implemented Interfaces:
    NSCoding, NSSecureCoding, NSObject

    public class CLSContext
    extends CLSObject
    Contexts represent activities, documents, and areas within your app. Contexts have two major components. (1) Child contexts, used to model your app hierarchy. (2) Activity, holds user generated data that pertains to this context.
    • Constructor Detail

      • CLSContext

        protected CLSContext​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • addChildContext

        public void addChildContext​(CLSContext child)
        Adds a child context. A context can only have a single parent. [@note] objectID of child context may change after it's been added.
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • becomeActive

        public void becomeActive()
        Marks contexts as active. If a context is already active, it will remain active. If another context is active, the other will resign active before this one becomes active.
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • createNewActivity

        public CLSActivity createNewActivity()
        Creates a new activity Creates a new activity and sets it as the current activity.
      • currentActivity

        public CLSActivity currentActivity()
        Returns the current activity. Activity associated with a context. If no activity was ever created this is nil. See: @c -[CLSContext createNewActivity]; for more details.
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • descendantMatchingIdentifierPathCompletion

        public void descendantMatchingIdentifierPathCompletion​(NSArray<java.lang.String> identifierPath,
                                                               CLSContext.Block_descendantMatchingIdentifierPathCompletion completion)
        Returns a descendant of this context matching the context path you provide. Context path must start with an identifier of a child context of the context to which this message is sent. If there are any missing contexts, they will be filled in by calling the following method on the context's data store's delegate: @code -[CLSDataStoreDelegate createContextForIdentifier:parentContext:parentIdentifierPath:] @endcode If the dataStore does not have a delegate and there are missing contexts then an incomplete list of contexts will be passed to the completion handler. Completion block is called on a background thread.
      • description_static

        public static java.lang.String description_static()
      • displayOrder

        public long displayOrder()
        The displayOrder is by default sorted ascending. Set the displayOrder if you want your contexts to be displayed in a particular order. The sort key is used as a way to sort sibling contexts in a particular order.
      • hash_static

        public static long hash_static()
      • identifier

        public java.lang.String identifier()
        App-assigned identifier. This identifier should work across users and devices and be unique with regards to its siblings within its parent. The identifier could be used to embed information later used for deep linking. For example: @em hydrogen-element, or @em chapter-1.
      • initWithTypeIdentifierTitle

        public CLSContext initWithTypeIdentifierTitle​(long type,
                                                      java.lang.String identifier,
                                                      java.lang.String title)
        Initialize and configure the type of content this context represents.
        Parameters:
        identifier - App-assigned identifier for this context. 256 characters max length.
        type - The type of content this context represents.
        title - Title for what this context represents. 256 characters max length.
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isActive

        public boolean isActive()
        Returns true if self is the active context.
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • parent

        public CLSContext parent()
        Returns the parent of this context.
      • removeFromParent

        public void removeFromParent()
        Removes this child context from its parent. If you remove a context from its parent and do not add it as a child of another context, it will be deleted when you call -save on the dataStore.
      • resignActive

        public void resignActive()
        Resign being active. This method does nothing if the reciever of the message is not active.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setDisplayOrder

        public void setDisplayOrder​(long value)
        The displayOrder is by default sorted ascending. Set the displayOrder if you want your contexts to be displayed in a particular order. The sort key is used as a way to sort sibling contexts in a particular order.
      • setTitle

        public void setTitle​(java.lang.String value)
        Title of this context. For example: @em Level 1 @em.
      • setTopic

        public void setTopic​(java.lang.String value)
        Topic associated with this context. See above for valid, predefined topics.
      • setUniversalLinkURL

        public void setUniversalLinkURL​(NSURL value)
        Alternative deep link URL using universal links. If your app supports universal links, you can supply them here to link the content this context represents.
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • supportsSecureCoding

        public static boolean supportsSecureCoding()
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.
        Specified by:
        _supportsSecureCoding in interface NSSecureCoding
        Overrides:
        _supportsSecureCoding in class CLSObject
      • title

        public java.lang.String title()
        Title of this context. For example: @em Level 1 @em.
      • topic

        public java.lang.String topic()
        Topic associated with this context. See above for valid, predefined topics.
      • type

        public long type()
        Type of this context The type that best describes this context.
      • universalLinkURL

        public NSURL universalLinkURL()
        Alternative deep link URL using universal links. If your app supports universal links, you can supply them here to link the content this context represents.
      • version_static

        public static long version_static()
      • customTypeName

        public java.lang.String customTypeName()
        An optional user-visible name for the context if its type is CLSContextTypeCustom. This property is relevant only if the type is CLSContextTypeCustom. This string should be localized. If this property is not set for a context of type CLSContextTypeCustom, Schoolwork app will use a default localized string ‘Custom’ as the name of the activity representing this context.
      • identifierPath

        public NSArray<java.lang.String> identifierPath()
        Context identifier path of this context. The identifier path starts with the main app context object and finishes with the identifier of this context. This is the identifier path that one would use in @code -[CLSDataStore contextsMatchingIdintifierPath:completion:] @endcode to find `this' context.
      • setCustomTypeName

        public void setCustomTypeName​(java.lang.String value)
        An optional user-visible name for the context if its type is CLSContextTypeCustom. This property is relevant only if the type is CLSContextTypeCustom. This string should be localized. If this property is not set for a context of type CLSContextTypeCustom, Schoolwork app will use a default localized string ‘Custom’ as the name of the activity representing this context.
      • setSummary

        public void setSummary​(java.lang.String value)
        An optional user-visible summary describing the context limited to 4000 characters in length. This may be used to provide information about the types of activities available under a given context or the context itself. This string should be localized.
      • setThumbnail

        public void setThumbnail​(CGImageRef value)
        An optional thumbnail image associated with the context. The size of this image should be equal to or larger than 80x80 pixels and equal to or smaller than 330x330 pixels. Images larger than 330x330 pixels will be scaled down. Images with both dimensions smaller than 80x80 pixels will not be accepted.
      • summary

        public java.lang.String summary()
        An optional user-visible summary describing the context limited to 4000 characters in length. This may be used to provide information about the types of activities available under a given context or the context itself. This string should be localized.
      • thumbnail

        public CGImageRef thumbnail()
        An optional thumbnail image associated with the context. The size of this image should be equal to or larger than 80x80 pixels and equal to or smaller than 330x330 pixels. Images larger than 330x330 pixels will be scaled down. Images with both dimensions smaller than 80x80 pixels will not be accepted.
      • addProgressReportingCapabilities

        public void addProgressReportingCapabilities​(NSSet<? extends CLSProgressReportingCapability> capabilities)
        Add or replace additional progress reporting capabilities of the app for this context. If this parameter contains multiple items with the same value for kind, then one of them will be arbitrarily selected and used. If this parameter contains a capability of kind CLSProgressReportingCapabilityKindDuration, it will be ignored.
        Parameters:
        capabilities - Progress reporting capabilities to add or replace existing capabilties.
      • isAssignable

        public boolean isAssignable()
        This property is true if the context can be assigned as an activity. The default value of this property is true. This should be set to false for a context that is used as a container for other contexts, but by itself, is not an assignable activity.
      • progressReportingCapabilities

        public NSSet<? extends CLSProgressReportingCapability> progressReportingCapabilities()
        Specifies progress reporting capablities of the app for this context. This information is intended to help teachers as they choose activities for their students. By default a CLSContext will have one CLSProgressReportingCapability instance of kind CLSProgressReportingCapabilityKindDuration. More progress reporting capabilities can be specified via '-addProgressReportingCapabilities:' to customize this set.
      • resetProgressReportingCapabilities

        public void resetProgressReportingCapabilities()
        Clears CLSProgressReportingCapability objects added to the receiver. Removes all capabilities added via '-addProgressReportingCapabilities:'. The context will have the default progress reporting capability of kind CLSProgressReportingCapabilityKindDuration.
      • setAssignable

        public void setAssignable​(boolean value)
        This property is true if the context can be assigned as an activity. The default value of this property is true. This should be set to false for a context that is used as a container for other contexts, but by itself, is not an assignable activity.
      • setSuggestedAge

        public void setSuggestedAge​(NSRange value)
        Suggested age range of students, expressed in years, for whom this context is suitable. This information is intended to help teachers to choose age-appropriate activities for their students. The default value is [0, NSIntegerMax - 1]. This is @em NSRange(0...Int.max-1) in @em Swift or @em NSMakeRange(0,NSIntegerMax) in @em Objective-C. Set the lower bound to 0 to specify no minimum age limit and set the upper bound to NSIntegerMax - 1 to specify no maximum age limit. [@example] An age range of 4 to 6 years is expressed by @em NSRange(4...6) in @em Swift or by @em NSMakeRange(4,3) in @Objective-C. [@example] An age range of up 10 years is expressed by @em NSRange(0...10) in @em Swift or by @em NSMakeRange(0,11) in @Objective-C. [@example] An age range of 18 years or above is expressed by @em NSRange(18...Int.max-1) in @em Swift or by @em NSMakeRange(18,NSIntegerMax-18) in @Objective-C.
      • setSuggestedCompletionTime

        public void setSuggestedCompletionTime​(NSRange value)
        Suggested time range, expressed in minutes, to complete the activity. This information will help teachers as they choose activities for their students. The default value is [0, NSIntegerMax - 1]. This is @em NSRange(0...Int.max-1) in @em Swift or @em NSMakeRange(0,NSIntegerMax) in @em Objective-C. Set the lower bound value to 0 to specify no minimum time limit and set the upper bound to NSIntegerMax - 1 to specify no maximum time limit. [@example] An time range of 10 to 15 minutes is expressed by @em NSRange(10...15) in @em Swift or by @em NSMakeRange(10,6) in @Objective-C. [@example] An time range of up to 10 minutes is expressed by @em NSRange(0...10) in @em Swift or by @em NSMakeRange(0,11) in @Objective-C. [@example] An time range of at least 20 minutes is expressed by @em NSRange(20...Int.max-1) in @em Swift or by @em NSMakeRange(20,NSIntegerMax-20) in @Objective-C.
      • setType

        public void setType​(long type)
        Sets the type. Use this to update a previously saved context.
      • suggestedAge

        public NSRange suggestedAge()
        Suggested age range of students, expressed in years, for whom this context is suitable. This information is intended to help teachers to choose age-appropriate activities for their students. The default value is [0, NSIntegerMax - 1]. This is @em NSRange(0...Int.max-1) in @em Swift or @em NSMakeRange(0,NSIntegerMax) in @em Objective-C. Set the lower bound to 0 to specify no minimum age limit and set the upper bound to NSIntegerMax - 1 to specify no maximum age limit. [@example] An age range of 4 to 6 years is expressed by @em NSRange(4...6) in @em Swift or by @em NSMakeRange(4,3) in @Objective-C. [@example] An age range of up 10 years is expressed by @em NSRange(0...10) in @em Swift or by @em NSMakeRange(0,11) in @Objective-C. [@example] An age range of 18 years or above is expressed by @em NSRange(18...Int.max-1) in @em Swift or by @em NSMakeRange(18,NSIntegerMax-18) in @Objective-C.
      • suggestedCompletionTime

        public NSRange suggestedCompletionTime()
        Suggested time range, expressed in minutes, to complete the activity. This information will help teachers as they choose activities for their students. The default value is [0, NSIntegerMax - 1]. This is @em NSRange(0...Int.max-1) in @em Swift or @em NSMakeRange(0,NSIntegerMax) in @em Objective-C. Set the lower bound value to 0 to specify no minimum time limit and set the upper bound to NSIntegerMax - 1 to specify no maximum time limit. [@example] An time range of 10 to 15 minutes is expressed by @em NSRange(10...15) in @em Swift or by @em NSMakeRange(10,6) in @Objective-C. [@example] An time range of up to 10 minutes is expressed by @em NSRange(0...10) in @em Swift or by @em NSMakeRange(0,11) in @Objective-C. [@example] An time range of at least 20 minutes is expressed by @em NSRange(20...Int.max-1) in @em Swift or by @em NSMakeRange(20,NSIntegerMax-20) in @Objective-C.