Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Auth added (Firebase Authentication) #196

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Dart

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

# Note: This workflow uses the latest stable version of the Dart SDK.
# You can specify other versions if desired, see documentation here:
# https://github.com/dart-lang/setup-dart/blob/main/README.md
# - uses: dart-lang/setup-dart@v1
- uses: dart-lang/setup-dart@9a04e6d73cca37bd455e0608d7e5092f881fd603

- name: Install dependencies
run: dart pub get

# Uncomment this step to verify the use of 'dart format' on each commit.
# - name: Verify formatting
# run: dart format --output=none --set-exit-if-changed .

# Consider passing '--fatal-infos' for slightly stricter analysis.
- name: Analyze project source
run: dart analyze

# Your project will need to have tests in test/ and a dependency on
# package:test for this step to succeed. Note that Flutter projects will
# want to change this to 'flutter test'.
- name: Run tests
run: dart test

- name: iOS Build Action
# You may pin to the exact commit or the version.
# uses: yukiarrr/ios-build-action@ed58ef62f757eb6789675b7ed70ab21255eb80a7
uses: yukiarrr/ios-build-action@v1.4.0
with:
# Base64 encoded p12 key
p12-key-base64: # optional
# Base64 encoded certificate for the p12 key
p12-cer-base64: # optional
# Base64 encoded p12 file (key + cert)
p12-base64: # optional
# Base64 encoded mobileprovision file
mobileprovision-base64: # optional
# p12 key path
p12-key-path: # optional
# Certificate path for the p12 key
p12-cer-path: # optional
# p12 path (key + cert)
p12-path: # optional
# mobileprovision path
mobileprovision-path: # optional
# Project path
project-path:
# For example, iOS Distribution
code-signing-identity:
# Team id
team-id:
# Workspace path
workspace-path: # optional, default is
# Choose app-store, ad-hoc, package, enterprise, development, or developer-id
export-method: # optional, default is app-store
# For example, Debug, Release
configuration: # optional, default is Release
# Certificate password
certificate-password: # optional, default is
# Output path of ipa
output-path: # optional, default is output.ipa
# Scheme
scheme: # optional, default is
# Targets to be updated with mobileprovision, code signing identity, etc
update-targets: # optional, default is
# Deprecated, use update-targets instead
disable-targets: # optional, default is
# Path to an export options plist
export-options: # optional, default is
# Path for Swift Package Manager dependencies
cloned-source-packages-path: # optional, default is
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,9 @@ app.*.symbols
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock

