alibc 1.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 42

阿里百川SDK #

接入说明 #

仅支持android,暂不支持IOS

1. 注册 #

阿里百川, 注册阿里百川账号,创建应用,申请权限

2. 生成安全图片 #

登录阿里百川开发者控制台, 获取V5版安全图片,放入res/drawable/yw_1222.jpg

3. 修改文件 #

修改android目录下AndroidManifest.xml文件,增加内容: xmlns:tools="http://schemas.android.com/tools" tools:replace="android:label"

    <manifest
        xmlns:tools="http://schemas.android.com/tools">
        <application
            tools:replace="android:label">
    ...

4. 混淆文件 #

在android/app/目录下新增proguard-rules.pro文件, 参考官方说明 内容:

    -keepattributes Signature
    -ignorewarnings
    -keep class javax.ws.rs.** { *; }
    -keep class com.alibaba.fastjson.** { *; }
    -dontwarn com.alibaba.fastjson.**
    -keep class sun.misc.Unsafe { *; }
    -dontwarn sun.misc.**
    -keep class com.taobao.** {*;}
    -keep class com.alibaba.** {*;}
    -keep class com.alipay.** {*;}
    -dontwarn com.taobao.**
    -dontwarn com.alibaba.**
    -dontwarn com.alipay.**
    -keep class com.ut.** {*;}
    -dontwarn com.ut.**
    -keep class com.ta.** {*;}
    -dontwarn com.ta.**
    -keep class org.json.** {*;}
    -keep class com.ali.auth.**  {*;}
    -dontwarn com.ali.auth.**
    -keep class com.taobao.securityjni.** {*;}
    -keep class com.taobao.wireless.security.** {*;}
    -keep class com.taobao.dp.**{*;}
    -keep class com.alibaba.wireless.security.**{*;}
    -keep interface mtopsdk.mtop.global.init.IMtopInitTask {*;}
    -keep class * implements mtopsdk.mtop.global.init.IMtopInitTask {*;}

1.0.4 #

    1. 修改内部参数传递方式,增加taoke参数支持

1.0.3 #

    1. 内部优化。
    1. 修改openURL kit参数为可选。

1.0.2 #

    1. 更新最新版SDK。
    • 登陆 v2.0.0.7
    • 安全组件 v5.4.200
    • Mtop v3.1.7.2
    • 电商基础组件 v4.0.0.14
    1. 解决Release版本初始化失败的问题(参考接入说明#4)。

1.0.1 #

    1. 修改初始化方式,不需要外部调用。

1.0.0 #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:alibc/alibc.dart';
import 'package:alibc/data.dart';

typedef ResultCallback = Future<dynamic> Function();

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

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

class _MyAppState extends State<MyApp> {
  Map<String, String> result = {};

  @override
  void initState() {
    super.initState();
  }

  Widget _buildButton(String title, ResultCallback callback) {
    return Container(
      child: ListView(
        primary: false,
        shrinkWrap: true,
        children: <Widget>[
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              FlatButton(
                color: Colors.grey.withAlpha(100),
                child: Text(title),
                onPressed: () {
                  callback()
                      .then((dynamic value) => setState(() {
                            result[title] = value.toString();
                          }))
                      .catchError((value) => setState(() {
                            result[title] = value.toString();
                          }));
                },
              ),
              Container(
                margin: EdgeInsets.only(left: 100),
                child: Text(result[title] ?? '结果:'),
              )
            ],
          )
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('阿里百川SDK示例'),
        ),
        body: ListView(
          primary: false,
          shrinkWrap: true,
          children: <Widget>[
            _buildButton('初始化', _initTest),
            _buildButton('淘宝账号授权登录', _loginTest),
            _buildButton('检查是否登录', _isloginTest),
            _buildButton('退出淘宝账号授权', _logoutTest),
            _buildButton('打开链接', _openURLTest),
            _buildButton('打开淘宝店铺', _openShopTest),
            _buildButton('打开淘宝购物车', _openMyCartsTest),
            _buildButton('添加购物车', _openAddCartTest),
            _buildButton('打开淘宝订单', _openMyOrdersTest),
            _buildButton('淘客打点同步/异步', _setSyncForTaokeTest),
            _buildButton('是否使用支付宝', _setShouldUseAlipayTest),
            _buildButton('淘宝客配置', _setTaokeParamsTest),
            _buildButton('渠道信息', _setChannelTest),
            _buildButton('ISVCode', _setISVCodeTest),
            _buildButton('ISV版本', _setISVVersionTest),
          ],
        ),
      ),
    );
  }

  Future<dynamic> _initTest() async {
    return await Alibc.init();
  }

  Future<dynamic> _loginTest() async {
    return await Alibc.login();
  }

  Future<dynamic> _isloginTest() async {
    return await Alibc.islogin();
  }

  Future<dynamic> _logoutTest() async {
    return await Alibc.logout();
  }

  Future<dynamic> _openURLTest() async {
    return await Alibc.openURL(
        'https://uland.taobao.com/coupon/edetail?e=oSSExmvWXYYGQASttHIRqdYQwfcs8zoyxKXGKLqne1Hsx8cAhaH1SiZlT35kVCJr5R4kLBbVNWVsYgQTrXiDpq0TeAL%2BmcF17w9v818T2zNzQzL%2FHTq%2BPBemP0hpIIPvjDppvlX%2Bob8NlNJBuapvQ2MDg9t1zp0RRkY43XGTK8ko1aiZVhb9ykMuxoRQ3C%2BH5vl92ZYH25Cie%2FpBy9wBFg%3D%3D&traceId=0b15099215669559409745730e&union_lens=lensId:0b0b9f56_0c4c_16cd5da2c7f_3b31&xId=PwB9ZSWQxCtEwHxtbQc8iynshj5KEW16KP6OV6MAlpGpKCKmVGQMnjwQNhiGQpRY1gFyQHtqnYiv5wxGKTyCdf&tj1=1&tj2=1&relationId=518419440&activityId=23f4487e169647bd98b0d7fb2645947a',
        AlibcShowParams(
            backUrl: 'alisdk://',
            degradeUrl: '',
            openType: 'native',
            clientType: 'taobao',
            title: '',
            proxy: '',
            bar: '',
            failedMode: 'h5',
            originalOpenType: ''));
  }

  Future<dynamic> _openDetailTest() async {
    return await Alibc.openPage(
        AlibcDetailPage('618165954008'),
        AlibcShowParams(
            backUrl: 'alisdk://',
            degradeUrl: '',
            openType: 'native',
            clientType: 'taobao',
            title: '',
            proxy: '',
            bar: '',
            failedMode: 'h5',
            originalOpenType: ''));
  }

  Future<dynamic> _openShopTest() async {
    return await Alibc.openPage(
        AlibcShopPage('65626181'),
        AlibcShowParams(
            backUrl: 'alisdk://',
            degradeUrl: '',
            openType: 'native',
            clientType: 'taobao',
            title: '',
            proxy: '',
            bar: '',
            failedMode: 'h5',
            originalOpenType: ''));
  }

  Future<dynamic> _openMyCartsTest() async {
    return await Alibc.openPage(
        AlibcMyCartsPage(),
        AlibcShowParams(
            backUrl: 'alisdk://',
            degradeUrl: '',
            openType: 'native',
            clientType: 'taobao',
            title: '',
            proxy: '',
            bar: '',
            failedMode: 'h5',
            originalOpenType: ''));
  }

  Future<dynamic> _openAddCartTest() async {
    return await Alibc.openPage(
        AlibcAddCartPage('618165954008'),
        AlibcShowParams(
            backUrl: 'alisdk://',
            degradeUrl: '',
            openType: 'native',
            clientType: 'taobao',
            title: '',
            proxy: '',
            bar: '',
            failedMode: 'h5',
            originalOpenType: ''));
  }

  Future<dynamic> _openMyOrdersTest() async {
    return await Alibc.openPage(
        AlibcMyOrdersPage(0, true),
        AlibcShowParams(
            backUrl: 'alisdk://',
            degradeUrl: '',
            openType: 'native',
            clientType: 'taobao',
            title: '',
            proxy: '',
            bar: '',
            failedMode: 'h5',
            originalOpenType: ''));
  }

  bool isSyncForTaoke = false;
  Future<dynamic> _setSyncForTaokeTest() async {
    isSyncForTaoke = !isSyncForTaoke;
    return await Alibc.setSyncForTaoke(isSyncForTaoke);
  }

  bool isShouldUseAlipay = false;
  Future<dynamic> _setShouldUseAlipayTest() async {
    isShouldUseAlipay = !isShouldUseAlipay;
    return await Alibc.setShouldUseAlipay(isShouldUseAlipay);
  }

  Future<dynamic> _setTaokeParamsTest() async {
    return await Alibc.setTaokeParams(
        AlibcTaokeParams(pid: 'mm_112883640_11584347_72287650277', adzoneId: '72287650277'));
  }

  Future<dynamic> _setChannelTest() async {}

  Future<dynamic> _setISVCodeTest() async {}

  Future<dynamic> _setISVVersionTest() async {}
}

Use this package as a library

1. Depend on it

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


dependencies:
  alibc: ^1.0.4

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:alibc/alibc.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:alibc/alibc.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:alibc/alibc.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:alibc/alibc.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:alibc/alibc.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [alibc] that is in a package requiring null.

Health suggestions

Fix lib/alibc.dart. (-0.50 points)

Analysis of lib/alibc.dart reported 1 hint:

line 2 col 8: Unused import: 'dart:convert'.

Fix lib/data.dart. (-0.50 points)

Analysis of lib/data.dart reported 1 hint:

line 1 col 8: Unused import: 'dart:convert'.

Maintenance issues and suggestions

The description contains too many non-ASCII characters. (-20 points)

The site uses English as its primary language. The value of the description field in your package's pubspec.yaml field should primarily contain characters used in English.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test