Code Monkey home page Code Monkey logo

react-native-vkontakte-login's Introduction

React Native Vkontakte login

npm version Build Status

This module is a wrapper around native VK SDKs for Android (v1) (VK, github) and iOS (VK, github).

It allows to log in to VK and obtain access token, which you can later use to make VK API calls.

Compatibility

React Native version(s) react-native-vkontakte-login version(s) Old readme
1.0.0 0.60+
0.4.x 0.58 - 0.59 0.4
0.3.18 0.52 - 0.57
0.1.17 0.47 - 0.51 0.1
0.1.16 0.41 - 0.46 0.1

Installation

yarn add react-native-vkontakte-login

This module support autolinking. However, some additional steps are required to configure native parts. They can be done automatically by running this script and answering questions:

yarn rn-vk-postlink

The last step is to run pod install:

cd ios && pod install

For manual installation instructions and for more detailed script description read this.

Usage

Import module in your JS code

import VKLogin from 'react-native-vkontakte-login';

Initialize VK with your APP ID once somewhere during your app startup:

componentDidMount() {
  VKLogin.initialize(5514471);
}

Check if user is logged in, perform login and logout:

const isLoggedIn = await VKLogin.isLoggedIn();
const auth = await VKLogin.login(['friends', 'photos', 'email']);
console.log(auth.access_token);
await VKLogin.logout();

The module also provides share method:

const shareResponse = await VKLogin.share({
  linkText: 'Cool site',
  linkUrl: 'https://news.ycombinator.com/',
  description: 'Check out this cool site!',
  image: TEST_IMAGE,
});

Check out API Reference for more information.

License

MIT

Contributing

Feel free to submit pull requests

react-native-vkontakte-login's People

Contributors

4031651 avatar alexeypodolian avatar alexfedosov avatar doomsower avatar kanzitelli avatar semantic-release-bot avatar vaagnavanesyan avatar voroncv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-vkontakte-login's Issues

axios alert

Please upgrade axios dep version to 0.19 because of this

===

в axios версий до 0.18 включительно обнаружена проблема безопасности. В двух словах - позволяет протолкнуть больше данных, чем указано в content-length

offline in scope everytime

I call login() method without 'offline' in scope:
VKLogin.login(['friends','photos','audio','video','messages'])
, but in VK says that 'offline' access is required for my app.
Why?

iOS isLoggedIn always false

isLoggedIn method always resolves with false on ios after app restart despite successful authorization. I do not know much about how sdk works, but it seems that wakeUpSession call is required for sdk to restore accessToken. At least, I cannot trace (sdk code) how initializeWithAppId (which is the only thing called by this library on app launch) can set vkSdkInstance.accessToken (which is how isLoggedIn works) without calling anything else.

'VKSdkFramework/VKSdkFramework.h' file not found

Following the manual installation guide I get the error "'VKSdkFramework/VKSdkFramework.h' file not found".
However, it works perfectly when I use "#import <VK_ios_sdk/VKSdk.h>" in AppDelegate.m

impossible to share cyrrilic url

Hi,

