-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cef774
commit bcf093b
Showing
38 changed files
with
647 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "155760957773", | ||
"project_id": "fir-swiftui-4f49f", | ||
"storage_bucket": "fir-swiftui-4f49f.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:155760957773:android:7ce973f12b023b6b61bf04", | ||
"android_client_info": { | ||
"package_name": "ngocpd.SwiftUIBase.android.dev" | ||
} | ||
}, | ||
"oauth_client": [], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyDp--jBlRrF6NiVT1PMpSy-5ExW_QxWPnc" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"flutter":{"platforms":{"android":{"default":{"projectId":"fir-swiftui-4f49f","appId":"1:155760957773:android:7ce973f12b023b6b61bf04","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"fir-swiftui-4f49f","appId":"1:155760957773:ios:ed148fec33995c3161bf04","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"fir-swiftui-4f49f","configurations":{"android":"1:155760957773:android:7ce973f12b023b6b61bf04","ios":"1:155760957773:ios:ed148fec33995c3161bf04"}}}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>API_KEY</key> | ||
<string>AIzaSyCOJY9mkjOLH7srOe3nQHbEX-9qEJLmdKg</string> | ||
<key>GCM_SENDER_ID</key> | ||
<string>155760957773</string> | ||
<key>PLIST_VERSION</key> | ||
<string>1</string> | ||
<key>BUNDLE_ID</key> | ||
<string>com.example.baseFlutter</string> | ||
<key>PROJECT_ID</key> | ||
<string>fir-swiftui-4f49f</string> | ||
<key>STORAGE_BUCKET</key> | ||
<string>fir-swiftui-4f49f.appspot.com</string> | ||
<key>IS_ADS_ENABLED</key> | ||
<false></false> | ||
<key>IS_ANALYTICS_ENABLED</key> | ||
<false></false> | ||
<key>IS_APPINVITE_ENABLED</key> | ||
<true></true> | ||
<key>IS_GCM_ENABLED</key> | ||
<true></true> | ||
<key>IS_SIGNIN_ENABLED</key> | ||
<true></true> | ||
<key>GOOGLE_APP_ID</key> | ||
<string>1:155760957773:ios:ed148fec33995c3161bf04</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
|
||
import 'package:base_flutter/data/base/data_source.dart'; | ||
|
||
class FirebaseDataSource with DataSource { | ||
final FirebaseAuth _firebaseAuth; | ||
|
||
FirebaseDataSource({FirebaseAuth? firebaseAuth}) | ||
: _firebaseAuth = firebaseAuth ?? FirebaseAuth.instance; | ||
|
||
Future<User?> signIn({ | ||
required String email, | ||
required String password, | ||
}) async { | ||
final response = await excuse(() async { | ||
final UserCredential userCredential = | ||
await _firebaseAuth.signInWithEmailAndPassword( | ||
email: email, | ||
password: password, | ||
); | ||
return userCredential.user; | ||
}); | ||
|
||
return response; | ||
} | ||
|
||
Future<User?> signUp({ | ||
required String email, | ||
required String password, | ||
}) async { | ||
final response = await excuse(() async { | ||
final UserCredential userCredential = | ||
await _firebaseAuth.createUserWithEmailAndPassword( | ||
email: email, | ||
password: password, | ||
); | ||
return userCredential.user; | ||
}); | ||
return response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
import 'package:base_flutter/data/remote/firebase_data_source.dart'; | ||
|
||
part 'firebase_data_source_provider.g.dart'; | ||
|
||
@Riverpod(keepAlive: true) | ||
FirebaseDataSource firebaseDataSource(FirebaseDataSourceRef ref) { | ||
return FirebaseDataSource(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
import 'package:shared_preferences/shared_preferences.dart'; | ||
|
||
import 'package:base_flutter/data/local/local_data_source.dart'; | ||
import 'package:base_flutter/data/local/preferences/preferences.dart'; | ||
import 'package:base_flutter/data/local/storage/secure_storage.dart'; | ||
import 'package:base_flutter/data/local/storage/storage_keys.dart'; | ||
|
||
part 'local_provider.g.dart'; | ||
|
||
@Riverpod(keepAlive: true) | ||
Future<SecureStorage> secureStorage(SecureStorageRef ref) { | ||
return SecureStorage.getInstance( | ||
keys: StorageKeys.values.map((e) => e.name).toSet()); | ||
SecureStorage secureStorage(SecureStorageRef ref) { | ||
return throw UnimplementedError(); | ||
} | ||
|
||
@Riverpod(keepAlive: true) | ||
SharedPreferences sharedPreferences(SharedPreferencesRef ref) => | ||
throw UnimplementedError(); | ||
|
||
@Riverpod(keepAlive: true) | ||
LocalDataSource localDataSource(LocalDataSourceRef ref) { | ||
return LocalDataSource( | ||
secureStorage: ref.watch(secureStorageProvider).requireValue, | ||
sharedPreferences: ref.watch(prefsProvider).requireValue, | ||
secureStorage: ref.watch(secureStorageProvider), | ||
sharedPreferences: ref.watch(sharedPreferencesProvider), | ||
); | ||
} |
Oops, something went wrong.