All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.bugvm.apple.contacts.CNContactStore Maven / Gradle / Ivy
/*
* Copyright (C) 2013-2015 RoboVM AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bugvm.apple.contacts;
/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
/* */
/**/
/**
* @since Available in iOS 9.0 and later.
*/
/* */
/**/@Library("Contacts") @NativeClass/* */
/**/public/* */ class /**/CNContactStore/* */
extends /**/NSObject/* */
/**//* */ {
public static class Notifications {
/**
* @since Available in iOS 9.0 and later.
*/
public static NSObject observeDidChange(CNContactStore object, final Runnable block) {
return NSNotificationCenter.getDefaultCenter().addObserver(DidChangeNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1() {
@Override
public void invoke(NSNotification a) {
block.run();
}
});
}
}
/**/public static class CNContactStorePtr extends Ptr {}/* */
/**/static { ObjCRuntime.bind(CNContactStore.class); }/* */
/**//* */
/**/
public CNContactStore() {}
protected CNContactStore(SkipInit skipInit) { super(skipInit); }
/* */
/**/
/* */
/**//* */
public boolean enumerateContacts(CNContactFetchRequest fetchRequest, VoidBlock2 block) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = enumerateContacts(fetchRequest, ptr, block);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
/**/
/**
* @since Available in iOS 9.0 and later.
*/
@GlobalValue(symbol="CNContactStoreDidChangeNotification", optional=true)
public static native NSString DidChangeNotification();
@Method(selector = "requestAccessForEntityType:completionHandler:")
public native void requestAccessForEntityType(CNEntityType entityType, @Block VoidBlock2 completionHandler);
public NSArray getUnifiedContactsMatchingPredicate(NSPredicate predicate, List keys) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
NSArray result = getUnifiedContactsMatchingPredicate(predicate, keys, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "unifiedContactsMatchingPredicate:keysToFetch:error:")
private native NSArray getUnifiedContactsMatchingPredicate(NSPredicate predicate, @com.bugvm.rt.bro.annotation.Marshaler(CNContactPropertyKey.AsListMarshaler.class) List keys, NSError.NSErrorPtr error);
public CNContact getUnifiedContact(String identifier, List keys) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
CNContact result = getUnifiedContact(identifier, keys, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "unifiedContactWithIdentifier:keysToFetch:error:")
private native CNContact getUnifiedContact(String identifier, @com.bugvm.rt.bro.annotation.Marshaler(CNContactPropertyKey.AsListMarshaler.class) List keys, NSError.NSErrorPtr error);
@Method(selector = "enumerateContactsWithFetchRequest:error:usingBlock:")
private native boolean enumerateContacts(CNContactFetchRequest fetchRequest, NSError.NSErrorPtr error, @Block VoidBlock2 block);
public NSArray getGroupsMatchingPredicate(NSPredicate predicate) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
NSArray result = getGroupsMatchingPredicate(predicate, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "groupsMatchingPredicate:error:")
private native NSArray getGroupsMatchingPredicate(NSPredicate predicate, NSError.NSErrorPtr error);
public NSArray getContainersMatchingPredicate(NSPredicate predicate) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
NSArray result = getContainersMatchingPredicate(predicate, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "containersMatchingPredicate:error:")
private native NSArray getContainersMatchingPredicate(NSPredicate predicate, NSError.NSErrorPtr error);
public boolean executeSaveRequest(CNSaveRequest saveRequest) throws NSErrorException {
NSError.NSErrorPtr ptr = new NSError.NSErrorPtr();
boolean result = executeSaveRequest(saveRequest, ptr);
if (ptr.get() != null) { throw new NSErrorException(ptr.get()); }
return result;
}
@Method(selector = "executeSaveRequest:error:")
private native boolean executeSaveRequest(CNSaveRequest saveRequest, NSError.NSErrorPtr error);
@Method(selector = "defaultContainerIdentifier")
public native String getDefaultContainerIdentifier();
@Method(selector = "authorizationStatusForEntityType:")
public static native CNAuthorizationStatus getAuthorizationStatusForEntityType(CNEntityType entityType);
/* */
}