Skip to content

Commit

Permalink
Merge branch 'develop' into fix/bottom-sheet-dividers
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas committed Apr 18, 2024
2 parents db47276 + 3fb8e47 commit aa9922f
Show file tree
Hide file tree
Showing 83 changed files with 2,588 additions and 1,176 deletions.
12 changes: 10 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,26 @@
android:name=".ui.AppLockActivity"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />

<activity
android:name=".ui.calling.CallActivity"
android:exported="true"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />

<activity
android:name=".ui.WireActivity"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.SplashScreen"
android:windowSoftInputMode="adjustResize|stateHidden">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,3 @@ object SlideNavigationAnimation : WireDestinationStyleAnimated {
object PopUpNavigationAnimation : WireDestinationStyleAnimated {
override fun animationType(): TransitionAnimationType = TransitionAnimationType.POP_UP
}

object WakeUpScreenPopUpNavigationAnimation : WireDestinationStyleAnimated, ScreenModeStyle {
override fun animationType(): TransitionAnimationType = TransitionAnimationType.POP_UP
override fun screenMode(): ScreenMode = ScreenMode.WAKE_UP
}

object KeepOnScreenPopUpNavigationAnimation : WireDestinationStyleAnimated, ScreenModeStyle {
override fun animationType(): TransitionAnimationType = TransitionAnimationType.POP_UP
override fun screenMode(): ScreenMode = ScreenMode.KEEP_ON
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun getActionReply(

fun getOpenIncomingCallAction(context: Context, conversationId: String, userId: String) = getAction(
context.getString(R.string.notification_action_open_call),
openIncomingCallPendingIntent(context, conversationId, userId)
fullScreenIncomingCallPendingIntent(context, conversationId, userId)
)

fun getDeclineCallAction(context: Context, conversationId: String, userId: String) = getAction(
Expand Down
37 changes: 10 additions & 27 deletions app/src/main/kotlin/com/wire/android/notification/PendingIntents.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import com.wire.android.notification.broadcastreceivers.CallNotificationDismissR
import com.wire.android.notification.broadcastreceivers.EndOngoingCallReceiver
import com.wire.android.notification.broadcastreceivers.NotificationReplyReceiver
import com.wire.android.ui.WireActivity
import com.wire.android.ui.calling.CallActivity
import com.wire.android.ui.calling.CallScreenType
import com.wire.android.util.deeplink.DeepLinkProcessor

fun messagePendingIntent(context: Context, conversationId: String, userId: String?): PendingIntent {
Expand Down Expand Up @@ -81,17 +83,6 @@ fun replyMessagePendingIntent(context: Context, conversationId: String, userId:
PendingIntent.FLAG_MUTABLE
)

fun openIncomingCallPendingIntent(context: Context, conversationId: String, userId: String): PendingIntent {
val intent = openIncomingCallIntent(context, conversationId, userId)

return PendingIntent.getActivity(
context.applicationContext,
OPEN_INCOMING_CALL_REQUEST_CODE,
intent,
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
}

fun openOngoingCallPendingIntent(context: Context, conversationId: String): PendingIntent {
val intent = openOngoingCallIntent(context, conversationId)

Expand Down Expand Up @@ -132,27 +123,21 @@ fun fullScreenIncomingCallPendingIntent(context: Context, conversationId: String
context,
FULL_SCREEN_REQUEST_CODE,
intent,
PendingIntent.FLAG_IMMUTABLE
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
}

private fun openIncomingCallIntent(context: Context, conversationId: String, userId: String) =
Intent(context.applicationContext, WireActivity::class.java).apply {
data = Uri.Builder()
.scheme(DeepLinkProcessor.DEEP_LINK_SCHEME)
.authority(DeepLinkProcessor.INCOMING_CALL_DEEPLINK_HOST)
.appendPath(conversationId)
.appendQueryParameter(DeepLinkProcessor.USER_TO_USE_QUERY_PARAM, userId)
.build()
Intent(context.applicationContext, CallActivity::class.java).apply {
putExtra(CallActivity.EXTRA_CONVERSATION_ID, conversationId)
putExtra(CallActivity.EXTRA_USER_ID, userId)
putExtra(CallActivity.EXTRA_SCREEN_TYPE, CallScreenType.Incoming.name)
}

private fun openOngoingCallIntent(context: Context, conversationId: String) =
Intent(context.applicationContext, WireActivity::class.java).apply {
data = Uri.Builder()
.scheme(DeepLinkProcessor.DEEP_LINK_SCHEME)
.authority(DeepLinkProcessor.ONGOING_CALL_DEEPLINK_HOST)
.appendPath(conversationId)
.build()
Intent(context.applicationContext, CallActivity::class.java).apply {
putExtra(CallActivity.EXTRA_CONVERSATION_ID, conversationId)
putExtra(CallActivity.EXTRA_SCREEN_TYPE, CallScreenType.Ongoing.name)
}

private fun openMigrationLoginIntent(context: Context, userHandle: String) =
Expand Down Expand Up @@ -188,14 +173,12 @@ fun openAppPendingIntent(context: Context): PendingIntent {

private const val MESSAGE_NOTIFICATIONS_SUMMARY_REQUEST_CODE = 0
private const val DECLINE_CALL_REQUEST_CODE = "decline_call_"
private const val OPEN_INCOMING_CALL_REQUEST_CODE = 2
private const val FULL_SCREEN_REQUEST_CODE = 3
private const val OPEN_ONGOING_CALL_REQUEST_CODE = 4
private const val OPEN_MIGRATION_LOGIN_REQUEST_CODE = 5
private const val END_ONGOING_CALL_REQUEST_CODE = "hang_up_call_"
private const val OPEN_MESSAGE_REQUEST_CODE_PREFIX = "open_message_"
private const val OPEN_OTHER_USER_PROFILE_CODE_PREFIX = "open_other_user_profile_"
private const val CALL_REQUEST_CODE_PREFIX = "call_"
private const val REPLY_MESSAGE_REQUEST_CODE_PREFIX = "reply_"

private fun getRequestCode(conversationId: String, prefix: String): Int = (prefix + conversationId).hashCode()
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ class WireNotificationManager @Inject constructor(
when (screens) {
is CurrentScreen.Conversation -> messagesNotificationManager.hideNotification(screens.id, userId)
is CurrentScreen.OtherUserProfile -> messagesNotificationManager.hideNotification(screens.id, userId)
is CurrentScreen.IncomingCallScreen -> callNotificationManager.hideIncomingCallNotification()
else -> {}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/kotlin/com/wire/android/ui/AppLockActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class AppLockActivity : AppCompatActivity() {
}
}
}

companion object {
const val SET_TEAM_APP_LOCK = "set_team_app_lock"
}
Expand Down
32 changes: 4 additions & 28 deletions app/src/main/kotlin/com/wire/android/ui/WireActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import com.wire.android.navigation.NavigationCommand
import com.wire.android.navigation.NavigationGraph
import com.wire.android.navigation.navigateToItem
import com.wire.android.navigation.rememberNavigator
import com.wire.android.ui.calling.ProximitySensorManager
import com.wire.android.ui.calling.getOngoingCallIntent
import com.wire.android.ui.common.snackbar.LocalSnackbarHostState
import com.wire.android.ui.common.topappbar.CommonTopAppBar
import com.wire.android.ui.common.topappbar.CommonTopAppBarViewModel
Expand All @@ -72,10 +72,8 @@ import com.wire.android.ui.destinations.E2EIEnrollmentScreenDestination
import com.wire.android.ui.destinations.E2eiCertificateDetailsScreenDestination
import com.wire.android.ui.destinations.HomeScreenDestination
import com.wire.android.ui.destinations.ImportMediaScreenDestination
import com.wire.android.ui.destinations.IncomingCallScreenDestination
import com.wire.android.ui.destinations.LoginScreenDestination
import com.wire.android.ui.destinations.MigrationScreenDestination
import com.wire.android.ui.destinations.OngoingCallScreenDestination
import com.wire.android.ui.destinations.OtherUserProfileScreenDestination
import com.wire.android.ui.destinations.SelfDevicesScreenDestination
import com.wire.android.ui.destinations.SelfUserProfileScreenDestination
Expand Down Expand Up @@ -103,7 +101,6 @@ import com.wire.android.util.SyncStateObserver
import com.wire.android.util.debug.FeatureVisibilityFlags
import com.wire.android.util.debug.LocalFeatureVisibilityFlags
import com.wire.android.util.deeplink.DeepLinkResult
import com.wire.android.util.ui.updateScreenSettings
import dagger.Lazy
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
Expand All @@ -122,9 +119,6 @@ class WireActivity : AppCompatActivity() {
@Inject
lateinit var currentScreenManager: CurrentScreenManager

@Inject
lateinit var proximitySensorManager: ProximitySensorManager

@Inject
lateinit var lockCodeTimeManager: Lazy<LockCodeTimeManager>

Expand Down Expand Up @@ -154,9 +148,6 @@ class WireActivity : AppCompatActivity() {
lifecycle.addObserver(currentScreenManager)
WindowCompat.setDecorFitsSystemWindows(window, false)

appLogger.i("$TAG proximity sensor")
proximitySensorManager.initialize()

lifecycleScope.launch(Dispatchers.Default) {

appLogger.i("$TAG persistent connection status")
Expand Down Expand Up @@ -219,7 +210,9 @@ class WireActivity : AppCompatActivity() {
CommonTopAppBar(
commonTopAppBarState = commonTopAppBarViewModel.state,
onReturnToCallClick = { establishedCall ->
navigator.navigate(NavigationCommand(OngoingCallScreenDestination(establishedCall.conversationId)))
getOngoingCallIntent(this@WireActivity, establishedCall.conversationId.toString()).run {
startActivity(this)
}
},
)
CompositionLocalProvider(LocalNavigator provides navigator) {
Expand Down Expand Up @@ -263,7 +256,6 @@ class WireActivity : AppCompatActivity() {
DisposableEffect(navController) {
val updateScreenSettingsListener = NavController.OnDestinationChangedListener { _, navDestination, _ ->
currentKeyboardController?.hide()
updateScreenSettings(navDestination)
}
navController.addOnDestinationChangedListener(updateScreenSettingsListener)
navController.addOnDestinationChangedListener(currentScreenManager)
Expand Down Expand Up @@ -480,13 +472,6 @@ class WireActivity : AppCompatActivity() {
}
}
}

proximitySensorManager.registerListener()
}

override fun onPause() {
super.onPause()
proximitySensorManager.unRegisterListener()
}

override fun onSaveInstanceState(outState: Bundle) {
Expand Down Expand Up @@ -532,15 +517,6 @@ class WireActivity : AppCompatActivity() {
// do nothing, already handled in ViewModel
}

is DeepLinkResult.IncomingCall -> {
if (result.switchedAccount) navigate(NavigationCommand(HomeScreenDestination, BackStackMode.CLEAR_WHOLE))
navigate(NavigationCommand(IncomingCallScreenDestination(result.conversationsId)))
}

is DeepLinkResult.OngoingCall -> {
navigate(NavigationCommand(OngoingCallScreenDestination(result.conversationsId)))
}

is DeepLinkResult.OpenConversation -> {
if (result.switchedAccount) navigate(NavigationCommand(HomeScreenDestination, BackStackMode.CLEAR_WHOLE))
navigate(NavigationCommand(ConversationScreenDestination(result.conversationsId), BackStackMode.UPDATE_EXISTED))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ class WireActivityViewModel @Inject constructor(
CurrentScreen.InBackground,
is CurrentScreen.Conversation,
CurrentScreen.Home,
is CurrentScreen.CallScreen,
is CurrentScreen.OtherUserProfile,
CurrentScreen.AuthRelated,
CurrentScreen.SomeOther -> true
Expand Down
Loading

0 comments on commit aa9922f

Please sign in to comment.