-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] #76 지도 및 기프티콘 상세에 표시되는 지도로 인한 공통 코드 및 로직 분리
- Loading branch information
Showing
14 changed files
with
373 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": 3, | ||
"artifactType": { | ||
"type": "APK", | ||
"kind": "Directory" | ||
}, | ||
"applicationId": "com.yapp.buddycon", | ||
"variantName": "release", | ||
"elements": [ | ||
{ | ||
"type": "SINGLE", | ||
"filters": [], | ||
"attributes": [], | ||
"versionCode": 1, | ||
"versionName": "1.0", | ||
"outputFile": "app-release.apk" | ||
} | ||
], | ||
"elementType": "File" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
core/utility/src/main/java/com/yapp/buddycon/utility/Clipboard.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.yapp.buddycon.utility | ||
|
||
import android.content.ClipData | ||
import android.content.ClipboardManager | ||
import android.content.Context | ||
import android.os.Build | ||
import android.widget.Toast | ||
import com.yapp.buddycon.designsystem.R | ||
|
||
fun copyInClipBoard( | ||
context: Context, | ||
text: String | ||
) { | ||
val manager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager | ||
val clip = ClipData.newPlainText("Address", text) | ||
manager.setPrimaryClip(clip) | ||
|
||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) { | ||
Toast.makeText(context, context.getString(R.string.copy_complete), Toast.LENGTH_SHORT).show() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
core/utility/src/main/java/com/yapp/buddycon/utility/DeepLink.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package com.yapp.buddycon.utility | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.content.pm.PackageManager | ||
import android.net.Uri | ||
import android.os.Build | ||
import android.provider.Settings | ||
|
||
fun navigateToSetting( | ||
context: Context, | ||
packageName: String | ||
) { | ||
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) | ||
intent.data = Uri.parse("package:$packageName") | ||
context.startActivity(intent) | ||
} | ||
|
||
fun navigateToNaverMap( | ||
context: Context, | ||
dlat: String, | ||
dlng: String, | ||
dname: String | ||
) { | ||
val uri = Uri | ||
.Builder() | ||
.scheme("nmap") | ||
.authority("route") | ||
.appendPath("public") | ||
.appendQueryParameter("appname", "com.yapp.buddycon") | ||
.appendQueryParameter("dlat", dlat) | ||
.appendQueryParameter("dlng", dlng) | ||
.appendQueryParameter("dname", dname) | ||
.build() | ||
|
||
val marketUrl = "market://details?id=com.nhn.android.nmap" | ||
runDeepLink( | ||
context = context, | ||
uri = uri, | ||
marketUrl = marketUrl | ||
) | ||
} | ||
|
||
fun navigateToKakaoMap( | ||
context: Context, | ||
dlat: String, | ||
dlng: String | ||
) { | ||
val uri = Uri | ||
.Builder() | ||
.scheme("kakaomap") | ||
.authority("route") | ||
.appendQueryParameter("ep", "$dlat,$dlng") | ||
.appendQueryParameter("by", "PUBLICTRANSIT") | ||
.build() | ||
|
||
val marketUrl = "market://details?id=net.daum.android.map" | ||
runDeepLink( | ||
context = context, | ||
uri = uri, | ||
marketUrl = marketUrl | ||
) | ||
} | ||
|
||
fun navigateToGoogleMap( | ||
context: Context, | ||
dlat: String, | ||
dlng: String, | ||
dname: String | ||
) { | ||
val uri = Uri | ||
.Builder() | ||
.scheme("geo") | ||
.appendPath("$dlat,$dlng") | ||
.appendQueryParameter("q", "$dname") | ||
.build() | ||
|
||
val marketUrl = "market://details?id=com.google.android.apps.maps" | ||
runDeepLink( | ||
context = context, | ||
uri = uri, | ||
marketUrl = marketUrl, | ||
packageName = "com.google.android.apps.maps" | ||
) | ||
} | ||
|
||
private fun runDeepLink( | ||
context: Context, | ||
uri: Uri, | ||
marketUrl: String, | ||
packageName: String? = null | ||
) { | ||
val intent = Intent(Intent.ACTION_VIEW, uri) | ||
intent.addCategory(Intent.CATEGORY_BROWSABLE) | ||
|
||
packageName?.let { name -> | ||
intent.setPackage(name) | ||
} | ||
|
||
val list = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { | ||
context.packageManager.queryIntentActivities(intent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong())) | ||
} else { | ||
context.packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY) | ||
} | ||
|
||
if (list.isEmpty()) { | ||
context.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(marketUrl))) | ||
} else { | ||
context.startActivity(intent) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.