com.bugvm.apple.accounts.ACAccountStore 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.accounts;
/**/
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 5.0 and later.
*/
/* */
/**/@Library("Accounts") @NativeClass/* */
/**/public/* */ class /**/ACAccountStore/* */
extends /**/NSObject/* */
/**//* */ {
public static class Notifications {
/**
* @since Available in iOS 5.0 and later.
*/
public NSObject observeDidChange(final Runnable block) {
return NSNotificationCenter.getDefaultCenter().addObserver(DidChangeNotification(), null, NSOperationQueue.getMainQueue(), new VoidBlock1() {
@Override
public void invoke(NSNotification a) {
block.run();
}
});
}
}
/**/public static class ACAccountStorePtr extends Ptr {}/* */
/**/static { ObjCRuntime.bind(ACAccountStore.class); }/* */
/**//* */
/**/
public ACAccountStore() {}
protected ACAccountStore(SkipInit skipInit) { super(skipInit); }
/* */
/**/
@Property(selector = "accounts")
public native NSArray getAccounts();
/* */
/**//* */
public void requestAccessToAccounts(ACAccountType accountType, ACAccountOptions options, @Block VoidBlock2 completion) {
requestAccessToAccounts(accountType, options == null ? null : options.getDictionary(), completion);
}
/**/
/**
* @since Available in iOS 5.0 and later.
*/
@GlobalValue(symbol="ACAccountStoreDidChangeNotification", optional=true)
public static native NSString DidChangeNotification();
@Method(selector = "accountWithIdentifier:")
public native ACAccount getAccount(String identifier);
@Method(selector = "accountTypeWithAccountTypeIdentifier:")
public native ACAccountType getAccountType(ACAccountTypeIdentifier typeIdentifier);
@Method(selector = "accountsWithAccountType:")
public native NSArray getAccounts(ACAccountType accountType);
@Method(selector = "saveAccount:withCompletionHandler:")
public native void saveAccount(ACAccount account, @Block VoidBlock2 completionHandler);
/**
* @since Available in iOS 5.0 and later.
* @deprecated Deprecated in iOS 6.0.
*/
@Deprecated
@Method(selector = "requestAccessToAccountsWithType:withCompletionHandler:")
public native void requestAccessToAccounts(ACAccountType accountType, @Block VoidBlock2 handler);
@Method(selector = "requestAccessToAccountsWithType:options:completion:")
protected native void requestAccessToAccounts(ACAccountType accountType, NSDictionary options, @Block VoidBlock2 completion);
@Method(selector = "renewCredentialsForAccount:completion:")
public native void renewCredentials(ACAccount account, @Block VoidBlock2 completionHandler);
@Method(selector = "removeAccount:withCompletionHandler:")
public native void removeAccount(ACAccount account, @Block VoidBlock2 completionHandler);
/* */
}