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

View File

@ -3,6 +3,7 @@ package eu.siacs.conversations.utils;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import java.util.Collections; import java.util.Collections;
@ -75,13 +76,11 @@ public class EasyOnboardingInvite implements Parcelable {
return supportingAccountsBuilder.build(); 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() { public String getDomain() {
return domain; return domain;