MC: Updated comment only
[pub/Android/ownCloud.git] / src / com / owncloud / android / operations / CreateShareOperation.java
index 63f7493..a7270eb 100644 (file)
@@ -27,7 +27,6 @@ package com.owncloud.android.operations;
 import android.content.Context;
 import android.content.Intent;
 
-import com.owncloud.android.MainApp;
 import com.owncloud.android.R;
 import com.owncloud.android.datamodel.FileDataStorageManager;
 import com.owncloud.android.datamodel.OCFile;
@@ -162,8 +161,16 @@ public class CreateShareOperation extends SyncOperation {
         OCFile file = getStorageManager().getFileByPath(mPath);
         if (file!=null) {
             mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink());
-            mSendIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(mContext.getString(R.string.subject_token),
-                    getClient().getCredentials().getUsername(), file.getFileName()));
+            if (getClient().getCredentials().getUsername() == null) {
+                //in saml is null
+                mSendIntent.putExtra(Intent.EXTRA_SUBJECT,
+                        String.format(mContext.getString(R.string.saml_subject_token),
+                                file.getFileName()));
+            } else {
+                mSendIntent.putExtra(Intent.EXTRA_SUBJECT,
+                        String.format(mContext.getString(R.string.subject_token),
+                                getClient().getCredentials().getUsername(), file.getFileName()));
+            }
             file.setPublicLink(share.getShareLink());
             file.setShareByLink(true);
             getStorageManager().saveFile(file);