Skip to content

Commit

Permalink
Adding new intent filter in LoginActivity for deep links only.
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelplazaspalacio committed Oct 19, 2023
1 parent 6ed98e8 commit 4b00988
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
7 changes: 7 additions & 0 deletions owncloudApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@
android:host="@string/oauth2_redirect_uri_path"
android:scheme="@string/oauth2_redirect_uri_scheme" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="@string/deep_link_uri_scheme" />
</intent-filter>
</activity>
</application>

Expand Down
3 changes: 3 additions & 0 deletions owncloudApp/src/main/res/values/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,7 @@
<!-- Secure connection -->
<bool name="enforce_secure_connection">false</bool>

<!-- Deep Link -->
<string name="deep_link_uri_scheme">owncloud</string>

</resources>
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
/**
* ownCloud Android client application
*
* @author Manuel Plazas Palacio
*
* Copyright (C) 2022 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.owncloud.android.domain.exceptions

class DeepLinkException() : Exception(INVALID_FORMAT)

const val INVALID_FORMAT = "Invalid deep link format"
const val INVALID_FORMAT = "Invalid deep link format"
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/**
* ownCloud Android client application
*
* @author Manuel Plazas Palacio
*
* Copyright (C) 2022 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.owncloud.android.domain.files.usecases

import com.owncloud.android.domain.BaseUseCaseWithResult
Expand All @@ -8,7 +28,7 @@ import java.net.URI
class ManageDeepLinkUseCase : BaseUseCaseWithResult<OCFile?, ManageDeepLinkUseCase.Params>() {

override fun run(params: Params): OCFile? {
val pathParts = params.uri.path.split(PATH_SEPARATOR)
val pathParts = params.uri.fragment.split(PATH_SEPARATOR)
if (pathParts[pathParts.size - 2] != DEEP_LINK_PREVIOUS_PATH_SEGMENT) {
throw DeepLinkException()
}
Expand All @@ -22,4 +42,4 @@ class ManageDeepLinkUseCase : BaseUseCaseWithResult<OCFile?, ManageDeepLinkUseCa
const val DEEP_LINK_PREVIOUS_PATH_SEGMENT = "f"
}

}
}

0 comments on commit 4b00988

Please sign in to comment.