Skip to content

Commit

Permalink
exclude Android build artifacts, format .kt files
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Aug 9, 2023
1 parent 15f6a21 commit ca31571
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*.{kt,kts}]
ktlint_code_style = android_studio
6 changes: 4 additions & 2 deletions incubator/@react-native-webapis/battery-status/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
},
"files": [
"RNWBatteryStatus.podspec",
"android/*",
"android/build.gradle",
"android/gradle.properties",
"android/src/*",
"ios/*",
"lib/*",
"macos/*",
Expand All @@ -33,7 +35,7 @@
"format": "rnx-kit-scripts format",
"format:c": "clang-format -i $(git ls-files '*.c' '*.cpp' '*.h' '*.m' '*.mm')",
"lint": "rnx-kit-scripts lint",
"lint:kt": "ktlint --code-style=android_studio --relative 'android/src/**/*.kt'"
"lint:kt": "ktlint --relative 'android/src/**/*.kt'"
},
"peerDependencies": {
"react-native": ">=0.71.0-0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ enum class AuthErrorType(val type: String) {
SERVER_PROTECTION_POLICIES_REQUIRED("ServerProtectionPoliciesRequired"),
TIMEOUT("Timeout"),
USER_CANCELED("UserCanceled"),
WORKPLACE_JOIN_REQUIRED("WorkplaceJoinRequired");
WORKPLACE_JOIN_REQUIRED("WorkplaceJoinRequired")
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class ReactNativeAuthPackage : ReactPackage {
return emptyList()
}

override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
override fun createViewManagers(
reactContext: ReactApplicationContext
): List<ViewManager<*, *>> {
return emptyList()
}
}
2 changes: 1 addition & 1 deletion packages/react-native-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"format": "rnx-kit-scripts format",
"format:c": "clang-format -i $(git ls-files '*.c' '*.cpp' '*.h' '*.m' '*.mm')",
"lint": "rnx-kit-scripts lint",
"lint:kt": "ktlint --relative --verbose 'android/src/**/*.kt'",
"lint:kt": "ktlint --relative 'android/src/**/*.kt'",
"update-readme": "rnx-kit-scripts update-api-readme"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-host/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"format": "rnx-kit-scripts format",
"format:c": "clang-format -i $(git ls-files '*.c' '*.cpp' '*.h' '*.m' '*.mm')",
"lint:kt": "ktlint --relative --verbose 'android/src/**/*.kt'"
"lint:kt": "ktlint --relative 'android/src/**/*.kt'"
},
"peerDependencies": {
"react-native": ">=0.64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ enum class AccountType(val type: String) {
private const val MSA_TENANT = "9188040d-6c67-4c5b-b112-36a304b66dad"

fun fromIssuer(issuer: String): AccountType {
return if (issuer.contains(MSA_TENANT))
return if (issuer.contains(MSA_TENANT)) {
MICROSOFT_ACCOUNT
else
} else {
ORGANIZATIONAL
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Config {

fun authorityFor(accountType: AccountType): String = when (accountType) {
AccountType.INVALID -> throw InvalidParameterException()
AccountType.MICROSOFT_ACCOUNT -> "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize"
AccountType.MICROSOFT_ACCOUNT ->
"https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize"
AccountType.ORGANIZATIONAL -> "https://login.microsoftonline.com/common/"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class MicrosoftAccountsActivity : AppCompatActivity() {
val userPrincipalName = sharedPreferences.getString(USERNAME_KEY, null)
val accountType = sharedPreferences.getString(ACCOUNT_TYPE_KEY, null)
val selectedAccount = allAccounts.find {
it.userPrincipalName == userPrincipalName && it.accountType.toString() == accountType
it.userPrincipalName == userPrincipalName &&
it.accountType.toString() == accountType
}
tokenBroker.selectedAccount = selectedAccount
viewModel.selectedAccount.postValue(selectedAccount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ class MsalPackage : TurboReactPackage() {

return when (name) {
info.name() -> ReactNativeAuthModuleProvider.create(reactContext)
?: throw IllegalStateException("ReactNativeAuthModuleProvider.create() wasn't supposed to return null")
?: throw IllegalStateException(
"ReactNativeAuthModuleProvider.create() wasn't supposed to return null"
)
else -> throw IllegalArgumentException("No module named '$name'")
}
}

override fun getReactModuleInfoProvider(): ReactModuleInfoProvider =
ReactModuleInfoProvider {
val info = ReactNativeAuthModuleProvider.info()
if (info == null)
mapOf()
else
mapOf(info.name() to info).toMutableMap()
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
val info = ReactNativeAuthModuleProvider.info()
if (info == null) {
mapOf()
} else {
mapOf(info.name() to info).toMutableMap()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ReactNativeAuthMSALModule(context: ReactApplicationContext?) :
accountType: RnxAccountType,
onTokenAcquired: OnTokenAcquired
) {
onTokenAcquired(null, RnxAuthError.notImplemented())
onTokenAcquired(null, RnxAuthError.notImplemented())
}

override fun acquireTokenWithScopes(
Expand Down Expand Up @@ -64,7 +64,8 @@ fun AuthErrorType.toRnxAuthErrorType(): RnxAuthErrorType = when (this) {
AuthErrorType.NO_RESPONSE -> RnxAuthErrorType.NO_RESPONSE
AuthErrorType.PRECONDITION_VIOLATED -> RnxAuthErrorType.PRECONDITION_VIOLATED
AuthErrorType.SERVER_DECLINED_SCOPES -> RnxAuthErrorType.SERVER_DECLINED_SCOPES
AuthErrorType.SERVER_PROTECTION_POLICIES_REQUIRED -> RnxAuthErrorType.SERVER_PROTECTION_POLICIES_REQUIRED
AuthErrorType.SERVER_PROTECTION_POLICIES_REQUIRED ->
RnxAuthErrorType.SERVER_PROTECTION_POLICIES_REQUIRED
AuthErrorType.TIMEOUT -> RnxAuthErrorType.TIMEOUT
AuthErrorType.USER_CANCELED -> RnxAuthErrorType.USER_CANCELED
AuthErrorType.WORKPLACE_JOIN_REQUIRED -> RnxAuthErrorType.WORKPLACE_JOIN_REQUIRED
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-test-app-msal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"scripts": {
"format:c": "clang-format -i $(git ls-files '*.h' '*.m')",
"format:swift": "swiftformat --swiftversion 5.7 ios",
"lint:kt": "ktlint --relative --verbose 'android/src/**/*.kt'",
"lint:kt": "ktlint --relative 'android/src/**/*.kt'",
"lint:swift": "swiftlint"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3190,7 +3190,7 @@ __metadata:
prettier: ^3.0.0
typescript: ^5.0.0
peerDependencies:
react-native: ">=0.71.0"
react-native: ">=0.71.0-0"
languageName: unknown
linkType: soft

Expand Down

0 comments on commit ca31571

Please sign in to comment.