it is impossible to share cyrrilic link (for example http://яндекс.рф)
VKLogin.share returns "share url is incorrect" error
is there any way to do this (I know that I can replace it by not user-frienly latin url like http://xn--d1acpjx3f.xn--p1ai but it will be shown in vk)?

also I have to specify linkText and description here. Is there any way to load this info from meta tags of shared url like it does while sharing from vk?

Проблема с разрешением

Приложение добавлено в ВК
iOS bundle и id приложения введены корректно

Simulator Screen Shot - iPhone Xʀ - 2019-08-10 at 20 19 46
Simulator Screen Shot - iPhone Xʀ - 2019-08-10 at 20 20 11

Если установлено приложение ВК то через него проходит авторизация а далее выдается ошибка - {"error": "invalid_request", "error_description": "sdk_bundle is incorrect"}

react-native - 0.60.4
react-native-vkontakte-login - 0.4.4

Android sharing

Hi! I've detected bug with sharing for android platform. I use the module like:

    async onClickVk(){
        try {
            await VKLogin.initialize(constants.sharing.APP_ID_VK)
            const shareConfig = {
              linkText: constants.sharing.LINK_TEXT,
              linkUrl: this.url,
              description: constants.sharing.DESCRIPTION,
            }
            await VKLogin.share(shareConfig)
        } catch (error) {
            console.log('error', error);
        }
    }

it shows dialog.

image

and display in console:

01-24 15:22:26.097 9254-9302/com.testapp D/VKAuthModule: Inititalizing ${VK_APP_ID}
01-24 15:22:26.099 9254-9302/com.testapp D/VKAuthModule: Open Share Dialog
01-24 15:22:26.133 9254-9284/com.testapp W/EGL_emulation: eglSurfaceAttrib not implemented
01-24 15:22:26.133 9254-9284/com.testapp W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xe21f4c00, error=EGL_SUCCESS

But when I press 'SEND' button, my application crashes with message 'Unfortunately TestApp has stopped'. And in console I see:

01-24 15:22:52.655 9254-9254/com.testapp D/AndroidRuntime: Shutting down VM
01-24 15:22:52.656 9254-9254/com.testapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.testapp, PID: 9254
    java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.vk.sdk.VKAccessToken.userId' on a null object reference
        at com.vk.sdk.dialogs.VKShareDialogDelegate.makePostWithAttachments(VKShareDialogDelegate.java:330)
        at com.vk.sdk.dialogs.VKShareDialogDelegate.access$700(VKShareDialogDelegate.java:75)
        at com.vk.sdk.dialogs.VKShareDialogDelegate$4.onClick(VKShareDialogDelegate.java:377)
        at android.view.View.performClick(View.java:4780)
        at android.view.View$PerformClick.run(View.java:19866)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:135)
        at android.app.ActivityThread.main(ActivityThread.java:5254)
        at java.lang.reflect.Method.invoke(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

constants.sharing.APP_ID_VK is number value

"dependencies": {
    ...
    "react-native": "0.39.0",
    "react-native-vkontakte-login": "^0.1.11",
    ...
  }

This bug detected on android 5.1 and android 4.1. Maybe I do anything wrong?

Проблема при логине из модального окна

Вход через Вконтакте у меня есть в двух местах: модальное окно входа и экран на котором можно привязать аккаунт Вконтакте. На обычном экране всё работает без проблем, а на экране логина нет.

Компоненты кнопок одинаковые для двух ситуаций:

import React, { Component } from "react";
import { connect } from "react-redux";
import { Image, TouchableOpacity, Alert } from "react-native";
import VKLogin from 'react-native-vkontakte-login';

import { loginVkontakte } from "../../../Actions/authActionCreator";
import I18n from '../../../Translations/i18n';
import { VK_APP_ID, VK_APP_PERMISSIONS } from '../../../Config';

class vkLoginButton extends Component {

  componentDidMount() {
    VKLogin.initialize(VK_APP_ID);
  }

  _onCancel = () => {
  }

  _onConfirm = () => {
    const { loginVkontakte } = this.props;
  
    console.log('---confirm---');
 
    VKLogin.login(VK_APP_PERMISSIONS).then((result) => {
      console.log('---result ---');
      console.log(result);

      if (result.email != undefined) {
        loginVkontakte({
          email: result.email,
          token: result.access_token,
          avatar: null,
          name: result.email,
        })
      }
    });
  }

  _onLogin = () => {
    Alert.alert(
      I18n.t('auth.oauth.alert.vk.title'),
      I18n.t('auth.oauth.alert.vk.message'),
      [
        {text: I18n.t('auth.oauth.alert.vk.cancel'), onPress: () => this._onCancel(), style: ''},
        {text: I18n.t('auth.oauth.alert.vk.confirm'), onPress: () => this._onConfirm()},
      ],
      { cancelable: false }
    )
  };

  render() {
    return (
      <TouchableOpacity onPress={this._onLogin}>
        <Image source={require('../../../Images/icons/oauth-vk.png')} />
      </TouchableOpacity>
    );
  }
}

const mapStateToProps = state => ({
});

const mapDispatchToProps = {
  loginVkontakte,
};

const VkLogin = connect(mapStateToProps, mapDispatchToProps)(vkLoginButton);

export default VkLogin;

В консоле есть только вывод

---confirm---

Если нажать вход на экране привязки, то после этого вход работает и в модальном окне.
И в консоле есть вывод:

---confirm---
---result---
{email: 'SECRET', secret: null, user_id: 'SECRET', expires_in: 0, access_token: 'SECRET' }

Скорее всего проблема с связана с тем как появляется окно входа через Вконтакте: оно "выезжает справа" (не знаю как это правильно называется) и можно сделать свайп назад.

Для модального окна входа у меня используется
https://github.com/wix/react-native-navigation
https://wix.github.io/react-native-navigation/#/screen-api?id=showmodalparams-

Можно ли сделать так чтобы окно входа через Вконтакте появлялось в еще одном модальном окне?
Так сделано в https://github.com/facebook/react-native-fbsdk и с ним проблем нет.

В любом случае буду благодарен за любую помощь.

[email protected]
[email protected]
react-native-vkontakte-login@^0.3.22
react-native-navigation@^1.1.407
react-native-fbsdk@^0.7.0:

ios integration issue

Thank you for the bridge. Is documentation relevant? I have an issue.

version: react-native 0.46.4

I follow by this steps:

  1. yarn add react-native-vkontakte-login
  2. react-native link react-native-vkontakte-login
  3. Add to info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>vk</string>
    <string>vk-share</string>
    <string>vkauthorize</string>
</array>
  1. Add
<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLName</key>
        <string>vk5514471</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>vk5514471</string>
        </array>
    </dict>
</array>
  1. Add to AppDelegate.m
#import "VKSdk.h"
...
//iOS 9 workflow 
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {
   [VKSdk processOpenURL:url fromApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]];
   return YES;
}
 
//iOS 8 and lower 
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
   [VKSdk processOpenURL:url fromApplication:sourceApplication];
   return YES;
}