.fvm
.fvm
pubspec.yaml
assets/items/apple_logo.png
lib/main.dart
lib/services/auth_service.dart
lib/views/auth/login_view.dart
64 changes: 30 additions & 34 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,50 @@
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:284562138050:android:6169fadfe936aaab432c5b",
"mobilesdk_app_id": "1:284562138050:android:4dd18f27c903c50f432c5b",
"android_client_info": {
"package_name": "com.example.retro_shopping"
"package_name": "tech.himanshusharma.relicbazaar"
}
},
"oauth_client": [
{
"client_id": "284562138050-5n24qtnibubmv443073qmeeipd324te4.apps.googleusercontent.com",
"client_id": "284562138050-0r52hg57q2tt1vmd23fcps35a5e7cnia.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.retro_shopping",
"package_name": "tech.himanshusharma.relicbazaar",
"certificate_hash": "3170047cb974c61e030402159ab0c74158413b7b"
}
},
{
"client_id": "284562138050-4l092ps2j10uojq4tsma8n9velt4n8l3.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "tech.himanshusharma.relicbazaar",
"certificate_hash": "2a12d2939154d680c5c9cc73036c740d4a459d3e"
}
},
{
"client_id": "284562138050-jd4sm4hg7cs3qc34h5ud2b9gq6hua8cf.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
"client_id": "284562138050-ctub8nvgiv3q5vt1hkhlkaml7kgiblqn.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "tech.himanshusharma.relicbazaar",
"certificate_hash": "026591a5ef09087a8f36e0991636e4bd40bfd9f2"
}
},
{
"current_key": "AIzaSyCOr5OgT_NBoA0_v14PdgI0A8dmPZYpiBM"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "284562138050-jd4sm4hg7cs3qc34h5ud2b9gq6hua8cf.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:284562138050:android:4dd18f27c903c50f432c5b",
"android_client_info": {
"package_name": "tech.himanshusharma.relicbazaar"
}
},
"oauth_client": [
"client_id": "284562138050-glc1id42m7trjlr06ndmb0pmvv249u7j.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "tech.himanshusharma.relicbazaar",
"certificate_hash": "0a73355f21b08c1d58e3a2d4dd52400b1793f920"
}
},
{
"client_id": "284562138050-0r52hg57q2tt1vmd23fcps35a5e7cnia.apps.googleusercontent.com",
"client_id": "284562138050-sos9f7ohrpktmc9t6o86vnt77vq6n29k.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "tech.himanshusharma.relicbazaar",
"certificate_hash": "3170047cb974c61e030402159ab0c74158413b7b"
"certificate_hash": "1cc63aed40b207db68825c78bd3c392da4994fef"
}
},
{
Expand All @@ -77,7 +72,8 @@
}
]
}
}
},
"admob_app_id": "ca-app-pub-1408860275796619~7877036507"
}
],
"configuration_version": "1"
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>retro_shopping</string>
<string>relic_bazaar</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
6 changes: 3 additions & 3 deletions lib/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:provider/provider.dart';
import 'package:retro_shopping/views/cart_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:retro_shopping/views/search_view.dart';
import 'package:relic_bazaar/views/cart_view.dart';
import 'package:relic_bazaar/views/home_view.dart';
import 'package:relic_bazaar/views/search_view.dart';
import 'helpers/ad_state.dart';
import 'views/profile/profile_view.dart';
import 'widgets/bottom_nav_bar.dart';
Expand Down
4 changes: 2 additions & 2 deletions lib/helpers/constants.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/widgets/product/product_card.dart';
import 'package:relic_bazaar/model/product_model.dart';
import 'package:relic_bazaar/widgets/product/product_card.dart';

// Route Names

Expand Down
52 changes: 26 additions & 26 deletions lib/helpers/route_page.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import 'package:flutter/cupertino.dart';
import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/helpers/slide_route.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/views/auth/signup_view.dart';
import 'package:retro_shopping/views/profile/orders.dart';
import 'package:retro_shopping/views/change_username_password.dart';
import 'package:retro_shopping/views/auth/login_view.dart';

import 'package:retro_shopping/views/cart_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:retro_shopping/views/profile/profile_view.dart';
import 'package:retro_shopping/views/profile/settings/about.dart';
import 'package:retro_shopping/views/profile/settings/address_screen.dart';
import 'package:retro_shopping/views/profile/settings/faqs_screen.dart';
import 'package:retro_shopping/views/profile/settings/manage_address.dart';
import 'package:retro_shopping/views/profile/settings/notifications_toggle.dart';
import 'package:retro_shopping/views/profile/settings/privacy_policy_screen.dart';
import 'package:retro_shopping/views/profile/settings/settings_view.dart';
import 'package:retro_shopping/views/profile/settings/github_webview.dart';
import 'package:retro_shopping/views/profile/wishlist.dart';
import 'package:retro_shopping/views/search_view.dart';
import 'package:retro_shopping/views/terms_conditions_view.dart';
import 'package:retro_shopping/views/unknown_view.dart';
import 'package:retro_shopping/widgets/payment/payment_successful.dart';
import 'package:retro_shopping/widgets/product/product_page.dart';
import 'package:relic_bazaar/dashboard.dart';
import 'package:relic_bazaar/helpers/constants.dart';
import 'package:relic_bazaar/helpers/slide_route.dart';
import 'package:relic_bazaar/model/product_model.dart';
import 'package:relic_bazaar/views/auth/signup_view.dart';
import 'package:relic_bazaar/views/profile/orders.dart';
import 'package:relic_bazaar/views/change_username_password.dart';
import 'package:relic_bazaar/views/auth/login_view.dart';

