reason

增加了第三方登录

...@@ -2,20 +2,18 @@ ...@@ -2,20 +2,18 @@
2 xmlns:tools="http://schemas.android.com/tools" 2 xmlns:tools="http://schemas.android.com/tools"
3 package="pub.yiyan.parlando.Parlando"> 3 package="pub.yiyan.parlando.Parlando">
4 4
5 - <uses-permission android:name="com.android.vending.BILLING" />
6 -
7 <application 5 <application
8 - android:requestLegacyExternalStorage="true" 6 + android:icon="@mipmap/ic_launcher"
9 - tools:replace="android:label"
10 android:label="Parlando" 7 android:label="Parlando"
11 - android:icon="@mipmap/ic_launcher"> 8 + android:requestLegacyExternalStorage="true"
9 + tools:replace="android:label">
12 <activity 10 <activity
13 android:name=".MainActivity" 11 android:name=".MainActivity"
14 - android:launchMode="singleTop"
15 - android:exported="true"
16 - android:theme="@style/LaunchTheme"
17 android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" 12 android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
13 + android:exported="true"
18 android:hardwareAccelerated="true" 14 android:hardwareAccelerated="true"
15 + android:launchMode="singleTop"
16 + android:theme="@style/LaunchTheme"
19 android:windowSoftInputMode="adjustResize"> 17 android:windowSoftInputMode="adjustResize">
20 <!-- Specifies an Android theme to apply to this Activity as soon as 18 <!-- Specifies an Android theme to apply to this Activity as soon as
21 the Android process has started. This theme is visible to the user 19 the Android process has started. This theme is visible to the user
...@@ -34,8 +32,8 @@ ...@@ -34,8 +32,8 @@
34 android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> 32 android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
35 <activity 33 <activity
36 android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity" 34 android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity"
37 - android:launchMode="singleTask" 35 + android:exported="true"
38 - android:exported="true"> 36 + android:launchMode="singleTask">
39 <intent-filter> 37 <intent-filter>
40 <action android:name="android.intent.action.VIEW" /> 38 <action android:name="android.intent.action.VIEW" />
41 39
...@@ -49,5 +47,17 @@ ...@@ -49,5 +47,17 @@
49 <meta-data 47 <meta-data
50 android:name="flutterEmbedding" 48 android:name="flutterEmbedding"
51 android:value="2" /> 49 android:value="2" />
50 + <meta-data
51 + android:name="com.facebook.sdk.ApplicationId"
52 + android:value="@string/facebook_app_id" />
53 + <meta-data
54 + android:name="com.facebook.sdk.ClientToken"
55 + android:value="@string/facebook_client_token" />
52 </application> 56 </application>
57 + <queries>
58 + <provider android:authorities="com.facebook.katana.provider.PlatformProvider" />
59 + </queries>
60 +
61 + <uses-permission android:name="com.android.vending.BILLING" />
62 + <uses-permission android:name="android.permission.INTERNET" />
53 </manifest> 63 </manifest>
......
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<resources>
3 + <string name="facebook_app_id">2980906268888917</string>
4 + <string name="facebook_client_token">93d996aa47987e5031a94e0c3071bf48</string>
5 +</resources>
...\ No newline at end of file ...\ No newline at end of file
...@@ -20,8 +20,11 @@ import 'package:Parlando/util/other_utils.dart'; ...@@ -20,8 +20,11 @@ import 'package:Parlando/util/other_utils.dart';
20 import 'package:Parlando/widgets/my_app_bar.dart'; 20 import 'package:Parlando/widgets/my_app_bar.dart';
21 import 'package:Parlando/widgets/my_button.dart'; 21 import 'package:Parlando/widgets/my_button.dart';
22 import 'package:Parlando/widgets/my_scroll_view.dart'; 22 import 'package:Parlando/widgets/my_scroll_view.dart';
23 +import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
24 +import 'package:flutter_signin_button/flutter_signin_button.dart';
23 import 'package:getwidget/getwidget.dart'; 25 import 'package:getwidget/getwidget.dart';
24 import 'package:sign_in_with_apple/sign_in_with_apple.dart'; 26 import 'package:sign_in_with_apple/sign_in_with_apple.dart';
27 +import 'package:twitter_login/twitter_login.dart';
25 28
26 import '../login_router.dart'; 29 import '../login_router.dart';
27 30
...@@ -165,8 +168,7 @@ class _LoginPageState extends State<LoginPage> ...@@ -165,8 +168,7 @@ class _LoginPageState extends State<LoginPage>
165 ); 168 );
166 } 169 }
167 170
168 - List<Widget> get _buildBody => 171 + List<Widget> get _buildBody => <Widget>[
169 - <Widget>[
170 Text( 172 Text(
171 ParlandoLocalizations.of(context).passwordLogin, 173 ParlandoLocalizations.of(context).passwordLogin,
172 style: TextStyles.textBold26, 174 style: TextStyles.textBold26,
...@@ -281,5 +283,58 @@ class _LoginPageState extends State<LoginPage> ...@@ -281,5 +283,58 @@ class _LoginPageState extends State<LoginPage>
281 : const Center( 283 : const Center(
282 child: Text(""), 284 child: Text(""),
283 ), 285 ),
286 + Gaps.vGap16,
287 + Row(
288 + mainAxisAlignment: MainAxisAlignment.center,
289 + children: [
290 + SignInButton(
291 + Buttons.Facebook,
292 + mini: true,
293 + onPressed: () async {
294 + final result = await FacebookAuth.instance.login(
295 + permissions: ["email", "public_profile", "user_friends"]);
296 +
297 + if (result.status == LoginStatus.success) {
298 + // you are logged
299 + final AccessToken accessToken = result.accessToken!;
300 + print(accessToken.token);
301 + } else {
302 + print(result.status);
303 + print(result.message);
304 + }
305 + },
306 + ),
307 + SignInButton(
308 + Buttons.Twitter,
309 + mini: true,
310 + onPressed: () async {
311 + final twitterLogin = TwitterLogin(
312 + // Consumer API keys
313 + apiKey: 'XP8O1y3dx6apqgObc4NV1udOr',
314 + apiSecretKey:
315 + 'EhPEUXZgFTlslYjyZXJ9TFaAlczmW5I6WoG0nVBYCzu4CJAuBT',
316 + // Registered Callback URLs in TwitterApp
317 + // Android is a deeplink
318 + // iOS is a URLScheme
319 + redirectURI: 'example://',
320 + );
321 + final authResult = await twitterLogin.login();
322 + switch (authResult.status) {
323 + case TwitterLoginStatus.loggedIn:
324 + // success
325 + break;
326 + case TwitterLoginStatus.cancelledByUser:
327 + // cancel
328 + break;
329 + case TwitterLoginStatus.error:
330 + // error
331 + break;
332 + default:
333 + break;
334 + }
335 + },
336 + ),
337 + ],
338 + )
284 ]; 339 ];
285 } 340 }
......
...@@ -398,6 +398,27 @@ packages: ...@@ -398,6 +398,27 @@ packages:
398 description: flutter 398 description: flutter
399 source: sdk 399 source: sdk
400 version: "0.0.0" 400 version: "0.0.0"
401 + flutter_facebook_auth:
402 + dependency: "direct main"
403 + description:
404 + name: flutter_facebook_auth
405 + url: "https://pub.flutter-io.cn"
406 + source: hosted
407 + version: "4.3.4+2"
408 + flutter_facebook_auth_platform_interface:
409 + dependency: transitive
410 + description:
411 + name: flutter_facebook_auth_platform_interface
412 + url: "https://pub.flutter-io.cn"
413 + source: hosted
414 + version: "3.1.2"
415 + flutter_facebook_auth_web:
416 + dependency: transitive
417 + description:
418 + name: flutter_facebook_auth_web
419 + url: "https://pub.flutter-io.cn"
420 + source: hosted
421 + version: "3.1.2"
401 flutter_inapp_purchase: 422 flutter_inapp_purchase:
402 dependency: "direct main" 423 dependency: "direct main"
403 description: 424 description:
...@@ -438,6 +459,13 @@ packages: ...@@ -438,6 +459,13 @@ packages:
438 url: "https://pub.flutter-io.cn" 459 url: "https://pub.flutter-io.cn"
439 source: hosted 460 source: hosted
440 version: "2.0.6" 461 version: "2.0.6"
462 + flutter_signin_button:
463 + dependency: "direct main"
464 + description:
465 + name: flutter_signin_button
466 + url: "https://pub.flutter-io.cn"
467 + source: hosted
468 + version: "2.0.0"
441 flutter_slidable: 469 flutter_slidable:
442 dependency: "direct main" 470 dependency: "direct main"
443 description: 471 description:
...@@ -1247,6 +1275,13 @@ packages: ...@@ -1247,6 +1275,13 @@ packages:
1247 url: "https://pub.flutter-io.cn" 1275 url: "https://pub.flutter-io.cn"
1248 source: hosted 1276 source: hosted
1249 version: "1.0.0" 1277 version: "1.0.0"
1278 + twitter_login:
1279 + dependency: "direct main"
1280 + description:
1281 + name: twitter_login
1282 + url: "https://pub.flutter-io.cn"
1283 + source: hosted
1284 + version: "4.2.3"
1250 typed_data: 1285 typed_data:
1251 dependency: transitive 1286 dependency: transitive
1252 description: 1287 description:
......
...@@ -109,6 +109,10 @@ dependencies: ...@@ -109,6 +109,10 @@ dependencies:
109 109
110 getwidget: ^2.0.5 110 getwidget: ^2.0.5
111 sign_in_with_apple: ^4.0.0 111 sign_in_with_apple: ^4.0.0
112 + flutter_facebook_auth: ^4.3.4+2
113 + flutter_signin_button: ^2.0.0
114 + twitter_login: ^4.2.3
115 +
112 event_bus: ^2.0.0 116 event_bus: ^2.0.0
113 117
114 animated_radial_menu: ^0.0.1 118 animated_radial_menu: ^0.0.1
......