Skip to content

πŸ”€ :: (#75) FCM κ΅¬ν˜„ #76

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
122 changes: 122 additions & 0 deletions .package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
"version" : "1.2022062300.0"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "5746b2d35c91c50581590ed97abe4c06b5037274",
"version" : "10.18.0"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "5de0369ee79ad096c164eb3afeb7921d92a43b58",
"version" : "10.18.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "6b332152355c372ace9966d8ee76ed191f97025e",
"version" : "10.17.0"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "a732a4b47f59e4f725a2ea10f0c77e93a7131117",
"version" : "9.3.0"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "bc27fad73504f3d4af235de451f02ee22586ebd3",
"version" : "7.12.1"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "a673bc2937fbe886dd1f99c401b01b6d977a9c98",
"version" : "1.49.1"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "115f75e43851774934d695449a4836123c3246e1",
"version" : "3.2.0"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
"version" : "100.0.0"
}
},
{
"identity" : "leveldb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "9d108e9112aa1d65ce508facf804674546116d9c",
"version" : "1.22.3"
}
},
{
"identity" : "nanopb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
"version" : "2.30909.0"
}
},
{
"identity" : "promises",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/promises.git",
"state" : {
"revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e",
"version" : "2.3.1"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8",
"version" : "1.25.2"
}
}
],
"version" : 2
}
30 changes: 30 additions & 0 deletions Application/GoogleService-Info.plist
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>AIzaSyATZppwDY1GHvots-hPpx9mIUK9yRg_oOY</string>
<key>GCM_SENDER_ID</key>
<string>486766481885</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.Sharing.iOS.app</string>
<key>PROJECT_ID</key>
<string>sharing-f3952</string>
<key>STORAGE_BUCKET</key>
<string>sharing-f3952.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:486766481885:ios:a4c5eedbc5c67b32e16634</string>
</dict>
</plist>
6 changes: 4 additions & 2 deletions Application/Project.swift
Original file line number Diff line number Diff line change
@@ -10,16 +10,18 @@ let project = Project(
name: "Sharing-iOS",
platform: .iOS,
product: .app,
bundleId: "\(SharingOrganizationName).iOS.app",
bundleId: "\(SharingOrganizationName).iOS.application",
deploymentTarget: .iOS(
targetVersion: "16.0",
devices: [.iphone, .ipad]
),
infoPlist: .file(path: "SuportingFile/Info.plist"),
sources: ["Sources/**"],
resources: ["Resources/**"],
entitlements: Path("SuportingFile/Sharing-iOS.entitlements"),
dependencies: [
.Project.appFlow
.Project.appFlow,
.SPM.FCM
]
)
]
30 changes: 30 additions & 0 deletions Application/Resources/GoogleService-Info.plist
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>AIzaSyAjsWhMl6Xgf3isTff2Gb73ru5Wr6AZOhA</string>
<key>GCM_SENDER_ID</key>
<string>62697569879</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.Sharing.iOS.application</string>
<key>PROJECT_ID</key>
<string>sharing-9d490</string>
<key>STORAGE_BUCKET</key>
<string>sharing-9d490.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:62697569879:ios:9ebc870511d5ca5a9ced12</string>
</dict>
</plist>
52 changes: 51 additions & 1 deletion Application/Sources/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,65 @@
import UIKit
import FirebaseCore
import FirebaseMessaging

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate {

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
FirebaseApp.configure()
self.setFCM(application)

return true
}

func setFCM(_ application: UIApplication) {
if #available(iOS 12.0, *) {
UNUserNotificationCenter.current().requestAuthorization(
options: [.alert, .sound, .badge, .providesAppNotificationSettings], completionHandler: { didAllow,Error in
})
} else {
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge], completionHandler: { didAllow,Error in
})
}
UNUserNotificationCenter.current().delegate = self
Messaging.messaging().delegate = self
application.registerForRemoteNotifications()
}

func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
Messaging.messaging().apnsToken = deviceToken
}

public func messaging(
_ messaging: Messaging,
didReceiveRegistrationToken fcmToken: String?
) {
let firebaseToken = fcmToken ?? ""
UserDefaults.standard.set(firebaseToken, forKey: "firebaseToken")
}

public func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
completionHandler([.badge, .sound, .banner, .list])
}

public func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
completionHandler()
}

// MARK: UISceneSession Lifecycle

func application(
30 changes: 30 additions & 0 deletions Application/SuportingFile/GoogleService-Info.plist
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>AIzaSyATZppwDY1GHvots-hPpx9mIUK9yRg_oOY</string>
<key>GCM_SENDER_ID</key>
<string>486766481885</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.Sharing.iOS.app</string>
<key>PROJECT_ID</key>
<string>sharing-f3952</string>
<key>STORAGE_BUCKET</key>
<string>sharing-f3952.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:486766481885:ios:a4c5eedbc5c67b32e16634</string>
</dict>
</plist>
6 changes: 6 additions & 0 deletions Application/SuportingFile/Info.plist
Original file line number Diff line number Diff line change
@@ -2,6 +2,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>FirebaseAppDelegateProxyEnabled</key>
<false/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
@@ -52,6 +54,10 @@
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
<string>Launch Screen.storyboard</string>
<key>UIRequiredDeviceCapabilities</key>
8 changes: 8 additions & 0 deletions Application/SuportingFile/Sharing-iOS.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>aps-environment</key>
<string>development</string>
</dict>
</plist>
9 changes: 5 additions & 4 deletions Modules/AppNetwork/Sources/Auth/Remote/API/AuthAPI.swift
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import Moya
import Core

public enum AuthAPI {
case login(accountID: String, password: String)
case login(accountID: String, password: String, deviceToken: String)
case signup(accountID: String, password: String, name: String, age: Int)
}

@@ -30,15 +30,16 @@ extension AuthAPI: TargetType {

public var task: Moya.Task {
switch self {
case .login(let accountID, let password):
case let .login(accountID, password, deviceToken):
return .requestParameters(
parameters: [
"account_id": accountID,
"password": password
"password": password,
"device_token": deviceToken
],
encoding: JSONEncoding.default)

case .signup(let accountID, let password, let name, let age):
case let .signup(accountID, password, name, age):
return .requestParameters(
parameters: [
"account_id": accountID,
Original file line number Diff line number Diff line change
@@ -16,4 +16,5 @@ public extension TargetDependency.SPM {
static let Kingfisher = TargetDependency.external(name: "Kingfisher")
static let SocketIO = TargetDependency.external(name: "SocketIO")
static let FloatingPanel = TargetDependency.external(name: "FloatingPanel")
static let FCM = TargetDependency.external(name: "FirebaseMessaging")
}
4 changes: 2 additions & 2 deletions Projects/Data/Sources/Auth/DataSource/AuthDataSource.swift
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ class AuthDataSource {
static let shared = AuthDataSource()
private init() {}

func login(accountID: String, password: String) -> Single<TokenDTO> {
return provider.rx.request(.login(accountID: accountID, password: password))
func login(accountID: String, password: String, deviceToken: String) -> Single<TokenDTO> {
return provider.rx.request(.login(accountID: accountID, password: password, deviceToken: deviceToken))
.filterSuccessfulStatusCodes()
.map(TokenDTO.self)
.catch { .error($0.toError(AuthError.self)) }
Loading