Class: UnderOs::Sharing::Instagram

Inherits:
UIActivity
  • Object
show all
Defined in:
lib/under_os/receivers/instagram.rb

Instance Method Summary collapse

Instance Method Details

#activityImageObject



12
13
14
# File 'lib/under_os/receivers/instagram.rb', line 12

def activityImage
  UIImage.imageNamed("instagram.png")
end

#activityTitleObject



8
9
10
# File 'lib/under_os/receivers/instagram.rb', line 8

def activityTitle
  "Instagram"
end

#activityTypeObject



4
5
6
# File 'lib/under_os/receivers/instagram.rb', line 4

def activityType
  "com.under-os.share.instagram"
end

#canPerformWithActivityItems(items) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/under_os/receivers/instagram.rb', line 16

def canPerformWithActivityItems(items)
  instagram_installed? && items.each do |item|
    if item_is_large_enough_image?(item)
      return true
    end
  end

  false
end

#performActivityObject



33
34
35
36
37
38
39
40
41
42
# File 'lib/under_os/receivers/instagram.rb', line 33

def performActivity
  return activityDidFinish(false) if ! @image_url

  @image_title = {"InstagramCaption" => @image_title} if @image_title

  @interaction = UnderOs::Sharing::Interaction.new("com.instagram.exclusivegram")
  @interaction.open @image_url, @image_title do |result|
    activityDidFinish result
  end
end

#prepareWithActivityItems(items) ⇒ Object



26
27
28
29
30
31
# File 'lib/under_os/receivers/instagram.rb', line 26

def prepareWithActivityItems(items)
  items.each do |item|
    @image_title = item if item.is_a?(String)
    @image_url   = save(item) if item.is_a?(UIImage)
  end
end