Class: Fastlane::Actions::FivAddTransparentStatusbarAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FivAddTransparentStatusbarAction
- Defined in:
- lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
110 111 112 113 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 110 def self. # So no one will ever forget your contribution to fastlane :) You are awesome btw! ['Your GitHub/Twitter Name'] end |
.available_options ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 64 def self. # Define all options your action supports. # Below a few examples [ FastlaneCore::ConfigItem.new( key: :ios, env_name: 'FIV_ADD_TRANSPARENT_STATUSBAR_PLATFORM', description: '---', optional: false, type: Boolean ), FastlaneCore::ConfigItem.new( key: :path, env_name: 'FIV_ADD_TRANSPARENT_STATUSBAR_PATH', description: 'Path to Appdelegate.m for ios and MainActivity.java for Android', optional: false, verify_block: proc do |value| unless File.exist?(value) UI.user_error!( 'Couldnt find AppDelegate or Main Activity! Please change your path.' ) end end, type: String ) ] end |
.description ⇒ Object
54 55 56 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 54 def self.description 'A short description with <= 80 characters of what this action does' end |
.details ⇒ Object
58 59 60 61 62 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 58 def self.details # Optional: # this is your chance to provide a more detailed description of this action 'You can use this action to do cool things...' end |
.is_supported?(platform) ⇒ Boolean
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 115 def self.is_supported?(platform) # you can do things like # # true # # platform == :ios # # [:ios, :mac].include?(platform) # platform == :ios end |
.output ⇒ Object
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 95 def self.output # Define the shared values you are going to provide # Example [ [ 'ADD_TRANSPARENT_STATUSBAR_CUSTOM_VALUE', 'A description of what this value contains' ] ] end |
.return_value ⇒ Object
106 107 108 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 106 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_add_transparent_statusbar.rb', line 9 def self.run(params) text = File.read(params[:path]) if params[:ios] puts 'platform is ios' /super.onCreate\(savedInstanceState\);/ new_contents = text.gsub( /{/, "{\n [self.viewController.navigationController.navigationBar setBackgroundImage:[UIImage new] \nforBarMetrics:UIBarMetricsDefault]; \nself.viewController.navigationController.navigationBar.shadowImage = [UIImage new]; \nself.viewController.navigationController.navigationBar.translucent = YES; \nself.viewController.navigationController.view.backgroundColor = [UIColor clearColor];" ) else puts 'platform is android' content = text.gsub( /super.onCreate\(savedInstanceState\);/, 'super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); }' ) new_contents = content.gsub( /import org.apache.cordova.*;/, "import org.apache.cordova.*;\nimport android.os.Build;\nimport android.view.View;" ) end File.open(params[:path], 'w') { |file| file.puts new_contents } end |