Skip to content

Commit

Permalink
0.0.11 (#12)
Browse files Browse the repository at this point in the history
* update customizeView method signature

* Dark mode

* Dark mode support

* customize fullscreen comments on dark mode

* package switf change

* fixes

* Add fastlane & GitHub workflows

* Update workflow

* Update pod spec

---------

Co-authored-by: Martin De Simone <[email protected]>
  • Loading branch information
mdesimone-viafoura and martin-desimone-1 authored Mar 27, 2023
1 parent b38b3ef commit 78b5aee
Show file tree
Hide file tree
Showing 83 changed files with 38,553 additions and 9,298 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/fastlane.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run Fastlane Actions

on:
push:
branches: [ main, "CI/CD" ]
pull_request:
branches: [ "CI/CD" ]
jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v2
name: Checkout

- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '13.1.0'

- name: Install Pods
run: |
pod install
- name: Install Fastlane
run: |
brew install fastlane
- name: Create testflight build
run: |
bundle exec fastlane makeAndSendBuild
env:
APPLE_TEAM_ID: '${{ secrets.APPLE_TEAM_ID }}'
MATCH_GIT_REPOSITORY_TOKEN: '${{ secrets.MATCH_GIT_REPOSITORY_TOKEN }}'
MATCH_GIT_URL: '${{ secrets.MATCH_GIT_URL }}'
MATCH_PASSWORD: '${{ secrets.MATCH_PASSWORD }}'
SLACK_URL: '${{ secrets.SLACK_URL }}'
FASTLANE_PASSWORD: '${{ secrets.FASTLANE_PASSWORD }}'
APP_STORE_CONNECT_CONTENT: '${{ secrets.APP_STORE_CONNECT_CONTENT }}'
APP_STORE_CONNECT_ISSUER_ID: '${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}'
APP_STORE_CONNECT_KEY_ID: '${{ secrets.APP_STORE_CONNECT_KEY_ID }}'
APP_STORE_CONNECT_CONTENT_OCH: '${{ secrets.APP_STORE_CONNECT_CONTENT_OCH }}'
APP_STORE_CONNECT_ISSUER_ID_OCH: '${{ secrets.APP_STORE_CONNECT_ISSUER_ID_OCH }}'
APP_STORE_CONNECT_KEY_ID_OCH: '${{ secrets.APP_STORE_CONNECT_KEY_ID_OCH }}'

- name: Trigger slack Notification on success
if: success()
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"Build Completed \n All fastlane actions run successfully \n Pull request ready to be merged on <https://github.com/Viafoura/sdk-ios/actions/runs/${{github.run_id}}|*FP iOS App*> \n <https://github.com/Viafoura/sdk-ios/actions/runs/${{github.run_id}}?check_suite_focus=true|VIEW *DETAILS*>", }' https://hooks.slack.com/services/
- name: Trigger slack Notification on failure
if: failure()
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"Build Failed \n Some fastlane actions failed \n Pull request *CANCELLED* on <https://github.com/Viafoura/sdk-ios/actions/runs/${{github.run_id}}|*FP iOS App*> \n <https://github.com/Viafoura/sdk-ios/actions/runs/${{github.run_id}}?check_suite_focus=true|VIEW *DETAILS*>", }' https://hooks.slack.com/services/
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Autogenerated by fastlane
#
# Ensure this file is checked in to source control!

source "https://rubygems.org"

gem 'fastlane'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
1 change: 1 addition & 0 deletions SampleApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ target 'Viafoura' do

pod 'LoginRadiusSDK', '~> 5.6.2'
pod 'Google-Mobile-Ads-SDK'
pod 'ViafouraCore'
pod 'FirebaseAnalytics'
pod 'FirebaseMessaging'
end
2 changes: 0 additions & 2 deletions SampleApp/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions SampleApp/Viafoura.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = arm64;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -574,7 +573,6 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
EXCLUDED_ARCHS = arm64;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -603,7 +601,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Viafoura/Viafoura.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
DEVELOPMENT_TEAM = JJ3874BH56;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Viafoura/Resources/Info.plist;
Expand All @@ -617,7 +615,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.21;
MARKETING_VERSION = 1.0.22;
PRODUCT_BUNDLE_IDENTIFIER = com.viafoura.sampleapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -635,7 +633,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Viafoura/Viafoura.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 22;
CURRENT_PROJECT_VERSION = 23;
DEVELOPMENT_TEAM = JJ3874BH56;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Viafoura/Resources/Info.plist;
Expand All @@ -649,7 +647,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.21;
MARKETING_VERSION = 1.0.22;
PRODUCT_BUNDLE_IDENTIFIER = com.viafoura.sampleapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
9 changes: 4 additions & 5 deletions SampleApp/Viafoura/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import LoginRadiusSDK
import GoogleMobileAds

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

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ViafouraSDK.initialize(siteUUID: "00000000-0000-4000-8000-c8cddfd7b365", siteDomain: "viafoura-mobile-demo.vercel.app")

