Skip to content

Commit 3eeb876

Browse files
author
Wilberforce Uwadiegwu
authored
Merge pull request wilburx9#91 from wilburt/flutter-2.0.0-migration
Flutter 2.0.0 migration
2 parents 44ae784 + 08c8459 commit 3eeb876

File tree

76 files changed

+944
-1348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+944
-1348
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 1.0.5 (Breaking change)
2+
* Supported sound null-safety
3+
* Resolved build failure due to unresolved VERSION_NAME and VERSION_CODE
4+
* Fixed issue with dark mode (courtesy of nuelsoft)
5+
* Switched static initialization for instance initialization of the plugin
6+
* Upgraded all native and cross-platform dependencies
7+
8+
19
## 1.0.4+1
210
* Downgraded minimum Flutter version to 1.20.1
311

android/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ group 'co.paystack.flutterpaystack'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.72'
5+
ext.kotlin_version = '1.4.31'
66
repositories {
77
google()
88
jcenter()
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:4.0.1'
12+
classpath 'com.android.tools.build:gradle:4.1.2'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
1515
}
@@ -23,7 +23,6 @@ rootProject.allprojects {
2323

2424
apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
26-
apply plugin: 'kotlin-android-extensions'
2726

2827
android {
2928
compileSdkVersion 28
@@ -44,5 +43,5 @@ android {
4443

4544
dependencies {
4645
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
47-
implementation 'com.google.android.material:material:1.3.0-alpha02'
46+
implementation 'com.google.android.material:material:1.4.0-alpha01'
4847
}

android/src/main/kotlin/co/paystack/flutterpaystack/AuthActivity.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import android.os.Bundle
77
import android.webkit.JavascriptInterface
88
import android.webkit.WebView
99
import android.webkit.WebViewClient
10-
import kotlinx.android.synthetic.main.co_paystack_android____activity_auth.*
1110

1211
/**
1312
* Created by Wilberforce on 29/07/18 at 18:47.
@@ -19,10 +18,12 @@ class AuthActivity : Activity() {
1918

2019
private val si = AuthSingleton.instance
2120
private var responseJson: String? = null
21+
private var webView: WebView? = null
2222

2323
override fun onCreate(savedInstanceState: Bundle?) {
2424
super.onCreate(savedInstanceState)
2525
setContentView(R.layout.co_paystack_android____activity_auth)
26+
webView = findViewById(R.id.webView)
2627
title = "Authorize your card"
2728
setup()
2829
}
@@ -40,7 +41,7 @@ class AuthActivity : Activity() {
4041

4142
@SuppressLint("SetJavaScriptEnabled", "AddJavascriptInterface")
4243
private fun setup() {
43-
webView!!.keepScreenOn = true
44+
webView?.keepScreenOn = true
4445

4546
abstract class AuthResponseJI {
4647
abstract fun processContent(aContent: String)
@@ -64,19 +65,19 @@ class AuthActivity : Activity() {
6465

6566
class JIFactory {
6667

67-
internal val ji: AuthResponseJI
68-
get() = if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
68+
val ji: AuthResponseJI
69+
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
6970
AuthResponse17JI()
7071
} else {
7172
AuthResponseLegacyJI()
7273
}
7374
}
7475

7576

76-
webView!!.settings.javaScriptEnabled = true
77-
webView!!.settings.javaScriptCanOpenWindowsAutomatically = true
78-
webView!!.addJavascriptInterface(JIFactory().ji, "INTERFACE")
79-
webView!!.webViewClient = object : WebViewClient() {
77+
webView?.settings?.javaScriptEnabled = true
78+
webView?.settings?.javaScriptCanOpenWindowsAutomatically = true
79+
webView?.addJavascriptInterface(JIFactory().ji, "INTERFACE")
80+
webView?.webViewClient = object : WebViewClient() {
8081
override fun onPageFinished(view: WebView, url: String) {
8182
if (url.contains(API_URL + "charge/three_d_response/")) {
8283
view.loadUrl("javascript:window.INTERFACE.processContent(document.getElementById('return').innerText);")
@@ -88,15 +89,13 @@ class AuthActivity : Activity() {
8889
}
8990
}
9091

91-
webView!!.loadUrl(si.url)
92+
webView?.loadUrl(si.url)
9293
}
9394

9495
public override fun onDestroy() {
9596
super.onDestroy()
96-
if (webView != null) {
97-
webView!!.stopLoading()
98-
webView!!.removeJavascriptInterface("INTERFACE")
99-
}
97+
webView?.stopLoading()
98+
webView?.removeJavascriptInterface("INTERFACE")
10099
handleResponse()
101100
}
102101

android/src/main/kotlin/co/paystack/flutterpaystack/AuthDelegate.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class AuthDelegate(private val activity: Activity) {
2121
return
2222
}
2323
AuthAsyncTask(WeakReference(activity), WeakReference(onAuthCompleteListener))
24-
.execute(methodCall.argument<String>("authUrl"))
24+
.execute(methodCall.argument("authUrl"))
2525
}
2626

2727
private val onAuthCompleteListener = object : OnAuthCompleteListener {

android/src/main/kotlin/co/paystack/flutterpaystack/Crypto.kt

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import android.util.Base64
44

55
import java.security.KeyFactory
66
import java.security.NoSuchAlgorithmException
7-
import java.security.PrivateKey
87
import java.security.PublicKey
98
import java.security.spec.InvalidKeySpecException
109
import java.security.spec.X509EncodedKeySpec
@@ -43,34 +42,13 @@ object Crypto {
4342

4443
return cipherText
4544
}
46-
47-
@Throws(SecurityException::class)
48-
fun encrypt(text: String, publicKey: String): String {
49-
return String(Base64.encode(encrypt(text, getPublicKeyFromString(publicKey)), Base64.NO_WRAP))
50-
}
45+
5146

5247
@Throws(SecurityException::class)
5348
fun encrypt(text: String): String {
5449
return String(Base64.encode(encrypt(text, getPublicKeyFromString(PAYSTACK_RSA_PUBLIC_KEY)), Base64.NO_WRAP))
5550
}
56-
57-
private fun decrypt(text: ByteArray, key: PrivateKey): String {
58-
var decryptedText: ByteArray? = null
59-
60-
try {
61-
// get an RSA cipher object
62-
val cipher = Cipher.getInstance(CIPHER)
63-
64-
//init cipher and decrypt the text using the private key
65-
cipher.init(Cipher.DECRYPT_MODE, key)
66-
decryptedText = cipher.doFinal(text)
67-
} catch (ex: Exception) {
68-
ex.printStackTrace()
69-
}
70-
71-
return String(decryptedText ?: ByteArray(0))
72-
}
73-
51+
7452

7553
@Throws(SecurityException::class)
7654
private fun getPublicKeyFromString(pubKey: String): PublicKey {

android/src/main/kotlin/co/paystack/flutterpaystack/MethodCallHandlerImpl.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ class MethodCallHandlerImpl(messenger: BinaryMessenger?, private val activity: A
2828
val deviceId = Settings.Secure.getString(activity?.contentResolver, Settings.Secure.ANDROID_ID)
2929
result.success("androidsdk_$deviceId")
3030
}
31-
"getUserAgent" -> {
32-
result.success("Android_" + Build.VERSION.SDK_INT + "_Paystack_" + BuildConfig.VERSION_NAME)
33-
}
34-
35-
"getVersionCode" -> {
36-
result.success(BuildConfig.VERSION_CODE.toString())
37-
}
38-
3931
"getAuthorization" -> {
4032
authDelegate?.handleAuthorization(result, call)
4133
}

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.72'
2+
ext.kotlin_version = '1.4.31'
33
repositories {
44
google()
55
jcenter()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.0.1'
9+
classpath 'com.android.tools.build:gradle:4.1.2'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}

example/android/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
android.enableJetifier=true
22
android.useAndroidX=true
33
org.gradle.jvmargs=-Xmx1536M
4-
android.enableR8=true
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Aug 21 21:56:56 WAT 2020
1+
#Sun Mar 14 03:06:25 WAT 2021
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

example/ios/Flutter/Flutter.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#
22
# NOTE: This podspec is NOT to be published. It is only used as a local source!
3+
# This is a generated file; do not edit or check into version control.
34
#
45

56
Pod::Spec.new do |s|
67
s.name = 'Flutter'
78
s.version = '1.0.0'
89
s.summary = 'High-performance, high-fidelity mobile apps.'
9-
s.description = <<-DESC
10-
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
11-
DESC
1210
s.homepage = 'https://flutter.io'
1311
s.license = { :type => 'MIT' }
1412
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
1513
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
1614
s.ios.deployment_target = '8.0'
17-
s.vendored_frameworks = 'Flutter.framework'
15+
# Framework linking is handled by Flutter tooling, not CocoaPods.
16+
# Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs.
17+
s.vendored_frameworks = 'path/to/nothing'
1818
end

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
97C146EC1CF9000F007C117D /* Resources */,
148148
9705A1C41CF9048500538489 /* Embed Frameworks */,
149149
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
150-
C0FC88BF64931ED5FCF4DBDF /* [CP] Embed Pods Frameworks */,
151150
);
152151
buildRules = (
153152
);
@@ -169,7 +168,7 @@
169168
TargetAttributes = {
170169
97C146ED1CF9000F007C117D = {
171170
CreatedOnToolsVersion = 7.3.1;
172-
DevelopmentTeam = 599T4B53UD;
171+
DevelopmentTeam = A75A29V65V;
173172
SystemCapabilities = {
174173
com.apple.BackgroundModes = {
175174
enabled = 1;
@@ -258,24 +257,6 @@
258257
shellPath = /bin/sh;
259258
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
260259
};
261-
C0FC88BF64931ED5FCF4DBDF /* [CP] Embed Pods Frameworks */ = {
262-
isa = PBXShellScriptBuildPhase;
263-
buildActionMask = 2147483647;
264-
files = (
265-
);
266-
inputPaths = (
267-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
268-
"${PODS_ROOT}/../Flutter/Flutter.framework",
269-
);
270-
name = "[CP] Embed Pods Frameworks";
271-
outputPaths = (
272-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
273-
);
274-
runOnlyForDeploymentPostprocessing = 0;
275-
shellPath = /bin/sh;
276-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
277-
showEnvVarsInLog = 0;
278-
};
279260
/* End PBXShellScriptBuildPhase section */
280261

281262
/* Begin PBXSourcesBuildPhase section */
@@ -421,7 +402,7 @@
421402
buildSettings = {
422403
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
423404
CURRENT_PROJECT_VERSION = 1;
424-
DEVELOPMENT_TEAM = 599T4B53UD;
405+
DEVELOPMENT_TEAM = A75A29V65V;
425406
ENABLE_BITCODE = NO;
426407
FRAMEWORK_SEARCH_PATHS = (
427408
"$(inherited)",
@@ -445,7 +426,7 @@
445426
buildSettings = {
446427
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
447428
CURRENT_PROJECT_VERSION = 1;
448-
DEVELOPMENT_TEAM = 599T4B53UD;
429+
DEVELOPMENT_TEAM = A75A29V65V;
449430
ENABLE_BITCODE = NO;
450431
FRAMEWORK_SEARCH_PATHS = (
451432
"$(inherited)",

example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)