and I'm getting an exception

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_SFSafariViewController", referenced from:
      objc-class-ref in libVKSdk.a(VKSdk.o)
      objc-class-ref in libVKSdk.a(VKShareDialogController.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)



** BUILD FAILED **


The following commands produced analyzer issues:

	Analyze /Users/username/dev/testVkAuth/node_modules/react-native/ReactCommon/yoga/yoga/YGNodeList.c
	Analyze /Users/username/dev/testVkAuth/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.c
(2 commands with analyzer issues)

The following build commands failed:
	Ld build/Build/Products/Debug-iphonesimulator/testVkAuth.app/testVkAuth normal x86_64
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/testVkAuth.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/testVkAuth.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

(ios, android) Integer APP_ID

I'm trying to implement react-native-config to support 12 factor and it seems like com_vk_sdk_AppId (Android) and VK_APP_ID (iOS) should be string type to support .env variables just like in fbsdk. Otherwise it doesn't work properly for Android and iOS with integer type. Moreover, I came accrose vk-andoid-sdk and found out they also have string type VKSdk.java#L64.

linkText parameter in VKLogin share not working

When I'm trying to insert linkText into linkURL as result in VK i see only link without inserted title.

linkText почему-то не прокидывается в саму ссылку. В ВК вижу ссылку с другим заголовком.

React-native : 0.46.3

works for RN 0.42 ?

Hi there, thanks a lot for your work!

I'm trying to repeat all the installation steps (in that article as well) for newest 0.42 RN and got a lot of errors.

Did you test this library for newest version of RN and is it possible that some steps in instructions are outdated?

Include a median ios integration option in documentation

Currently documentation says that there are two ways to use this library: either you do pod 'react-native-vkontakte-login' or include both this and vksdk as regular libraries. Both options are bad since the second one requires modifying the project of library, so npm install is not safe anymore; and the first one requires to move React to pods, which is VERY hard process (especially when you have multiple libraries, or wanna upgrade RN from time to time) and basically turns the project into hell.

However, the combo — downloading 'VK-ios-sdk' and using it as pod, but linking this library in a common RN way — seems to work nicely without both disadvantages. Therefore I suggest, if this approach does not have some hidden problems, that this integration method is listed in readme just to save unexperienced developers time and joy.

Share dialog doesn't open

Добрый день. Столкнулся с такой проблемой: не открывается диалог шаринга после нажатия на кнопку "поделиться в вк". То есть я нажимаю, открывается браузер с логином, логинюсь, браузер закрывается и диалог шаринга после этого не открывается. Ниже привел лог из Xcode и код приложения (инициализация->логин->шаринг). AuthContainer маунтится в самом начале, так что его ComponentDidMount происходит перед логином.

AuthContainer.js

    componentDidMount() {
        VKLogin.initialize(6056ххх);
    }

Share.js

