Skip to content

Commit

Permalink
Merge pull request wildfirechat#2 from wildfirechat/master
Browse files Browse the repository at this point in the history
update
  • Loading branch information
ThirdPrince authored Jan 7, 2021
2 parents bb2ea69 + 4dd781a commit 4c91170
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 80 deletions.
15 changes: 1 addition & 14 deletions chat/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,10 @@
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:resizeableActivity="true"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">

<meta-data
android:name="android.max_aspect"
android:value="2.1" />

<meta-data
android:name="design_width"
android:value="720" />
<meta-data
android:name="design_height"
android:value="1280" />
<meta-data
android:name="android.max_aspect"
android:value="2.1" />

<meta-data
android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected int contentLayout() {
@Override
protected void afterViews() {
setStatusBarTheme(this, false);
setStatusBarColor(R.color.white);
setStatusBarColor(R.color.gray14);
}

@OnTextChanged(value = R.id.phoneNumberEditText, callback = OnTextChanged.Callback.AFTER_TEXT_CHANGED)
Expand Down
33 changes: 25 additions & 8 deletions chat/src/main/java/cn/wildfire/chat/app/main/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.content.ContextCompat;

import butterknife.ButterKnife;
import cn.wildfire.chat.app.login.SMSLoginActivity;
Expand All @@ -42,21 +43,15 @@ public class SplashActivity extends AppCompatActivity {
private String id;
private String token;

private void hideStatusBar() {
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}

@TargetApi(Build.VERSION_CODES.M)
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
setContentView(R.layout.activity_splash);
ButterKnife.bind(this);
hideStatusBar();
hideSystemUI();
setStatusBarColor(R.color.white);

sharedPreferences = getSharedPreferences("config", Context.MODE_PRIVATE);
id = sharedPreferences.getString("id", null);
Expand Down Expand Up @@ -105,6 +100,8 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
showNextScreen();
}
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}

Expand Down Expand Up @@ -133,4 +130,24 @@ private void showLogin() {
startActivity(intent, bundle);
finish();
}

private void hideSystemUI() {
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
View mDecorView = getWindow().getDecorView();
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
// | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}

protected void setStatusBarColor(int resId) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(ContextCompat.getColor(this, resId));
}
}
}
1 change: 1 addition & 0 deletions chat/src/main/res/layout/login_activity_sms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray14"
android:orientation="vertical">

<LinearLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ private ChannelInfo converProtoChannelInfo(ProtoChannelInfo protoChannelInfo) {
channelInfo.portrait = protoChannelInfo.getPortrait();
channelInfo.extra = protoChannelInfo.getExtra();
channelInfo.owner = protoChannelInfo.getOwner();
channelInfo.status = ChannelInfo.ChannelStatus.status(protoChannelInfo.getStatus());
channelInfo.status = protoChannelInfo.getStatus();
channelInfo.updateDt = protoChannelInfo.getUpdateDt();

return channelInfo;
Expand Down
45 changes: 16 additions & 29 deletions client/src/main/java/cn/wildfirechat/model/ChannelInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,27 @@


public class ChannelInfo implements Parcelable {
public enum ChannelStatus {
//member can add quit change group name and portrait, owner can do all the operations
Public(0),
//every member can add quit change group name and portrait, no one can kickoff others
Private(1),
//member can only quit, owner can do all the operations
Destoryed(2);

private int value;

ChannelStatus(int value) {
this.value = value;
}

public int value() {
return this.value;
}

public static ChannelStatus status(int type) {
if (type >= 0 && type < ChannelStatus.values().length) {
return ChannelStatus.values()[type];
}

throw new IllegalArgumentException("GroupType " + type + " is invalid");
}
public interface ChannelStatusMask {
//第0位表示是否允许查看用户所有信息,还是只允许看用户id,用户名称,用户昵称和用户头像
int Channel_State_Mask_FullInfo = 0x01;
//第1位表示是否允许查看非订阅用户信息
int Channel_State_Mask_Unsubscribed_User_Access = 0x02;
//第2位表示是否允许主动添加用户订阅关系
int Channel_State_Mask_Active_Subscribe = 0x04;
//第3位表示是否允许给非订阅用户发送消息
int Channel_State_Mask_Message_Unsubscribed = 0x08;
//第4位表示是否私有
int Channel_State_Mask_Private = 0x10;
//第6位表示是否删除
int Channel_State_Mask_Deleted = 0x40;
}

public String channelId;
public String name;
public String portrait;
public String desc;
public String owner;
public ChannelStatus status;
public int status;
public String extra;
public long updateDt;

Expand All @@ -65,7 +53,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.portrait);
dest.writeString(this.owner);
dest.writeString(this.desc);
dest.writeInt(this.status == null ? -1 : this.status.ordinal());
dest.writeInt(this.status);
dest.writeString(this.extra);
dest.writeLong(this.updateDt);
}
Expand All @@ -76,8 +64,7 @@ protected ChannelInfo(Parcel in) {
this.portrait = in.readString();
this.owner = in.readString();
this.desc = in.readString();
int tmpType = in.readInt();
this.status = tmpType == -1 ? null : ChannelStatus.values()[tmpType];
this.status = in.readInt();
this.extra = in.readString();
this.updateDt = in.readLong();
}
Expand Down
20 changes: 19 additions & 1 deletion client/src/main/java/cn/wildfirechat/remote/ChatManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,22 @@ public void registerMessageContent(Class<? extends MessageContent> msgContentCls
* @return
*/
public Message insertMessage(Conversation conversation, String sender, MessageContent content, MessageStatus status, boolean notify, long serverTime) {
return insertMessage(conversation, sender, 0, content, status, notify, serverTime);
}

/**
* 插入消息
*
* @param conversation 目标会话
* @param sender 消息发送者id
* @param messageUid 消息uid,可以传0
* @param content 消息体
* @param status 消息状态
* @param notify 是否通知界面,通知时,会通过{@link #onReceiveMessage(List, boolean)}通知界面
* @param serverTime 服务器时间
* @return
*/
public Message insertMessage(Conversation conversation, String sender, long messageUid, MessageContent content, MessageStatus status, boolean notify, long serverTime) {
if (!checkRemoteService()) {
return null;
}
Expand All @@ -1408,6 +1424,7 @@ public Message insertMessage(Conversation conversation, String sender, MessageCo
message.content = content;
message.sender = sender;
message.status = status;
message.messageUid = messageUid;
message.serverTime = serverTime;
if (this.userId.equals(sender)) {
message.direction = MessageDirection.Send;
Expand Down Expand Up @@ -1543,6 +1560,7 @@ public void disconnect(boolean disablePush, boolean cleanSession) {
this.token = null;
}
}

/**
* 设置备选服务地址,仅专业版支持,一般用于政企单位内外网两种网络环境。
*
Expand Down Expand Up @@ -5967,7 +5985,7 @@ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
mClient = IRemoteClient.Stub.asInterface(iBinder);
try {
mClient.setBackupAddressStrategy(backupAddressStrategy);
if(!TextUtils.isEmpty(backupAddressHost))
if (!TextUtils.isEmpty(backupAddressHost))
mClient.setBackupAddress(backupAddressHost, backupAddressPort);

mClient.setServerAddress(SERVER_HOST);
Expand Down
Binary file modified mars-core-release/mars-core-release.aar
Binary file not shown.
14 changes: 0 additions & 14 deletions uikit/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,6 @@
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">

<meta-data
android:name="android.max_aspect"
android:value="2.1" />

<meta-data
android:name="design_width"
android:value="720" />
<meta-data
android:name="design_height"
android:value="1280" />
<meta-data
android:name="android.max_aspect"
android:value="2.1" />

<meta-data
android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,7 @@ public void onChanged(@Nullable UiMessage uiMessage) {
};

private boolean isDisplayableMessage(UiMessage uiMessage) {
MessageContent content = uiMessage.message.content;
if (content.getPersistFlag() == PersistFlag.Persist
|| content.getPersistFlag() == PersistFlag.Persist_And_Count) {
return true;
}
return false;
return uiMessage.message.messageId != 0;
}

private Observer<Map<String, String>> mediaUploadedLiveDataObserver = new Observer<Map<String, String>>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public UnkownMessageContentViewHolder(ConversationFragment fragment, RecyclerVie

@Override
public void onBind(UiMessage message) {
contentTextView.setText("unknown message");
contentTextView.setText("暂不支持此消息,请升级最新版本!");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ public void didChangeState(AVEngineKit.CallState callState) {
if (callState == AVEngineKit.CallState.Connected) {
updateParticipantStatus(callSession);
} else if (callState == AVEngineKit.CallState.Idle) {
if (getActivity() == null) {
return;
}
getActivity().finish();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ public void didChangeState(AVEngineKit.CallState callState) {
if (callState == AVEngineKit.CallState.Connected) {
updateParticipantStatus(callSession);
} else if (callState == AVEngineKit.CallState.Idle) {
if (getActivity() == null) {
return;
}
getActivity().finish();
getActivity().overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.wildfire.chat.kit.GlideApp;
import cn.wildfire.chat.kit.user.UserViewModel;
import cn.wildfirechat.avenginekit.AVEngineKit;
import cn.wildfire.chat.kit.R;
import cn.wildfire.chat.kit.R2;
import cn.wildfire.chat.kit.user.UserViewModel;
import cn.wildfirechat.avenginekit.AVEngineKit;
import cn.wildfirechat.model.UserInfo;
import cn.wildfirechat.remote.ChatManager;

Expand Down Expand Up @@ -83,7 +83,10 @@ public void didChangeState(AVEngineKit.CallState state) {
outgoingActionContainer.setVisibility(View.VISIBLE);
descTextView.setVisibility(View.GONE);
durationTextView.setVisibility(View.VISIBLE);
} else if(state == AVEngineKit.CallState.Idle) {
} else if (state == AVEngineKit.CallState.Idle) {
if (getActivity() == null) {
return;
}
getActivity().finish();
getActivity().overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ public void didChangeState(AVEngineKit.CallState state) {
connectedActionContainer.setVisibility(View.VISIBLE);
inviteeInfoContainer.setVisibility(View.GONE);
} else if (state == AVEngineKit.CallState.Idle) {
if (getActivity() == null) {
return;
}
getActivity().finish();
getActivity().overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
Expand Down
2 changes: 1 addition & 1 deletion uikit/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!--<item name="android:windowAnimationStyle">@style/activityAnimation</item>-->
<!-- Customize color of navigation drawer icon and back arrow -->
<item name="colorBackgroundFloating">@color/white</item>
<item name="android:navigationBarColor">@color/black</item>
<item name="android:navigationBarColor">@color/gray14</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
</resources>
2 changes: 1 addition & 1 deletion uikit/src/main/res/values-v23/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!--<item name="android:windowAnimationStyle">@style/activityAnimation</item>-->
<!-- Customize color of navigation drawer icon and back arrow -->
<item name="colorBackgroundFloating">@color/white</item>
<item name="android:navigationBarColor">@color/black</item>
<item name="android:navigationBarColor">@color/gray14</item>
<item name="android:windowLightStatusBar">false</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
Expand Down
15 changes: 15 additions & 0 deletions uikit/src/main/res/values-v27/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<!-- 设置activity切换动画 -->
<!--<item name="android:windowAnimationStyle">@style/activityAnimation</item>-->
<!-- Customize color of navigation drawer icon and back arrow -->
<item name="colorBackgroundFloating">@color/white</item>
<item name="android:navigationBarColor">@color/gray14</item>
<item name="android:windowLightNavigationBar">true</item>
<item name="android:windowLightStatusBar">false</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
</resources>

0 comments on commit 4c91170

Please sign in to comment.