use of com.zendesk.rememberthedate.model.UserProfile in project sdk_demo_app_android by zendesk.
the class CreateProfileActivity method showStoredProfile.
private void showStoredProfile() {
UserProfile userProfile = storage.getUserProfile();
imageView.setOnClickListener(v -> Belvedere.from(getApplicationContext()).document().contentType("image/*").allowMultiple(false).open(CreateProfileActivity.this));
if (userProfile.getUri() != null) {
ImageUtils.loadProfilePicture(getApplicationContext(), userProfile.getUri(), imageView);
}
if (!StringUtils.hasLength(nameText.getText().toString())) {
nameText.setText(userProfile.getName());
}
if (!StringUtils.hasLength(emailText.getText().toString())) {
emailText.setText(userProfile.getEmail());
}
}
use of com.zendesk.rememberthedate.model.UserProfile in project sdk_demo_app_android by zendesk.
the class CreateProfileActivity method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
case R.id.action_edit:
final String email = emailText.getText().toString();
final String name = nameText.getText().toString();
if (isProfileSettable) {
final UserProfile user = new UserProfile(name, email, uri);
storage.storeUserProfile(user);
updateIdentityInSdks(user);
finish();
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
use of com.zendesk.rememberthedate.model.UserProfile in project sdk_demo_app_android by zendesk.
the class MainActivity method initialiseChatSdk.
private void initialiseChatSdk() {
final UserProfile profile = storage.getUserProfile();
if (StringUtils.hasLength(profile.getEmail())) {
// Init Zopim Visitor info
final VisitorInfo.Builder build = VisitorInfo.builder().withEmail(profile.getEmail());
if (StringUtils.hasLength(profile.getName())) {
build.withName(profile.getName());
}
Chat.INSTANCE.providers().profileProvider().setVisitorInfo(build.build(), null);
}
}
use of com.zendesk.rememberthedate.model.UserProfile in project sdk_demo_app_android by zendesk.
the class AppStorage method getUserProfile.
public UserProfile getUserProfile() {
final String name = storage.getString(NAME_KEY, "");
final String email = storage.getString(EMAIL_KEY, "");
final String avatarUri = storage.getString(IMAGE_DATA_KEY, "");
Uri uri = null;
if (StringUtils.hasLength(avatarUri)) {
uri = Uri.parse(avatarUri);
}
return new UserProfile(name, email, uri);
}
use of com.zendesk.rememberthedate.model.UserProfile in project sdk_demo_app_android by zendesk.
the class ProfileFragment method onStart.
@Override
public void onStart() {
super.onStart();
AppStorage storage = Global.getStorage(getContext());
UserProfile userProfile = storage.getUserProfile();
if (userProfile.getUri() != null) {
ImageUtils.loadProfilePicture(getContext(), userProfile.getUri(), imageView);
}
userName.setText(userProfile.getName());
email.setText(userProfile.getEmail());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
userName.setTextColor(getResources().getColor(R.color.primaryTextColor, getActivity().getTheme()));
email.setTextColor(getResources().getColor(R.color.primaryTextColor, getActivity().getTheme()));
}
}
Aggregations