_onPress = () => {
    try {
        const params = await VKLogin.login(['wall','photos']);
        console.log('PARAMS: ', params);
        const response = await VKLogin.share({
            linkText: 'Link visible text',
            linkUrl: 'http://labravet.ru/',
            description: 'Some description',
            image: SHARE_VK,
        });
        console.log('====================================');
        console.log('RESPONSE: ', response);
        console.log('====================================');
    } catch (error) {
        console.log('====================================');
        console.log('ERROR_share: ', error);
        console.log('====================================');
    }
}
2017-07-04 12:31:39.233 rayfund[29049:1123064] [VKLogin] -[VkontakteManager login:resolver:rejecter:] Login with scope (
    wall,
    photos
)
2017-07-04 12:31:39.235 rayfund[29049:1123064] [VKLogin] -[VkontakteManager login:resolver:rejecter:]_block_invoke Authorization required
2017-07-04 12:31:39.239 rayfund[29049:1123064] -canOpenURL: failed for URL: "vkauthorize://authorize" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2017-07-04 12:31:39.251 rayfund[29049:1123064] [VKLogin] -[VkontakteManager vkSdkShouldPresentViewController:] Presenting view controller
2017-07-04 12:33:32.223 rayfund[29049:1123064] [VKLogin] -[VkontakteManager vkSdkAccessAuthorizationFinishedWithResult:] Authorization result is <VKMutableAuthorizationResult: 0x608000e5a460>
2017-07-04 12:33:32.229 [info][tid:com.facebook.react.JavaScript] 'PARAMS: ', { email: null,
  secret: null,
  user_id: '19712426',
  expires_in: 0,
  access_token: '0d2bd13f1ba343dc232ddd5a49166aa72d007d2da261cb1e3445403273555a1e1808e88f07391d38f8aff' }
2017-07-04 12:33:32.231 rayfund[29049:1123064] [VKSharing] -[VkontakteSharing share:resolver:rejecter:] Open Share Dialog
2017-07-04 12:33:32.279 rayfund[29049:1123924] Warning: Attempt to present <VKShareDialogController: 0x7fd81c7c9450> on <UIViewController: 0x7fd81c411940> whose view is not in the window hierarchy!

После того, как диалог шаринга не открылся, нажимаю снова на кнопку шаринга, после чего приложение падает и Xcode пишет следующее:

