syncbase/src/main/java/io/v/syncbase/Database.java
/**
     * Joins the syncgroup associated with the given invite and adds it to the user's "userdata"
     * collection, as needed. The passed callback is called on the current thread.
     *
     * @param invite the syncgroup invite
     * @param cb     the callback to call with the syncgroup handle
     */
Joins the syncgroup associated with the given invite and adds it to the user's "userdata"
collection, as needed. The passed callback is called on the current thread.

@param invite the syncgroup invite
@param cb     the callback to call with the syncgroup handle
Joins the syncgroup associated with the given invite and adds it to the user ' s " userdata " collection as needed . The passed callback is called on the current thread . @param invite the syncgroup invite @param cb the callback to call with the syncgroup handle
public void acceptSyncgroupInvite(final SyncgroupInvite invite,
                                      final AcceptSyncgroupInviteCallback cb) {
        final io.v.syncbase.core.Syncgroup coreSyncgroup =
                mCoreDatabase.syncgroup(invite.getId().toCoreId());
        final Database database = this;
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    String publishName = Syncbase.sOpts.mCloudName; 
                    List<String> expectedBlessings = invite.getInviterBlessingNames();
                    if (Syncbase.sOpts.mCloudAdmin != null) {
                        expectedBlessings.add(Syncbase.sOpts.mCloudAdmin);
                    }
                    coreSyncgroup.join(publishName, expectedBlessings, new SyncgroupMemberInfo());
                    Syncbase.addToUserdata(invite.getId());
                } catch (VError | SyncbaseException e) {
                    cb.onFailure(e);
                    return;
                }
                cb.onSuccess(new Syncgroup(coreSyncgroup, database));
            }
        }).start();
    }
public void acceptSyncgroupInvite ( final SyncgroupInvite invite , final AcceptSyncgroupInviteCallback cb ) { final io . v . syncbase . core . Syncgroup coreSyncgroup = mCoreDatabase . syncgroup ( invite . getId ( ) . toCoreId ( ) ) ; final Database database = this ; new Thread ( new Runnable ( ) { @ Override public void run ( ) { try { String publishName = Syncbase . sOpts . mCloudName ; List < String > expectedBlessings = invite . getInviterBlessingNames ( ) ; if ( Syncbase . sOpts . mCloudAdmin != null ) { expectedBlessings . add ( Syncbase . sOpts . mCloudAdmin ) ; } coreSyncgroup . join ( publishName , expectedBlessings , new SyncgroupMemberInfo ( ) ) ; Syncbase . addToUserdata ( invite . getId ( ) ) ; } catch ( VError | SyncbaseException e ) { cb . onFailure ( e ) ; return ; } cb . onSuccess ( new Syncgroup ( coreSyncgroup , database ) ) ; } } ) . start ( ) ; }
Joins the syncgroup associated with the given invite and adds it to the user's "userdata"
 collection, as needed.
Joins the syncgroup associated with the given invite and adds it to the user ' s " userdata " collection as needed .
// TODO(sadovsky): Should we add "accept" and "ignore" methods to the SyncgroupInvite class, // or should we treat it as a POJO (with no reference to Database)? // TODO(razvanm): Figure out if we should use an AsyncTask or something else. // ok if null