import 'package:relic_bazaar/views/cart_view.dart';
import 'package:relic_bazaar/views/home_view.dart';
import 'package:relic_bazaar/views/profile/profile_view.dart';
import 'package:relic_bazaar/views/profile/settings/about.dart';
import 'package:relic_bazaar/views/profile/settings/address_screen.dart';
import 'package:relic_bazaar/views/profile/settings/faqs_screen.dart';
import 'package:relic_bazaar/views/profile/settings/manage_address.dart';
import 'package:relic_bazaar/views/profile/settings/notifications_toggle.dart';
import 'package:relic_bazaar/views/profile/settings/privacy_policy_screen.dart';
import 'package:relic_bazaar/views/profile/settings/settings_view.dart';
import 'package:relic_bazaar/views/profile/settings/github_webview.dart';
import 'package:relic_bazaar/views/profile/wishlist.dart';
import 'package:relic_bazaar/views/search_view.dart';
import 'package:relic_bazaar/views/terms_conditions_view.dart';
import 'package:relic_bazaar/views/unknown_view.dart';
import 'package:relic_bazaar/widgets/payment/payment_successful.dart';
import 'package:relic_bazaar/widgets/product/product_page.dart';

class RoutePage {
static Route<dynamic> generateRoute(RouteSettings settings) {
Expand Down
11 changes: 5 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';
import 'package:provider/provider.dart';
import 'package:retro_shopping/dashboard.dart';
import 'package:retro_shopping/helpers/ad_state.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/helpers/route_page.dart';
import 'package:retro_shopping/views/auth/login_view.dart';
import 'package:retro_shopping/views/home_view.dart';
import 'package:relic_bazaar/dashboard.dart';
import 'package:relic_bazaar/helpers/ad_state.dart';
import 'package:relic_bazaar/helpers/constants.dart';
import 'package:relic_bazaar/helpers/route_page.dart';
import 'package:relic_bazaar/views/auth/login_view.dart';

import 'services/remote_config.dart';

Expand Down
39 changes: 38 additions & 1 deletion lib/services/auth_service.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
import 'package:google_sign_in/google_sign_in.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:relic_bazaar/helpers/constants.dart';
import 'package:flutter/material.dart';

class AuthenticationService {
final FirebaseAuth _auth = FirebaseAuth.instance;

static Future<String> appleSignIn() async {
try {
final AuthorizationCredentialAppleID appleResult =
await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
// webAuthenticationOptions: WebAuthenticationOptions(
// clientId: <CLIENT_ID>,
// redirectUri: Uri.parse(
// <REDIRECT_URI>,
// ),
// ),
);

final AuthCredential credential = OAuthProvider('apple.com').credential(
idToken: appleResult.identityToken,
accessToken: appleResult.authorizationCode,
);

final UserCredential firebaseResult =
await FirebaseAuth.instance.signInWithCredential(credential);
final User user = firebaseResult.user;
assert(!user.isAnonymous);

final User currentUser = FirebaseAuth.instance.currentUser;
assert(user.uid == currentUser.uid);

return '$user';
} catch (e) {
e.toString();
return null;
}
}

static Future<String> signInWithGoogle() async {
final GoogleSignInAccount googleSignInAccount =
await GoogleSignIn().signIn();
Expand Down
4 changes: 2 additions & 2 deletions lib/services/product_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/product/product_card.dart';
import 'package:relic_bazaar/helpers/constants.dart';
import 'package:relic_bazaar/widgets/product/product_card.dart';

class ProductService {
Future<List<ProductCard>> getProducts() async {
Expand Down
Loading