2017-07-04 13:31:27.621 rayfund[30103:1171588] [VKSharing] -[VkontakteSharing share:resolver:rejecter:] Open Share Dialog
2017-07-04 13:31:27.669 rayfund[30103:1173023] *** Assertion failure in void _UIPerformResizeOfTextViewForTextContainer(NSLayoutManager *, UIView<NSTextContainerView> *, NSTextContainer *, NSUInteger)(), /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIFoundation_Sim/UIFoundation-491.7/UIFoundation/TextSystem/NSLayoutManager_Private.m:1577
2017-07-04 13:31:27.689 rayfund[30103:1173023] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only run on the main thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010b7fdb0b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x000000010a31e141 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010b801cf2 +[NSException raise:format:arguments:] + 98
	3   Foundation                          0x0000000109eed69b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 165
	4   UIFoundation                        0x00000001126d47d6 -[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:] + 406
	5   UIFoundation                        0x00000001126d4500 -[NSLayoutManager(NSPrivate) _recalculateUsageForTextContainerAtIndex:] + 2229
	6   UIFoundation                        0x00000001126d4571 -[NSLayoutManager(NSPrivate) _validatedStoredUsageForTextContainerAtIndex:] + 82
	7   UIFoundation                        0x000000011270f268 -[NSLayoutManager usedRectForTextContainer:] + 122
	8   UIKit                               0x0000000108f828d0 -[_UITextContainerView textContainerOrigin] + 145
	9   UIFoundation                        0x000000011270ca3c -[NSLayoutManager _primitiveInvalidateDisplayForGlyphRange:] + 4396
	10  UIFoundation                        0x000000011270d3a1 -[NSLayoutManager invalidateDisplayForCharacterRange:] + 403
	11  UIFoundation                        0x00000001126d4609 -[NSLayoutManager(NSPrivate) _invalidateDisplayIfNeeded] + 68
	12  UIFoundation                        0x00000001126d6fd2 -[NSLayoutManager(NSPrivate) _rectArrayForRange:withinSelectionRange:rangeIsCharRange:singleRectOnly:fullLineRectsOnly:inTextContainer:rectCount:rangeWithinContainer:glyphsDrawOutsideLines:rectArray:rectArrayCapacity:] + 9335
	13  UIFoundation                        0x00000001126d7e6a -[NSLayoutManager(NSPrivate) _rectArrayForRange:withinSelectionRange:rangeIsCharRange:singleRectOnly:fullLineRectsOnly:inTextContainer:rectCount:rangeWithinContainer:glyphsDrawOutsideLines:] + 69
	14  UIFoundation                        0x0000000112711393 -[NSLayoutManager rectArrayForCharacterRange:withinSelectedCharacterRange:inTextContainer:rectCount:] + 35
	15  UIKit                               0x0000000108f83b4f -[_UITextContainerView updateInsertionPointStateAndRestartTimer:] + 276
	16  UIFoundation                        0x00000001126dcd1d -[NSLayoutManager(NSPrivate) _invalidateLayoutForExtendedCharacterRange:isSoft:invalidateUsage:] + 2225
	17  UIFoundation                        0x000000011270ad4c -[NSLayoutManager textContainerChangedGeometry:] + 256
	18  UIFoundation                        0x0000000112730b5e -[NSTextContainer setAttributesForExtraLineFragment:] + 288
	19  UIKit                               0x0000000108f72643 -[UITextView setFont:] + 282
	20  VKSdkFramework                      0x0000000109d3e02d -[VKShareDialogView initWithFrame:] + 5821
	21  VKSdkFramework                      0x0000000109d4089b -[VKShareDialogControllerInternal loadView] + 155
	22  UIKit                               0x0000000108647c0a -[UIViewController loadViewIfRequired] + 195
	23  UIKit                               0x000000010864845a -[UIViewController view] + 27
	24  rayfund                             0x0000000104fa50cc -[UIViewController(FIRAScreenClassName) fira_viewDidAppear:] + 292
	25  UIKit                               0x000000010868169b -[UINavigationController viewDidAppear:] + 85
	26  UIKit                               0x000000010864dcae -[UIViewController _setViewAppearState:isAnimating:] + 704
	27  UIKit                               0x000000010864e6d4 -[UIViewController _endAppearanceTransition:] + 197
	28  VKSdkFramework                      0x0000000109d38037 -[VKShareDialogController loadView] + 1399
	29  UIKit                               0x0000000108647c0a -[UIViewController loadViewIfRequired] + 195
	30  UIKit                               0x000000010864845a -[UIViewController view] + 27
	31  UIKit                               0x000000010866191f -[UIViewController _setPresentationController:] + 100
	32  UIKit                               0x000000010865940c -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1320
	33  UIKit                               0x000000010865afae -[UIViewController _presentViewController:withAnimationController:completion:] + 4660
	34  UIKit                               0x000000010865de8a -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 532
	35  UIKit                               0x000000010865d962 -[UIViewController presentViewController:animated:completion:] + 181
	36  rayfund                             0x0000000104d9230e -[VkontakteSharing openShareDlg:resolver:rejecter:] + 446
	37  rayfund                             0x0000000104d93246 __44-[VkontakteSharing share:resolver:rejecter:]_block_invoke + 358
	38  rayfund                             0x00000001053a7d13 __119-[RCTImageLoader loadImageWithURLRequest:size:scale:clipped:resizeMode:progressBlock:partialLoadBlock:completionBlock:]_block_invoke_2 + 371
	39  rayfund                             0x00000001053a891a __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_2 + 666
	40  rayfund                             0x00000001053a929e __80-[RCTImageLoader decodeImageData:size:scale:clipped:resizeMode:completionBlock:]_block_invoke_3.313 + 478
	41  libdispatch.dylib                   0x000000010c5fb4a6 _dispatch_call_block_and_release + 12
	42  libdispatch.dylib                   0x000000010c62405c _dispatch_client_callout + 8
	43  libdispatch.dylib                   0x000000010c606198 _dispatch_root_queue_drain + 1358
	44  libdispatch.dylib                   0x000000010c605bef _dispatch_worker_thread3 + 123
	45  libsystem_pthread.dylib             0x000000010c9bb5a2 _pthread_wqthread + 1299
	46  libsystem_pthread.dylib             0x000000010c9bb07d start_wqthread + 13
)

image

Заранее благодарен.

Pod: React has been deprecated! Duplicate module name: react-native-packager

Hello.
Now i have error: React has been deprecated!
Pod install React (0.11.0) (Why?)
If run react-native run-ios i get next errors:

Failed to build DependencyGraph: @providesModule naming collision:
  Duplicate module name: react-native-packager
  Paths: /apps/MyApp/ios/Pods/React/packager/package.json collides with /apps/MyApp/node_modules/react-native/packager/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
  Duplicate module name: react-native-packager
  Paths: /apps/MyApp/ios/Pods/React/packager/package.json collides with /apps/MyApp/node_modules/react-native/packager/package.json

This error is caused by a @providesModule declaration with the same name across two different files.
    at HasteMap._updateHasteMap (//apps/MyApp/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:159:13)
    at p.getName.then.name (/apps/MyApp/node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:134:31)

react: "15.6.1"
react-native: "0.38.1"
react-native-vkontakte-login: "^0.1.16"

Couldn't build ver. 0.1.8 on Android

To fix it I just changed in VKAuthModule.java:
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data)
to
public void onActivityResult( int requestCode, int resultCode, Intent data)

