Merge branch 'master' into dev_group_chat

This commit is contained in:
Sylvain Berfini 2017-10-31 10:36:50 +01:00
commit 7b30c40a98
8 changed files with 89 additions and 40 deletions

View file

@ -2,8 +2,8 @@
<manifest package="org.linphone" <manifest package="org.linphone"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="3284" android:versionCode="3303"
android:versionName="3.2.8"> android:versionName="3.3.0">
<uses-sdk <uses-sdk
android:minSdkVersion="16" android:minSdkVersion="16"

View file

@ -2,8 +2,8 @@
<manifest package="org.linphone" <manifest package="org.linphone"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="3284" android:versionCode="3303"
android:versionName="3.2.8"> android:versionName="3.3.0">
<uses-sdk <uses-sdk
android:minSdkVersion="16" android:minSdkVersion="16"

View file

@ -12,14 +12,20 @@ Group changes to describe their impact on the project, as follows:
## [Incomming] ## [Incomming]
## [3.2.8] ## [3.3.0] - 2017-10-18
### Added ### Added
- File sharing - Integration with Android O
- New video adaptive bitrate algorithm(More informations [here](https://wiki.linphone.org/xwiki/wiki/public/view/FAQ/How%20does%20adaptive%20bitrate%20algorithm%20work%20%3F/))
### Changed
- Application is no more managing in-call wakelock, it's now managed by the library
### Fixed ### Fixed
- Crashs in new chat view - Crashs in new chat view
- Contacts management - Contacts management
- Random crash in chatroom
- Improve chats list loading time
## [3.2.7] - 2017-05-15 ## [3.2.7] - 2017-05-15

View file

@ -21,7 +21,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:2.3.3'
if (googleFile.exists()) { if (googleFile.exists()) {
classpath 'com.google.gms:google-services:3.1.0' classpath 'com.google.gms:google-services:3.+'
} }
} }
} }
@ -45,7 +45,7 @@ dependencies {
androidTestCompile 'junit:junit:+' androidTestCompile 'junit:junit:+'
compile 'org.apache.commons:commons-compress:+' compile 'org.apache.commons:commons-compress:+'
if (firebaseEnable()) { if (firebaseEnable()) {
compile 'com.google.firebase:firebase-messaging:11.4.0' compile 'com.google.firebase:firebase-messaging:11.+'
} else { } else {
compile fileTree(include: 'gcm.jar', dir: 'libs') compile fileTree(include: 'gcm.jar', dir: 'libs')
compile 'com.android.support:support-v4:+' compile 'com.android.support:support-v4:+'
@ -84,7 +84,7 @@ excludePackage.add('**/LICENSE.txt')
android { android {
defaultConfig { defaultConfig {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.2" buildToolsVersion "26.0.1"
applicationId getPackageName() applicationId getPackageName()
multiDexEnabled true multiDexEnabled true
@ -158,8 +158,10 @@ android {
debug.setRoot('build-types/debug') debug.setRoot('build-types/debug')
release.setRoot('build-types/release') release.setRoot('build-types/release')
} }
compileSdkVersion 26 packagingOptions {
buildToolsVersion '26.0.1' pickFirst 'META-INF/NOTICE'
pickFirst 'META-INF/LICENSE'
}
} }
// Grant permissions // Grant permissions

View file

@ -191,6 +191,7 @@
<string name="displayed">Read</string> <string name="displayed">Read</string>
<string name="delivered">Delivered</string> <string name="delivered">Delivered</string>
<string name="resend">Resend</string> <string name="resend">Resend</string>
<string name="error_opening_file">An error occurs when opening this file.</string>
<string name="conversation_information">Infos</string> <string name="conversation_information">Infos</string>
<string name="administrator">Admin</string> <string name="administrator">Admin</string>
<string name="conversation_subject_hint">Name your group</string> <string name="conversation_subject_hint">Name your group</string>

View file

@ -133,7 +133,7 @@ public class LinphoneLauncherActivity extends Activity {
newIntent.setData(intent.getData()); newIntent.setData(intent.getData());
if (Intent.ACTION_SEND.equals(action) && type != null) { if (Intent.ACTION_SEND.equals(action) && type != null) {
if (type.contains("text/")){ if (type.contains("text/")){
if(("text/plain").equals(type) && intent.getStringExtra(Intent.EXTRA_TEXT)!= null) { if(("text/plain").equals(type) && (String)intent.getStringExtra(Intent.EXTRA_TEXT)!= null) {
stringFileShared = intent.getStringExtra(Intent.EXTRA_TEXT); stringFileShared = intent.getStringExtra(Intent.EXTRA_TEXT);
newIntent.putExtra("msgShared", stringFileShared); newIntent.putExtra("msgShared", stringFileShared);
} else if(((Uri) intent.getExtras().get(Intent.EXTRA_STREAM)) != null){ } else if(((Uri) intent.getExtras().get(Intent.EXTRA_STREAM)) != null){
@ -141,19 +141,23 @@ public class LinphoneLauncherActivity extends Activity {
newIntent.putExtra("fileShared", stringFileShared); newIntent.putExtra("fileShared", stringFileShared);
} }
}else { }else {
if(intent.getStringExtra(Intent.EXTRA_STREAM) != null){ if(((String) intent.getStringExtra(Intent.EXTRA_STREAM)) != null){
stringUriFileShared = intent.getStringExtra(Intent.EXTRA_STREAM); stringUriFileShared = intent.getStringExtra(Intent.EXTRA_STREAM);
}else { }else {
fileUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); fileUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
stringUriFileShared = LinphoneUtils.getRealPathFromURI(getBaseContext(), fileUri); stringUriFileShared = LinphoneUtils.getRealPathFromURI(getBaseContext(), fileUri);
if(stringUriFileShared == null) if(stringUriFileShared == null)
if(fileUri.getPath().contains("/0/1/mediakey:/local")) { if(fileUri.getPath().contains("/0/1/mediakey:/local") || fileUri.getPath().contains("/ORIGINAL/NONE/")) {
stringUriFileShared = LinphoneUtils.getFilePath(getBaseContext(), fileUri); stringUriFileShared = LinphoneUtils.getFilePath(getBaseContext(), fileUri);
}else }else
stringUriFileShared = fileUri.getPath(); stringUriFileShared = fileUri.getPath();
} }
newIntent.putExtra("fileShared", stringUriFileShared); newIntent.putExtra("fileShared", stringUriFileShared);
} }
}else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
if (type.startsWith("image/")) {
//TODO : Manage multiple files sharing
}
}else if( ACTION_CALL_LINPHONE.equals(action) && (intent.getStringExtra("NumberToCall") != null)) { }else if( ACTION_CALL_LINPHONE.equals(action) && (intent.getStringExtra("NumberToCall") != null)) {
String numberToCall = intent.getStringExtra("NumberToCall"); String numberToCall = intent.getStringExtra("NumberToCall");
if (CallActivity.isInstanciated()) { if (CallActivity.isInstanciated()) {

View file

@ -170,7 +170,7 @@ private static AssistantActivity instance;
if (getResources().getBoolean(R.bool.use_phone_number_validation) if (getResources().getBoolean(R.bool.use_phone_number_validation)
&& cfg.getDomain().equals(getString(R.string.default_domain)) && cfg.getDomain().equals(getString(R.string.default_domain))
&& LinphoneManager.getLc().getDefaultProxyConfig() != null) { && LinphoneManager.getLc().getDefaultProxyConfig() != null) {
accountCreator.isAccountExist(); loadAccountCreator(cfg).isAccountExist();
} else { } else {
success(); success();
} }
@ -226,6 +226,24 @@ private static AssistantActivity instance;
status = fragment; status = fragment;
} }
private AccountCreator loadAccountCreator(ProxyConfig cfg) {
AccountCreator accountCreator = LinphoneManager.getLc().createAccountCreator(LinphonePreferences.instance().getXmlrpcUrl());
ProxyConfig cfgTab[] = LinphoneManager.getLc().getProxyConfigList();
accountCreator.setListener(this);
int n = -1;
for (int i = 0 ; i < cfgTab.length ; i++) {
if (cfgTab[i].equals(cfg)) {
n = i;
break;
}
}
if (n >= 0) {
accountCreator.setDomain(mPrefs.getAccountDomain(n));
accountCreator.setUsername(mPrefs.getAccountUsername(n));
}
return accountCreator;
}
private void initUI() { private void initUI() {
back = (ImageView) findViewById(R.id.back); back = (ImageView) findViewById(R.id.back);
back.setOnClickListener(this); back.setOnClickListener(this);

View file

@ -768,7 +768,7 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
private void sendImageMessage(String path, int imageSize) { private void sendImageMessage(String path, int imageSize) {
if(path.contains("file://")) { if(path.contains("file://")) {
path = path.substring(7); path = path.split("file:///", 2)[1];
} }
if(path.contains("%20")) { if(path.contains("%20")) {
path = path.replace("%20", "-"); path = path.replace("%20", "-");
@ -801,7 +801,7 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
private void sendFileSharingMessage(String path, int size ) { private void sendFileSharingMessage(String path, int size ) {
if (path.contains("file://")) { if (path.contains("file://")) {
path = path.substring(7); path = path.split("file:///", 2)[1];
} else if (path.contains("com.android.contacts/contacts/")) { } else if (path.contains("com.android.contacts/contacts/")) {
path = getCVSPathFromLookupUri(path).toString(); path = getCVSPathFromLookupUri(path).toString();
} else if (path.contains("vcard") || path.contains("vcf")) { } else if (path.contains("vcard") || path.contains("vcf")) {
@ -1584,20 +1584,29 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
contentUri = Uri.parse(imageUri); contentUri = Uri.parse(imageUri);
} else { } else {
file = new File(imageUri); file = new File(imageUri);
try {
contentUri = FileProvider.getUriForFile(getActivity(), "org.linphone.provider", file); contentUri = FileProvider.getUriForFile(getActivity(), "org.linphone.provider", file);
}catch(java.lang.IllegalArgumentException e){
Log.e("Something wrong happend : "+e);
contentUri = null;
}
} }
String type = null; String type = null;
if(contentUri != null) {
String extension = MimeTypeMap.getFileExtensionFromUrl(contentUri.toString()); String extension = MimeTypeMap.getFileExtensionFromUrl(contentUri.toString());
if (extension != null) { if (extension != null) {
type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
} }
if(type != null) { if (type != null) {
intent.setDataAndType(contentUri, type); intent.setDataAndType(contentUri, type);
}else { } else {
intent.setDataAndType(contentUri, "*/*"); intent.setDataAndType(contentUri, "*/*");
} }
intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(intent); context.startActivity(intent);
}else{
LinphoneActivity.instance().displayCustomToast(getString(R.string.error_opening_file), Toast.LENGTH_LONG);
}
} }
}); });
} }
@ -1749,20 +1758,29 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
contentUri = Uri.parse(imageUri); contentUri = Uri.parse(imageUri);
} else { } else {
file = new File(imageUri); file = new File(imageUri);
try {
contentUri = FileProvider.getUriForFile(getActivity(), "org.linphone.provider", file); contentUri = FileProvider.getUriForFile(getActivity(), "org.linphone.provider", file);
}catch(java.lang.IllegalArgumentException e){
Log.e("Something wrong happend : "+e);
contentUri = null;
}
} }
String type = null; String type = null;
if(contentUri != null) {
String extension = MimeTypeMap.getFileExtensionFromUrl(contentUri.toString()); String extension = MimeTypeMap.getFileExtensionFromUrl(contentUri.toString());
if (extension != null) { if (extension != null) {
type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
} }
if(type != null) { if (type != null) {
intent.setDataAndType(contentUri, type); intent.setDataAndType(contentUri, type);
}else { } else {
intent.setDataAndType(contentUri, "*/*"); intent.setDataAndType(contentUri, "*/*");
} }
intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(intent); context.startActivity(intent);
}else{
LinphoneActivity.instance().displayCustomToast(getString(R.string.error_opening_file), Toast.LENGTH_LONG);
}
} }
}); });
} }