Commit bf38d91e authored by she's avatar she

1.2.0

parent 8a6635cd
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="1.8" /> <bytecodeTargetLevel target="11" />
</component> </component>
</project> </project>
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<option name="distributionType" value="DEFAULT_WRAPPED" /> <option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.5-all/exhrs6ca08n232b14ue48lbye/gradle-3.5" /> <option name="gradleHome" value="$USER_HOME$/.gradle/wrapper/dists/gradle-3.5-all/exhrs6ca08n232b14ue48lbye/gradle-3.5" />
<option name="gradleJvm" value="Embedded JDK" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</map> </map>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -32,6 +32,7 @@ import com.ccwangluo.im.adapter.ChannelAdapter; ...@@ -32,6 +32,7 @@ import com.ccwangluo.im.adapter.ChannelAdapter;
import com.ccwangluo.im.data.LoginViewModel; import com.ccwangluo.im.data.LoginViewModel;
import com.ccwangluo.im.databinding.FragmentNotificationsBinding; import com.ccwangluo.im.databinding.FragmentNotificationsBinding;
import com.ccwangluo.im.listener.ChannelClickListener; import com.ccwangluo.im.listener.ChannelClickListener;
import com.ccwangluo.im.ui.login.LoginActivity;
import com.ccwangluo.im.ui.login.TestActivity; import com.ccwangluo.im.ui.login.TestActivity;
import com.ccwangluo.im.util.ToastUtil; import com.ccwangluo.im.util.ToastUtil;
...@@ -74,6 +75,14 @@ public class NotificationsFragment extends Fragment { ...@@ -74,6 +75,14 @@ public class NotificationsFragment extends Fragment {
binding.channelList.setAdapter(channelAdapter); binding.channelList.setAdapter(channelAdapter);
binding.logout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CCIMClient.getInstance().logout();
startActivity(new Intent(getContext(), LoginActivity.class));
}
});
loginViewModel.channelList.observe(getViewLifecycleOwner(), new Observer<HashSet<Long>>() { loginViewModel.channelList.observe(getViewLifecycleOwner(), new Observer<HashSet<Long>>() {
@Override @Override
public void onChanged(HashSet<Long> longs) { public void onChanged(HashSet<Long> longs) {
......
...@@ -31,6 +31,13 @@ ...@@ -31,6 +31,13 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<Button
android:layout_marginLeft="10dp"
android:text="登出"
android:id="@+id/logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout> </LinearLayout>
......
...@@ -11,7 +11,7 @@ android { ...@@ -11,7 +11,7 @@ android {
minSdkVersion 24 minSdkVersion 24
targetSdkVersion 30 targetSdkVersion 30
versionCode 3 versionCode 3
versionName "1.0.2" versionName "1.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro" consumerProguardFiles "consumer-rules.pro"
......
...@@ -102,6 +102,8 @@ public class CCIMClient { ...@@ -102,6 +102,8 @@ public class CCIMClient {
public void initSDK(Context context, String appKey, String userName, String extData, Long userId, Long ts, String sign, String server, OnConnectListener resultCallback) { public void initSDK(Context context, String appKey, String userName, String extData, Long userId, Long ts, String sign, String server, OnConnectListener resultCallback) {
this.user = new User(userId, userName, extData); this.user = new User(userId, userName, extData);
messageManager.init(context, userId); messageManager.init(context, userId);
//清除已加入频道信息
channelManager.clear();
socketManager.initChat(context, appKey, userName, extData, userId, ts, sign, server, new OnClientConnectListener() { socketManager.initChat(context, appKey, userName, extData, userId, ts, sign, server, new OnClientConnectListener() {
@Override @Override
public void onSocketConnection(Chat.ConnectResponse.ClientConfig clientConfig) { public void onSocketConnection(Chat.ConnectResponse.ClientConfig clientConfig) {
...@@ -762,6 +764,8 @@ public class CCIMClient { ...@@ -762,6 +764,8 @@ public class CCIMClient {
public void logout() { public void logout() {
isConnected = false; isConnected = false;
channelManager.clear();
contactManager.clear();
socketManager.disConnect(); socketManager.disConnect();
} }
......
...@@ -166,6 +166,9 @@ public class ChannelManager { ...@@ -166,6 +166,9 @@ public class ChannelManager {
} }
}); });
} }
}
public void clear() {
channelIds.clear(); channelIds.clear();
} }
} }
...@@ -524,4 +524,10 @@ public class ContactManager { ...@@ -524,4 +524,10 @@ public class ContactManager {
} }
public void clear() {
contacts.clear();
contactGroups.clear();
dialogs.clear();
blocklist.clear();
}
} }
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment