Skip to content

Commit 3d410e8

Browse files
committed
WIP
1 parent 1308916 commit 3d410e8

File tree

18 files changed

+206
-357
lines changed

18 files changed

+206
-357
lines changed

android/build.gradle

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ group 'za.co.britehouse.flutter_microsoft_authentication'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.60'
5+
ext.kotlin_version = '1.5.10'
66
repositories {
77
google()
88
jcenter()
9+
maven {
10+
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
11+
}
912
}
1013

1114
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.2'
15+
classpath 'com.android.tools.build:gradle:4.2.1'
1316
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1417
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
1518
}
@@ -19,6 +22,9 @@ rootProject.allprojects {
1922
repositories {
2023
google()
2124
jcenter()
25+
maven {
26+
url 'https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1'
27+
}
2228
}
2329
}
2430

@@ -27,7 +33,7 @@ apply plugin: 'kotlin-android'
2733
apply plugin: 'kotlinx-serialization'
2834

2935
android {
30-
compileSdkVersion 28
36+
compileSdkVersion 30
3137

3238
sourceSets {
3339
main.java.srcDirs += 'src/main/kotlin'
@@ -42,15 +48,15 @@ android {
4248
}
4349

4450
dependencies {
45-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
46-
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1"
51+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
52+
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0"
4753
if (findProject(':msal') != null) {
4854
// For developer team only.
4955
localImplementation project(':msal')
50-
externalImplementation 'com.microsoft.identity.client:msal:1.4.0'
56+
externalImplementation 'com.microsoft.identity.client:msal:2.0.+'
5157
}
5258
else {
5359
// Downloads and Builds MSAL from maven central.
54-
implementation 'com.microsoft.identity.client:msal:1.4.0'
60+
implementation 'com.microsoft.identity.client:msal:2.0.+'
5561
}
5662
}

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

android/src/main/kotlin/za/co/britehouse/flutter_microsoft_authentication/FlutterMicrosoftAuthenticationPlugin.kt

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,10 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {
3838

3939
override fun onMethodCall(call: MethodCall, result: Result) {
4040

41-
val scopesArg : ArrayList<String>? = call.argument("kScopes")
42-
val scopes: Array<String>? = scopesArg?.toTypedArray()
43-
val authority: String? = call.argument("kAuthority")
44-
val configPath: String? = call.argument("configPath")
45-
46-
47-
if (configPath == null) {
48-
Log.d(TAG, "no config")
49-
result.error("NO_CONFIG","Call must include a config file path", null)
50-
return
51-
}
52-
53-
if(scopes == null){
54-
Log.d(TAG, "no scope")
55-
result.error("NO_SCOPE","Call must include a scope", null)
56-
return
57-
}
58-
59-
if(authority == null){
60-
Log.d(TAG,"error no authority")
61-
result.error("NO_AUTHORITY", "Call must include an authority", null)
62-
return
63-
}
41+
val scopesArg : ArrayList<String> = call.argument("scopes")!!
42+
val scopes: Array<String> = scopesArg?.toTypedArray()!!
43+
val authority: String = call.argument("authority")!!
44+
val configPath: String = call.argument("configPath")!!
6445

6546
when(call.method){
6647
"acquireTokenInteractively" -> acquireTokenInteractively(scopes, authority, result)
@@ -126,7 +107,7 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {
126107
}
127108

128109
override fun onError(exception: MsalException) {
129-
Log.e(TAG, exception.message)
110+
Log.e(TAG, exception.message!!)
130111
}
131112
})
132113
}
@@ -158,7 +139,7 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {
158139
}
159140

160141
override fun onError(exception: MsalException) {
161-
Log.e(TAG, exception.message)
142+
Log.e(TAG, exception.message!!)
162143
result.error("ERROR", exception.errorCode, null)
163144
}
164145
})
@@ -261,7 +242,7 @@ class FlutterMicrosoftAuthenticationPlugin: MethodCallHandler {
261242
}
262243

263244
override fun onError(exception: MsalException) {
264-
Log.e(TAG, exception.message)
245+
Log.e(TAG, exception.message!!)
265246
result.error("MsalException", exception.message, null)
266247
}
267248
})

