Search in sources :

Example 6 with StringMap

use of cx.ring.daemon.StringMap in project ring-client-android by savoirfairelinux.

the class AccountService method setAccountDetails.

/**
 * Sets the account details in the Daemon
 */
@SuppressWarnings("unchecked")
public // Hashmap runtime cast
void setAccountDetails(final String accountId, final Map map) {
    Log.i(TAG, "setAccountDetails() " + map.get("Account.hostname"));
    final StringMap swigmap = StringMap.toSwig(map);
    FutureUtils.executeDaemonThreadCallable(mExecutor, mDeviceRuntimeService.provideDaemonThreadId(), false, () -> {
        Ringservice.setAccountDetails(accountId, swigmap);
        Log.i(TAG, "setAccountDetails() thread running... " + swigmap.get("Account.hostname"));
        return true;
    });
}
Also used : StringMap(cx.ring.daemon.StringMap)

Example 7 with StringMap

use of cx.ring.daemon.StringMap in project ring-client-android by savoirfairelinux.

the class AccountService method renameDevice.

/**
 * @param accountId id of the account used with the device
 * @param newName   new device name
 */
public void renameDevice(final String accountId, final String newName) {
    final Account account = getAccount(accountId);
    account.setDevices(FutureUtils.executeDaemonThreadCallable(mExecutor, mDeviceRuntimeService.provideDaemonThreadId(), true, (Callable<Map<String, String>>) () -> {
        Log.i(TAG, "renameDevice() thread running... " + newName);
        StringMap details = Ringservice.getAccountDetails(accountId);
        details.set(ConfigKey.ACCOUNT_DEVICE_NAME.key(), newName);
        Ringservice.setAccountDetails(accountId, details);
        return Ringservice.getKnownRingDevices(accountId).toNative();
    }));
    account.setDetail(ConfigKey.ACCOUNT_DEVICE_NAME, newName);
}
Also used : Account(cx.ring.model.Account) StringMap(cx.ring.daemon.StringMap) Callable(java.util.concurrent.Callable)

Example 8 with StringMap

use of cx.ring.daemon.StringMap in project ring-client-android by savoirfairelinux.

the class CallService method sendAccountTextMessage.

public Long sendAccountTextMessage(final String accountId, final String to, final String msg) {
    return FutureUtils.executeDaemonThreadCallable(mExecutor, mDeviceRuntimeService.provideDaemonThreadId(), true, () -> {
        Log.i(TAG, "sendAccountTextMessage() thread running... " + accountId + " " + to + " " + msg);
        StringMap msgs = new StringMap();
        msgs.setRaw("text/plain", Blob.fromString(msg));
        return Ringservice.sendAccountTextMessage(accountId, to, msgs);
    });
}
Also used : StringMap(cx.ring.daemon.StringMap)

Example 9 with StringMap

use of cx.ring.daemon.StringMap in project ring-client-android by savoirfairelinux.

the class CallService method sendTextMessage.

public void sendTextMessage(final String callId, final String msg) {
    FutureUtils.executeDaemonThreadCallable(mExecutor, mDeviceRuntimeService.provideDaemonThreadId(), false, () -> {
        Log.i(TAG, "sendTextMessage() thread running...");
        StringMap messages = new StringMap();
        messages.setRaw("text/plain", Blob.fromString(msg));
        Ringservice.sendTextMessage(callId, messages, "", false);
        return true;
    });
}
Also used : StringMap(cx.ring.daemon.StringMap)

Aggregations

StringMap (cx.ring.daemon.StringMap)9 Account (cx.ring.model.Account)3 Point (android.graphics.Point)2 HashMap (java.util.HashMap)1 Callable (java.util.concurrent.Callable)1