Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
b404779f
Commit
b404779f
authored
May 31, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// Apple 登录
parent
29663b1c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
87 deletions
+7
-87
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+3
-7
YHAppleLoginViewController.swift
...dules/AppleLogin(苹果登录)/C/YHAppleLoginViewController.swift
+0
-76
YHAppleLoginManager.swift
...sses/Modules/AppleLogin(苹果登录)/M/YHAppleLoginManager.swift
+4
-4
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
b404779f
...
...
@@ -247,7 +247,6 @@
049663BA2BF6105C003C8295
/* YHRefreshHeaderAnimator.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049663B92BF6105C003C8295
/* YHRefreshHeaderAnimator.swift */
;
};
049663C02BF729F6003C8295
/* galaxy_refresher.gif in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049663BF2BF729F5003C8295
/* galaxy_refresher.gif */
;
};
0499E3002C056EE30037E646
/* YHOneKeyLoginView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0499E2FF2C056EE30037E646
/* YHOneKeyLoginView.swift */
;
};
0499E3042C05B91A0037E646
/* YHAppleLoginViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0499E3032C05B91A0037E646
/* YHAppleLoginViewController.swift */
;
};
049A48A82B49417300D0C641
/* YHAboutUsViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049A48A72B49417300D0C641
/* YHAboutUsViewController.swift */
;
};
049A48AA2B49536000D0C641
/* YHAboutUsAdvantageCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049A48A92B49536000D0C641
/* YHAboutUsAdvantageCell.swift */
;
};
049AC4C62BC3E55300F857F4
/* YHServiceSectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
;
};
...
...
@@ -721,7 +720,6 @@
049663B92BF6105C003C8295
/* YHRefreshHeaderAnimator.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHRefreshHeaderAnimator.swift
;
sourceTree
=
"<group>"
;
};
049663BF2BF729F5003C8295
/* galaxy_refresher.gif */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.gif
;
path
=
galaxy_refresher.gif
;
sourceTree
=
"<group>"
;
};
0499E2FF2C056EE30037E646
/* YHOneKeyLoginView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHOneKeyLoginView.swift
;
sourceTree
=
"<group>"
;
};
0499E3032C05B91A0037E646
/* YHAppleLoginViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAppleLoginViewController.swift
;
sourceTree
=
"<group>"
;
};
049A48A72B49417300D0C641
/* YHAboutUsViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAboutUsViewController.swift
;
sourceTree
=
"<group>"
;
};
049A48A92B49536000D0C641
/* YHAboutUsAdvantageCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAboutUsAdvantageCell.swift
;
sourceTree
=
"<group>"
;
};
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHServiceSectionView.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1742,18 +1740,17 @@
isa
=
PBXGroup
;
children
=
(
04FA8B312C08808B00ABE43F
/* V */
,
0499E3022C05B7E90037E646
/*
C
*/
,
0499E3022C05B7E90037E646
/*
M
*/
,
);
path
=
"AppleLogin(苹果登录)"
;
sourceTree
=
"<group>"
;
};
0499E3022C05B7E90037E646
/*
C
*/
=
{
0499E3022C05B7E90037E646
/*
M
*/
=
{
isa
=
PBXGroup
;
children
=
(
0499E3032C05B91A0037E646
/* YHAppleLoginViewController.swift */
,
04FA8B2A2C06F59D00ABE43F
/* YHAppleLoginManager.swift */
,
);
path
=
C
;
path
=
M
;
sourceTree
=
"<group>"
;
};
04A671562B9F18C800C1FB91
/* MyCertificates(我的证书) */
=
{
...
...
@@ -3080,7 +3077,6 @@
045EEF092B9F171A0022A143
/* YHBasicInfoFillModel.swift in Sources */
,
A5ACE9352B4564F7002C94D2
/* YHNetRequest.swift in Sources */
,
A5FD63CB2B63D6C300D1D9DA
/* YHInformationFillTipsCell.swift in Sources */
,
0499E3042C05B91A0037E646
/* YHAppleLoginViewController.swift in Sources */
,
045EEF1F2B9F171A0022A143
/* YHDatePickView.swift in Sources */
,
04174D7A2BCD5B74000BA46D
/* YHDetailMessageCell.swift in Sources */
,
045EEE972B9F171A0022A143
/* YHPreviewInfoWorkExpView.swift in Sources */
,
...
...
galaxy/galaxy/Classes/Modules/AppleLogin(苹果登录)/C/YHAppleLoginViewController.swift
deleted
100644 → 0
View file @
29663b1c
//
// YHAppleLoginViewController.swift
// galaxy
//
// Created by edy on 2024/5/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
AuthenticationServices
class
YHAppleLoginViewController
:
YHBaseViewController
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setupUI
()
}
func
setupUI
()
{
let
appleLoginBtn
:
ASAuthorizationAppleIDButton
=
ASAuthorizationAppleIDButton
.
init
(
authorizationButtonType
:
.
default
,
authorizationButtonStyle
:
.
white
)
appleLoginBtn
.
frame
=
CGRectMake
(
50
,
200
,
KScreenWidth
-
100
,
45
)
self
.
view
.
addSubview
(
appleLoginBtn
)
appleLoginBtn
.
addTarget
(
self
,
action
:
#selector(
didAppleIDBtnClicked
)
,
for
:
.
touchUpInside
)
view
.
addSubview
(
appleLoginBtn
)
}
@objc
func
didAppleIDBtnClicked
()
{
let
appleIDProvider
=
ASAuthorizationAppleIDProvider
()
let
request
=
appleIDProvider
.
createRequest
()
request
.
requestedScopes
=
[
.
fullName
,
.
email
]
// let keychainRequest = ASAuthorizationPasswordProvider().createRequest()
let
vc
=
ASAuthorizationController
(
authorizationRequests
:
[
request
])
vc
.
delegate
=
self
vc
.
presentationContextProvider
=
self
vc
.
performRequests
()
}
}
extension
YHAppleLoginViewController
:
ASAuthorizationControllerDelegate
,
ASAuthorizationControllerPresentationContextProviding
{
func
authorizationController
(
controller
:
ASAuthorizationController
,
didCompleteWithAuthorization
authorization
:
ASAuthorization
)
{
// 其中`authorization.credential`包含了Token,用户ID等授权所需信息,可上报到后台
let
credential
=
authorization
.
credential
if
credential
is
ASPasswordCredential
{
let
passwdCredential
=
credential
as!
ASPasswordCredential
let
userIdentifier
=
passwdCredential
.
user
let
username
=
passwdCredential
.
user
let
password
=
passwdCredential
.
password
printLog
(
"username:
\(
username
)
, passwd:
\(
password
)
"
)
}
else
if
credential
is
ASAuthorizationAppleIDCredential
{
let
appleIdCredential
=
credential
as!
ASAuthorizationAppleIDCredential
let
userIdentifier
=
appleIdCredential
.
user
let
fullName
=
appleIdCredential
.
fullName
let
email
=
appleIdCredential
.
email
??
"email"
let
authorizationCode
=
appleIdCredential
.
authorizationCode
let
authorizationCodeStr
=
String
(
decoding
:
authorizationCode
!
,
as
:
UTF8
.
self
)
let
identityToken
=
appleIdCredential
.
identityToken
let
identityTokenStr
=
String
(
decoding
:
identityToken
!
,
as
:
UTF8
.
self
)
let
realUserStatus
=
appleIdCredential
.
realUserStatus
printLog
(
"authorizationCodeStr:
\(
authorizationCodeStr
)
"
)
}
}
func
authorizationController
(
controller
:
ASAuthorizationController
,
didCompleteWithError
error
:
Error
)
{
printLog
(
"FAILED:
\(
error
.
localizedDescription
)
"
)
}
func
presentationAnchor
(
for
controller
:
ASAuthorizationController
)
->
ASPresentationAnchor
{
return
UIApplication
.
shared
.
yhKeyWindow
()
!
}
}
galaxy/galaxy/Classes/Modules/AppleLogin(苹果登录)/
C
/YHAppleLoginManager.swift
→
galaxy/galaxy/Classes/Modules/AppleLogin(苹果登录)/
M
/YHAppleLoginManager.swift
View file @
b404779f
...
...
@@ -38,7 +38,6 @@ extension YHAppleLoginManager: ASAuthorizationControllerDelegate, ASAuthorizatio
var
authorizationCodeStr
=
""
var
identityTokenStr
=
""
// 其中`authorization.credential`包含了Token,用户ID等授权所需信息,可上报到后台
let
credential
=
authorization
.
credential
if
credential
is
ASPasswordCredential
{
let
passwdCredential
=
credential
as!
ASPasswordCredential
...
...
@@ -51,6 +50,7 @@ extension YHAppleLoginManager: ASAuthorizationControllerDelegate, ASAuthorizatio
let
appleIdCredential
=
credential
as!
ASAuthorizationAppleIDCredential
userId
=
appleIdCredential
.
user
email
=
appleIdCredential
.
email
??
""
fullName
=
appleIdCredential
.
fullName
?
.
givenName
??
""
let
authorizationCode
=
appleIdCredential
.
authorizationCode
authorizationCodeStr
=
String
(
decoding
:
authorizationCode
!
,
as
:
UTF8
.
self
)
let
identityToken
=
appleIdCredential
.
identityToken
...
...
@@ -62,13 +62,13 @@ extension YHAppleLoginManager: ASAuthorizationControllerDelegate, ASAuthorizatio
printLog
(
"APPLE LOGIN identityToken:
\(
identityTokenStr
)
"
)
printLog
(
"APPLE LOGIN authorizationCode:
\(
authorizationCodeStr
)
"
)
let
params
:[
String
:
Any
]
=
[
"
apple_id"
:
"string"
,
let
params
:[
String
:
Any
]
=
[
"
full_name"
:
fullName
,
"user_id"
:
userId
,
"email"
:
"string"
,
"full_name"
:
"string"
,
"email"
:
email
,
"authorization_code"
:
authorizationCodeStr
,
"identity_token"
:
identityTokenStr
]
self
.
success
?(
params
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment