share xmpp uri if landing url is not available

This commit is contained in:
Daniel Gultsch 2020-12-06 17:57:55 +01:00
parent 528f192f76
commit 99cb23fe14
2 changed files with 6 additions and 13 deletions

View file

@ -68,7 +68,7 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn
final String shareText = getString(
R.string.easy_invite_share_text,
easyOnboardingInvite.getDomain(),
easyOnboardingInvite.getLandingUrl()
easyOnboardingInvite.getShareableLink()
);
final Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
@ -99,13 +99,7 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn
final Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
final int width = Math.min(size.x, size.y);
final String content;
if (Strings.isNullOrEmpty(invite.getLandingUrl())) {
content = invite.getUri();
} else {
content = invite.getLandingUrl();
}
final Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(content, width);
final Bitmap bitmap = BarcodeProvider.create2dBarcodeBitmap(invite.getShareableLink(), width);
binding.qrCode.setImageBitmap(bitmap);
}

View file

@ -3,6 +3,7 @@ package eu.siacs.conversations.utils;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import java.util.Collections;
@ -75,13 +76,11 @@ public class EasyOnboardingInvite implements Parcelable {
return supportingAccountsBuilder.build();
}
public String getUri() {
return uri;
public String getShareableLink() {
return Strings.isNullOrEmpty(landingUrl) ? uri : landingUrl;
}
public String getLandingUrl() {
return landingUrl;
}
public String getDomain() {
return domain;