VKLogin crash then call 'login()'

Android v5.0.2

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: (Project bundle ID), PID: 2488
    java.lang.RuntimeException: Unable to start activity ComponentInfo{(Project bundle ID)/com.vk.sdk.VKServiceActivity}: android.view.InflateException: Binary XML file line #21: Error inflating class com.vk.sdk.WebView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2455)

Code:

componentDidMount() {
    VKLogin.initialize(appID);
  }

  auth = () => {
    NativeModules.VkontakteManager.login(['friends', 'email', 'groups']).then((res) => {
      this.props.login(res.access_token);
    }, (err) => {
      console.log('err>>>', err)
    });
  }

[iOS] isLoggedIn missing

react-native 0.36.1
react-native-vkontakte-login 0.1.8
iPhone 5 iOS 10 simulator in XCode 8.0

This code

const VKLogin = require('react-native-vkontakte-login')
console.log(Object.keys(VKLogin))

gives following output in console:

["initialize", "login", "logout", "share"]

So, VKLogin.isLoggedIn() results in error undefined is not a function. VK_APP_ID is set in Info.plist and is used by the library judging from debugger output.
The same project runs correctly on android, function isLoggedIn exists and works.

Android is not working with React Native 0.29

The build output:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-vkontakte-login'.
   > Could not resolve all dependencies for configuration ':react-native-vkontakte-login:_debugCompile'.
      > Could not find any version that matches com.facebook.react:react-native:0.28.+.
        Versions that do not match:
            0.20.1
            0.20.0
            0.19.1
            0.19.0
            0.18.0
            + 13 more
        Searched in the following locations:
           ...

Unable to load Maven meta-data

I'm not sure is it a proper place to write but I've got an issue today. It was fine yesterday and I didn't change any code. @doomsower do you have an idea why? Thanks!

A problem occurred configuring project ':app'.
[1] > Could not resolve all dependencies for configuration ':app:_debugApk'.
[1]    > A problem occurred configuring project ':react-native-vkontakte-login'.
[1]       > Could not resolve all dependencies for configuration ':react-native-vkontakte-login:_debugPublishCopy'.
[1]          > Could not resolve com.vk:androidsdk:1.+.
[1]            Required by:
[1]                insearchapp:react-native-vkontakte-login:unspecified
[1]             > Could not resolve com.vk:androidsdk:1.+.
               > Failed to list versions for com.vk:androidsdk.
                  > Unable to load Maven meta-data from https://jcenter.bintray.com/com/vk/androidsdk/maven-metadata.xml.
[1]                      > Could not GET 'https://jcenter.bintray.com/com/vk/androidsdk/maven-metadata.xml'.
[1]                         > Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused (Connection refused)
[1]             > Could not resolve com.vk:androidsdk:1.+.
[1]                > Failed to list versions for com.vk:androidsdk.
[1]                   > Unable to load Maven meta-data from https://maven.google.com/com/vk/androidsdk/maven-metadata.xml.
[1]                      > Could not GET 'https://maven.google.com/com/vk/androidsdk/maven-metadata.xml'.
                        > Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused (Connection refused)
[1]             > Could not resolve com.vk:androidsdk:1.+.
[1]                > Failed to list versions for com.vk:androidsdk.
[1]                   > Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/vk/androidsdk/maven-metadata.xml.
[1]                      > Could not GET 'https://repo1.maven.org/maven2/com/vk/androidsdk/maven-metadata.xml'.
[1]                         > Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused (Connection refused)

Invalid type in JSON write (VKError)

Hello.
There is an error, if user push on done button or cancel, when he wants auth with vk.
Maybe incorrect processing error.

RCTJSONStringify() encountered the following error: Invalid type in JSON write (VKError)

Thx!

[Android] Cannot read property 'login' of undefined

Yet another error with android. Maybe I missing something at installation step?

The code is quite simple:

export function authorize() {
  // VKLogin.initialize('...')
  return VKLogin.login(['email'])
}

Vk app id setup in settings. But with VKLogin.initialize('...') have same error.
Error

Thanks in advance.

Проблемы с SDK на MIUI 10

Добрый день.

MIUI 10.2.2.0, андроид 9, при вызове VKLogin.login([]) вместо всплывающего окошка с авторизацией, получаю на экране:

{"error":"invalid_request","error_description":"sdk not set up, check application settings"}

