-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added android support for deep link and change icon
- Loading branch information
Showing
29 changed files
with
82 additions
and
15 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions
59
example/wallet/android/app/src/main/kotlin/com/example/wallet/MainActivity.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 |
---|---|---|
@@ -1,6 +1,65 @@ | ||
package com.walletconnect.flutterwallet | ||
|
||
import android.content.BroadcastReceiver | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.Uri | ||
import android.os.Bundle | ||
import androidx.annotation.NonNull | ||
|
||
import io.flutter.embedding.android.FlutterActivity | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugin.common.EventChannel | ||
import io.flutter.plugin.common.MethodCall | ||
import io.flutter.plugin.common.MethodChannel | ||
|
||
class MainActivity: FlutterActivity() { | ||
private val eventsChannel = "com.walletconnect.flutterwallet/events" | ||
private val methodsChannel = "com.walletconnect.flutterwallet/methods" | ||
|
||
private var initialLink: String? = null | ||
private var linksReceiver: BroadcastReceiver? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
val intent: Intent? = intent | ||
initialLink = intent?.data?.toString() | ||
|
||
EventChannel(flutterEngine?.dartExecutor?.binaryMessenger, eventsChannel).setStreamHandler( | ||
object : EventChannel.StreamHandler { | ||
override fun onListen(args: Any?, events: EventChannel.EventSink) { | ||
linksReceiver = createChangeReceiver(events) | ||
} | ||
override fun onCancel(args: Any?) { | ||
linksReceiver = null | ||
} | ||
} | ||
) | ||
|
||
MethodChannel(flutterEngine!!.dartExecutor.binaryMessenger, methodsChannel).setMethodCallHandler { call, result -> | ||
if (call.method == "initialLink") { | ||
if (initialLink != null) { | ||
result.success(initialLink) | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun onNewIntent(intent: Intent) { | ||
super.onNewIntent(intent) | ||
if (intent.action === Intent.ACTION_VIEW) { | ||
linksReceiver?.onReceive(this.applicationContext, intent) | ||
} | ||
} | ||
|
||
fun createChangeReceiver(events: EventChannel.EventSink): BroadcastReceiver? { | ||
return object : BroadcastReceiver() { | ||
override fun onReceive(context: Context, intent: Intent) { | ||
val dataString = intent.dataString ?: | ||
events.error("UNAVAILABLE", "Link unavailable", null) | ||
events.success(dataString) | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
example/wallet/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
5 changes: 5 additions & 0 deletions
5
example/wallet/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
Binary file removed
BIN
-544 Bytes
example/wallet/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+2.59 KB
example/wallet/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Binary file not shown.
Binary file added
BIN
+3.16 KB
example/wallet/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Binary file not shown.
Binary file removed
BIN
-442 Bytes
example/wallet/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file added
BIN
+1020 Bytes
example/wallet/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file added
BIN
+1.47 KB
example/wallet/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Binary file not shown.
Binary file added
BIN
+2 KB
example/wallet/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Binary file not shown.
Binary file removed
BIN
-721 Bytes
example/wallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+4.34 KB
example/wallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Binary file not shown.
Binary file added
BIN
+4.48 KB
example/wallet/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file removed
BIN
-1.01 KB
example/wallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file added
BIN
+3.84 KB
example/wallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file added
BIN
+9.66 KB
example/wallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Binary file not shown.
Binary file added
BIN
+7.87 KB
example/wallet/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Binary file not shown.
Binary file removed
BIN
-1.41 KB
example/wallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary file not shown.
Binary file added
BIN
+6.09 KB
example/wallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file added
BIN
+17.7 KB
example/wallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Binary file not shown.
Binary file added
BIN
+12.4 KB
example/wallet/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Binary file not shown.
4 changes: 4 additions & 0 deletions
4
example/wallet/android/app/src/main/res/values/ic_launcher_background.xml
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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="ic_launcher_background">#F5EDFF</color> | ||
</resources> |
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
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