saltedfish_weibo_plugin 0.0.6

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 64

saltedfish_weibo_plugin

新浪微博插件

  • 1 目前支持授权和分享
  • 2 图片分享待开发
  • 3 由于新浪SDK太渣,aar里面so不全,加多了一份arm64-v8a so,请注意适配

How to use

1. Install

Add this to your package's pubspec.yaml file:

dependencies:
  saltedfish_weibo_plugin: "^0.0.6"

2. Import

import 'package:saltedfish_weibo_plugin/saltedfish_weibo_plugin.dart';

3. IOS配置

plist文件

<key>LSApplicationQueriesSchemes</key>
    <array>
        <string>sinaweibo</string>
        <string>sinaweibohd</string>
        <string>sinaweibosso</string>
        <string>sinaweibohdsso</string>
        <string>weibosdk</string>
        <string>weibosdk2.5</string>
    </array>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

重写项目的AppDelegate的handleOpenURL和openURL方法

// ios 8.x or older
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
     NSString * urlStr = [url absoluteString];
    [[NSNotificationCenter defaultCenter]
     postNotificationName:@"Weibo" object:nil userInfo:@{@"url":urlStr}];
    return YES;
}
// ios 9.0+
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
            options:(NSDictionary<NSString*, id> *)options
{
    NSString * urlStr = [url absoluteString];
    [[NSNotificationCenter defaultCenter]
     postNotificationName:@"Weibo" object:nil userInfo:@{@"url":urlStr}];
    return YES;
}

4. Use

例子里面也有,可以看example/main.dart

  • 初始化
SaltedfishWeiboSharePlugin.install('你的appid', '回调地址', '权限');
  • web授权
SaltedfishWeiboSharePlugin.webAuth();
  • sso授权
SaltedfishWeiboSharePlugin.ssoAuth();
  • all in one授权
SaltedfishWeiboSharePlugin.allInOneAuth();
  • 分享

参数依次为标题,内容,图片(目前仅支持单张,页面地址)

 SaltedfishWeiboPlugin.shareToWeibo(
                    '12345678',
                    '2月18日,在各种期待和质疑声中,Apple Pay正式登陆中国,无需联网,甚至不用打开手机屏幕,只要把手机或者iwatch靠近pos机,验证一下指纹,叮咚一声,钱就付了。尽管遭到很多人吐槽:支付三秒钟,绑卡三小时,但令人崩溃的绑卡过程并没减少大家对Apple Pay的热情,据悉,上线第一天Apple Pay的绑卡数量就超过3000万张...',
                    'http://www.17fxw.cn/wts/images/3c21405c29fcdaf7ce6b0ab2c2d4232e','http://www.17fxw.cn/wts/wx/art/detail/7c5b3d90550211e885d8514f3ad721ba');
  • 状态说明

    0——成功

    -1——取消

    1——失败

Thanks

flutter_wechat flutter_qq

License

Copyright 2018 LuoHao

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

0.0.5

  • IOS 实现

0.0.6

*修复android 64位闪退的问题

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:saltedfish_weibo_plugin/saltedfish_weibo_plugin.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final String WTS_SHARE_SINA_APP_KEY = "2045436852";
  final String WTS_SHARE_SINA_REDIRECT_URL = "https://www.sina.com";
  final String WTS_SHARE_SINA_SCOPE =
      "email,direct_messages_read,direct_messages_write,friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog,invitation_write";

  @override
  void initState() {
    super.initState();
    SaltedfishWeiboPlugin.install(WTS_SHARE_SINA_APP_KEY,
        WTS_SHARE_SINA_REDIRECT_URL, WTS_SHARE_SINA_SCOPE);
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: new Column(
          children: <Widget>[
            InkWell(
              child: Container(
                child: Text('web授权'),
                padding: EdgeInsets.all(16.0),
              ),
              onTap: () {
                SaltedfishWeiboPlugin.webAuth().then((map){
                  print(map);
                });
              },
            ),
            InkWell(
              child: Container(
                child: Text('sso授权'),
                padding: EdgeInsets.all(16.0),
              ),
              onTap: () {
                SaltedfishWeiboPlugin.ssoAuth();
              },
            ),
            InkWell(
              child: Container(
                child: Text('all in one'),
                padding: EdgeInsets.all(16.0),
              ),
              onTap: () {
                SaltedfishWeiboPlugin.allInOneAuth();
              },
            ),
            InkWell(
              child: Container(
                child: Text('分享'),
                padding: EdgeInsets.all(16.0),
              ),
              onTap: () {
                SaltedfishWeiboPlugin.shareToWeibo(
                    '12345678',
                    '2月18日,在各种期待和质疑声中,Apple Pay正式登陆中国,无需联网,甚至不用打开手机屏幕,只要把手机或者iwatch靠近pos机,验证一下指纹,叮咚一声,钱就付了。尽管遭到很多人吐槽:支付三秒钟,绑卡三小时,但令人崩溃的绑卡过程并没减少大家对Apple Pay的热情,据悉,上线第一天Apple Pay的绑卡数量就超过3000万张...',
                    'http://www.17fxw.cn/wts/images/3c21405c29fcdaf7ce6b0ab2c2d4232e','http://www.17fxw.cn/wts/wx/art/detail/7c5b3d90550211e885d8514f3ad721ba');
              },
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  saltedfish_weibo_plugin: ^0.0.6

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:saltedfish_weibo_plugin/saltedfish_weibo_plugin.dart';
  
Version Uploaded Documentation Archive
0.0.6 Aug 20, 2018 Go to the documentation of saltedfish_weibo_plugin 0.0.6 Download saltedfish_weibo_plugin 0.0.6 archive
0.0.5 Aug 19, 2018 Go to the documentation of saltedfish_weibo_plugin 0.0.5 Download saltedfish_weibo_plugin 0.0.5 archive
0.0.4 Aug 4, 2018 Go to the documentation of saltedfish_weibo_plugin 0.0.4 Download saltedfish_weibo_plugin 0.0.4 archive
0.0.3 Aug 4, 2018 Go to the documentation of saltedfish_weibo_plugin 0.0.3 Download saltedfish_weibo_plugin 0.0.3 archive
0.0.2 Aug 4, 2018 Go to the documentation of saltedfish_weibo_plugin 0.0.2 Download saltedfish_weibo_plugin 0.0.2 archive
0.0.1 Aug 4, 2018 Go to the documentation of saltedfish_weibo_plugin 0.0.1 Download saltedfish_weibo_plugin 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
45
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7
  • Flutter: 1.0.0

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs (-10 points)

7 out of 7 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release. (-10 points)

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8