В консоли ошибок никаких. Что, характерно, на 6.0.1 и 7.1.2 работает всё корректно.

Понимаю, что вопрос может быть не по адресу, но что-то не соображу с чем может быть связано. В MIUI для приложения разрешено всё.

Update. Мои извинения, сам виноват, поломал настройки приложения в ВК.

Archive build failed after adding a pod

Hi! Thanks for you module!
I follow all instruction to install module and everything works perfect. But now I get an error when I try to archive build in iOS for upload to TestFlight.

react-native 0.45.1

    /Users/tavria/Library/Developer/Xcode/DerivedData/myapp-hfmnmtfftxluofdugtpjdhghbwxu/Build/Intermediates/ArchiveIntermediates/myapp/BuildProductsPath/Release-iphoneos/libReact.a(RCTHTTPRequestHandler.o)
    /Users/tavria/Library/Developer/Xcode/DerivedData/myapp-hfmnmtfftxluofdugtpjdhghbwxu/Build/Intermediates/ArchiveIntermediates/myapp/BuildProductsPath/Release-iphoneos/libRCTNetwork.a(RCTHTTPRequestHandler.o)
ld: 99 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I understand that this problem about duplicate react code into project Library and react code into Pod. But if I delete it from project library – modules that was install without pod, like fbsdk, they will crash. If I remove react from Podfile – I have a lot of errors like

rctdevsettings mm 2017-08-14 11-25-23

I try to add jschelpers to project -> build phases -> link binary with libraries – but this is not helped me)

Very interesting fact, when I build debug or release build everything builded

Не закрывается окно авторизации

Добрый день, столкнулся с проблемой при авторизации.
const auth = await VKLogin.login(['friends', 'photos', 'email']);
При использовании метода login, открывается окно с авторизацией, после чего приложение запрашивает доступ к аккаунта и при нажатии на кнопку разрешить просто происходит открытие этого же окна.

image

Android crash with gradle 3.1.4

temp fix

"fixRNVkontakteLogin": "find ./node_modules/react-native-vkontakte-login/android/build.gradle -type f -exec sed -i '' 's#jcenter()#jcenter()\\'$'\n        maven { url \"https://dl.bintray.com/android/android-tools/\" }#g' {} \\;",

Обновление SDK

Добрый день!

На данный момент библиотека поддерживает VK SDK для Android версии 1.+, но уже есть SDK версии 2+.
Скажите пожалуйста, планируете ли вы обновлять библиотеку?

[iOS] Crash on app initialization.

I have react-native 0.35, xcode 8. When app is built on iOS 10 simulator, the following error occurs:

[NSCFString stringValue]: unrecognized selector sent to instance XXXXXXXX

for the following line of code (ios/VkontakteManager.m):

sdk = [VKSdk initializeWithAppId:[appId stringValue]];

Changing the line to

sdk = [VKSdk initializeWithAppId:(NSString *) appId];

allows the app to work and use vk authorization. Unfortunately, I don't know objective C at all, so I don't understand what those lines do and how that problem should be fixed properly.

Выкидывает ошибку Error fingerprint если установлено на телефоне приложение VK

Если авторизоваться в моем приложении с установленным приложением вконтакте на телефоне, выдают ошибку хэш ключа. На айфоне такой проблемы нету. Если удаляю приложение вк, то авторизация проходит без проблем. VKCOM/vk-android-sdk#307 Тут вроде бы советуют перейти на SDK 2+. Если можно обойтись без этого, как обойти эту проблему ?

iOS, stuck on Launch Screen RN 0.59.1

Does it work with RN 0.59.1?, I needed to update my RN0.56 to RN0.59.1, and was unable to make this library work on new RN version.

I have this script (Run Script - workaround to remove unused architecture), in my target -> build phases. Do not know if this is related or not as you have also .Framework.

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

echo "Test"
done

What should I do?

not working with react-native 0.33.0

Hi

after upgrading to react-native 0.33.0 project build (android) fails with

