Fix chat storage issue
This commit is contained in:
parent
40aee4de97
commit
39233976a7
2 changed files with 12 additions and 15 deletions
|
@ -106,7 +106,6 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
private FragmentsAvailable currentFragment, nextFragment;
|
||||
private Fragment dialerFragment, messageListenerFragment, messageListFragment, friendStatusListenerFragment;
|
||||
private SavedState dialerSavedState;
|
||||
private ChatStorage chatStorage;
|
||||
private boolean preferLinphoneContacts = false, isAnimationDisabled = false, isContactPresenceDisabled = true;
|
||||
private Handler mHandler = new Handler();
|
||||
private List<Contact> contactList, sipContactList;
|
||||
|
@ -1170,10 +1169,10 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
}
|
||||
|
||||
public ChatStorage getChatStorage() {
|
||||
if (chatStorage == null) {
|
||||
chatStorage = new ChatStorage(this);
|
||||
if (LinphoneManager.getInstance().chatStorage == null) {
|
||||
return new ChatStorage(this);
|
||||
}
|
||||
return chatStorage;
|
||||
return LinphoneManager.getInstance().chatStorage;
|
||||
}
|
||||
|
||||
public void addContact(String displayName, String sipUri)
|
||||
|
@ -1255,11 +1254,6 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
|
||||
prepareContactsInBackground();
|
||||
|
||||
if (chatStorage != null) {
|
||||
chatStorage.close();
|
||||
}
|
||||
chatStorage = new ChatStorage(this);
|
||||
|
||||
updateMissedChatCount();
|
||||
|
||||
displayMissedCalls(LinphoneManager.getLc().getMissedCallsCount());
|
||||
|
@ -1284,11 +1278,6 @@ public class LinphoneActivity extends FragmentActivity implements
|
|||
@Override
|
||||
protected void onDestroy() {
|
||||
LinphoneManager.removeListener(this);
|
||||
|
||||
if (chatStorage != null) {
|
||||
chatStorage.close();
|
||||
chatStorage = null;
|
||||
}
|
||||
|
||||
if (mOrientationHelper != null) {
|
||||
mOrientationHelper.disable();
|
||||
|
|
|
@ -157,6 +157,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
private BroadcastReceiver bluetoothReiceiver = new BluetoothManager();
|
||||
public boolean isBluetoothScoConnected;
|
||||
public boolean isUsingBluetoothAudioRoute;
|
||||
|
||||
public ChatStorage chatStorage;
|
||||
|
||||
private static List<LinphoneSimpleListener> simpleListeners = new ArrayList<LinphoneSimpleListener>();
|
||||
public static void addListener(LinphoneSimpleListener listener) {
|
||||
|
@ -188,6 +190,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
mPowerManager = (PowerManager) c.getSystemService(Context.POWER_SERVICE);
|
||||
mConnectivityManager = (ConnectivityManager) c.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
mR = c.getResources();
|
||||
|
||||
chatStorage = new ChatStorage(mServiceContext);
|
||||
}
|
||||
|
||||
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
|
||||
|
@ -959,6 +963,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
private void doDestroy() {
|
||||
if (chatStorage != null) {
|
||||
chatStorage.close();
|
||||
chatStorage = null;
|
||||
}
|
||||
|
||||
try {
|
||||
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30))
|
||||
mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
|
||||
|
@ -1099,7 +1108,6 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
}
|
||||
|
||||
LinphoneAddress from = message.getFrom();
|
||||
ChatStorage chatStorage = new ChatStorage(mServiceContext);
|
||||
|
||||
String textMessage = message.getText();
|
||||
String url = message.getExternalBodyUrl();
|
||||
|
|
Loading…
Reference in a new issue