Expand All @@ -30,7 +32,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate, UNUser
applyUIStyling()

registerForNotifications(application: application)

return true
}

Expand All @@ -50,9 +52,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MessagingDelegate, UNUser
if #available(iOS 15, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.titleTextAttributes = [.foregroundColor: UIColor.black]
appearance.backgroundColor = .white
appearance.shadowColor = .clear
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
}
Expand Down
66 changes: 51 additions & 15 deletions SampleApp/Viafoura/Features/Article/ArticleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,18 @@ class ArticleViewController: UIViewController {

var settings: VFSettings?

let darkBackgroundColor = UIColor(red: 0.16, green: 0.15, blue: 0.17, alpha: 1.00)

override func viewDidLoad() {
super.viewDidLoad()

setupUI()
}

func addComponents(){
if UserDefaults.standard.bool(forKey: SettingsKeys.showTrendingArticles) == true {
addTrendingViewController()
}

if UserDefaults.standard.bool(forKey: SettingsKeys.commentsContainerFullscreen) == true {
commentsContainerViewHeight.constant = 120
Expand All @@ -54,22 +62,18 @@ class ArticleViewController: UIViewController {
} else {
addPreCommentViewController()
}

if UserDefaults.standard.bool(forKey: SettingsKeys.showTrendingArticles) == true {
addTrendingViewController()
}
}

@objc
func seeCommentsTapped(){
presentCommentsContainerViewController()
}

override var preferredStatusBarStyle: UIStatusBarStyle {
.darkContent
}

func setupUI(){
if UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true {
view.backgroundColor = darkBackgroundColor
}

self.title = articleViewModel.story.title

webView.uiDelegate = self
Expand All @@ -82,7 +86,7 @@ class ArticleViewController: UIViewController {
webView.scrollView.isScrollEnabled = false
webView.allowsLinkPreview = false
webView.load(URLRequest(url: URL(string: articleViewModel.story.link)!))

let colors = VFColors(colorPrimary: UIColor(red: 0.00, green: 0.45, blue: 0.91, alpha: 1.00), colorPrimaryLight: UIColor(red: 0.90, green: 0.95, blue: 1.00, alpha: 1.00))
settings = VFSettings(colors: colors)
}
Expand All @@ -104,7 +108,8 @@ class ArticleViewController: UIViewController {
guard let trendingViewController = VFVerticalTrendingViewController.new(containerId: articleViewModel.story.containerId, title: "Trending content", limit: 5, daysPublished: nil, trendWindow: 48, sort: .comments, viewType: .condensed, settings: settings) else {
return
}


trendingViewController.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
trendingViewController.setAdDelegate(adDelegate: self)
trendingViewController.setCustomUIDelegate(customUIDelegate: self)
trendingViewController.setActionCallbacks(callbacks: callbacks)
Expand Down Expand Up @@ -142,11 +147,23 @@ class ArticleViewController: UIViewController {
return
}

preCommentsViewController.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
preCommentsViewController.setCustomUIDelegate(customUIDelegate: self)
preCommentsViewController.setActionCallbacks(callbacks: callbacks)
preCommentsViewController.setAdDelegate(adDelegate: self)
preCommentsViewController.setLayoutDelegate(layoutDelegate: self)

preCommentsViewController.setLayoutDelegate(layoutDelegate: self)

if let contentUUID = articleViewModel.selectedContentUUID {
preCommentsViewController.getContentScrollPosition(contentUUID: contentUUID, completion: { [weak self] yPosition in
guard let strongSelf = self else {
return
}

let originY = strongSelf.scrollView.convert(CGPoint.zero, from: strongSelf.commentsContainerView).y
strongSelf.scrollView.setContentOffset(CGPoint(x: 0, y: originY + yPosition), animated: true)
})
}

addChild(preCommentsViewController)
commentsContainerView.addSubview(preCommentsViewController.view)

Expand Down Expand Up @@ -181,6 +198,7 @@ class ArticleViewController: UIViewController {
return
}

profileViewController.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
profileViewController.setCustomUIDelegate(customUIDelegate: self)
profileViewController.setActionCallbacks(callbacks: callbacks)
self.present(profileViewController, animated: true)
Expand Down Expand Up @@ -214,6 +232,7 @@ class ArticleViewController: UIViewController {
guard let newCommentViewController = VFNewCommentViewController.new(newCommentActionType: actionType, containerId: articleViewModel.story.containerId, articleMetadata: articleViewModel.articleMetadata, loginDelegate: self, settings: settings) else{
return
}
newCommentViewController.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
newCommentViewController.setCustomUIDelegate(customUIDelegate: self)
newCommentViewController.setActionCallbacks(callbacks: callbacks)
self.present(newCommentViewController, animated: true)
Expand All @@ -236,8 +255,15 @@ extension ArticleViewController: WKNavigationDelegate{
trendingContainerView.isHidden = false
webView.isHidden = false

if UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true {
webView.evaluateJavaScript("document.documentElement.classList.add(\"dark\");")
}

DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.webViewHeight.constant = webView.scrollView.contentSize.height
self.view.layoutIfNeeded()

self.addComponents()
}
}
}
Expand All @@ -257,10 +283,20 @@ extension ArticleViewController: VFLoginDelegate {
}

extension ArticleViewController: VFCustomUIDelegate {
func customizeView(view: VFCustomizableView) {
func customizeView(theme: VFTheme, view: VFCustomizableView) {
switch view {
case .postButton(let button):
break
case .previewBackgroundView(let view):
if theme == VFTheme.dark {
view.backgroundColor = darkBackgroundColor
}
case .trendingCarouselBackgroundView(let view):
if theme == VFTheme.dark {
view.backgroundColor = darkBackgroundColor
}
case .trendingVerticalBackgroundView(let view):
if theme == VFTheme.dark {
view.backgroundColor = darkBackgroundColor
}
default:
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extension BookmarksViewController: UITableViewDelegate{
guard let vc = VFLiveChatViewController.new(containerId: bookmark.title, articleMetadata: metadata, loginDelegate: self, settings: settings) else {
return
}
vc.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
vc.title = bookmark.title
vc.hidesBottomBarWhenPushed = true
self.navigationController?.pushViewController(vc, animated: true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ class CommentsContainerViewController: UIViewController {
var viewModel: CommentsContainerViewModel!
var settings: VFSettings!

let darkBackgroundColor = UIColor(red: 0.16, green: 0.15, blue: 0.17, alpha: 1.00)

override func viewDidLoad() {
super.viewDidLoad()

if UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true {
view.backgroundColor = darkBackgroundColor
}

let colors = VFColors(colorPrimary: UIColor(red: 0.00, green: 0.45, blue: 0.91, alpha: 1.00), colorPrimaryLight: UIColor(red: 0.90, green: 0.95, blue: 1.00, alpha: 1.00))
settings = VFSettings(colors: colors)

Expand Down Expand Up @@ -47,6 +53,7 @@ class CommentsContainerViewController: UIViewController {
return
}

preCommentsViewController.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
preCommentsViewController.setCustomUIDelegate(customUIDelegate: self)
preCommentsViewController.setActionCallbacks(callbacks: callbacks)
preCommentsViewController.setAdDelegate(adDelegate: self)
Expand Down Expand Up @@ -85,6 +92,7 @@ class CommentsContainerViewController: UIViewController {
return
}

profileViewController.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
profileViewController.setCustomUIDelegate(customUIDelegate: self)
profileViewController.setActionCallbacks(callbacks: callbacks)
self.present(profileViewController, animated: true)
Expand All @@ -105,6 +113,7 @@ class CommentsContainerViewController: UIViewController {
guard let newCommentViewController = VFNewCommentViewController.new(newCommentActionType: actionType, containerId: viewModel.story.containerId, articleMetadata: viewModel.articleMetadata, loginDelegate: self, settings: settings) else{
return
}
newCommentViewController.setTheme(theme: UserDefaults.standard.bool(forKey: SettingsKeys.darkMode) == true ? .dark : .light)
newCommentViewController.setCustomUIDelegate(customUIDelegate: self)
newCommentViewController.setActionCallbacks(callbacks: callbacks)
self.present(newCommentViewController, animated: true)
Expand Down Expand Up @@ -132,9 +141,12 @@ extension CommentsContainerViewController: VFLoginDelegate {
}

extension CommentsContainerViewController: VFCustomUIDelegate {
func customizeView(view: VFCustomizableView) {
func customizeView(theme: VFTheme, view: VFCustomizableView) {
switch view {
case .postButton(let button):
case .previewBackgroundView(let view):
if theme == .dark {
view.backgroundColor = darkBackgroundColor
}
break
default:
break
Expand Down
Loading

0 comments on commit 78b5aee

Please sign in to comment.