example/.flutter-plugins-dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_microsoft_authentication","dependencies":[]}]}
1+
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_microsoft_authentication","path":"C:\\\\Users\\\\crist\\\\Desktop\\\\GitHub\\\\flutter-microsoft-authentication\\\\","dependencies":[]}],"android":[{"name":"flutter_microsoft_authentication","path":"C:\\\\Users\\\\crist\\\\Desktop\\\\GitHub\\\\flutter-microsoft-authentication\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_microsoft_authentication","dependencies":[]}],"date_created":"2021-05-26 12:55:26.478563","version":"2.2.0"}

example/android/app/build.gradle

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 28
29+
compileSdkVersion 30
3030

3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
@@ -40,10 +40,9 @@ android {
4040
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4141
applicationId "za.co.britehouse.flutter_microsoft_authentication_example"
4242
minSdkVersion 19
43-
targetSdkVersion 28
43+
targetSdkVersion 30
4444
versionCode flutterVersionCode.toInteger()
4545
versionName flutterVersionName
46-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
4746
}
4847

4948
buildTypes {
@@ -64,8 +63,5 @@ flutter {
6463
}
6564

6665
dependencies {
67-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
68-
testImplementation 'junit:junit:4.12'
69-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
70-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
66+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
7167
}

example/android/app/src/debug/AndroidManifest.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="za.co.britehouse.flutter_microsoft_authentication_example">
3+
<uses-permission android:name="android.permission.INTERNET"/>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
35

4-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5-
calls FlutterMain.startInitialization(this); in its onCreate method.
6-
In most cases you can leave this as-is, but you if you want to provide
7-
additional functionality it is fine to subclass or reimplement
8-
FlutterApplication and put your custom class here. -->
96
<application
10-
android:name="io.flutter.app.FlutterApplication"
117
android:label="flutter_microsoft_authentication_example"
128
android:icon="@mipmap/ic_launcher">
9+
<meta-data
10+
android:name="flutterEmbedding"
11+
android:value="2" />
12+
13+
<activity
14+
android:name="com.microsoft.identity.client.BrowserTabActivity">
15+
<intent-filter>
16+
<action android:name="android.intent.action.VIEW" />
17+
<category android:name="android.intent.category.DEFAULT" />
18+
<category android:name="android.intent.category.BROWSABLE" />
19+
<data
20+
android:scheme="msauth"
21+
android:host="za.co.britehouse.flutter_microsoft_authentication_example"
22+
android:path="/1wIqXSqBj7w+h11ZifsnqwgyKrY=" />
23+
</intent-filter>
24+
</activity>
25+
1326
<activity
14-
android:name=".MainActivity"
27+
android:name="io.flutter.embedding.android.FlutterActivity"
1528
android:launchMode="singleTop"
1629
android:theme="@style/LaunchTheme"
1730
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1831
android:hardwareAccelerated="true"
1932
android:windowSoftInputMode="adjustResize">
20-
<!-- This keeps the window background of the activity showing
21-
until Flutter renders its first frame. It can be removed if
22-
there is no splash screen (such as the default splash screen
23-
defined in @style/LaunchTheme). -->
24-
<meta-data
25-
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
26-
android:value="true" />
33+
2734
<intent-filter>
2835
<action android:name="android.intent.action.MAIN"/>
2936
<category android:name="android.intent.category.LAUNCHER"/>
3037
</intent-filter>
3138
</activity>
3239

33-
<activity android:name="com.microsoft.identity.client.BrowserTabActivity">
34-
<intent-filter>
35-
<action android:name="android.intent.action.VIEW" />
36-
<category android:name="android.intent.category.DEFAULT" />
37-
<category android:name="android.intent.category.BROWSABLE" />
38-
<data
39-
android:host="com.azuresamples.msalandroidkotlinapp"
40-
android:path="/1wIqXSqBj7w+h11ZifsnqwgyKrY="
41-
android:scheme="msauth" />
42-
</intent-filter>
43-
</activity>
40+
4441
</application>
4542
</manifest>

example/android/app/src/main/kotlin/za/co/britehouse/flutter_microsoft_authentication_example/MainActivity.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

example/android/app/src/profile/AndroidManifest.xml

Lines changed: 0 additions & 7 deletions
This file was deleted.

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.60'
2+
ext.kotlin_version = '1.5.10'
33
repositories {
44
google()
55
jcenter()
66
}
77

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

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
32
android.enableR8=true
3+
android.useAndroidX=true

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ 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-4.10.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

0 commit comments

Comments
 (0)