:react-native-vkontakte-login:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
\node_modules\react-native-vkontakte-login\android\src\main\java\camp\kuznetsov\rn\vkontakte\VKAuthModule.java:17: error: VKAuthModule is not abstract and does not override abstract method onActivityResult(Activity,int,int,Intent) in ActivityEventListener
public class VKAuthModule extends ReactContextBaseJavaModule implements ActivityEventListener {
^
\node_modules\react-native-vkontakte-login\android\src\main\java\camp\kuznetsov\rn\vkontakte\VKAuthModule.java:109: error: method does not override or implement a method from a supertype
@OverRide
^
2 errors
:react-native-vkontakte-login:compileReleaseJavaWithJavac FAILED

Could you fix it?
and thank you for great module

IOS Allow button doesn't work

2018-01-31 14 11 36

Allow and Cancel buttons don't work. Nothing happens when I press them.

RN: 0.52.2
react: 16.2.0
react-native-vkontakte-login: 0.3.18

Already authorized on Android

Once I authorize in iOS - everything is OK, next time when I call login() method, it just returns token,
but on Android it asks access from scope every time!
How make it pass authorization if it was confirmed scope earlier?

по-русски:
На андроиде запрашивает доступ каждый раз при вызове login(), а на iOS как и полагается - если уже разрешал, сразу отдает токен.

Не получается авторизироваться.

Все устанавливал по мануалу без cocoapods. После нажатия кнопки залогинится открывается вебвью, когда нажимаю разрешить, происходит микро загрузка чего-то и все, ничего не меняется. Т.е. залогиниться должно было, но почему-то нет и само не закрылось. Тгда нажимаю Done и вижу
image
Но стоит заметить что этот красный экран всплывает только если включен дебаггер, если его отключить, то приложение выводит на главный экран, но человек по прежнему не залогинен.
еще кидает вот такую ошибку -canOpenURL: failed for URL: "vkauthorize://authorize" - error: "The operation , но я так понял, что это потому что на симуляторе нет приложения vk

Не работает автоматическая установка

Попробовал сначала установить с помощью react-native link react-native-vkontakte-login
в результате проект не собрался, была ошибка
error: resource style/VK.Transparent
Собирал только в среде виндовс для андройда.

Сделал Manual installation и все собралось успешно.

Пожалуйста, проверьте. Если ошибку не удастся воспроизвести, готов повторить это у себя и дать дополнительные данные об ошибке

Share

Hello, Share not working, thx

Sharing by non auth user

Hi!

I think that code not need.

if (![sdk hasPermissions:permissions]){
  //reject(RCTErrorUnspecified, nil, RCTErrorWithMessage(@"Access denied: no access to call this method"));
  //return;
}

Because VK-nonauthed user cannot sharing info.
When i commented reject and return i see prompt that i not authed, than authed and can share info.

Grammar issue

After linking package, next message is shown: "In this case you have update AppDelegate.m manually"
What did you mean?
"In this case you have updateD AppDelegate.m manually already"
or
"In this case you have TO update AppDelegate.m manually"

Thank you.

[Android] Attempt to invoke virtual method 'java.lang.String com.vk.sdk.api.VKError.toString()' on a null object reference

Произошло на устройстве HUAWEI PRA-TL10 (android 7.0)
react-native: 0.53.3
react-native-vkontakte-login: 0.3.19

Fatal Exception: java.lang.RuntimeException
Failure delivering result ResultInfo{who=null, request=10485, result=0, data=null} to activity {com.package.name/com.package.name.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.vk.sdk.api.VKError.toString()' on a null object reference

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.String com.vk.sdk.api.VKError.toString()' on a null object reference

camp.kuznetsov.rn.vkontakte.VKAuthModule$2.onError (VKAuthModule.java:158)
com.vk.sdk.VKSdk.onActivityResult (VKSdk.java:247)
camp.kuznetsov.rn.vkontakte.VKAuthModule.onActivityResult (VKAuthModule.java:146)
com.facebook.react.bridge.ReactContext.onActivityResult (ReactContext.java:255)
com.facebook.react.ReactInstanceManager.onActivityResult (ReactInstanceManager.java:706)
com.facebook.react.ReactActivityDelegate.onActivityResult (ReactActivityDelegate.java:126)
com.facebook.react.ReactActivity.onActivityResult (ReactActivity.java:77)
com.package.name.MainActivity.onActivityResult (MainActivity.java:48)

Установка в Expo

Существует возможность использовать модуль совместно с Expo?
Во время автоматической установки модуля (react-native link react-native-vkontakte-login) получаю сообщения:

Could not find AndroidManifest.xml, please update it manually
Could not find AppDelegate.m file for this project at null, so could not add the framework for iOS.
You should add the framework manually.

Build failed

I have an error, any idea? Thx
/node_modules/react-native-vkontakte-login/ios/VkontakteSharing.m:3:9:

error: 'RCTUtils.h' f
File not found with include; use "quotes" instead
#import <RCTUtils.h>
^~~~~~~~~~~~
"RCTUtils.h"

** BUILD FAILED **

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.