├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android ├── .gitignore ├── build.gradle ├── gradle.properties ├── settings.gradle └── src │ └── main │ ├── AndroidManifest.xml │ └── kotlin │ └── yury │ └── smidovich │ └── flutter_vk_sdk │ └── VkSdkPlugin.kt ├── example ├── .flutter-plugins-dependencies ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── yury │ │ │ │ │ └── smidovich │ │ │ │ │ └── vk_sdk_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── flutter_export_environment.sh │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ └── main.dart ├── pubspec.lock └── pubspec.yaml ├── ios ├── .gitignore ├── Assets │ └── .gitkeep ├── Classes │ ├── SwiftVkSdkPlugin.swift │ ├── VkSdkPlugin.h │ └── VkSdkPlugin.m └── flutter_vk_sdk.podspec ├── lib ├── flutter_vk_sdk.dart └── src │ ├── vk_access_token.dart │ ├── vk_authorization_result.dart │ ├── vk_authorization_state.dart │ ├── vk_permission.dart │ ├── vk_sdk.dart │ ├── vk_sdk_event.dart │ ├── vk_sdk_exception.dart │ ├── vk_user.dart │ └── vk_wake_up_session_result.dart ├── pubspec.lock ├── pubspec.yaml └── vk_sdk.iml /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | 9 | .idea/ 10 | .vscode/ -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.0 2 | 3 | * First beta realease 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Yury Smidovich 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Port of [vk-ios-sdk](https://github.com/VKCOM/vk-ios-sdk) for Flutter 2 | 3 | A Flutter plugin for using the native iOS [VK SDK](https://github.com/VKCOM/vk-ios-sdk). 4 | 5 | **This is not an official repository!** [Here](https://github.com/VKCOM) you can find platform native implemetations. 6 | 7 | ## Platform support 8 | 9 | - **only for iOS >= 8.0** 10 | - if you need Android support, use [flutter_vk_login](https://github.com/ObjReponse/flutter_vk_login) 11 | 12 | ## Installation 13 | 14 | Add this to your package's pubspec.yaml file: 15 | ```yml 16 | dependencies: 17 | flutter_vk_sdk: 18 | git: 19 | url: git@github.com:Stmol/flutter_vk_sdk.git 20 | ref: 0.1.1 21 | ``` 22 | 23 | And then install it: 24 | ```bash 25 | flutter packages get 26 | ``` 27 | 28 | Import lib in your Dart code: 29 | ```dart 30 | import 'package:flutter_vk_sdk/flutter_vk_sdk.dart'; 31 | ``` 32 | 33 | After that, you need to [create VK App](https://vk.com/dev) and configure schema of your application. Read how-to in official vk-ios-sdk [documentation](https://github.com/VKCOM/vk-ios-sdk#setup-url-schema-of-your-application). 34 | 35 | ## Simple example 36 | 37 | First, you should try to initialize SDK: 38 | ```dart 39 | import 'package:flutter_vk_sdk/flutter_vk_sdk.dart'; 40 | 41 | const String APP_ID = '12345'; 42 | const String API_VERSION = '5.90'; 43 | 44 | void main() async { 45 | try { 46 | final vkSdk = await VKSdk.initialize(appId: APP_ID, apiVersion: API_VERSION); 47 | 48 | runApp(MyApp()); 49 | } on VKSdkException catch (error) { 50 | print(error.message); 51 | } 52 | } 53 | ``` 54 | 55 | Second, you should check if user is logged in alredy: 56 | ```dart 57 | final List scopes = [ 58 | VKPermission.FRIENDS, 59 | VKPermission.PHOTOS, 60 | VKPermission.OFFLINE, 61 | ]; 62 | 63 | vkSdk.wakeUpSession(scopes).then((result) async { 64 | if (result.state == VKAuthorizationState.Authorized) { 65 | final accessToken = await vkSdk.accessToken(); 66 | print(accessToken.localUser?.id); 67 | } 68 | }); 69 | ``` 70 | 71 | If they are not, handle any button tap and start an authorization flow: 72 | ```dart 73 | void onLoginButtonPressed() async { 74 | final isLoggedIn = await vkSdk.isLoggedIn(); 75 | if (isLoggedIn) { 76 | return; 77 | } 78 | 79 | try { 80 | await vkSdk.authorize(scopes, isSafariDisabled: true); 81 | } on VKSdkException catch (error) { 82 | print(error.message); 83 | } 84 | } 85 | ``` 86 | 87 | >_**tip: You probably should not using redirection to Safari. In that case your app may be rejected by Apple review team. To avoid redirection set argument `isSafariDisabled` to `true`**_ 88 | 89 | Next, subscribe to one of a stream and listen a result of authorization: 90 | ```dart 91 | vkSdk.authorizationStateUpdated.listen((result) { 92 | if (result.state == VKAuthorizationState.Authorized) { 93 | print(result.token); 94 | print(result.user?.id); 95 | } 96 | }); 97 | ``` 98 | 99 | You also can use SDK's streams in the `StreamBuilder` widget. 100 | 101 | Finally, you can use `http` Dart library to call VK API: 102 | ```dart 103 | final token = await vkSdk.accessToken(); 104 | if (token == null || token.accessToken == null) { 105 | throw 'Access token is empty'; 106 | } 107 | 108 | if (token == null || token.localUser?.id == null) { 109 | throw 'User ID not defined'; 110 | } 111 | 112 | final apiUrl = 113 | 'https://api.vk.com/method/users.get?user_ids=${token.localUser.id}&fields=bdate&access_token=${token.accessToken}&v=$API_VERSION'; 114 | 115 | final response = await http.get(apiUrl); 116 | print(response.statusCode); 117 | print(response.body); 118 | ``` 119 | 120 | The complete example you can find in `/example` folder. Before you run it, do the search `cmd+shift+f` with `INSERT_HERE_YOUR_APP_ID` query string. 121 | 122 | ## Goals and status 123 | 124 | ### Goals 125 | 126 | - [ ] implement full API of VK SDK 127 | - [ ] support Android 128 | - [ ] add tests 129 | 130 | ### Status 131 | 132 | - Currently project is under development. But you can use it for user authorization flow (see `/example` folder). 133 | - I will upload this plugin to `pub.dartlang.org` after I add the implementation of [VKRequest](https://github.com/VKCOM/vk-ios-sdk/blob/5504d80f2b546eacd1074e733ef749afefbc8aa0/library/Source/Core/VKRequest.h) class 134 | 135 | ## Author 136 | 137 | Developed by **Yury Smidovich** 138 | 139 | ## License 140 | 141 | See the [LICENSE](https://github.com/Stmol/flutter_vk_sdk/blob/master/LICENSE) file 142 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'yury.smidovich.flutter_vk_sdk' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.2.71' 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.2.1' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | sourceSets { 31 | main.java.srcDirs += 'src/main/kotlin' 32 | } 33 | defaultConfig { 34 | minSdkVersion 16 35 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 36 | } 37 | lintOptions { 38 | disable 'InvalidPackage' 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 44 | } 45 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_vk_sdk' 2 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/kotlin/yury/smidovich/flutter_vk_sdk/VkSdkPlugin.kt: -------------------------------------------------------------------------------- 1 | package yury.smidovich.flutter_vk_sdk 2 | 3 | import io.flutter.plugin.common.MethodCall 4 | import io.flutter.plugin.common.MethodChannel 5 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 6 | import io.flutter.plugin.common.MethodChannel.Result 7 | import io.flutter.plugin.common.PluginRegistry.Registrar 8 | 9 | class VkSdkPlugin: MethodCallHandler { 10 | companion object { 11 | @JvmStatic 12 | fun registerWith(registrar: Registrar) { 13 | val channel = MethodChannel(registrar.messenger(), "flutter_vk_sdk") 14 | channel.setMethodCallHandler(VkSdkPlugin()) 15 | } 16 | } 17 | 18 | override fun onMethodCall(call: MethodCall, result: Result) { 19 | if (call.method == "getPlatformVersion") { 20 | result.success("Android ${android.os.Build.VERSION.RELEASE}") 21 | } else { 22 | result.notImplemented() 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /example/.flutter-plugins-dependencies: -------------------------------------------------------------------------------- 1 | {"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_vk_sdk","dependencies":[]}]} -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_vk_sdk_example 2 | 3 | Demonstrates how to use the flutter_vk_sdk plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.io/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "yury.smidovich.flutter_vk_sdk_example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/yury/smidovich/vk_sdk_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package yury.smidovich.flutter_vk_sdk_example 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=/Users/stmol/Projects/source/flutter" 4 | export "FLUTTER_APPLICATION_PATH=/Users/stmol/Projects/source/flutter_vk_sdk/example" 5 | export "FLUTTER_TARGET=lib/main.dart" 6 | export "FLUTTER_BUILD_DIR=build" 7 | export "SYMROOT=${SOURCE_ROOT}/../build/ios" 8 | export "FLUTTER_FRAMEWORK_DIR=/Users/stmol/Projects/source/flutter/bin/cache/artifacts/engine/ios" 9 | export "FLUTTER_BUILD_NAME=1.0.0" 10 | export "FLUTTER_BUILD_NUMBER=1" 11 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | 38 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 39 | # referring to absolute paths on developers' machines. 40 | system('rm -rf .symlinks') 41 | system('mkdir -p .symlinks/plugins') 42 | 43 | # Flutter Pods 44 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 45 | if generated_xcode_build_settings.empty? 46 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 47 | end 48 | generated_xcode_build_settings.map { |p| 49 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 50 | symlink = File.join('.symlinks', 'flutter') 51 | File.symlink(File.dirname(p[:path]), symlink) 52 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 53 | end 54 | } 55 | 56 | # Plugin Pods 57 | plugin_pods = parse_KV_file('../.flutter-plugins') 58 | plugin_pods.map { |p| 59 | symlink = File.join('.symlinks', 'plugins', p[:name]) 60 | File.symlink(p[:path], symlink) 61 | pod p[:name], :path => File.join(symlink, 'ios') 62 | } 63 | end 64 | 65 | post_install do |installer| 66 | installer.pods_project.targets.each do |target| 67 | target.build_configurations.each do |config| 68 | config.build_settings['ENABLE_BITCODE'] = 'NO' 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - flutter_vk_sdk (0.0.1): 4 | - Flutter 5 | - VK-ios-sdk (~> 1.4) 6 | - VK-ios-sdk (1.4.6) 7 | 8 | DEPENDENCIES: 9 | - Flutter (from `.symlinks/flutter/ios`) 10 | - flutter_vk_sdk (from `.symlinks/plugins/flutter_vk_sdk/ios`) 11 | 12 | SPEC REPOS: 13 | https://github.com/cocoapods/specs.git: 14 | - VK-ios-sdk 15 | 16 | EXTERNAL SOURCES: 17 | Flutter: 18 | :path: ".symlinks/flutter/ios" 19 | flutter_vk_sdk: 20 | :path: ".symlinks/plugins/flutter_vk_sdk/ios" 21 | 22 | SPEC CHECKSUMS: 23 | Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a 24 | flutter_vk_sdk: 9bc16407e98371e63e15cb5ab5f92a1c4610a747 25 | VK-ios-sdk: 7fd48bc5aaa6b96c3197c1987eb6593f2ea67331 26 | 27 | PODFILE CHECKSUM: ebd43b443038e611b86ede96e613bd6033c49497 28 | 29 | COCOAPODS: 1.6.1 30 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 11 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 12 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 13 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 18 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 19 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 20 | B2D604A0F07344ED8ED31378 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B3AFB3E0B54AD91F9F646A6 /* Pods_Runner.framework */; }; 21 | F7B79C5B2252DB150010C16B /* VK_ios_sdk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7B79C5A2252DB150010C16B /* VK_ios_sdk.framework */; }; 22 | F7B79C5F2252DD240010C16B /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = F7B79C5C2252DD240010C16B /* GeneratedPluginRegistrant.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 00617BA31C665D41E4FAEECF /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 42 | 0B3AFB3E0B54AD91F9F646A6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 44 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 45 | 5BA6E79AB75E0699B3694886 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 46 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 47 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 48 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 49 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 50 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 51 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | B6BD368A0AE01099A5950662 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 57 | F7B79C5A2252DB150010C16B /* VK_ios_sdk.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = VK_ios_sdk.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | F7B79C5C2252DD240010C16B /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 59 | F7B79C5D2252DD240010C16B /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 60 | F7B79C5E2252DD240010C16B /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | F7B79C5B2252DB150010C16B /* VK_ios_sdk.framework in Frameworks */, 69 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 70 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 71 | B2D604A0F07344ED8ED31378 /* Pods_Runner.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXFrameworksBuildPhase section */ 76 | 77 | /* Begin PBXGroup section */ 78 | 12DD32441B19A7912A2B7AB9 /* Pods */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 5BA6E79AB75E0699B3694886 /* Pods-Runner.debug.xcconfig */, 82 | B6BD368A0AE01099A5950662 /* Pods-Runner.release.xcconfig */, 83 | 00617BA31C665D41E4FAEECF /* Pods-Runner.profile.xcconfig */, 84 | ); 85 | path = Pods; 86 | sourceTree = ""; 87 | }; 88 | 9740EEB11CF90186004384FC /* Flutter */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 3B80C3931E831B6300D905FE /* App.framework */, 92 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 93 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 94 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 95 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 96 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 97 | ); 98 | name = Flutter; 99 | sourceTree = ""; 100 | }; 101 | 97C146E51CF9000F007C117D = { 102 | isa = PBXGroup; 103 | children = ( 104 | 9740EEB11CF90186004384FC /* Flutter */, 105 | 97C146F01CF9000F007C117D /* Runner */, 106 | 97C146EF1CF9000F007C117D /* Products */, 107 | 12DD32441B19A7912A2B7AB9 /* Pods */, 108 | E5B555CD860748E4AA907F7F /* Frameworks */, 109 | ); 110 | sourceTree = ""; 111 | }; 112 | 97C146EF1CF9000F007C117D /* Products */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 97C146EE1CF9000F007C117D /* Runner.app */, 116 | ); 117 | name = Products; 118 | sourceTree = ""; 119 | }; 120 | 97C146F01CF9000F007C117D /* Runner */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | F7B79C5D2252DD240010C16B /* GeneratedPluginRegistrant.h */, 124 | F7B79C5E2252DD240010C16B /* Runner-Bridging-Header.h */, 125 | F7B79C5C2252DD240010C16B /* GeneratedPluginRegistrant.m */, 126 | 97C147021CF9000F007C117D /* Info.plist */, 127 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 128 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 129 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 130 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 131 | 97C146F11CF9000F007C117D /* Supporting Files */, 132 | ); 133 | path = Runner; 134 | sourceTree = ""; 135 | }; 136 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | ); 140 | name = "Supporting Files"; 141 | sourceTree = ""; 142 | }; 143 | E5B555CD860748E4AA907F7F /* Frameworks */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | F7B79C5A2252DB150010C16B /* VK_ios_sdk.framework */, 147 | 0B3AFB3E0B54AD91F9F646A6 /* Pods_Runner.framework */, 148 | ); 149 | name = Frameworks; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | 97C146ED1CF9000F007C117D /* Runner */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 158 | buildPhases = ( 159 | 5A5FE20B6895E0A2B6F107C9 /* [CP] Check Pods Manifest.lock */, 160 | 9740EEB61CF901F6004384FC /* Run Script */, 161 | 97C146EA1CF9000F007C117D /* Sources */, 162 | 97C146EB1CF9000F007C117D /* Frameworks */, 163 | 97C146EC1CF9000F007C117D /* Resources */, 164 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 165 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 166 | F3BD4F1751E2BC3D4CFA5298 /* [CP] Embed Pods Frameworks */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | ); 172 | name = Runner; 173 | productName = Runner; 174 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 175 | productType = "com.apple.product-type.application"; 176 | }; 177 | /* End PBXNativeTarget section */ 178 | 179 | /* Begin PBXProject section */ 180 | 97C146E61CF9000F007C117D /* Project object */ = { 181 | isa = PBXProject; 182 | attributes = { 183 | LastUpgradeCheck = 0910; 184 | ORGANIZATIONNAME = "The Chromium Authors"; 185 | TargetAttributes = { 186 | 97C146ED1CF9000F007C117D = { 187 | CreatedOnToolsVersion = 7.3.1; 188 | DevelopmentTeam = 3H23JM4W46; 189 | LastSwiftMigration = 0910; 190 | }; 191 | }; 192 | }; 193 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 194 | compatibilityVersion = "Xcode 3.2"; 195 | developmentRegion = English; 196 | hasScannedForEncodings = 0; 197 | knownRegions = ( 198 | English, 199 | en, 200 | Base, 201 | ); 202 | mainGroup = 97C146E51CF9000F007C117D; 203 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 204 | projectDirPath = ""; 205 | projectRoot = ""; 206 | targets = ( 207 | 97C146ED1CF9000F007C117D /* Runner */, 208 | ); 209 | }; 210 | /* End PBXProject section */ 211 | 212 | /* Begin PBXResourcesBuildPhase section */ 213 | 97C146EC1CF9000F007C117D /* Resources */ = { 214 | isa = PBXResourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 218 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 219 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 220 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 221 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | }; 225 | /* End PBXResourcesBuildPhase section */ 226 | 227 | /* Begin PBXShellScriptBuildPhase section */ 228 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 229 | isa = PBXShellScriptBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | ); 233 | inputPaths = ( 234 | ); 235 | name = "Thin Binary"; 236 | outputPaths = ( 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | shellPath = /bin/sh; 240 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 241 | }; 242 | 5A5FE20B6895E0A2B6F107C9 /* [CP] Check Pods Manifest.lock */ = { 243 | isa = PBXShellScriptBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | ); 247 | inputFileListPaths = ( 248 | ); 249 | inputPaths = ( 250 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 251 | "${PODS_ROOT}/Manifest.lock", 252 | ); 253 | name = "[CP] Check Pods Manifest.lock"; 254 | outputFileListPaths = ( 255 | ); 256 | outputPaths = ( 257 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | shellPath = /bin/sh; 261 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 262 | showEnvVarsInLog = 0; 263 | }; 264 | 9740EEB61CF901F6004384FC /* Run Script */ = { 265 | isa = PBXShellScriptBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | ); 269 | inputPaths = ( 270 | ); 271 | name = "Run Script"; 272 | outputPaths = ( 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | shellPath = /bin/sh; 276 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 277 | }; 278 | F3BD4F1751E2BC3D4CFA5298 /* [CP] Embed Pods Frameworks */ = { 279 | isa = PBXShellScriptBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | ); 283 | inputFileListPaths = ( 284 | ); 285 | inputPaths = ( 286 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 287 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", 288 | "${BUILT_PRODUCTS_DIR}/VK-ios-sdk/VK_ios_sdk.framework", 289 | ); 290 | name = "[CP] Embed Pods Frameworks"; 291 | outputFileListPaths = ( 292 | ); 293 | outputPaths = ( 294 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 295 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/VK_ios_sdk.framework", 296 | ); 297 | runOnlyForDeploymentPostprocessing = 0; 298 | shellPath = /bin/sh; 299 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 300 | showEnvVarsInLog = 0; 301 | }; 302 | /* End PBXShellScriptBuildPhase section */ 303 | 304 | /* Begin PBXSourcesBuildPhase section */ 305 | 97C146EA1CF9000F007C117D /* Sources */ = { 306 | isa = PBXSourcesBuildPhase; 307 | buildActionMask = 2147483647; 308 | files = ( 309 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 310 | F7B79C5F2252DD240010C16B /* GeneratedPluginRegistrant.m in Sources */, 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | /* End PBXSourcesBuildPhase section */ 315 | 316 | /* Begin PBXVariantGroup section */ 317 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 318 | isa = PBXVariantGroup; 319 | children = ( 320 | 97C146FB1CF9000F007C117D /* Base */, 321 | ); 322 | name = Main.storyboard; 323 | sourceTree = ""; 324 | }; 325 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 326 | isa = PBXVariantGroup; 327 | children = ( 328 | 97C147001CF9000F007C117D /* Base */, 329 | ); 330 | name = LaunchScreen.storyboard; 331 | sourceTree = ""; 332 | }; 333 | /* End PBXVariantGroup section */ 334 | 335 | /* Begin XCBuildConfiguration section */ 336 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 337 | isa = XCBuildConfiguration; 338 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNREACHABLE_CODE = YES; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 366 | ENABLE_NS_ASSERTIONS = NO; 367 | ENABLE_STRICT_OBJC_MSGSEND = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_NO_COMMON_BLOCKS = YES; 370 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 372 | GCC_WARN_UNDECLARED_SELECTOR = YES; 373 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 374 | GCC_WARN_UNUSED_FUNCTION = YES; 375 | GCC_WARN_UNUSED_VARIABLE = YES; 376 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 377 | MTL_ENABLE_DEBUG_INFO = NO; 378 | SDKROOT = iphoneos; 379 | TARGETED_DEVICE_FAMILY = "1,2"; 380 | VALIDATE_PRODUCT = YES; 381 | }; 382 | name = Profile; 383 | }; 384 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 385 | isa = XCBuildConfiguration; 386 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 387 | buildSettings = { 388 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 389 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 390 | DEVELOPMENT_TEAM = 3H23JM4W46; 391 | ENABLE_BITCODE = NO; 392 | FRAMEWORK_SEARCH_PATHS = ( 393 | "$(inherited)", 394 | "$(PROJECT_DIR)/Flutter", 395 | ); 396 | INFOPLIST_FILE = Runner/Info.plist; 397 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 398 | LIBRARY_SEARCH_PATHS = ( 399 | "$(inherited)", 400 | "$(PROJECT_DIR)/Flutter", 401 | ); 402 | PRODUCT_BUNDLE_IDENTIFIER = yury.smidovich.vkSdkExample; 403 | PRODUCT_NAME = "$(TARGET_NAME)"; 404 | SWIFT_VERSION = 4.0; 405 | VERSIONING_SYSTEM = "apple-generic"; 406 | }; 407 | name = Profile; 408 | }; 409 | 97C147031CF9000F007C117D /* Debug */ = { 410 | isa = XCBuildConfiguration; 411 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 412 | buildSettings = { 413 | ALWAYS_SEARCH_USER_PATHS = NO; 414 | CLANG_ANALYZER_NONNULL = YES; 415 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 416 | CLANG_CXX_LIBRARY = "libc++"; 417 | CLANG_ENABLE_MODULES = YES; 418 | CLANG_ENABLE_OBJC_ARC = YES; 419 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 420 | CLANG_WARN_BOOL_CONVERSION = YES; 421 | CLANG_WARN_COMMA = YES; 422 | CLANG_WARN_CONSTANT_CONVERSION = YES; 423 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 424 | CLANG_WARN_EMPTY_BODY = YES; 425 | CLANG_WARN_ENUM_CONVERSION = YES; 426 | CLANG_WARN_INFINITE_RECURSION = YES; 427 | CLANG_WARN_INT_CONVERSION = YES; 428 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 429 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 430 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 431 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 432 | CLANG_WARN_STRICT_PROTOTYPES = YES; 433 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 434 | CLANG_WARN_UNREACHABLE_CODE = YES; 435 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 436 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 437 | COPY_PHASE_STRIP = NO; 438 | DEBUG_INFORMATION_FORMAT = dwarf; 439 | ENABLE_STRICT_OBJC_MSGSEND = YES; 440 | ENABLE_TESTABILITY = YES; 441 | GCC_C_LANGUAGE_STANDARD = gnu99; 442 | GCC_DYNAMIC_NO_PIC = NO; 443 | GCC_NO_COMMON_BLOCKS = YES; 444 | GCC_OPTIMIZATION_LEVEL = 0; 445 | GCC_PREPROCESSOR_DEFINITIONS = ( 446 | "DEBUG=1", 447 | "$(inherited)", 448 | ); 449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 451 | GCC_WARN_UNDECLARED_SELECTOR = YES; 452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 453 | GCC_WARN_UNUSED_FUNCTION = YES; 454 | GCC_WARN_UNUSED_VARIABLE = YES; 455 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 456 | MTL_ENABLE_DEBUG_INFO = YES; 457 | ONLY_ACTIVE_ARCH = YES; 458 | SDKROOT = iphoneos; 459 | TARGETED_DEVICE_FAMILY = "1,2"; 460 | }; 461 | name = Debug; 462 | }; 463 | 97C147041CF9000F007C117D /* Release */ = { 464 | isa = XCBuildConfiguration; 465 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 466 | buildSettings = { 467 | ALWAYS_SEARCH_USER_PATHS = NO; 468 | CLANG_ANALYZER_NONNULL = YES; 469 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 470 | CLANG_CXX_LIBRARY = "libc++"; 471 | CLANG_ENABLE_MODULES = YES; 472 | CLANG_ENABLE_OBJC_ARC = YES; 473 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 474 | CLANG_WARN_BOOL_CONVERSION = YES; 475 | CLANG_WARN_COMMA = YES; 476 | CLANG_WARN_CONSTANT_CONVERSION = YES; 477 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 478 | CLANG_WARN_EMPTY_BODY = YES; 479 | CLANG_WARN_ENUM_CONVERSION = YES; 480 | CLANG_WARN_INFINITE_RECURSION = YES; 481 | CLANG_WARN_INT_CONVERSION = YES; 482 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 483 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 484 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 485 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 486 | CLANG_WARN_STRICT_PROTOTYPES = YES; 487 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 488 | CLANG_WARN_UNREACHABLE_CODE = YES; 489 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 490 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 491 | COPY_PHASE_STRIP = NO; 492 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 493 | ENABLE_NS_ASSERTIONS = NO; 494 | ENABLE_STRICT_OBJC_MSGSEND = YES; 495 | GCC_C_LANGUAGE_STANDARD = gnu99; 496 | GCC_NO_COMMON_BLOCKS = YES; 497 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 498 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 499 | GCC_WARN_UNDECLARED_SELECTOR = YES; 500 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 501 | GCC_WARN_UNUSED_FUNCTION = YES; 502 | GCC_WARN_UNUSED_VARIABLE = YES; 503 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 504 | MTL_ENABLE_DEBUG_INFO = NO; 505 | SDKROOT = iphoneos; 506 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 507 | TARGETED_DEVICE_FAMILY = "1,2"; 508 | VALIDATE_PRODUCT = YES; 509 | }; 510 | name = Release; 511 | }; 512 | 97C147061CF9000F007C117D /* Debug */ = { 513 | isa = XCBuildConfiguration; 514 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 515 | buildSettings = { 516 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 517 | CLANG_ENABLE_MODULES = YES; 518 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 519 | DEVELOPMENT_TEAM = 3H23JM4W46; 520 | ENABLE_BITCODE = NO; 521 | FRAMEWORK_SEARCH_PATHS = ( 522 | "$(inherited)", 523 | "$(PROJECT_DIR)/Flutter", 524 | ); 525 | INFOPLIST_FILE = Runner/Info.plist; 526 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 527 | LIBRARY_SEARCH_PATHS = ( 528 | "$(inherited)", 529 | "$(PROJECT_DIR)/Flutter", 530 | ); 531 | PRODUCT_BUNDLE_IDENTIFIER = yury.smidovich.vkSdkExample; 532 | PRODUCT_NAME = "$(TARGET_NAME)"; 533 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 534 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 535 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 536 | SWIFT_VERSION = 4.0; 537 | VERSIONING_SYSTEM = "apple-generic"; 538 | }; 539 | name = Debug; 540 | }; 541 | 97C147071CF9000F007C117D /* Release */ = { 542 | isa = XCBuildConfiguration; 543 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 544 | buildSettings = { 545 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 546 | CLANG_ENABLE_MODULES = YES; 547 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 548 | DEVELOPMENT_TEAM = 3H23JM4W46; 549 | ENABLE_BITCODE = NO; 550 | FRAMEWORK_SEARCH_PATHS = ( 551 | "$(inherited)", 552 | "$(PROJECT_DIR)/Flutter", 553 | ); 554 | INFOPLIST_FILE = Runner/Info.plist; 555 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 556 | LIBRARY_SEARCH_PATHS = ( 557 | "$(inherited)", 558 | "$(PROJECT_DIR)/Flutter", 559 | ); 560 | PRODUCT_BUNDLE_IDENTIFIER = yury.smidovich.vkSdkExample; 561 | PRODUCT_NAME = "$(TARGET_NAME)"; 562 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 563 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 564 | SWIFT_VERSION = 4.0; 565 | VERSIONING_SYSTEM = "apple-generic"; 566 | }; 567 | name = Release; 568 | }; 569 | /* End XCBuildConfiguration section */ 570 | 571 | /* Begin XCConfigurationList section */ 572 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 573 | isa = XCConfigurationList; 574 | buildConfigurations = ( 575 | 97C147031CF9000F007C117D /* Debug */, 576 | 97C147041CF9000F007C117D /* Release */, 577 | 249021D3217E4FDB00AE95B9 /* Profile */, 578 | ); 579 | defaultConfigurationIsVisible = 0; 580 | defaultConfigurationName = Release; 581 | }; 582 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 583 | isa = XCConfigurationList; 584 | buildConfigurations = ( 585 | 97C147061CF9000F007C117D /* Debug */, 586 | 97C147071CF9000F007C117D /* Release */, 587 | 249021D4217E4FDB00AE95B9 /* Profile */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | /* End XCConfigurationList section */ 593 | }; 594 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 595 | } 596 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.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 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_vk_sdk_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleURLTypes 22 | 23 | 24 | CFBundleTypeRole 25 | Editor 26 | CFBundleURLName 27 | vk{INSERT_HERE_YOUR_APP_ID} 28 | CFBundleURLSchemes 29 | 30 | vk{INSERT_HERE_YOUR_APP_ID} 31 | 32 | 33 | 34 | CFBundleVersion 35 | $(FLUTTER_BUILD_NUMBER) 36 | LSApplicationQueriesSchemes 37 | 38 | vk 39 | vk-share 40 | vkauthorize 41 | 42 | LSRequiresIPhoneOS 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIMainStoryboardFile 47 | Main 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | UIViewControllerBasedStatusBarAppearance 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_vk_sdk/flutter_vk_sdk.dart'; 3 | import 'package:http/http.dart' as http; 4 | 5 | const String APP_ID = 'INSERT_HERE_YOUR_APP_ID'; 6 | const String API_VERSION = '5.90'; 7 | 8 | final List scopes = [ 9 | VKPermission.FRIENDS, 10 | VKPermission.PHOTOS, 11 | VKPermission.OFFLINE, 12 | ]; 13 | 14 | void main() async { 15 | try { 16 | final vkSdk = await VKSdk.initialize(appId: APP_ID, apiVersion: API_VERSION); 17 | 18 | runApp(MyApp(vkSdk: vkSdk)); 19 | } on VKSdkException catch (error) { 20 | print(error.message); 21 | } 22 | } 23 | 24 | class MyApp extends StatelessWidget { 25 | final VKSdk vkSdk; 26 | 27 | const MyApp({Key key, @required this.vkSdk}) : super(key: key); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return MaterialApp( 32 | title: 'VK SDK | iOS Example', 33 | debugShowCheckedModeBanner: false, 34 | theme: ThemeData(primarySwatch: Colors.blue), 35 | home: AuthScreen(vkSdk: vkSdk), 36 | ); 37 | } 38 | } 39 | 40 | enum AuthState { 41 | IN_PROGRESS, 42 | LOGGED_IN, 43 | LOGGED_OUT, 44 | } 45 | 46 | class AuthScreen extends StatefulWidget { 47 | final VKSdk vkSdk; 48 | 49 | const AuthScreen({Key key, this.vkSdk}) : super(key: key); 50 | 51 | @override 52 | State createState() => AuthScreenState(); 53 | } 54 | 55 | class AuthScreenState extends State { 56 | AuthState _authState = AuthState.IN_PROGRESS; 57 | VKUser _vkUser; 58 | 59 | @override 60 | void initState() { 61 | super.initState(); 62 | 63 | widget.vkSdk.authorizationStateUpdated.listen((result) { 64 | setState(() { 65 | _vkUser = result.user; 66 | _authState = result.state == VKAuthorizationState.Authorized 67 | ? AuthState.LOGGED_IN 68 | : AuthState.LOGGED_OUT; 69 | }); 70 | }); 71 | 72 | widget.vkSdk.wakeUpSession(scopes).then((result) async { 73 | final accessToken = await widget.vkSdk.accessToken(); 74 | 75 | setState(() { 76 | _vkUser = accessToken.localUser; 77 | _authState = 78 | result.state == VKAuthorizationState.Authorized && accessToken.localUser != null 79 | ? AuthState.LOGGED_IN 80 | : AuthState.LOGGED_OUT; 81 | }); 82 | }); 83 | } 84 | 85 | @override 86 | Widget build(BuildContext context) { 87 | return Scaffold( 88 | appBar: AppBar(title: Text('VK SDK | iOS Example')), 89 | body: Container( 90 | child: Center( 91 | child: Column( 92 | mainAxisAlignment: MainAxisAlignment.center, 93 | children: [ 94 | _buildMessageText(), 95 | _buildButton(), 96 | ], 97 | ), 98 | ), 99 | ), 100 | ); 101 | } 102 | 103 | Widget _buildMessageText() { 104 | if (_vkUser != null && _vkUser.firstName != null) { 105 | return Text('Hello, ${_vkUser.firstName}'); 106 | } 107 | 108 | return Text('Press button to login'); 109 | } 110 | 111 | Widget _buildButton() { 112 | switch (_authState) { 113 | case AuthState.IN_PROGRESS: 114 | return CircularProgressIndicator(); 115 | 116 | case AuthState.LOGGED_IN: 117 | return Column( 118 | children: [ 119 | RaisedButton( 120 | color: Colors.red, 121 | child: Text('Logout', style: TextStyle(color: Colors.white)), 122 | onPressed: _onLogoutButtoPressed, 123 | ), 124 | SizedBox(height: 10), 125 | RaisedButton( 126 | color: Colors.blue, 127 | child: Text('Test API Call', style: TextStyle(color: Colors.white)), 128 | onPressed: _onTestApiButtonPressed, 129 | ), 130 | ], 131 | ); 132 | 133 | case AuthState.LOGGED_OUT: 134 | default: 135 | return RaisedButton( 136 | color: Colors.blue, 137 | child: Text('Login with VK', style: TextStyle(color: Colors.white)), 138 | onPressed: _onLoginButtonPressed, 139 | ); 140 | } 141 | } 142 | 143 | void _onLogoutButtoPressed() async { 144 | setState(() => _authState = AuthState.IN_PROGRESS); 145 | 146 | await widget.vkSdk.forceLogout(); 147 | final isLoggedIn = await widget.vkSdk.isLoggedIn(); 148 | setState(() { 149 | _vkUser = null; 150 | _authState = isLoggedIn ? AuthState.LOGGED_IN : AuthState.LOGGED_OUT; 151 | }); 152 | } 153 | 154 | void _onLoginButtonPressed() async { 155 | final isLoggedIn = await widget.vkSdk.isLoggedIn(); 156 | if (isLoggedIn) { 157 | setState(() => _authState = AuthState.LOGGED_IN); 158 | return; 159 | } 160 | 161 | try { 162 | await widget.vkSdk.authorize(scopes, isSafariDisabled: false); 163 | } on VKSdkException catch (error) { 164 | print(error.message); 165 | } 166 | } 167 | 168 | void _onTestApiButtonPressed() async { 169 | final accessToken = await widget.vkSdk.accessToken(); 170 | if (accessToken == null || accessToken.accessToken == null) { 171 | throw 'Access token is empty'; 172 | } 173 | 174 | if (accessToken == null || accessToken.localUser?.id == null) { 175 | throw 'User ID not defined'; 176 | } 177 | 178 | final apiUrl = 179 | 'https://api.vk.com/method/users.get?user_ids=${accessToken.localUser.id}&fields=bdate&access_token=${accessToken.accessToken}&v=$API_VERSION'; 180 | 181 | final response = await http.get(apiUrl); 182 | print(response.statusCode); 183 | print(response.body); 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.11" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.3" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | flutter_vk_sdk: 71 | dependency: "direct dev" 72 | description: 73 | path: ".." 74 | relative: true 75 | source: path 76 | version: "0.1.1" 77 | http: 78 | dependency: "direct dev" 79 | description: 80 | name: http 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.12.0+2" 84 | http_parser: 85 | dependency: transitive 86 | description: 87 | name: http_parser 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "3.1.3" 91 | image: 92 | dependency: transitive 93 | description: 94 | name: image 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "2.1.4" 98 | matcher: 99 | dependency: transitive 100 | description: 101 | name: matcher 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "0.12.6" 105 | meta: 106 | dependency: transitive 107 | description: 108 | name: meta 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "1.1.8" 112 | path: 113 | dependency: transitive 114 | description: 115 | name: path 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "1.6.4" 119 | pedantic: 120 | dependency: transitive 121 | description: 122 | name: pedantic 123 | url: "https://pub.dartlang.org" 124 | source: hosted 125 | version: "1.8.0+1" 126 | petitparser: 127 | dependency: transitive 128 | description: 129 | name: petitparser 130 | url: "https://pub.dartlang.org" 131 | source: hosted 132 | version: "2.4.0" 133 | quiver: 134 | dependency: transitive 135 | description: 136 | name: quiver 137 | url: "https://pub.dartlang.org" 138 | source: hosted 139 | version: "2.0.5" 140 | sky_engine: 141 | dependency: transitive 142 | description: flutter 143 | source: sdk 144 | version: "0.0.99" 145 | source_span: 146 | dependency: transitive 147 | description: 148 | name: source_span 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.5.5" 152 | stack_trace: 153 | dependency: transitive 154 | description: 155 | name: stack_trace 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.9.3" 159 | stream_channel: 160 | dependency: transitive 161 | description: 162 | name: stream_channel 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "2.0.0" 166 | string_scanner: 167 | dependency: transitive 168 | description: 169 | name: string_scanner 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.0.5" 173 | term_glyph: 174 | dependency: transitive 175 | description: 176 | name: term_glyph 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.1.0" 180 | test_api: 181 | dependency: transitive 182 | description: 183 | name: test_api 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "0.2.11" 187 | typed_data: 188 | dependency: transitive 189 | description: 190 | name: typed_data 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "1.1.6" 194 | vector_math: 195 | dependency: transitive 196 | description: 197 | name: vector_math 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "2.0.8" 201 | xml: 202 | dependency: transitive 203 | description: 204 | name: xml 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "3.5.0" 208 | sdks: 209 | dart: ">=2.4.0 <3.0.0" 210 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_vk_sdk_example 2 | description: Demonstrates how to use the flutter_vk_sdk plugin. 3 | author: Yury Smidovich 4 | publish_to: 'none' 5 | 6 | environment: 7 | sdk: ">=2.1.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | dev_dependencies: 14 | http: ^0.12.0+2 15 | 16 | flutter_test: 17 | sdk: flutter 18 | 19 | flutter_vk_sdk: 20 | path: ../ 21 | 22 | flutter: 23 | uses-material-design: true 24 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Stmol/flutter_vk_sdk/28123452d788b89dd5b9455c5a4230ca666df647/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /ios/Classes/SwiftVkSdkPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import VK_ios_sdk 4 | 5 | private struct ChannelName { 6 | static let method = "me.stmol.flutter_vk_sdk_plugin/method" 7 | static let event = "me.stmol.flutter_vk_sdk_plugin/event" 8 | } 9 | 10 | private enum MethodName: String { 11 | case setupVKSdk 12 | case isLoggedIn 13 | case authorize 14 | case wakeUpSession 15 | case accessToken 16 | case forceLogout 17 | case initialized 18 | case vkAppMayExists 19 | case apiVersion 20 | case currentAppId 21 | case setSchedulerEnabled 22 | } 23 | 24 | private enum EventName: String { 25 | case vkSdkAccessAuthorizationFinished 26 | case vkSdkAuthorizationStateUpdated 27 | case vkSdkUserAuthorizationFailed 28 | case vkSdkAccessTokenUpdated 29 | case vkSdkTokenHasExpired 30 | case vkSdkWillDismiss 31 | case vkSdkDidDismiss 32 | case vkSdkShouldPresent 33 | case vkSdkNeedCaptchaEnter 34 | } 35 | 36 | private enum Result { 37 | case success(Any?) 38 | case failure(String) 39 | } 40 | 41 | public class SwiftVkSdkPlugin: NSObject, FlutterPlugin { 42 | private typealias VKWakeUpCompletion = (VKAuthorizationState, Error?) -> Void 43 | 44 | private var eventSink: FlutterEventSink? 45 | 46 | public static func register(with registrar: FlutterPluginRegistrar) { 47 | let methodChannel = FlutterMethodChannel(name: ChannelName.method, binaryMessenger: registrar.messenger()) 48 | let eventChannel = FlutterEventChannel(name: ChannelName.event, binaryMessenger: registrar.messenger()) 49 | 50 | let instance = SwiftVkSdkPlugin() 51 | 52 | registrar.addApplicationDelegate(instance) 53 | registrar.addMethodCallDelegate(instance, channel: methodChannel) 54 | 55 | eventChannel.setStreamHandler(instance) 56 | } 57 | 58 | // iOS 8 and lower 59 | public func application(_: UIApplication, open url: URL, sourceApplication: String, annotation _: Any) -> Bool { 60 | VKSdk.processOpen(url, fromApplication: sourceApplication) 61 | return true 62 | } 63 | 64 | // iOS 9 workflow 65 | public func application(_: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { 66 | if #available(iOS 9.0, *) { 67 | VKSdk.processOpen(url, fromApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String) 68 | return true 69 | } 70 | 71 | return false 72 | } 73 | 74 | public func handle(_ input: FlutterMethodCall, result output: @escaping FlutterResult) { 75 | guard let methodName = MethodName(rawValue: input.method) else { 76 | output(FlutterMethodNotImplemented) 77 | return 78 | } 79 | 80 | switch methodName { 81 | case .setupVKSdk: 82 | guard 83 | let appId: String = getArgument("appId", from: input.arguments) 84 | else { 85 | feedback(.failure("Invalid arguments"), to: output) 86 | return 87 | } 88 | 89 | let apiVersion: String? = getArgument("apiVersion", from: input.arguments) 90 | 91 | setupVKSdk(appId, apiVersion) 92 | feedback(.success(nil), to: output) 93 | 94 | case .authorize: 95 | guard let permissions: [String] = getArgument("permissions", from: input.arguments) else { 96 | feedback(.failure("Invalid arguments"), to: output) 97 | return 98 | } 99 | 100 | let isSafariDisabled: Bool = getArgument("isSafariDisabled", from: input.arguments) ?? false 101 | 102 | authorize(permissions, isSafariDisabled) 103 | feedback(.success(nil), to: output) 104 | 105 | case .wakeUpSession: 106 | guard let permissions: [String] = getArgument("permissions", from: input.arguments) else { 107 | feedback(.failure("Invalid arguments"), to: output) 108 | return 109 | } 110 | 111 | wakeUpSession(permissions) { [weak self] state, error in 112 | let payload: [String: Any?] = [ 113 | "state": state.rawValue, 114 | "error": error?.localizedDescription ?? nil, 115 | ] 116 | 117 | self?.feedback(.success(payload), to: output) 118 | } 119 | 120 | case .setSchedulerEnabled: 121 | guard let enabled: Bool = getArgument("enabled", from: input.arguments) else { 122 | feedback(.failure("Invalid arguments"), to: output) 123 | return 124 | } 125 | 126 | VKSdk.setSchedulerEnabled(enabled) 127 | feedback(.success(nil), to: output) 128 | 129 | case .accessToken: 130 | let accessToken = transformToMap(VKSdk.accessToken()) 131 | feedback(.success(accessToken), to: output) 132 | 133 | case .isLoggedIn: 134 | feedback(.success(VKSdk.isLoggedIn()), to: output) 135 | 136 | case .forceLogout: 137 | VKSdk.forceLogout() 138 | feedback(.success(nil), to: output) 139 | 140 | case .initialized: 141 | feedback(.success(VKSdk.initialized()), to: output) 142 | 143 | case .vkAppMayExists: 144 | feedback(.success(VKSdk.vkAppMayExists()), to: output) 145 | 146 | case .apiVersion: 147 | if let instance = VKSdk.instance() { 148 | feedback(.success(instance.apiVersion), to: output) 149 | break 150 | } 151 | feedback(.failure("Instance of VKSdk not initialized"), to: output) 152 | 153 | case .currentAppId: 154 | if let instance = VKSdk.instance() { 155 | feedback(.success(instance.currentAppId), to: output) 156 | break 157 | } 158 | feedback(.failure("Instance of VKSdk not initialized"), to: output) 159 | } 160 | } 161 | 162 | /// 163 | /// Initialize SDK 164 | /// 165 | private func setupVKSdk(_ appId: String, _ apiVersion: String?) { 166 | if apiVersion == nil { 167 | VKSdk.initialize(withAppId: appId) 168 | } else { 169 | VKSdk.initialize(withAppId: appId, apiVersion: apiVersion) 170 | } 171 | 172 | VKSdk.instance().uiDelegate = self 173 | VKSdk.instance().register(self) 174 | } 175 | 176 | /// 177 | /// authorize method handler 178 | /// 179 | private func authorize(_ permissions: [String], _ isSafariDisabled: Bool) { 180 | if isSafariDisabled { 181 | VKSdk.authorize(permissions, with: .disableSafariController) 182 | } else { 183 | VKSdk.authorize(permissions) 184 | } 185 | } 186 | 187 | /// 188 | /// wakeUpSession method handler 189 | /// 190 | private func wakeUpSession(_ permissions: [String], completion: @escaping VKWakeUpCompletion) { 191 | VKSdk.wakeUpSession(permissions) { (state: VKAuthorizationState, error: Error?) in 192 | completion(state, error) 193 | } 194 | } 195 | 196 | /// 197 | /// Helper for getting argument from Flutter channel 198 | /// 199 | private func getArgument(_ name: String, from arguments: Any?) -> T? { 200 | guard let arguments = arguments as? [String: Any] else { return nil } 201 | return arguments[name] as? T 202 | } 203 | 204 | /// 205 | /// Build response to flutter channel output 206 | /// 207 | private func feedback(_ result: Result, to output: FlutterResult) { 208 | var response = [String: Any]() 209 | 210 | switch result { 211 | case let .success(payload): 212 | response["status"] = "success" 213 | response["payload"] = payload 214 | case let .failure(cause): 215 | response["status"] = "failure" 216 | response["payload"] = cause 217 | } 218 | 219 | output(response) 220 | } 221 | 222 | /// 223 | /// Transform VKAccessToken object to map for response 224 | /// 225 | private func transformToMap(_ accessToken: VKAccessToken?) -> [String: Any?] { 226 | return [ 227 | "accessToken": accessToken?.accessToken, 228 | "userId": accessToken?.userId, 229 | "secret": accessToken?.secret, 230 | "permissions": accessToken?.permissions as? [String], 231 | "httpsRequired": accessToken?.httpsRequired, 232 | "expiresIn": accessToken?.expiresIn, 233 | "email": accessToken?.email, 234 | "isExpired": accessToken?.isExpired(), 235 | "localUser": transformToMap(accessToken?.localUser), 236 | ] 237 | } 238 | 239 | /// 240 | /// Transofrm VKUser object to map for response 241 | /// 242 | private func transformToMap(_ user: VKUser?) -> [String: Any?] { 243 | return [ 244 | "id": user?.id, 245 | "firstName": user?.first_name, 246 | "lastName": user?.last_name, 247 | "sex": user?.sex, 248 | "online": user?.online, 249 | "bdate": user?.bdate, 250 | "photoMax": user?.photo_max, 251 | "photo50": user?.photo_50, 252 | "photo100": user?.photo_100, 253 | "photo200": user?.photo_200, 254 | "photo200orig": user?.photo_200_orig, 255 | "photo400orig": user?.photo_400_orig, 256 | "photoMaxOrig": user?.photo_max_orig, 257 | ] 258 | } 259 | 260 | /// 261 | /// Dispatch Flutter event 262 | /// 263 | private func dispatch(_ eventName: EventName, payload: Any? = nil) { 264 | eventSink?([ 265 | "eventName": eventName.rawValue, 266 | "payload": payload, 267 | ]) 268 | } 269 | } 270 | 271 | extension SwiftVkSdkPlugin: FlutterStreamHandler { 272 | public func onListen(withArguments _: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? { 273 | eventSink = events 274 | return nil 275 | } 276 | 277 | public func onCancel(withArguments _: Any?) -> FlutterError? { 278 | eventSink = nil 279 | return nil 280 | } 281 | } 282 | 283 | extension SwiftVkSdkPlugin: VKSdkUIDelegate, VKSdkDelegate { 284 | public func vkSdkShouldPresent(_ controller: UIViewController!) { 285 | dispatch(.vkSdkShouldPresent) 286 | guard let rootController = UIApplication.shared.keyWindow?.rootViewController else { 287 | // TODO: Should dispatch error 288 | return 289 | } 290 | rootController.present(controller, animated: true) 291 | } 292 | 293 | public func vkSdkNeedCaptchaEnter(_ captchaError: VKError!) { 294 | dispatch(.vkSdkNeedCaptchaEnter, payload: [ 295 | "error": captchaError.errorMessage, 296 | ]) 297 | 298 | guard 299 | let rootController = UIApplication.shared.keyWindow?.rootViewController, 300 | let controller = VKCaptchaViewController.captchaControllerWithError(captchaError) else { 301 | // TODO: Should dispatch error 302 | return 303 | } 304 | 305 | rootController.present(controller, animated: true) 306 | } 307 | 308 | public func vkSdkWillDismiss(_: UIViewController!) { 309 | dispatch(.vkSdkWillDismiss) 310 | } 311 | 312 | public func vkSdkDidDismiss(_: UIViewController!) { 313 | dispatch(.vkSdkDidDismiss) 314 | } 315 | 316 | public func vkSdkAccessAuthorizationFinished(with result: VKAuthorizationResult!) { 317 | let payload: [String: Any?] = [ 318 | "error": result.error?.localizedDescription, 319 | "state": result.state.rawValue, 320 | "token": transformToMap(result.token), 321 | "user": transformToMap(result.user), 322 | ] 323 | 324 | dispatch(.vkSdkAccessAuthorizationFinished, payload: payload) 325 | } 326 | 327 | public func vkSdkUserAuthorizationFailed() { 328 | dispatch(.vkSdkUserAuthorizationFailed) 329 | } 330 | 331 | public func vkSdkAuthorizationStateUpdated(with result: VKAuthorizationResult!) { 332 | let payload: [String: Any?] = [ 333 | "error": result.error?.localizedDescription, 334 | "state": result.state.rawValue, 335 | "token": transformToMap(result.token), 336 | "user": transformToMap(result.user), 337 | ] 338 | 339 | dispatch(.vkSdkAuthorizationStateUpdated, payload: payload) 340 | } 341 | 342 | public func vkSdkAccessTokenUpdated(_ newToken: VKAccessToken!, oldToken: VKAccessToken!) { 343 | dispatch(.vkSdkAccessTokenUpdated, payload: [ 344 | "newToken": transformToMap(newToken), 345 | "oldToken": transformToMap(oldToken), 346 | ]) 347 | } 348 | 349 | public func vkSdkTokenHasExpired(_ expiredToken: VKAccessToken!) { 350 | dispatch(.vkSdkTokenHasExpired, payload: [ 351 | "token": transformToMap(expiredToken), 352 | ]) 353 | } 354 | } 355 | -------------------------------------------------------------------------------- /ios/Classes/VkSdkPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface VkSdkPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/Classes/VkSdkPlugin.m: -------------------------------------------------------------------------------- 1 | #import "VkSdkPlugin.h" 2 | #import 3 | 4 | @implementation VkSdkPlugin 5 | + (void)registerWithRegistrar:(NSObject*)registrar { 6 | [SwiftVkSdkPlugin registerWithRegistrar:registrar]; 7 | } 8 | @end 9 | -------------------------------------------------------------------------------- /ios/flutter_vk_sdk.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'flutter_vk_sdk' 6 | s.version = '0.0.1' 7 | s.summary = 'VK SDK plugin for Flutter' 8 | s.description = <<-DESC 9 | VK SDK plugin for Flutter. 10 | DESC 11 | s.homepage = 'https://github.com/Stmol/flutter_vk_sdk' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Yury Smidovich' => 'y.smidovich@gmail.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | s.dependency 'VK-ios-sdk', '~> 1.4' 19 | s.static_framework = true 20 | s.ios.deployment_target = '8.0' 21 | end 22 | -------------------------------------------------------------------------------- /lib/flutter_vk_sdk.dart: -------------------------------------------------------------------------------- 1 | library flutter_vk_sdk; 2 | 3 | import 'dart:async'; 4 | 5 | import 'package:flutter/services.dart'; 6 | import 'package:meta/meta.dart'; 7 | 8 | part 'src/vk_access_token.dart'; 9 | part 'src/vk_authorization_result.dart'; 10 | part 'src/vk_wake_up_session_result.dart'; 11 | part 'src/vk_authorization_state.dart'; 12 | part 'src/vk_permission.dart'; 13 | part 'src/vk_sdk_event.dart'; 14 | part 'src/vk_sdk_exception.dart'; 15 | part 'src/vk_user.dart'; 16 | part 'src/vk_sdk.dart'; 17 | -------------------------------------------------------------------------------- /lib/src/vk_access_token.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | /// 4 | /// TODO: Add IterableEquality to == function for List of permissions 5 | /// 6 | class VKAccessToken { 7 | final String accessToken; 8 | final String userId; 9 | final String secret; 10 | final String email; 11 | 12 | final bool isExpired; 13 | final bool httpsRequired; 14 | 15 | final List permissions; 16 | final DateTime expiresIn; 17 | final VKUser localUser; 18 | 19 | VKAccessToken.fromMap(Map map) 20 | : accessToken = map['accessToken'], 21 | userId = map['userId'], 22 | secret = map['secret'], 23 | httpsRequired = map['httpsRequired'], 24 | email = map['email'], 25 | isExpired = map['isExpired'], 26 | permissions = map['permissions'] is List ? List.from(map['permissions']) : null, 27 | expiresIn = map['expiresIn'] is int 28 | ? DateTime.fromMillisecondsSinceEpoch(map['expiresIn'], isUtc: true) 29 | : null, 30 | localUser = map['localUser'] != null 31 | ? VKUser.fromMap(Map.from(map['localUser'])) 32 | : null; 33 | 34 | @override 35 | bool operator ==(Object o) => 36 | identical(this, o) || 37 | o is VKAccessToken && 38 | runtimeType == o.runtimeType && 39 | accessToken == o.accessToken && 40 | userId == o.userId && 41 | secret == o.secret && 42 | email == o.email && 43 | httpsRequired == o.httpsRequired && 44 | isExpired == o.isExpired && 45 | expiresIn == o.expiresIn && 46 | localUser == o.localUser; 47 | 48 | @override 49 | int get hashCode => 50 | accessToken.hashCode ^ 51 | userId.hashCode ^ 52 | secret.hashCode ^ 53 | email.hashCode ^ 54 | httpsRequired.hashCode ^ 55 | isExpired.hashCode ^ 56 | expiresIn.hashCode ^ 57 | localUser.hashCode; 58 | } 59 | -------------------------------------------------------------------------------- /lib/src/vk_authorization_result.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | class VKAuthorizationResult { 4 | final VKAccessToken token; 5 | final VKAuthorizationState state; 6 | final String error; 7 | final VKUser user; 8 | 9 | VKAuthorizationResult.fromMap(Map map) 10 | : token = map['token'] != null 11 | ? VKAccessToken.fromMap(Map.from(map['token'])) 12 | : null, 13 | user = map['user'] != null ? VKUser.fromMap(Map.from(map['user'])) : null, 14 | state = map['state'] != null ? _parseState(map['state']) : null, 15 | error = map['error']; 16 | 17 | @override 18 | bool operator ==(Object o) => 19 | identical(this, o) || 20 | o is VKAuthorizationResult && 21 | token == o.token && 22 | state == o.state && 23 | error == o.error && 24 | user == o.user; 25 | 26 | @override 27 | int get hashCode => token.hashCode ^ state.hashCode ^ error.hashCode ^ user.hashCode; 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/vk_authorization_state.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | enum VKAuthorizationState { 4 | Unknown, 5 | Initialized, 6 | Pending, 7 | External, 8 | SafariInApp, 9 | Webview, 10 | Authorized, 11 | Error, 12 | } 13 | 14 | VKAuthorizationState _parseState(int rawValue) { 15 | switch (rawValue) { 16 | case 0: 17 | return VKAuthorizationState.Unknown; 18 | case 1: 19 | return VKAuthorizationState.Initialized; 20 | case 2: 21 | return VKAuthorizationState.Pending; 22 | case 3: 23 | return VKAuthorizationState.External; 24 | case 4: 25 | return VKAuthorizationState.SafariInApp; 26 | case 5: 27 | return VKAuthorizationState.Webview; 28 | case 6: 29 | return VKAuthorizationState.Authorized; 30 | case 7: 31 | return VKAuthorizationState.Error; 32 | } 33 | 34 | throw VKSdkException('Unknown VKAuthorizationState: $rawValue'); 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/vk_permission.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | class VKPermission { 4 | static const NOTIFY = 'notify'; 5 | static const FRIENDS = 'friends'; 6 | static const PHOTOS = 'photos'; 7 | static const AUDIO = 'audio'; 8 | static const VIDEO = 'video'; 9 | static const DOCS = 'docs'; 10 | static const NOTES = 'notes'; 11 | static const PAGES = 'pages'; 12 | static const STATUS = 'status'; 13 | static const WALL = 'wall'; 14 | static const GROUPS = 'groups'; 15 | static const MESSAGES = 'messages'; 16 | static const NOTIFICATIONS = 'notifications'; 17 | static const STATS = 'stats'; 18 | static const ADS = 'ads'; 19 | static const OFFLINE = 'offline'; 20 | static const NOHTTPS = 'nohttps'; 21 | static const EMAIL = 'email'; 22 | static const MARKET = 'market'; 23 | 24 | VKPermission._(); 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/vk_sdk.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | class VKSdk { 4 | static const MethodChannel methodChannel = MethodChannel('me.stmol.flutter_vk_sdk_plugin/method'); 5 | static const EventChannel eventChannel = EventChannel('me.stmol.flutter_vk_sdk_plugin/event'); 6 | 7 | static Future initialize({@required String appId, String apiVersion}) async { 8 | final instance = VKSdk._(); 9 | await instance._setupVKSdk(appId, apiVersion); 10 | 11 | eventChannel.receiveBroadcastStream().listen(instance._onEvent); 12 | 13 | return instance; 14 | } 15 | 16 | static Future initialized() async => await _callMethod('initialized') as bool; 17 | 18 | static Future vkAppMayExists() async => await _callMethod('vkAppMayExists') as bool; 19 | 20 | static Future setSchedulerEnabled(bool isEnabled) async => 21 | await _callMethod('setSchedulerEnabled'); 22 | 23 | VKSdk._(); 24 | 25 | final _vkSdkEvents = StreamController.broadcast(); 26 | 27 | Stream get accessAuthorizationFinished => _vkSdkEvents.stream 28 | .where((e) => e.eventName == VKSdkEvent.EVENT_AUTH_FINISHED) 29 | .map((e) => e.eventObject); 30 | 31 | Stream get authorizationStateUpdated => _vkSdkEvents.stream 32 | .where((e) => e.eventName == VKSdkEvent.EVENT_AUTH_STATE_UPDATED) 33 | .map((e) => e.eventObject); 34 | 35 | Stream get userAuthorizationFailed => _vkSdkEvents.stream 36 | .where((e) => e.eventName == VKSdkEvent.EVENT_USER_AUTH_FAILED) 37 | .map((_) => null); 38 | 39 | Stream get shouldPresent => _vkSdkEvents.stream 40 | .where((e) => e.eventName == VKSdkEvent.EVENT_SHOULD_PRESENT) 41 | .map((_) => null); 42 | 43 | Stream get willDismiss => _vkSdkEvents.stream 44 | .where((e) => e.eventName == VKSdkEvent.EVENT_WILL_DISMISS) 45 | .map((_) => null); 46 | 47 | Stream get didDismiss => _vkSdkEvents.stream 48 | .where((e) => e.eventName == VKSdkEvent.EVENT_DID_DISMISS) 49 | .map((_) => null); 50 | 51 | Stream get needCaptchaEnter => _vkSdkEvents.stream 52 | .where((e) => e.eventName == VKSdkEvent.EVENT_NEED_CAPTCHA) 53 | .map((e) => e.eventObject); 54 | 55 | Stream get tokenHasExpired => _vkSdkEvents.stream 56 | .where((e) => e.eventName == VKSdkEvent.EVENT_TOKEN_HAS_EXPIRED) 57 | .map((e) => e.eventObject); 58 | 59 | Stream> get accessTokenUpdated => _vkSdkEvents.stream 60 | .where((e) => e.eventName == VKSdkEvent.EVENT_ACCESS_TOKEN_UPDATED) 61 | .map((e) => e.eventObject); 62 | 63 | Future apiVersion() async => await _callMethod('apiVersion') as String; 64 | 65 | Future currentAppId() async => await _callMethod('currentAppId') as String; 66 | 67 | Future isLoggedIn() async => await _callMethod('isLoggedIn') as bool; 68 | 69 | Future forceLogout() async => await _callMethod('forceLogout'); 70 | 71 | Future authorize(List permissions, {bool isSafariDisabled = false}) async { 72 | await _callMethod('authorize', { 73 | 'permissions': permissions, 74 | 'isSafariDisabled': isSafariDisabled, 75 | }); 76 | } 77 | 78 | Future accessToken() async { 79 | final result = await _callMethod('accessToken'); 80 | return VKAccessToken.fromMap(Map.from(result)); 81 | } 82 | 83 | Future wakeUpSession(List permissions) async { 84 | final result = await _callMethod('wakeUpSession', { 85 | 'permissions': permissions, 86 | }); 87 | 88 | return VKWakeUpSessionResult(Map.from(result)); 89 | } 90 | 91 | Future _setupVKSdk(String appId, String apiVersion) async { 92 | await _callMethod('setupVKSdk', { 93 | 'appId': appId, 94 | 'apiVersion': apiVersion, 95 | }); 96 | } 97 | 98 | void _onEvent(Object event) { 99 | final response = Map.from(event); 100 | final eventName = response['eventName']; 101 | 102 | switch (eventName) { 103 | case VKSdkEvent.EVENT_AUTH_FINISHED: 104 | case VKSdkEvent.EVENT_AUTH_STATE_UPDATED: 105 | final payload = Map.from(response['payload']); 106 | _vkSdkEvents.add(VKSdkEvent( 107 | eventName: eventName, 108 | eventObject: VKAuthorizationResult.fromMap(payload), 109 | )); 110 | break; 111 | 112 | case VKSdkEvent.EVENT_NEED_CAPTCHA: 113 | final payload = Map.from(response['payload']); 114 | _vkSdkEvents.add(VKSdkEvent( 115 | eventName: eventName, 116 | eventObject: payload['error'], 117 | )); 118 | break; 119 | 120 | case VKSdkEvent.EVENT_TOKEN_HAS_EXPIRED: 121 | final payload = Map.from(response['payload']); 122 | _vkSdkEvents.add(VKSdkEvent( 123 | eventName: eventName, 124 | eventObject: payload['token'] != null 125 | ? VKAccessToken.fromMap(Map.from(payload['token'])) 126 | : null, 127 | )); 128 | break; 129 | 130 | case VKSdkEvent.EVENT_ACCESS_TOKEN_UPDATED: 131 | final payload = Map.from(response['payload']); 132 | final newToken = VKAccessToken.fromMap(Map.from(payload['newToken'])); 133 | final oldToken = VKAccessToken.fromMap(Map.from(payload['oldToken'])); 134 | 135 | _vkSdkEvents.add(VKSdkEvent>( 136 | eventName: eventName, 137 | eventObject: { 138 | 'newToken': newToken, 139 | 'oldToken': oldToken, 140 | }, 141 | )); 142 | 143 | break; 144 | 145 | case VKSdkEvent.EVENT_USER_AUTH_FAILED: 146 | case VKSdkEvent.EVENT_SHOULD_PRESENT: 147 | case VKSdkEvent.EVENT_WILL_DISMISS: 148 | case VKSdkEvent.EVENT_DID_DISMISS: 149 | _vkSdkEvents.add(VKSdkEvent(eventName: eventName, eventObject: null)); 150 | break; 151 | 152 | default: 153 | _vkSdkEvents.addError('Event $eventName has no handlers.'); 154 | } 155 | } 156 | 157 | static Future _callMethod(String method, 158 | [Map arguments = const {}]) async { 159 | final Map result = await methodChannel.invokeMethod(method, arguments); 160 | 161 | if (result['status'] == 'failure') { 162 | throw VKSdkException(result['payload']); 163 | } 164 | 165 | if (result['status'] == 'success') { 166 | return result['payload']; 167 | } 168 | 169 | throw VKSdkException('Invalid result response'); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /lib/src/vk_sdk_event.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | class VKSdkEvent { 4 | static const String EVENT_AUTH_FINISHED = 'vkSdkAccessAuthorizationFinished'; 5 | static const String EVENT_AUTH_STATE_UPDATED = 'vkSdkAuthorizationStateUpdated'; 6 | static const String EVENT_USER_AUTH_FAILED = 'vkSdkUserAuthorizationFailed'; 7 | static const String EVENT_ACCESS_TOKEN_UPDATED = 'vkSdkAccessTokenUpdated'; 8 | static const String EVENT_TOKEN_HAS_EXPIRED = 'vkSdkTokenHasExpired'; 9 | static const String EVENT_WILL_DISMISS = 'vkSdkWillDismiss'; 10 | static const String EVENT_DID_DISMISS = 'vkSdkDidDismiss'; 11 | static const String EVENT_SHOULD_PRESENT = 'vkSdkShouldPresent'; 12 | static const String EVENT_NEED_CAPTCHA = 'vkSdkNeedCaptchaEnter'; 13 | 14 | final String eventName; 15 | final T eventObject; 16 | 17 | VKSdkEvent({@required this.eventName, @required this.eventObject}); 18 | 19 | @override 20 | bool operator ==(Object o) => 21 | identical(this, o) || 22 | o is VKSdkEvent && eventName == o.eventName && eventObject == o.eventObject; 23 | 24 | @override 25 | int get hashCode => eventName.hashCode ^ eventObject.hashCode; 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/vk_sdk_exception.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | class VKSdkException implements Exception { 4 | String message; 5 | VKSdkException(this.message); 6 | } 7 | -------------------------------------------------------------------------------- /lib/src/vk_user.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | class VKUser { 4 | final int id; 5 | final String firstName; 6 | final String lastName; 7 | final int sex; 8 | final int online; 9 | final String bdate; 10 | final String photoMax; 11 | final String photo50; 12 | final String photo100; 13 | final String photo200; 14 | final String photo200orig; 15 | final String photo400orig; 16 | final String photoMaxOrig; 17 | 18 | VKUser.fromMap(Map map) 19 | : id = map['id'], 20 | firstName = map['firstName'], 21 | lastName = map['lastName'], 22 | sex = map['sex'], 23 | online = map['online'], 24 | bdate = map['bdate'], 25 | photoMax = map['photoMax'], 26 | photo50 = map['photo50'], 27 | photo100 = map['photo100'], 28 | photo200 = map['photo200'], 29 | photo200orig = map['photo200orig'], 30 | photo400orig = map['photo400orig'], 31 | photoMaxOrig = map['photoMaxOrig']; 32 | 33 | @override 34 | bool operator ==(Object o) => 35 | identical(this, o) || 36 | o is VKUser && 37 | runtimeType == o.runtimeType && 38 | id == o.id && 39 | firstName == o.firstName && 40 | lastName == o.lastName && 41 | sex == o.sex && 42 | online == o.online && 43 | bdate == o.bdate && 44 | photoMax == o.photoMax && 45 | photo50 == o.photo50 && 46 | photo100 == o.photo100 && 47 | photo200 == o.photo200 && 48 | photo200orig == o.photo200orig && 49 | photo400orig == o.photo400orig && 50 | photoMaxOrig == o.photoMaxOrig; 51 | 52 | @override 53 | int get hashCode => 54 | id.hashCode ^ 55 | firstName.hashCode ^ 56 | lastName.hashCode ^ 57 | sex.hashCode ^ 58 | online.hashCode ^ 59 | bdate.hashCode ^ 60 | photoMax.hashCode ^ 61 | photo50.hashCode ^ 62 | photo100.hashCode ^ 63 | photo200.hashCode ^ 64 | photo200orig.hashCode ^ 65 | photo400orig.hashCode ^ 66 | photoMaxOrig.hashCode; 67 | } 68 | -------------------------------------------------------------------------------- /lib/src/vk_wake_up_session_result.dart: -------------------------------------------------------------------------------- 1 | part of flutter_vk_sdk; 2 | 3 | class VKWakeUpSessionResult { 4 | final VKAuthorizationState state; 5 | final String error; 6 | 7 | VKWakeUpSessionResult(Map map) 8 | : state = map['state'] != null ? _parseState(map['state']) : null, 9 | error = map['error']; 10 | 11 | @override 12 | bool operator ==(Object o) => 13 | identical(this, o) || o is VKWakeUpSessionResult && state == o.state && error == o.error; 14 | 15 | @override 16 | int get hashCode => state.hashCode ^ error.hashCode; 17 | } 18 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.0.11" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.5.2" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.0" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.0.5" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.2" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.14.11" 46 | convert: 47 | dependency: transitive 48 | description: 49 | name: convert 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "2.1.1" 53 | crypto: 54 | dependency: transitive 55 | description: 56 | name: crypto 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.1.3" 60 | flutter: 61 | dependency: "direct main" 62 | description: flutter 63 | source: sdk 64 | version: "0.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | image: 71 | dependency: transitive 72 | description: 73 | name: image 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "2.1.4" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.12.6" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.1.8" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.6.4" 98 | pedantic: 99 | dependency: transitive 100 | description: 101 | name: pedantic 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "1.8.0+1" 105 | petitparser: 106 | dependency: transitive 107 | description: 108 | name: petitparser 109 | url: "https://pub.dartlang.org" 110 | source: hosted 111 | version: "2.4.0" 112 | quiver: 113 | dependency: transitive 114 | description: 115 | name: quiver 116 | url: "https://pub.dartlang.org" 117 | source: hosted 118 | version: "2.0.5" 119 | sky_engine: 120 | dependency: transitive 121 | description: flutter 122 | source: sdk 123 | version: "0.0.99" 124 | source_span: 125 | dependency: transitive 126 | description: 127 | name: source_span 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.5.5" 131 | stack_trace: 132 | dependency: transitive 133 | description: 134 | name: stack_trace 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.9.3" 138 | stream_channel: 139 | dependency: transitive 140 | description: 141 | name: stream_channel 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.0.0" 145 | string_scanner: 146 | dependency: transitive 147 | description: 148 | name: string_scanner 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "1.0.5" 152 | term_glyph: 153 | dependency: transitive 154 | description: 155 | name: term_glyph 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.1.0" 159 | test_api: 160 | dependency: transitive 161 | description: 162 | name: test_api 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "0.2.11" 166 | typed_data: 167 | dependency: transitive 168 | description: 169 | name: typed_data 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "1.1.6" 173 | vector_math: 174 | dependency: transitive 175 | description: 176 | name: vector_math 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "2.0.8" 180 | xml: 181 | dependency: transitive 182 | description: 183 | name: xml 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "3.5.0" 187 | sdks: 188 | dart: ">=2.4.0 <3.0.0" 189 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_vk_sdk 2 | description: VKontakte SDK for Flutter. 3 | version: 0.1.1 4 | author: Yury Smidovich 5 | homepage: https://github.com/Stmol/flutter_vk_sdk 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | flutter: 18 | plugin: 19 | androidPackage: yury.smidovich.flutter_vk_sdk 20 | pluginClass: VkSdkPlugin 21 | -------------------------------------------------------------------------------- /vk_sdk.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | --------------------------------------------------------------------------------