├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── SharedCode ├── build.gradle.kts └── src │ ├── androidMain │ └── kotlin │ │ └── actual.kt │ ├── commonMain │ └── kotlin │ │ ├── common.kt │ │ └── dynamo │ │ └── PasswordGenerator.kt │ └── iosMain │ └── kotlin │ └── actual.kt ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── jetbrains │ │ └── handson │ │ └── mpp │ │ └── mobile │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── cdrussell │ │ │ └── dynamo │ │ │ ├── MainActivity.kt │ │ │ └── MainViewModel.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── ic_autorenew_black_24dp.xml │ │ ├── ic_content_copy_black_24dp.xml │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── menu │ │ └── bottom_app_bar_menu.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── jetbrains │ └── handson │ └── mpp │ └── mobile │ └── ExampleUnitTest.kt ├── build.gradle ├── docs └── dynamo-android.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── native └── KotlinIOS │ ├── KotlinIOS.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ ├── KotlinIOS │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── ViewController.swift │ ├── KotlinIOSTests │ ├── Info.plist │ └── KotlinIOSTests.swift │ └── KotlinIOSUITests │ ├── Info.plist │ └── KotlinIOSUITests.swift └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | gradlew binary 2 | gradlew.bat binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .gradle 3 | build/ 4 | *.iml 5 | 6 | local.properties 7 | 8 | *xcuserdata 9 | *xcworkspacedata 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dynamo - Password Generator 2 | Password Generator built using [Kotlin Multiplatform](https://kotlinlang.org/docs/reference/multiplatform.html) 3 | 4 | ## What is this? 5 | Example of using Kotlin Multiplatform to build a password generator library which can be shared across platforms. 6 | 7 | Includes example implementations for: 8 | - Android 9 | - iOS 10 | 11 | ![Android app](docs/dynamo-android.png) 12 | 13 | ## Experimental ⚠️ 14 | This was a hack days project, so expect bugs. -------------------------------------------------------------------------------- /SharedCode/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget 2 | 3 | plugins { 4 | kotlin("multiplatform") 5 | } 6 | 7 | configurations.create("compileClasspath") 8 | 9 | kotlin { 10 | //select iOS target platform depending on the Xcode environment variables 11 | val iOSTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget = 12 | if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true) 13 | ::iosArm64 14 | else 15 | ::iosX64 16 | 17 | iOSTarget("ios") { 18 | binaries { 19 | framework { 20 | baseName = "SharedCode" 21 | } 22 | } 23 | } 24 | 25 | jvm("android") 26 | 27 | sourceSets["commonMain"].dependencies { 28 | implementation("org.jetbrains.kotlin:kotlin-stdlib-common") 29 | } 30 | 31 | // sourceSets["commonTest"].dependencies { 32 | // implementation(kotlin("test-common")) 33 | // implementation(kotlin("test-annotations-common")) 34 | // } 35 | 36 | sourceSets["androidMain"].dependencies { 37 | implementation("org.jetbrains.kotlin:kotlin-stdlib") 38 | } 39 | } 40 | 41 | 42 | val packForXcode by tasks.creating(Sync::class) { 43 | group = "build" 44 | 45 | //selecting the right configuration for the iOS framework depending on the Xcode environment variables 46 | val mode = System.getenv("CONFIGURATION") ?: "DEBUG" 47 | val framework = kotlin.targets.getByName("ios").binaries.getFramework(mode) 48 | 49 | inputs.property("mode", mode) 50 | dependsOn(framework.linkTask) 51 | 52 | val targetDir = File(buildDir, "xcode-frameworks") 53 | from({ framework.outputDirectory }) 54 | into(targetDir) 55 | 56 | doLast { 57 | val gradlew = File(targetDir, "gradlew") 58 | gradlew.writeText("#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n") 59 | gradlew.setExecutable(true) 60 | } 61 | } 62 | 63 | tasks.getByName("build").dependsOn(packForXcode) 64 | -------------------------------------------------------------------------------- /SharedCode/src/androidMain/kotlin/actual.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.mpp.mobile 2 | 3 | actual fun platformName(): String { 4 | return "Android" 5 | } 6 | -------------------------------------------------------------------------------- /SharedCode/src/commonMain/kotlin/common.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.mpp.mobile 2 | 3 | expect fun platformName(): String 4 | 5 | fun createApplicationScreenMessage(): String { 6 | return "Kotlin Rocks on ${platformName()}" 7 | } -------------------------------------------------------------------------------- /SharedCode/src/commonMain/kotlin/dynamo/PasswordGenerator.kt: -------------------------------------------------------------------------------- 1 | package com.cdrussell.dynamo 2 | 3 | import com.cdrussell.dynamo.PasswordGenerator.PasswordResult.PasswordFailure 4 | import com.cdrussell.dynamo.PasswordGenerator.PasswordResult.PasswordSuccess 5 | import kotlin.random.Random 6 | 7 | class PasswordGenerator { 8 | 9 | private val asciiNumbers = initialiseNumbers() 10 | private val asciiUppercaseLetters = initialiseUppercaseLetters() 11 | private val asciiLowercaseLetters = initialiseLowercaseLetters() 12 | private val asciiSpecialCharacters = initialiseSpecialCharacters() 13 | 14 | fun generatePassword(passwordConfiguration: PasswordConfiguration): PasswordResult { 15 | if (passwordConfiguration.requiredLength <= 0) return PasswordFailure(IllegalArgumentException("Required password length but be > 0")) 16 | if (!passwordConfiguration.characterTypesAvailable()) return PasswordFailure(IllegalArgumentException("No characters types selected")) 17 | 18 | val minimumCharactersToSatisfyEachConstraint = calculateMinimumCharactersFromCriteria(passwordConfiguration) 19 | 20 | if (minimumCharactersToSatisfyEachConstraint > passwordConfiguration.requiredLength) { 21 | return PasswordFailure(IllegalArgumentException("$minimumCharactersToSatisfyEachConstraint characters required to match subtypes, but total password length is too short: ${passwordConfiguration.requiredLength}")) 22 | } 23 | 24 | val characterCandidates = initializeAvailableCharacters(passwordConfiguration) 25 | 26 | val sb = StringBuilder() 27 | for (i in 0 until passwordConfiguration.requiredLength) { 28 | sb.append(characterCandidates.randomCharacter()) 29 | } 30 | 31 | return PasswordSuccess(sb.toString()) 32 | } 33 | 34 | private fun initializeAvailableCharacters(passwordConfiguration: PasswordConfiguration): MutableList { 35 | val characterCandidates = mutableListOf().also { 36 | if (passwordConfiguration.numericalType.included) it.addAll(asciiNumbers) 37 | if (passwordConfiguration.upperCaseLetterType.included) it.addAll(asciiUppercaseLetters) 38 | if (passwordConfiguration.lowerCaseLetterType.included) it.addAll(asciiLowercaseLetters) 39 | if (passwordConfiguration.specialCharacterLetterType.included) it.addAll(asciiSpecialCharacters) 40 | } 41 | return characterCandidates 42 | } 43 | 44 | private fun initialiseNumbers(): List { 45 | return initialiseAsciiRange(48, 57) 46 | } 47 | 48 | private fun initialiseUppercaseLetters(): List { 49 | return initialiseAsciiRange(65, 90) 50 | } 51 | 52 | private fun initialiseLowercaseLetters(): List { 53 | return initialiseAsciiRange(97, 122) 54 | } 55 | 56 | private fun initialiseSpecialCharacters(): List { 57 | return mutableListOf().also { 58 | it.addAll(initialiseAsciiRange(33, 47)) 59 | it.addAll(initialiseAsciiRange(58, 64)) 60 | it.addAll(initialiseAsciiRange(91, 96)) 61 | it.addAll(initialiseAsciiRange(123, 126)) 62 | } 63 | } 64 | 65 | private fun initialiseAsciiRange(startRange: Int, endRange: Int): List { 66 | val list = mutableListOf() 67 | for (i in startRange..endRange) { 68 | list.add(i.toChar()) 69 | } 70 | return list.toList() 71 | } 72 | 73 | private fun calculateMinimumCharactersFromCriteria(passwordConfiguration: PasswordConfiguration): Int { 74 | val minimumCharactersToSatisfyEachConstraint = 0 + 75 | passwordConfiguration.numericalType.minimumCharactersRequired() + 76 | passwordConfiguration.lowerCaseLetterType.minimumCharactersRequired() + 77 | passwordConfiguration.upperCaseLetterType.minimumCharactersRequired() + 78 | passwordConfiguration.specialCharacterLetterType.minimumCharactersRequired() 79 | return minimumCharactersToSatisfyEachConstraint 80 | } 81 | 82 | // This should really use a `SecureRandom` equivalent but that's not available for Kotlin MPP currently 83 | private fun MutableList.randomCharacter() = this[Random.nextInt(this.size)] 84 | 85 | sealed class PasswordResult { 86 | data class PasswordSuccess(val password: String) : PasswordResult() 87 | data class PasswordFailure(val exception: Exception) : PasswordResult() 88 | } 89 | 90 | data class PasswordConfiguration( 91 | val requiredLength: Int, 92 | val numericalType: NumericalType, 93 | val upperCaseLetterType: UpperCaseLetterType, 94 | val lowerCaseLetterType: LowerCaseLetterType, 95 | val specialCharacterLetterType: SpecialCharacterLetterType 96 | ) 97 | 98 | data class SelectedCharacter(val character: Char, val type: CharacterType) 99 | 100 | abstract class CharacterType(open val included: Boolean) 101 | 102 | data class NumericalType(override val included: Boolean) : CharacterType(included) 103 | data class UpperCaseLetterType(override val included: Boolean) : CharacterType(included) 104 | data class LowerCaseLetterType(override val included: Boolean) : CharacterType(included) 105 | data class SpecialCharacterLetterType(override val included: Boolean) : CharacterType(included) 106 | 107 | private fun CharacterType.minimumCharactersRequired(): Int { 108 | if (!this.included) return 0 109 | return 1 110 | } 111 | 112 | private fun PasswordConfiguration.characterTypesAvailable(): Boolean { 113 | if (upperCaseLetterType.included) return true 114 | if (lowerCaseLetterType.included) return true 115 | if (numericalType.included) return true 116 | if (specialCharacterLetterType.included) return true 117 | return false 118 | } 119 | } -------------------------------------------------------------------------------- /SharedCode/src/iosMain/kotlin/actual.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.mpp.mobile 2 | 3 | import platform.UIKit.UIDevice 4 | 5 | actual fun platformName(): String { 6 | return UIDevice.currentDevice.systemName() + 7 | " " + 8 | UIDevice.currentDevice.systemVersion 9 | } 10 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | apply plugin: 'kotlin-android' 4 | 5 | apply plugin: 'kotlin-android-extensions' 6 | 7 | android { 8 | compileSdkVersion 30 9 | defaultConfig { 10 | applicationId "com.cdrussell.dynamo.android" 11 | minSdkVersion 21 12 | targetSdkVersion 30 13 | versionCode 1 14 | versionName "1.0" 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | } 21 | } 22 | 23 | compileOptions { 24 | sourceCompatibility = JavaVersion.VERSION_1_8 25 | targetCompatibility = JavaVersion.VERSION_1_8 26 | } 27 | kotlinOptions { 28 | jvmTarget = "1.8" 29 | } 30 | lintOptions { 31 | abortOnError false 32 | } 33 | 34 | } 35 | 36 | dependencies { 37 | implementation project(':SharedCode') 38 | implementation fileTree(dir: 'libs', include: ['*.jar']) 39 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 40 | implementation 'androidx.appcompat:appcompat:1.1.0' 41 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7" 42 | implementation "com.google.android.material:material:1.3.0-alpha01" 43 | implementation "androidx.core:core-ktx:1.3.0" 44 | 45 | ext.lifecycle = "2.2.0" 46 | implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle" 47 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle" 48 | implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle" 49 | implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle" 50 | implementation "androidx.core:core-ktx:1.3.0" 51 | 52 | implementation 'androidx.fragment:fragment-ktx:1.2.5' 53 | 54 | implementation 'androidx.core:core-ktx:1.3.0' 55 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 56 | testImplementation 'junit:junit:4.13' 57 | androidTestImplementation 'androidx.test:runner:1.2.0' 58 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 59 | } 60 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/jetbrains/handson/mpp/mobile/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.mpp.mobile 2 | 3 | import androidx.test.InstrumentationRegistry 4 | import androidx.test.runner.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getTargetContext() 22 | assertEquals("com.jetbrains.handson.mpp.mobile", appContext.packageName) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/cdrussell/dynamo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.cdrussell.dynamo 2 | 3 | import android.content.ClipData 4 | import android.content.ClipboardManager 5 | import android.content.Context 6 | import android.content.SharedPreferences 7 | import android.os.Bundle 8 | import android.widget.NumberPicker 9 | import android.widget.Switch 10 | import android.widget.TextView 11 | import androidx.activity.viewModels 12 | import androidx.appcompat.app.AppCompatActivity 13 | import androidx.core.content.edit 14 | import androidx.lifecycle.Observer 15 | import com.cdrussell.dynamo.PasswordGenerator.* 16 | import com.cdrussell.dynamo.PasswordGenerator.PasswordResult.PasswordFailure 17 | import com.cdrussell.dynamo.PasswordGenerator.PasswordResult.PasswordSuccess 18 | import com.google.android.material.bottomappbar.BottomAppBar 19 | import com.google.android.material.floatingactionbutton.FloatingActionButton 20 | import com.google.android.material.snackbar.Snackbar 21 | import com.jetbrains.handson.mpp.mobile.R 22 | 23 | 24 | class MainActivity : AppCompatActivity(R.layout.activity_main) { 25 | 26 | private val viewModel: MainViewModel by viewModels() 27 | 28 | private lateinit var generatedPasswordField: TextView 29 | private lateinit var bottomBar: BottomAppBar 30 | private lateinit var passwordLengthPicker: NumberPicker 31 | private lateinit var newPasswordButton: FloatingActionButton 32 | private lateinit var includeNumbersSwitch: Switch 33 | private lateinit var includeUppercaseSwitch: Switch 34 | private lateinit var includeLowercaseSwitch: Switch 35 | private lateinit var includeSpecialCharacterSwitch: Switch 36 | 37 | override fun onCreate(savedInstanceState: Bundle?) { 38 | super.onCreate(savedInstanceState) 39 | configureViewReferences() 40 | restoreUiPreferences() 41 | configureUiEventHandlers() 42 | configureViewStateObserver() 43 | } 44 | 45 | override fun onStart() { 46 | super.onStart() 47 | generateNewPassword() 48 | } 49 | 50 | private fun restoreUiPreferences() { 51 | with(sharedPrefs()) { 52 | val pwLength = getInt(PREF_KEY_PASSWORD_LENGTH, 12) 53 | with(passwordLengthPicker) { 54 | minValue = 4 55 | maxValue = 60 56 | wrapSelectorWheel = false 57 | value = pwLength 58 | } 59 | 60 | includeUppercaseSwitch.isChecked = getBoolean(PREF_KEY_PASSWORD_USE_UPPERCASE, true) 61 | includeLowercaseSwitch.isChecked = getBoolean(PREF_KEY_PASSWORD_USE_LOWERCASE, true) 62 | includeNumbersSwitch.isChecked = getBoolean(PREF_KEY_PASSWORD_USE_NUMBERS, true) 63 | includeSpecialCharacterSwitch.isChecked = getBoolean(PREF_KEY_PASSWORD_USE_SPECIAL_CHARS, true) 64 | } 65 | } 66 | 67 | private fun configureViewStateObserver() { 68 | viewModel.viewState.observe(this, Observer { 69 | when (it.result) { 70 | is PasswordSuccess -> { 71 | generatedPasswordField.text = it.result.password 72 | } 73 | is PasswordFailure -> { 74 | generatedPasswordField.text = it.result.exception.message 75 | } 76 | } 77 | }) 78 | } 79 | 80 | private fun configureViewReferences() { 81 | bottomBar = findViewById(R.id.bottomAppBar) 82 | generatedPasswordField = findViewById(R.id.generatedPasswordText) 83 | passwordLengthPicker = findViewById(R.id.lengthPicker) 84 | newPasswordButton = findViewById(R.id.newPasswordButton) 85 | includeUppercaseSwitch = findViewById(R.id.useUppercaseSwitch) 86 | includeLowercaseSwitch = findViewById(R.id.useLowercaseSwitch) 87 | includeNumbersSwitch = findViewById(R.id.useNumbersSwitch) 88 | includeSpecialCharacterSwitch = findViewById(R.id.useSpecialCharactersSwitch) 89 | } 90 | 91 | private fun configureUiEventHandlers() { 92 | newPasswordButton.setOnClickListener { generateNewPassword() } 93 | 94 | bottomBar.setOnMenuItemClickListener { 95 | when (it.itemId) { 96 | R.id.copyPassword -> { 97 | generatedPasswordField.text.copyToClipboard() 98 | true 99 | } 100 | else -> false 101 | } 102 | } 103 | passwordLengthPicker.setOnValueChangedListener { _, _, newValue -> 104 | generateNewPassword() 105 | savePreferredLength(newValue) 106 | } 107 | 108 | includeUppercaseSwitch.setOnCheckedChangeListener { _, checked -> 109 | generateNewPassword() 110 | saveCharacterTypePreference(PREF_KEY_PASSWORD_USE_UPPERCASE, checked) 111 | } 112 | 113 | includeLowercaseSwitch.setOnCheckedChangeListener { _, checked -> 114 | generateNewPassword() 115 | saveCharacterTypePreference(PREF_KEY_PASSWORD_USE_LOWERCASE, checked) 116 | } 117 | 118 | includeNumbersSwitch.setOnCheckedChangeListener { _, checked -> 119 | generateNewPassword() 120 | saveCharacterTypePreference(PREF_KEY_PASSWORD_USE_NUMBERS, checked) 121 | } 122 | 123 | includeSpecialCharacterSwitch.setOnCheckedChangeListener { _, checked -> 124 | generateNewPassword() 125 | saveCharacterTypePreference(PREF_KEY_PASSWORD_USE_SPECIAL_CHARS, checked) 126 | } 127 | } 128 | 129 | private fun CharSequence.copyToClipboard() { 130 | val clipboard: ClipboardManager = getSystemService(CLIPBOARD_SERVICE) as ClipboardManager 131 | val clip = ClipData.newPlainText("password", this) 132 | clipboard.setPrimaryClip(clip) 133 | 134 | Snackbar.make(bottomBar, 135 | R.string.copiedToClipboard, Snackbar.LENGTH_SHORT).also { snackbar -> 136 | snackbar.anchorView = bottomBar 137 | }.show() 138 | } 139 | 140 | private fun generateNewPassword() { 141 | val passwordConfiguration = PasswordConfiguration( 142 | requiredLength = passwordLengthPicker.value, 143 | numericalType = NumericalType(included = includeNumbersSwitch.isChecked), 144 | upperCaseLetterType = UpperCaseLetterType(included = includeUppercaseSwitch.isChecked), 145 | lowerCaseLetterType = LowerCaseLetterType(included = includeLowercaseSwitch.isChecked), 146 | specialCharacterLetterType = SpecialCharacterLetterType(included = includeSpecialCharacterSwitch.isChecked) 147 | ) 148 | viewModel.generateNewPassword(passwordConfiguration) 149 | } 150 | 151 | private fun sharedPrefs(): SharedPreferences { 152 | return getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE) 153 | } 154 | 155 | private fun saveCharacterTypePreference(preferenceKey: String, checked: Boolean) { 156 | sharedPrefs().edit { putBoolean(preferenceKey, checked) } 157 | } 158 | 159 | private fun savePreferredLength(newValue: Int) { 160 | sharedPrefs().edit { putInt(PREF_KEY_PASSWORD_LENGTH, newValue) } 161 | } 162 | 163 | companion object { 164 | private const val PREF_FILE = "ui_prefs" 165 | private const val PREF_KEY_PASSWORD_LENGTH = "pw_length" 166 | private const val PREF_KEY_PASSWORD_USE_UPPERCASE = "pw_use_upper" 167 | private const val PREF_KEY_PASSWORD_USE_LOWERCASE = "pw_use_lower" 168 | private const val PREF_KEY_PASSWORD_USE_NUMBERS = "pr_use_numbers" 169 | private const val PREF_KEY_PASSWORD_USE_SPECIAL_CHARS = "pr_use_special_chars" 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /app/src/main/java/com/cdrussell/dynamo/MainViewModel.kt: -------------------------------------------------------------------------------- 1 | package com.cdrussell.dynamo 2 | 3 | import androidx.lifecycle.MutableLiveData 4 | import androidx.lifecycle.ViewModel 5 | import androidx.lifecycle.viewModelScope 6 | import com.cdrussell.dynamo.PasswordGenerator.PasswordResult 7 | import kotlinx.coroutines.Dispatchers 8 | import kotlinx.coroutines.launch 9 | import kotlinx.coroutines.withContext 10 | 11 | 12 | class MainViewModel : ViewModel() { 13 | 14 | val viewState: MutableLiveData = MutableLiveData() 15 | 16 | fun generateNewPassword(passwordConfiguration: PasswordGenerator.PasswordConfiguration) { 17 | viewModelScope.launch { 18 | val result = PasswordGenerator().generatePassword(passwordConfiguration) 19 | 20 | withContext(Dispatchers.Main) { 21 | viewState.value = ViewState(result = result) 22 | } 23 | } 24 | } 25 | } 26 | 27 | data class ViewState(val result: PasswordResult) -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_autorenew_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_content_copy_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 15 | 16 | 23 | 24 | 31 | 32 | 33 | 41 | 42 | 54 | 55 | 61 | 62 | 72 | 73 | 88 | 89 | 102 | 103 | 116 | 117 | 130 | 131 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /app/src/main/res/menu/bottom_app_bar_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ff9900 4 | #995c00 5 | #3399ff 6 | #3399ff 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | KotlinMPP 3 | New Password 4 | Length 5 | Numbers 6 | Uppercase 7 | Lowercase 8 | Special Characters 9 | Generate 10 | Copy 11 | Copied to clipboard 12 | Dynamo 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 16 | 17 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/test/java/com/jetbrains/handson/mpp/mobile/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.jetbrains.handson.mpp.mobile 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext.kotlin_version = '1.3.41' 5 | repositories { 6 | google() 7 | jcenter() 8 | 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.4.2' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /docs/dynamo-android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/docs/dynamo-android.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CDRussell/dynamo/bf9c114a4409afe4d65aa2b4cba47d10bc1a8a40/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 47729E0622F447C800B9B36B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47729E0522F447C800B9B36B /* AppDelegate.swift */; }; 11 | 47729E0822F447C800B9B36B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47729E0722F447C800B9B36B /* ViewController.swift */; }; 12 | 47729E0B22F447C800B9B36B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 47729E0922F447C800B9B36B /* Main.storyboard */; }; 13 | 47729E0D22F447CA00B9B36B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 47729E0C22F447CA00B9B36B /* Assets.xcassets */; }; 14 | 47729E1022F447CA00B9B36B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 47729E0E22F447CA00B9B36B /* LaunchScreen.storyboard */; }; 15 | 47729E1B22F447CA00B9B36B /* KotlinIOSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47729E1A22F447CA00B9B36B /* KotlinIOSTests.swift */; }; 16 | 47729E2622F447CA00B9B36B /* KotlinIOSUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47729E2522F447CA00B9B36B /* KotlinIOSUITests.swift */; }; 17 | 47729E6E22F4806C00B9B36B /* SharedCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47729E6D22F4806B00B9B36B /* SharedCode.framework */; }; 18 | 47729E6F22F4806C00B9B36B /* SharedCode.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 47729E6D22F4806B00B9B36B /* SharedCode.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 47729E1722F447CA00B9B36B /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 47729DFA22F447C800B9B36B /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 47729E0122F447C800B9B36B; 27 | remoteInfo = KotlinIOS; 28 | }; 29 | 47729E2222F447CA00B9B36B /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 47729DFA22F447C800B9B36B /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 47729E0122F447C800B9B36B; 34 | remoteInfo = KotlinIOS; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXCopyFilesBuildPhase section */ 39 | 47729E7022F4806C00B9B36B /* Embed Frameworks */ = { 40 | isa = PBXCopyFilesBuildPhase; 41 | buildActionMask = 2147483647; 42 | dstPath = ""; 43 | dstSubfolderSpec = 10; 44 | files = ( 45 | 47729E6F22F4806C00B9B36B /* SharedCode.framework in Embed Frameworks */, 46 | ); 47 | name = "Embed Frameworks"; 48 | runOnlyForDeploymentPostprocessing = 0; 49 | }; 50 | /* End PBXCopyFilesBuildPhase section */ 51 | 52 | /* Begin PBXFileReference section */ 53 | 47729E0222F447C800B9B36B /* Dynamo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Dynamo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 47729E0522F447C800B9B36B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 55 | 47729E0722F447C800B9B36B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 56 | 47729E0A22F447C800B9B36B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 57 | 47729E0C22F447CA00B9B36B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 58 | 47729E0F22F447CA00B9B36B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 59 | 47729E1122F447CA00B9B36B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 47729E1622F447CA00B9B36B /* KotlinIOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KotlinIOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 61 | 47729E1A22F447CA00B9B36B /* KotlinIOSTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KotlinIOSTests.swift; sourceTree = ""; }; 62 | 47729E1C22F447CA00B9B36B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | 47729E2122F447CA00B9B36B /* KotlinIOSUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KotlinIOSUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 64 | 47729E2522F447CA00B9B36B /* KotlinIOSUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KotlinIOSUITests.swift; sourceTree = ""; }; 65 | 47729E2722F447CA00B9B36B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 66 | 47729E6D22F4806B00B9B36B /* SharedCode.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SharedCode.framework; path = "../../SharedCode/build/xcode-frameworks/SharedCode.framework"; sourceTree = ""; }; 67 | /* End PBXFileReference section */ 68 | 69 | /* Begin PBXFrameworksBuildPhase section */ 70 | 47729DFF22F447C800B9B36B /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | 47729E6E22F4806C00B9B36B /* SharedCode.framework in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | 47729E1322F447CA00B9B36B /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | 47729E1E22F447CA00B9B36B /* Frameworks */ = { 86 | isa = PBXFrameworksBuildPhase; 87 | buildActionMask = 2147483647; 88 | files = ( 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | /* End PBXFrameworksBuildPhase section */ 93 | 94 | /* Begin PBXGroup section */ 95 | 47729DF922F447C800B9B36B = { 96 | isa = PBXGroup; 97 | children = ( 98 | 47729E6D22F4806B00B9B36B /* SharedCode.framework */, 99 | 47729E0422F447C800B9B36B /* KotlinIOS */, 100 | 47729E1922F447CA00B9B36B /* KotlinIOSTests */, 101 | 47729E2422F447CA00B9B36B /* KotlinIOSUITests */, 102 | 47729E0322F447C800B9B36B /* Products */, 103 | ); 104 | sourceTree = ""; 105 | }; 106 | 47729E0322F447C800B9B36B /* Products */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 47729E0222F447C800B9B36B /* Dynamo.app */, 110 | 47729E1622F447CA00B9B36B /* KotlinIOSTests.xctest */, 111 | 47729E2122F447CA00B9B36B /* KotlinIOSUITests.xctest */, 112 | ); 113 | name = Products; 114 | sourceTree = ""; 115 | }; 116 | 47729E0422F447C800B9B36B /* KotlinIOS */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 47729E0522F447C800B9B36B /* AppDelegate.swift */, 120 | 47729E0722F447C800B9B36B /* ViewController.swift */, 121 | 47729E0922F447C800B9B36B /* Main.storyboard */, 122 | 47729E0C22F447CA00B9B36B /* Assets.xcassets */, 123 | 47729E0E22F447CA00B9B36B /* LaunchScreen.storyboard */, 124 | 47729E1122F447CA00B9B36B /* Info.plist */, 125 | ); 126 | path = KotlinIOS; 127 | sourceTree = ""; 128 | }; 129 | 47729E1922F447CA00B9B36B /* KotlinIOSTests */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 47729E1A22F447CA00B9B36B /* KotlinIOSTests.swift */, 133 | 47729E1C22F447CA00B9B36B /* Info.plist */, 134 | ); 135 | path = KotlinIOSTests; 136 | sourceTree = ""; 137 | }; 138 | 47729E2422F447CA00B9B36B /* KotlinIOSUITests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 47729E2522F447CA00B9B36B /* KotlinIOSUITests.swift */, 142 | 47729E2722F447CA00B9B36B /* Info.plist */, 143 | ); 144 | path = KotlinIOSUITests; 145 | sourceTree = ""; 146 | }; 147 | /* End PBXGroup section */ 148 | 149 | /* Begin PBXNativeTarget section */ 150 | 47729E0122F447C800B9B36B /* KotlinIOS */ = { 151 | isa = PBXNativeTarget; 152 | buildConfigurationList = 47729E2A22F447CA00B9B36B /* Build configuration list for PBXNativeTarget "KotlinIOS" */; 153 | buildPhases = ( 154 | 47729E7122F480EB00B9B36B /* ShellScript */, 155 | 47729DFE22F447C800B9B36B /* Sources */, 156 | 47729DFF22F447C800B9B36B /* Frameworks */, 157 | 47729E0022F447C800B9B36B /* Resources */, 158 | 47729E7022F4806C00B9B36B /* Embed Frameworks */, 159 | ); 160 | buildRules = ( 161 | ); 162 | dependencies = ( 163 | ); 164 | name = KotlinIOS; 165 | productName = KotlinIOS; 166 | productReference = 47729E0222F447C800B9B36B /* Dynamo.app */; 167 | productType = "com.apple.product-type.application"; 168 | }; 169 | 47729E1522F447CA00B9B36B /* KotlinIOSTests */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 47729E2D22F447CA00B9B36B /* Build configuration list for PBXNativeTarget "KotlinIOSTests" */; 172 | buildPhases = ( 173 | 47729E1222F447CA00B9B36B /* Sources */, 174 | 47729E1322F447CA00B9B36B /* Frameworks */, 175 | 47729E1422F447CA00B9B36B /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | 47729E1822F447CA00B9B36B /* PBXTargetDependency */, 181 | ); 182 | name = KotlinIOSTests; 183 | productName = KotlinIOSTests; 184 | productReference = 47729E1622F447CA00B9B36B /* KotlinIOSTests.xctest */; 185 | productType = "com.apple.product-type.bundle.unit-test"; 186 | }; 187 | 47729E2022F447CA00B9B36B /* KotlinIOSUITests */ = { 188 | isa = PBXNativeTarget; 189 | buildConfigurationList = 47729E3022F447CA00B9B36B /* Build configuration list for PBXNativeTarget "KotlinIOSUITests" */; 190 | buildPhases = ( 191 | 47729E1D22F447CA00B9B36B /* Sources */, 192 | 47729E1E22F447CA00B9B36B /* Frameworks */, 193 | 47729E1F22F447CA00B9B36B /* Resources */, 194 | ); 195 | buildRules = ( 196 | ); 197 | dependencies = ( 198 | 47729E2322F447CA00B9B36B /* PBXTargetDependency */, 199 | ); 200 | name = KotlinIOSUITests; 201 | productName = KotlinIOSUITests; 202 | productReference = 47729E2122F447CA00B9B36B /* KotlinIOSUITests.xctest */; 203 | productType = "com.apple.product-type.bundle.ui-testing"; 204 | }; 205 | /* End PBXNativeTarget section */ 206 | 207 | /* Begin PBXProject section */ 208 | 47729DFA22F447C800B9B36B /* Project object */ = { 209 | isa = PBXProject; 210 | attributes = { 211 | LastSwiftUpdateCheck = 1030; 212 | LastUpgradeCheck = 1030; 213 | ORGANIZATIONNAME = "Evgeny Petrenko"; 214 | TargetAttributes = { 215 | 47729E0122F447C800B9B36B = { 216 | CreatedOnToolsVersion = 10.3; 217 | }; 218 | 47729E1522F447CA00B9B36B = { 219 | CreatedOnToolsVersion = 10.3; 220 | TestTargetID = 47729E0122F447C800B9B36B; 221 | }; 222 | 47729E2022F447CA00B9B36B = { 223 | CreatedOnToolsVersion = 10.3; 224 | TestTargetID = 47729E0122F447C800B9B36B; 225 | }; 226 | }; 227 | }; 228 | buildConfigurationList = 47729DFD22F447C800B9B36B /* Build configuration list for PBXProject "KotlinIOS" */; 229 | compatibilityVersion = "Xcode 9.3"; 230 | developmentRegion = en; 231 | hasScannedForEncodings = 0; 232 | knownRegions = ( 233 | en, 234 | Base, 235 | ); 236 | mainGroup = 47729DF922F447C800B9B36B; 237 | productRefGroup = 47729E0322F447C800B9B36B /* Products */; 238 | projectDirPath = ""; 239 | projectRoot = ""; 240 | targets = ( 241 | 47729E0122F447C800B9B36B /* KotlinIOS */, 242 | 47729E1522F447CA00B9B36B /* KotlinIOSTests */, 243 | 47729E2022F447CA00B9B36B /* KotlinIOSUITests */, 244 | ); 245 | }; 246 | /* End PBXProject section */ 247 | 248 | /* Begin PBXResourcesBuildPhase section */ 249 | 47729E0022F447C800B9B36B /* Resources */ = { 250 | isa = PBXResourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | 47729E1022F447CA00B9B36B /* LaunchScreen.storyboard in Resources */, 254 | 47729E0D22F447CA00B9B36B /* Assets.xcassets in Resources */, 255 | 47729E0B22F447C800B9B36B /* Main.storyboard in Resources */, 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | 47729E1422F447CA00B9B36B /* Resources */ = { 260 | isa = PBXResourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | 47729E1F22F447CA00B9B36B /* Resources */ = { 267 | isa = PBXResourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | }; 273 | /* End PBXResourcesBuildPhase section */ 274 | 275 | /* Begin PBXShellScriptBuildPhase section */ 276 | 47729E7122F480EB00B9B36B /* ShellScript */ = { 277 | isa = PBXShellScriptBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | inputFileListPaths = ( 282 | ); 283 | inputPaths = ( 284 | ); 285 | outputFileListPaths = ( 286 | ); 287 | outputPaths = ( 288 | ); 289 | runOnlyForDeploymentPostprocessing = 0; 290 | shellPath = /bin/sh; 291 | shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\ncd \"$SRCROOT/../../SharedCode/build/xcode-frameworks\"\n./gradlew :SharedCode:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION}\n"; 292 | }; 293 | /* End PBXShellScriptBuildPhase section */ 294 | 295 | /* Begin PBXSourcesBuildPhase section */ 296 | 47729DFE22F447C800B9B36B /* Sources */ = { 297 | isa = PBXSourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | 47729E0822F447C800B9B36B /* ViewController.swift in Sources */, 301 | 47729E0622F447C800B9B36B /* AppDelegate.swift in Sources */, 302 | ); 303 | runOnlyForDeploymentPostprocessing = 0; 304 | }; 305 | 47729E1222F447CA00B9B36B /* Sources */ = { 306 | isa = PBXSourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | 47729E1B22F447CA00B9B36B /* KotlinIOSTests.swift in Sources */, 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | }; 313 | 47729E1D22F447CA00B9B36B /* Sources */ = { 314 | isa = PBXSourcesBuildPhase; 315 | buildActionMask = 2147483647; 316 | files = ( 317 | 47729E2622F447CA00B9B36B /* KotlinIOSUITests.swift in Sources */, 318 | ); 319 | runOnlyForDeploymentPostprocessing = 0; 320 | }; 321 | /* End PBXSourcesBuildPhase section */ 322 | 323 | /* Begin PBXTargetDependency section */ 324 | 47729E1822F447CA00B9B36B /* PBXTargetDependency */ = { 325 | isa = PBXTargetDependency; 326 | target = 47729E0122F447C800B9B36B /* KotlinIOS */; 327 | targetProxy = 47729E1722F447CA00B9B36B /* PBXContainerItemProxy */; 328 | }; 329 | 47729E2322F447CA00B9B36B /* PBXTargetDependency */ = { 330 | isa = PBXTargetDependency; 331 | target = 47729E0122F447C800B9B36B /* KotlinIOS */; 332 | targetProxy = 47729E2222F447CA00B9B36B /* PBXContainerItemProxy */; 333 | }; 334 | /* End PBXTargetDependency section */ 335 | 336 | /* Begin PBXVariantGroup section */ 337 | 47729E0922F447C800B9B36B /* Main.storyboard */ = { 338 | isa = PBXVariantGroup; 339 | children = ( 340 | 47729E0A22F447C800B9B36B /* Base */, 341 | ); 342 | name = Main.storyboard; 343 | sourceTree = ""; 344 | }; 345 | 47729E0E22F447CA00B9B36B /* LaunchScreen.storyboard */ = { 346 | isa = PBXVariantGroup; 347 | children = ( 348 | 47729E0F22F447CA00B9B36B /* Base */, 349 | ); 350 | name = LaunchScreen.storyboard; 351 | sourceTree = ""; 352 | }; 353 | /* End PBXVariantGroup section */ 354 | 355 | /* Begin XCBuildConfiguration section */ 356 | 47729E2822F447CA00B9B36B /* Debug */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ALWAYS_SEARCH_USER_PATHS = NO; 360 | CLANG_ANALYZER_NONNULL = YES; 361 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_ENABLE_OBJC_WEAK = YES; 367 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 368 | CLANG_WARN_BOOL_CONVERSION = YES; 369 | CLANG_WARN_COMMA = YES; 370 | CLANG_WARN_CONSTANT_CONVERSION = YES; 371 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 372 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 373 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 374 | CLANG_WARN_EMPTY_BODY = YES; 375 | CLANG_WARN_ENUM_CONVERSION = YES; 376 | CLANG_WARN_INFINITE_RECURSION = YES; 377 | CLANG_WARN_INT_CONVERSION = YES; 378 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 379 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 380 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 382 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 383 | CLANG_WARN_STRICT_PROTOTYPES = YES; 384 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 385 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | CODE_SIGN_IDENTITY = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | DEBUG_INFORMATION_FORMAT = dwarf; 391 | ENABLE_STRICT_OBJC_MSGSEND = YES; 392 | ENABLE_TESTABILITY = YES; 393 | GCC_C_LANGUAGE_STANDARD = gnu11; 394 | GCC_DYNAMIC_NO_PIC = NO; 395 | GCC_NO_COMMON_BLOCKS = YES; 396 | GCC_OPTIMIZATION_LEVEL = 0; 397 | GCC_PREPROCESSOR_DEFINITIONS = ( 398 | "DEBUG=1", 399 | "$(inherited)", 400 | ); 401 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 402 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 403 | GCC_WARN_UNDECLARED_SELECTOR = YES; 404 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 405 | GCC_WARN_UNUSED_FUNCTION = YES; 406 | GCC_WARN_UNUSED_VARIABLE = YES; 407 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 408 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 409 | MTL_FAST_MATH = YES; 410 | ONLY_ACTIVE_ARCH = YES; 411 | SDKROOT = iphoneos; 412 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 413 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 414 | }; 415 | name = Debug; 416 | }; 417 | 47729E2922F447CA00B9B36B /* Release */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | ALWAYS_SEARCH_USER_PATHS = NO; 421 | CLANG_ANALYZER_NONNULL = YES; 422 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 423 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 424 | CLANG_CXX_LIBRARY = "libc++"; 425 | CLANG_ENABLE_MODULES = YES; 426 | CLANG_ENABLE_OBJC_ARC = YES; 427 | CLANG_ENABLE_OBJC_WEAK = YES; 428 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 429 | CLANG_WARN_BOOL_CONVERSION = YES; 430 | CLANG_WARN_COMMA = YES; 431 | CLANG_WARN_CONSTANT_CONVERSION = YES; 432 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 433 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 434 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 435 | CLANG_WARN_EMPTY_BODY = YES; 436 | CLANG_WARN_ENUM_CONVERSION = YES; 437 | CLANG_WARN_INFINITE_RECURSION = YES; 438 | CLANG_WARN_INT_CONVERSION = YES; 439 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 440 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 441 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 442 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 443 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 444 | CLANG_WARN_STRICT_PROTOTYPES = YES; 445 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 446 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 447 | CLANG_WARN_UNREACHABLE_CODE = YES; 448 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 449 | CODE_SIGN_IDENTITY = "iPhone Developer"; 450 | COPY_PHASE_STRIP = NO; 451 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 452 | ENABLE_NS_ASSERTIONS = NO; 453 | ENABLE_STRICT_OBJC_MSGSEND = YES; 454 | GCC_C_LANGUAGE_STANDARD = gnu11; 455 | GCC_NO_COMMON_BLOCKS = YES; 456 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 457 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 458 | GCC_WARN_UNDECLARED_SELECTOR = YES; 459 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 460 | GCC_WARN_UNUSED_FUNCTION = YES; 461 | GCC_WARN_UNUSED_VARIABLE = YES; 462 | IPHONEOS_DEPLOYMENT_TARGET = 12.4; 463 | MTL_ENABLE_DEBUG_INFO = NO; 464 | MTL_FAST_MATH = YES; 465 | SDKROOT = iphoneos; 466 | SWIFT_COMPILATION_MODE = wholemodule; 467 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 468 | VALIDATE_PRODUCT = YES; 469 | }; 470 | name = Release; 471 | }; 472 | 47729E2B22F447CA00B9B36B /* Debug */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 476 | CODE_SIGN_STYLE = Automatic; 477 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../../SharedCode/build/xcode-frameworks"; 478 | INFOPLIST_FILE = KotlinIOS/Info.plist; 479 | LD_RUNPATH_SEARCH_PATHS = ( 480 | "$(inherited)", 481 | "@executable_path/Frameworks", 482 | ); 483 | PRODUCT_BUNDLE_IDENTIFIER = com.cdrussell.dynamo.ios; 484 | PRODUCT_NAME = Dynamo; 485 | SWIFT_VERSION = 5.0; 486 | TARGETED_DEVICE_FAMILY = "1,2"; 487 | }; 488 | name = Debug; 489 | }; 490 | 47729E2C22F447CA00B9B36B /* Release */ = { 491 | isa = XCBuildConfiguration; 492 | buildSettings = { 493 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 494 | CODE_SIGN_STYLE = Automatic; 495 | FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../../SharedCode/build/xcode-frameworks"; 496 | INFOPLIST_FILE = KotlinIOS/Info.plist; 497 | LD_RUNPATH_SEARCH_PATHS = ( 498 | "$(inherited)", 499 | "@executable_path/Frameworks", 500 | ); 501 | PRODUCT_BUNDLE_IDENTIFIER = com.cdrussell.dynamo.ios; 502 | PRODUCT_NAME = Dynamo; 503 | SWIFT_VERSION = 5.0; 504 | TARGETED_DEVICE_FAMILY = "1,2"; 505 | }; 506 | name = Release; 507 | }; 508 | 47729E2E22F447CA00B9B36B /* Debug */ = { 509 | isa = XCBuildConfiguration; 510 | buildSettings = { 511 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 512 | BUNDLE_LOADER = "$(TEST_HOST)"; 513 | CODE_SIGN_STYLE = Automatic; 514 | INFOPLIST_FILE = KotlinIOSTests/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = ( 516 | "$(inherited)", 517 | "@executable_path/Frameworks", 518 | "@loader_path/Frameworks", 519 | ); 520 | PRODUCT_BUNDLE_IDENTIFIER = com.jetbrains.handson.mpp.mobile.KotlinIOSTests; 521 | PRODUCT_NAME = "$(TARGET_NAME)"; 522 | SWIFT_VERSION = 5.0; 523 | TARGETED_DEVICE_FAMILY = "1,2"; 524 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KotlinIOS.app/KotlinIOS"; 525 | }; 526 | name = Debug; 527 | }; 528 | 47729E2F22F447CA00B9B36B /* Release */ = { 529 | isa = XCBuildConfiguration; 530 | buildSettings = { 531 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 532 | BUNDLE_LOADER = "$(TEST_HOST)"; 533 | CODE_SIGN_STYLE = Automatic; 534 | INFOPLIST_FILE = KotlinIOSTests/Info.plist; 535 | LD_RUNPATH_SEARCH_PATHS = ( 536 | "$(inherited)", 537 | "@executable_path/Frameworks", 538 | "@loader_path/Frameworks", 539 | ); 540 | PRODUCT_BUNDLE_IDENTIFIER = com.jetbrains.handson.mpp.mobile.KotlinIOSTests; 541 | PRODUCT_NAME = "$(TARGET_NAME)"; 542 | SWIFT_VERSION = 5.0; 543 | TARGETED_DEVICE_FAMILY = "1,2"; 544 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/KotlinIOS.app/KotlinIOS"; 545 | }; 546 | name = Release; 547 | }; 548 | 47729E3122F447CA00B9B36B /* Debug */ = { 549 | isa = XCBuildConfiguration; 550 | buildSettings = { 551 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 552 | CODE_SIGN_STYLE = Automatic; 553 | INFOPLIST_FILE = KotlinIOSUITests/Info.plist; 554 | LD_RUNPATH_SEARCH_PATHS = ( 555 | "$(inherited)", 556 | "@executable_path/Frameworks", 557 | "@loader_path/Frameworks", 558 | ); 559 | PRODUCT_BUNDLE_IDENTIFIER = com.jetbrains.handson.mpp.mobile.KotlinIOSUITests; 560 | PRODUCT_NAME = "$(TARGET_NAME)"; 561 | SWIFT_VERSION = 5.0; 562 | TARGETED_DEVICE_FAMILY = "1,2"; 563 | TEST_TARGET_NAME = KotlinIOS; 564 | }; 565 | name = Debug; 566 | }; 567 | 47729E3222F447CA00B9B36B /* Release */ = { 568 | isa = XCBuildConfiguration; 569 | buildSettings = { 570 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 571 | CODE_SIGN_STYLE = Automatic; 572 | INFOPLIST_FILE = KotlinIOSUITests/Info.plist; 573 | LD_RUNPATH_SEARCH_PATHS = ( 574 | "$(inherited)", 575 | "@executable_path/Frameworks", 576 | "@loader_path/Frameworks", 577 | ); 578 | PRODUCT_BUNDLE_IDENTIFIER = com.jetbrains.handson.mpp.mobile.KotlinIOSUITests; 579 | PRODUCT_NAME = "$(TARGET_NAME)"; 580 | SWIFT_VERSION = 5.0; 581 | TARGETED_DEVICE_FAMILY = "1,2"; 582 | TEST_TARGET_NAME = KotlinIOS; 583 | }; 584 | name = Release; 585 | }; 586 | /* End XCBuildConfiguration section */ 587 | 588 | /* Begin XCConfigurationList section */ 589 | 47729DFD22F447C800B9B36B /* Build configuration list for PBXProject "KotlinIOS" */ = { 590 | isa = XCConfigurationList; 591 | buildConfigurations = ( 592 | 47729E2822F447CA00B9B36B /* Debug */, 593 | 47729E2922F447CA00B9B36B /* Release */, 594 | ); 595 | defaultConfigurationIsVisible = 0; 596 | defaultConfigurationName = Release; 597 | }; 598 | 47729E2A22F447CA00B9B36B /* Build configuration list for PBXNativeTarget "KotlinIOS" */ = { 599 | isa = XCConfigurationList; 600 | buildConfigurations = ( 601 | 47729E2B22F447CA00B9B36B /* Debug */, 602 | 47729E2C22F447CA00B9B36B /* Release */, 603 | ); 604 | defaultConfigurationIsVisible = 0; 605 | defaultConfigurationName = Release; 606 | }; 607 | 47729E2D22F447CA00B9B36B /* Build configuration list for PBXNativeTarget "KotlinIOSTests" */ = { 608 | isa = XCConfigurationList; 609 | buildConfigurations = ( 610 | 47729E2E22F447CA00B9B36B /* Debug */, 611 | 47729E2F22F447CA00B9B36B /* Release */, 612 | ); 613 | defaultConfigurationIsVisible = 0; 614 | defaultConfigurationName = Release; 615 | }; 616 | 47729E3022F447CA00B9B36B /* Build configuration list for PBXNativeTarget "KotlinIOSUITests" */ = { 617 | isa = XCConfigurationList; 618 | buildConfigurations = ( 619 | 47729E3122F447CA00B9B36B /* Debug */, 620 | 47729E3222F447CA00B9B36B /* Release */, 621 | ); 622 | defaultConfigurationIsVisible = 0; 623 | defaultConfigurationName = Release; 624 | }; 625 | /* End XCConfigurationList section */ 626 | }; 627 | rootObject = 47729DFA22F447C800B9B36B /* Project object */; 628 | } 629 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // KotlinIOS 4 | // 5 | // Created by Evgeny Petrenko on 02.08.2019. 6 | // Copyright © 2019 Evgeny Petrenko. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 28 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOS/ViewController.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import SharedCode 3 | 4 | typealias PasswordSuccess = PasswordGenerator.PasswordResultPasswordSuccess 5 | typealias PasswordFailure = PasswordGenerator.PasswordResultPasswordFailure 6 | 7 | class ViewController: UIViewController { 8 | 9 | @IBAction func generatePasswordButtonPressed(_ sender: Any) { 10 | generatePassword() 11 | } 12 | 13 | @IBOutlet weak var passwordField: UILabel! 14 | 15 | 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | 19 | let tap = UITapGestureRecognizer(target: self, action: #selector(copyPassword(sender:))) 20 | passwordField.addGestureRecognizer(tap) 21 | 22 | generatePassword() 23 | } 24 | 25 | func generatePassword() { 26 | let config = PasswordGenerator.PasswordConfiguration(requiredLength:12, 27 | numericalType: PasswordGenerator.NumericalType(included: true), 28 | upperCaseLetterType: PasswordGenerator.UpperCaseLetterType(included: true ), 29 | lowerCaseLetterType: PasswordGenerator.LowerCaseLetterType(included: true), 30 | specialCharacterLetterType: PasswordGenerator.SpecialCharacterLetterType(included: true)) 31 | 32 | let result = PasswordGenerator().generatePassword(passwordConfiguration: config) 33 | 34 | if let result = result as? PasswordSuccess { 35 | passwordField.text = result.password 36 | } else if let result = result as? PasswordFailure { 37 | passwordField.text = result.exception.message 38 | } 39 | } 40 | 41 | @objc func copyPassword(sender: UITapGestureRecognizer) { 42 | UIPasteboard.general.string = passwordField.text 43 | if let output = UIPasteboard.general.string { 44 | print("Copied \(output)") 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOSTests/KotlinIOSTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KotlinIOSTests.swift 3 | // KotlinIOSTests 4 | // 5 | // Created by Evgeny Petrenko on 02.08.2019. 6 | // Copyright © 2019 Evgeny Petrenko. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import KotlinIOS 11 | 12 | class KotlinIOSTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOSUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /native/KotlinIOS/KotlinIOSUITests/KotlinIOSUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KotlinIOSUITests.swift 3 | // KotlinIOSUITests 4 | // 5 | // Created by Evgeny Petrenko on 02.08.2019. 6 | // Copyright © 2019 Evgeny Petrenko. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class KotlinIOSUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 20 | XCUIApplication().launch() 21 | 22 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 23 | } 24 | 25 | override func tearDown() { 26 | // Put teardown code here. This method is called after the invocation of each test method in the class. 27 | } 28 | 29 | func testExample() { 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | include ':SharedCode' 3 | --------------------------------------------------------------------------------