Skip to content

Commit

Permalink
Merge branch 'DEV' into dev-233805-implement-the-functionality-of-bei…
Browse files Browse the repository at this point in the history
…ng-able-to-choose-webview-or-in-app-browser-in-the-sdk
  • Loading branch information
marcosrivereto authored Nov 13, 2024
2 parents 0cfa223 + e6d0cb9 commit 2557c47
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 3 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/check_tittle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check PR Title
on:
pull_request:
types: [opened, edited, reopened]
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN_SECRET }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
PR_NUMBER: ${{ github.event.number }}
jobs:
check_pr_title:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
run: git clone -q https://${GIT_TOKEN_SECRET}@github.com/${OWNER}/${REPO}.git --depth=2
- name: Check Jira ID on PR title
run: |
cd ${REPO} || exit
pr_title=$(gh pr view "${PR_NUMBER}" --json title | jq '.title' | tr -d '"')
pr_author=$(gh pr view "${PR_NUMBER}" --json author | jq '.author.login' | tr -d '"')
if [[ ${pr_title} =~ ^\[(DEV|DEVAUTOM|INF)-[0-9]+\] ]]; then
echo -e "(√) Title '${pr_title}' is ok!"
exit 0
else
echo -e "(x) Title '${pr_title}' is not ok!"
gh issue comment ${PR_NUMBER} --body ":x: @${pr_author} this pull request title '${pr_title}' is incorrect!
Please insert your Jira ID issue on title according the follow convention: [DEVAUTOM-12345], [DEV-12345] or [INF-12345]"
exit 1
fi
shell: bash
42 changes: 42 additions & 0 deletions .github/workflows/trigger_sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Trigger Sonar
on:
pull_request:
types: [opened, synchronize, reopened]
env:
GH_TOKEN: ${{ secrets.GIT_TOKEN_SECRET }}
BAMBOO_TOKEN_SECRET: ${{ secrets.BAMBOO_TOKEN_SECRET }}
GITHUB_TOKEN_SECRET: ${{ secrets.GIT_TOKEN_SECRET }}
GITHUB_REPO_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name }}
GITHUB_PR_ID: ${{ github.event.number }}
jobs:
trigger_sonar:
if: |
github.repository == 'TrustlyInc/trustly-ios' &&
github.event.pull_request.mergeable_status != 'dirty'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
run: git clone -q https://${GITHUB_TOKEN_SECRET}@github.com/${GITHUB_REPO_OWNER}/${GITHUB_REPO}.git --depth=2
- name: Trigger Bamboo Pipeline - SonarQube Pull Request Analysis
run: |
cd "${GITHUB_REPO}" || exit
echo -e "Github PR ID : ${GITHUB_PR_ID}"
echo -e "Github repository: ${GITHUB_REPO}"
echo -e "Trigger Bamboo Pipeline"
response=$(curl --request POST \
"https://bamboo.paywithmybank.com/rest/api/latest/queue/CAS-SATAPR?bamboo.GITHUB_PR_ID=${GITHUB_PR_ID}" \
--data "stage&executeAllStages" \
--header "Authorization: Bearer ${BAMBOO_TOKEN_SECRET}" \
--write-out "%{http_code}" \
--silent \
--output /dev/null)
if [ "${response}" -eq 200 ]; then
echo "Pipeline triggered successfully."
else
echo "Failed to trigger pipeline. HTTP status code: ${response}"
fi
shell: bash
9 changes: 6 additions & 3 deletions Sources/TrustlySDK/TrustlyView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public class TrustlyView : UIView, TrustlyProtocol, WKNavigationDelegate, WKScri
}

func initView() {
self.createNotifications()

if let tempCid = generateCid() {
cid = tempCid
Expand Down Expand Up @@ -165,7 +164,6 @@ public class TrustlyView : UIView, TrustlyProtocol, WKNavigationDelegate, WKScri
isLocalEnvironment = environment.isLocal

var request = URLRequest(url: environment.url)

request.httpMethod = "GET"
request.setValue("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", forHTTPHeaderField:"Accept")

Expand Down Expand Up @@ -531,7 +529,9 @@ extension TrustlyView {
}

private func proceedToChooseAccount(){
self.mainWebView.evaluateJavaScript("window.Trustly.proceedToChooseAccount();", completionHandler: nil)
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.mainWebView.evaluateJavaScript("window.Trustly.proceedToChooseAccount();", completionHandler: nil)
}
}

// MARK: - Utility Functions
Expand All @@ -540,6 +540,9 @@ extension TrustlyView {
}

@objc func closeWebview(notification: Notification){

NotificationCenter.default.removeObserver(self, name: .trustlyCloseWebview, object: nil)

if webSession != nil {
webSession.cancel()
}
Expand Down

0 comments on commit 2557c47

Please sign in to comment.